зеркало из https://github.com/mozilla/pjs.git
removing initial window sizing from StartLayout (now done in nsWebShellWindow). Long overdue change; also necessary as part of bug 15775. r:hyatt@netscape.com
This commit is contained in:
Родитель
289da958e1
Коммит
273c808d4d
|
@ -3447,53 +3447,16 @@ nsXULDocument::StartLayout(void)
|
|||
if (! webShellContainer)
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
|
||||
PRBool intrinsic = PR_FALSE;
|
||||
nsCOMPtr<nsIBrowserWindow> 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<nsIDOMElement> 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<nsIViewManager> vm;
|
||||
shell->GetViewManager(getter_AddRefs(vm));
|
||||
if (vm) {
|
||||
|
@ -3510,53 +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<nsIBaseWindow> 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);
|
||||
}
|
||||
|
||||
// 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<nsIViewManager> vm;
|
||||
shell->GetViewManager(getter_AddRefs(vm));
|
||||
if (vm) {
|
||||
nsCOMPtr<nsIContentViewer> 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.
|
||||
|
|
|
@ -3447,53 +3447,16 @@ nsXULDocument::StartLayout(void)
|
|||
if (! webShellContainer)
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
|
||||
PRBool intrinsic = PR_FALSE;
|
||||
nsCOMPtr<nsIBrowserWindow> 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<nsIDOMElement> 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<nsIViewManager> vm;
|
||||
shell->GetViewManager(getter_AddRefs(vm));
|
||||
if (vm) {
|
||||
|
@ -3510,53 +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<nsIBaseWindow> 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);
|
||||
}
|
||||
|
||||
// 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<nsIViewManager> vm;
|
||||
shell->GetViewManager(getter_AddRefs(vm));
|
||||
if (vm) {
|
||||
nsCOMPtr<nsIContentViewer> 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.
|
||||
|
|
Загрузка…
Ссылка в новой задаче