From 5a261c8ad9bb13424a1dc7874d8c0ec39b7d6ea8 Mon Sep 17 00:00:00 2001 From: "danm%netscape.com" Date: Sat, 15 Jan 2000 05:53:41 +0000 Subject: [PATCH] reapplying changes from rev 1.234, which was lost as part of 1.235 --- content/xul/document/src/nsXULDocument.cpp | 94 +--------------------- rdf/content/src/nsXULDocument.cpp | 94 +--------------------- 2 files changed, 8 insertions(+), 180 deletions(-) diff --git a/content/xul/document/src/nsXULDocument.cpp b/content/xul/document/src/nsXULDocument.cpp index 7f20c2b3a2fb..f7c3a12809f2 100644 --- a/content/xul/document/src/nsXULDocument.cpp +++ b/content/xul/document/src/nsXULDocument.cpp @@ -3399,7 +3399,6 @@ static const char kXULNameSpaceURI[] = XUL_NAMESPACE_URI; } - nsresult nsXULDocument::StartLayout(void) { @@ -3448,53 +3447,16 @@ nsXULDocument::StartLayout(void) if (! webShellContainer) return NS_ERROR_UNEXPECTED; - PRBool intrinsic = PR_FALSE; nsCOMPtr browser; browser = do_QueryInterface(webShellContainer); - if (browser) { - browser->IsIntrinsicallySized(intrinsic); - } - else { - // XXX we're XUL embedded inside an iframe? - } nsRect r; cx->GetVisibleArea(r); - if (intrinsic) { - // Flow at an unconstrained width and height - r.width = NS_UNCONSTRAINEDSIZE; - r.height = NS_UNCONSTRAINEDSIZE; - } - if (browser) { - // We're top-level. - // See if we have attributes on our root tag that set the width and height. - // read "height" attribute// Convert r.width and r.height to twips. - float p2t; - cx->GetPixelsToTwips(&p2t); - - nsCOMPtr windowElement = do_QueryInterface(mRootContent); - nsString sizeString; - PRInt32 specSize; - PRInt32 errorCode; - if (NS_SUCCEEDED(windowElement->GetAttribute("height", sizeString))) { - specSize = sizeString.ToInteger(&errorCode); - if (NS_SUCCEEDED(errorCode) && specSize > 0) - r.height = NSIntPixelsToTwips(specSize, p2t); - } - - // read "width" attribute - if (NS_SUCCEEDED(windowElement->GetAttribute("width", sizeString))) { - specSize = sizeString.ToInteger(&errorCode); - if (NS_SUCCEEDED(errorCode) || specSize > 0) - r.width = NSIntPixelsToTwips(specSize, p2t); - } - } - - cx->SetVisibleArea(r); - - // XXX Copy of the code below. See XXX below for details... - // Now trigger a refresh + // Trigger a refresh before the call to InitialReflow(), because + // the view manager's UpdateView() function is dropping dirty rects if + // refresh is disabled rather than accumulating them until refresh is + // enabled and then triggering a repaint... nsCOMPtr vm; shell->GetViewManager(getter_AddRefs(vm)); if (vm) { @@ -3511,54 +3473,6 @@ nsXULDocument::StartLayout(void) shell->InitialReflow(r.width, r.height); - if (browser) { - // We're top level. - // Retrieve the answer. - cx->GetVisibleArea(r); - - // Perform the resize - PRInt32 chromeX,chromeY,chromeWidth,chromeHeight; - nsCOMPtr docShellWin(do_QueryInterface(webShell)); - NS_ABORT_IF_FALSE(docShellWin, "QI Failed!!!!"); - docShellWin->GetPositionAndSize(&chromeX, &chromeY, &chromeWidth, - &chromeHeight); - - float t2p; - cx->GetTwipsToPixels(&t2p); - PRInt32 width = PRInt32((float)r.width*t2p); - PRInt32 height = PRInt32((float)r.height*t2p); - - PRInt32 widthDelta = width - chromeWidth; - PRInt32 heightDelta = height - chromeHeight; - - nsRect windowBounds; - browser->GetWindowBounds(windowBounds); - browser->SizeWindowTo(windowBounds.width + widthDelta, - windowBounds.height + heightDelta, - PR_FALSE, PR_FALSE); - } - - // XXX Moving this call up before the call to InitialReflow(), because - // the view manager's UpdateView() function is dropping dirty rects if - // refresh is disabled rather than accumulating them until refresh is - // enabled and then triggering a repaint... -#if 0 - // Now trigger a refresh - nsCOMPtr vm; - shell->GetViewManager(getter_AddRefs(vm)); - if (vm) { - nsCOMPtr contentViewer; - nsresult rv = webShell->GetContentViewer(getter_AddRefs(contentViewer)); - if (NS_SUCCEEDED(rv) && (contentViewer != nsnull)) { - PRBool enabled; - contentViewer->GetEnableRendering(&enabled); - if (enabled) { - vm->EnableRefresh(); - } - } - } -#endif - // Start observing the document _after_ we do the initial // reflow. Otherwise, we'll get into an trouble trying to // create kids before the root frame is established. diff --git a/rdf/content/src/nsXULDocument.cpp b/rdf/content/src/nsXULDocument.cpp index 7f20c2b3a2fb..f7c3a12809f2 100644 --- a/rdf/content/src/nsXULDocument.cpp +++ b/rdf/content/src/nsXULDocument.cpp @@ -3399,7 +3399,6 @@ static const char kXULNameSpaceURI[] = XUL_NAMESPACE_URI; } - nsresult nsXULDocument::StartLayout(void) { @@ -3448,53 +3447,16 @@ nsXULDocument::StartLayout(void) if (! webShellContainer) return NS_ERROR_UNEXPECTED; - PRBool intrinsic = PR_FALSE; nsCOMPtr browser; browser = do_QueryInterface(webShellContainer); - if (browser) { - browser->IsIntrinsicallySized(intrinsic); - } - else { - // XXX we're XUL embedded inside an iframe? - } nsRect r; cx->GetVisibleArea(r); - if (intrinsic) { - // Flow at an unconstrained width and height - r.width = NS_UNCONSTRAINEDSIZE; - r.height = NS_UNCONSTRAINEDSIZE; - } - if (browser) { - // We're top-level. - // See if we have attributes on our root tag that set the width and height. - // read "height" attribute// Convert r.width and r.height to twips. - float p2t; - cx->GetPixelsToTwips(&p2t); - - nsCOMPtr windowElement = do_QueryInterface(mRootContent); - nsString sizeString; - PRInt32 specSize; - PRInt32 errorCode; - if (NS_SUCCEEDED(windowElement->GetAttribute("height", sizeString))) { - specSize = sizeString.ToInteger(&errorCode); - if (NS_SUCCEEDED(errorCode) && specSize > 0) - r.height = NSIntPixelsToTwips(specSize, p2t); - } - - // read "width" attribute - if (NS_SUCCEEDED(windowElement->GetAttribute("width", sizeString))) { - specSize = sizeString.ToInteger(&errorCode); - if (NS_SUCCEEDED(errorCode) || specSize > 0) - r.width = NSIntPixelsToTwips(specSize, p2t); - } - } - - cx->SetVisibleArea(r); - - // XXX Copy of the code below. See XXX below for details... - // Now trigger a refresh + // Trigger a refresh before the call to InitialReflow(), because + // the view manager's UpdateView() function is dropping dirty rects if + // refresh is disabled rather than accumulating them until refresh is + // enabled and then triggering a repaint... nsCOMPtr vm; shell->GetViewManager(getter_AddRefs(vm)); if (vm) { @@ -3511,54 +3473,6 @@ nsXULDocument::StartLayout(void) shell->InitialReflow(r.width, r.height); - if (browser) { - // We're top level. - // Retrieve the answer. - cx->GetVisibleArea(r); - - // Perform the resize - PRInt32 chromeX,chromeY,chromeWidth,chromeHeight; - nsCOMPtr docShellWin(do_QueryInterface(webShell)); - NS_ABORT_IF_FALSE(docShellWin, "QI Failed!!!!"); - docShellWin->GetPositionAndSize(&chromeX, &chromeY, &chromeWidth, - &chromeHeight); - - float t2p; - cx->GetTwipsToPixels(&t2p); - PRInt32 width = PRInt32((float)r.width*t2p); - PRInt32 height = PRInt32((float)r.height*t2p); - - PRInt32 widthDelta = width - chromeWidth; - PRInt32 heightDelta = height - chromeHeight; - - nsRect windowBounds; - browser->GetWindowBounds(windowBounds); - browser->SizeWindowTo(windowBounds.width + widthDelta, - windowBounds.height + heightDelta, - PR_FALSE, PR_FALSE); - } - - // XXX Moving this call up before the call to InitialReflow(), because - // the view manager's UpdateView() function is dropping dirty rects if - // refresh is disabled rather than accumulating them until refresh is - // enabled and then triggering a repaint... -#if 0 - // Now trigger a refresh - nsCOMPtr vm; - shell->GetViewManager(getter_AddRefs(vm)); - if (vm) { - nsCOMPtr contentViewer; - nsresult rv = webShell->GetContentViewer(getter_AddRefs(contentViewer)); - if (NS_SUCCEEDED(rv) && (contentViewer != nsnull)) { - PRBool enabled; - contentViewer->GetEnableRendering(&enabled); - if (enabled) { - vm->EnableRefresh(); - } - } - } -#endif - // Start observing the document _after_ we do the initial // reflow. Otherwise, we'll get into an trouble trying to // create kids before the root frame is established.