From c6417cc01e5b994e6f5f7d1102425bb3441dca60 Mon Sep 17 00:00:00 2001 From: Phil Ringnalda Date: Wed, 11 May 2016 21:08:08 -0700 Subject: [PATCH] Back out 5 changesets (bug 881832) for failures in browser_html_tooltip-02.js Backed out changeset 117e8e24d714 (bug 881832) Backed out changeset 8a0d5df41cfb (bug 881832) Backed out changeset 6b3c5e185b04 (bug 881832) Backed out changeset 11106afdcbe7 (bug 881832) Backed out changeset d711b7c19a43 (bug 881832) --- docshell/base/nsDocShell.cpp | 14 +-- docshell/base/nsIContentViewer.idl | 6 -- dom/base/nsFrameLoader.cpp | 3 +- dom/events/test/test_bug602962.xul | 6 +- dom/ipc/TabChild.cpp | 4 +- dom/ipc/TabParent.cpp | 3 +- embedding/browser/nsDocShellTreeOwner.cpp | 2 +- embedding/browser/nsWebBrowser.cpp | 14 ++- layout/base/MobileViewportManager.cpp | 6 +- layout/base/nsDocumentViewer.cpp | 11 +- layout/base/nsIPresShell.h | 4 +- layout/base/nsPresShell.cpp | 26 ++--- layout/base/nsPresShell.h | 4 +- layout/style/test/chrome/hover_helper.html | 117 ++++++++++++--------- layout/xul/nsResizerFrame.cpp | 3 +- view/nsViewManager.cpp | 8 +- view/nsViewManager.h | 3 +- widget/nsIBaseWindow.idl | 8 +- xpfe/appshell/nsChromeTreeOwner.cpp | 6 +- xpfe/appshell/nsContentTreeOwner.cpp | 9 +- xpfe/appshell/nsWebShellWindow.cpp | 2 +- xpfe/appshell/nsXULWindow.cpp | 4 +- 22 files changed, 115 insertions(+), 148 deletions(-) diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index 152e8f8c9235..3e9b6adc3db0 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -5592,7 +5592,7 @@ nsDocShell::InitWindow(nativeWindow aParentNativeWindow, int32_t aWidth, int32_t aHeight) { SetParentWidget(aParentWidget); - SetPositionAndSize(aX, aY, aWidth, aHeight, 0); + SetPositionAndSize(aX, aY, aWidth, aHeight, false); return NS_OK; } @@ -5838,8 +5838,7 @@ nsDocShell::SetSize(int32_t aWidth, int32_t aHeight, bool aRepaint) { int32_t x = 0, y = 0; GetPosition(&x, &y); - return SetPositionAndSize(x, y, aWidth, aHeight, - aRepaint ? nsIBaseWindow::eRepaint : 0); + return SetPositionAndSize(x, y, aWidth, aHeight, aRepaint); } NS_IMETHODIMP @@ -5850,7 +5849,7 @@ nsDocShell::GetSize(int32_t* aWidth, int32_t* aHeight) NS_IMETHODIMP nsDocShell::SetPositionAndSize(int32_t aX, int32_t aY, int32_t aWidth, - int32_t aHeight, uint32_t aFlags) + int32_t aHeight, bool aFRepaint) { mBounds.x = aX; mBounds.y = aY; @@ -5860,11 +5859,8 @@ nsDocShell::SetPositionAndSize(int32_t aX, int32_t aY, int32_t aWidth, // Hold strong ref, since SetBounds can make us null out mContentViewer nsCOMPtr viewer = mContentViewer; if (viewer) { - uint32_t cvflags = (aFlags & nsIBaseWindow::eDelayResize) ? - nsIContentViewer::eDelayResize : 0; // XXX Border figured in here or is that handled elsewhere? - nsresult rv = viewer->SetBoundsWithFlags(mBounds, cvflags); - NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE); + NS_ENSURE_SUCCESS(viewer->SetBounds(mBounds), NS_ERROR_FAILURE); } return NS_OK; @@ -5878,7 +5874,7 @@ nsDocShell::GetPositionAndSize(int32_t* aX, int32_t* aY, int32_t* aWidth, // ensure size is up-to-date if window has changed resolution LayoutDeviceIntRect r; mParentWidget->GetClientBounds(r); - SetPositionAndSize(mBounds.x, mBounds.y, r.width, r.height, 0); + SetPositionAndSize(mBounds.x, mBounds.y, r.width, r.height, false); } // We should really consider just getting this information from diff --git a/docshell/base/nsIContentViewer.idl b/docshell/base/nsIContentViewer.idl index 68c424e46222..7291178aa894 100644 --- a/docshell/base/nsIContentViewer.idl +++ b/docshell/base/nsIContentViewer.idl @@ -104,12 +104,6 @@ interface nsIContentViewer : nsISupports [noscript] void getBounds(in nsIntRectRef aBounds); [noscript] void setBounds([const] in nsIntRectRef aBounds); - /** - * The 'aFlags' argument to setBoundsWithFlags is a set of these bits. - */ - const unsigned long eDelayResize = 1; - [noscript] void setBoundsWithFlags([const] in nsIntRectRef aBounds, - in unsigned long aFlags); /** * The previous content viewer, which has been |close|d but not diff --git a/dom/base/nsFrameLoader.cpp b/dom/base/nsFrameLoader.cpp index 540345d0cf9d..9edb7aa8ebaf 100644 --- a/dom/base/nsFrameLoader.cpp +++ b/dom/base/nsFrameLoader.cpp @@ -2311,8 +2311,7 @@ nsFrameLoader::UpdateBaseWindowPositionAndSize(nsSubDocumentFrame *aIFrame) ScreenIntSize size = aIFrame->GetSubdocumentSize(); - baseWindow->SetPositionAndSize(x, y, size.width, size.height, - nsIBaseWindow::eDelayResize); + baseWindow->SetPositionAndSize(x, y, size.width, size.height, false); } } diff --git a/dom/events/test/test_bug602962.xul b/dom/events/test/test_bug602962.xul index cc500d132680..afd729626863 100644 --- a/dom/events/test/test_bug602962.xul +++ b/dom/events/test/test_bug602962.xul @@ -37,10 +37,8 @@ function doTest() { win.addEventListener("resize", function() { win.removeEventListener("resize", arguments.callee, false); - setTimeout(function(){ - sbo.scrollBy(200, 0); - resize(); - },0); + sbo.scrollBy(200, 0); + setTimeout(function() { resize(); }, 0); }, false); oldWidth = win.outerWidth; diff --git a/dom/ipc/TabChild.cpp b/dom/ipc/TabChild.cpp index 841dd31fb172..94afc3af0b24 100644 --- a/dom/ipc/TabChild.cpp +++ b/dom/ipc/TabChild.cpp @@ -1694,7 +1694,7 @@ TabChild::RecvUpdateDimensions(const CSSRect& rect, const CSSSize& size, // size from the content viewer when it computes a new CSS viewport. nsCOMPtr baseWin = do_QueryInterface(WebNavigation()); baseWin->SetPositionAndSize(0, 0, screenSize.width, screenSize.height, - nsIBaseWindow::eRepaint); + true); mPuppetWidget->Resize(screenRect.x + clientOffset.x + chromeDisp.x, screenRect.y + clientOffset.y + chromeDisp.y, @@ -3059,7 +3059,7 @@ TabChild::RecvUIResolutionChanged(const float& aDpi, const double& aScale) nsCOMPtr baseWin = do_QueryInterface(WebNavigation()); baseWin->SetPositionAndSize(0, 0, screenSize.width, screenSize.height, - nsIBaseWindow::eRepaint); + true); } return true; diff --git a/dom/ipc/TabParent.cpp b/dom/ipc/TabParent.cpp index 5a72aee4f552..c1b6df7ad7ad 100644 --- a/dom/ipc/TabParent.cpp +++ b/dom/ipc/TabParent.cpp @@ -870,8 +870,7 @@ TabParent::RecvSetDimensions(const uint32_t& aFlags, if (aFlags & nsIEmbeddingSiteWindow::DIM_FLAGS_POSITION && aFlags & nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_OUTER) { - treeOwnerAsWin->SetPositionAndSize(x, y, cx, cy, - nsIBaseWindow::eRepaint); + treeOwnerAsWin->SetPositionAndSize(x, y, cx, cy, true); return true; } diff --git a/embedding/browser/nsDocShellTreeOwner.cpp b/embedding/browser/nsDocShellTreeOwner.cpp index 38b7332a0199..cc029db0f6d9 100644 --- a/embedding/browser/nsDocShellTreeOwner.cpp +++ b/embedding/browser/nsDocShellTreeOwner.cpp @@ -647,7 +647,7 @@ nsDocShellTreeOwner::GetSize(int32_t* aCX, int32_t* aCY) NS_IMETHODIMP nsDocShellTreeOwner::SetPositionAndSize(int32_t aX, int32_t aY, int32_t aCX, - int32_t aCY, uint32_t aFlags) + int32_t aCY, bool aRepaint) { nsCOMPtr ownerWin = GetOwnerWin(); if (ownerWin) { diff --git a/embedding/browser/nsWebBrowser.cpp b/embedding/browser/nsWebBrowser.cpp index 501b271e81eb..532b443ed52a 100644 --- a/embedding/browser/nsWebBrowser.cpp +++ b/embedding/browser/nsWebBrowser.cpp @@ -1150,7 +1150,7 @@ nsWebBrowser::InitWindow(nativeWindow aParentNativeWindow, NS_ENSURE_SUCCESS(SetParentNativeWindow(aParentNativeWindow), NS_ERROR_FAILURE); - NS_ENSURE_SUCCESS(SetPositionAndSize(aX, aY, aCX, aCY, 0), + NS_ENSURE_SUCCESS(SetPositionAndSize(aX, aY, aCX, aCY, false), NS_ERROR_FAILURE); return NS_OK; @@ -1325,7 +1325,7 @@ nsWebBrowser::SetPosition(int32_t aX, int32_t aY) GetSize(&cx, &cy); - return SetPositionAndSize(aX, aY, cx, cy, 0); + return SetPositionAndSize(aX, aY, cx, cy, false); } NS_IMETHODIMP @@ -1342,8 +1342,7 @@ nsWebBrowser::SetSize(int32_t aCX, int32_t aCY, bool aRepaint) GetPosition(&x, &y); - return SetPositionAndSize(x, y, aCX, aCY, - aRepaint ? nsIBaseWindow::eRepaint : 0); + return SetPositionAndSize(x, y, aCX, aCY, aRepaint); } NS_IMETHODIMP @@ -1354,7 +1353,7 @@ nsWebBrowser::GetSize(int32_t* aCX, int32_t* aCY) NS_IMETHODIMP nsWebBrowser::SetPositionAndSize(int32_t aX, int32_t aY, - int32_t aCX, int32_t aCY, uint32_t aFlags) + int32_t aCX, int32_t aCY, bool aRepaint) { if (!mDocShell) { mInitInfo->x = aX; @@ -1370,13 +1369,12 @@ nsWebBrowser::SetPositionAndSize(int32_t aX, int32_t aY, // We also need to resize our widget then. if (mInternalWidget) { doc_x = doc_y = 0; - NS_ENSURE_SUCCESS(mInternalWidget->Resize(aX, aY, aCX, aCY, - !!(aFlags & nsIBaseWindow::eRepaint)), + NS_ENSURE_SUCCESS(mInternalWidget->Resize(aX, aY, aCX, aCY, aRepaint), NS_ERROR_FAILURE); } // Now reposition/ resize the doc NS_ENSURE_SUCCESS( - mDocShellAsWin->SetPositionAndSize(doc_x, doc_y, aCX, aCY, aFlags), + mDocShellAsWin->SetPositionAndSize(doc_x, doc_y, aCX, aCY, aRepaint), NS_ERROR_FAILURE); } diff --git a/layout/base/MobileViewportManager.cpp b/layout/base/MobileViewportManager.cpp index 08f071ac863a..568767c876ac 100644 --- a/layout/base/MobileViewportManager.cpp +++ b/layout/base/MobileViewportManager.cpp @@ -352,9 +352,6 @@ MobileViewportManager::RefreshViewportSize(bool aForceAdjustResolution) UpdateDisplayPortMargins(); } - const bool isHeightChanging = - (mMobileViewportSize.height != viewport.height); - // Update internal state. mIsFirstPaint = false; mMobileViewportSize = viewport; @@ -362,6 +359,5 @@ MobileViewportManager::RefreshViewportSize(bool aForceAdjustResolution) // Kick off a reflow. mPresShell->ResizeReflowIgnoreOverride( nsPresContext::CSSPixelsToAppUnits(viewport.width), - nsPresContext::CSSPixelsToAppUnits(viewport.height), - isHeightChanging); + nsPresContext::CSSPixelsToAppUnits(viewport.height)); } diff --git a/layout/base/nsDocumentViewer.cpp b/layout/base/nsDocumentViewer.cpp index 988c7df099ce..b334ebf67247 100644 --- a/layout/base/nsDocumentViewer.cpp +++ b/layout/base/nsDocumentViewer.cpp @@ -1909,7 +1909,7 @@ nsDocumentViewer::SetPreviousViewer(nsIContentViewer* aViewer) } NS_IMETHODIMP -nsDocumentViewer::SetBoundsWithFlags(const nsIntRect& aBounds, uint32_t aFlags) +nsDocumentViewer::SetBounds(const nsIntRect& aBounds) { NS_ENSURE_TRUE(mDocument, NS_ERROR_NOT_AVAILABLE); @@ -1924,8 +1924,7 @@ nsDocumentViewer::SetBoundsWithFlags(const nsIntRect& aBounds, uint32_t aFlags) } else if (mPresContext && mViewManager) { int32_t p2a = mPresContext->AppUnitsPerDevPixel(); mViewManager->SetWindowDimensions(NSIntPixelsToAppUnits(mBounds.width, p2a), - NSIntPixelsToAppUnits(mBounds.height, p2a), - !!(aFlags & nsIContentViewer::eDelayResize)); + NSIntPixelsToAppUnits(mBounds.height, p2a)); } // If there's a previous viewer, it's the one that's actually showing, @@ -1943,12 +1942,6 @@ nsDocumentViewer::SetBoundsWithFlags(const nsIntRect& aBounds, uint32_t aFlags) return NS_OK; } -NS_IMETHODIMP -nsDocumentViewer::SetBounds(const nsIntRect& aBounds) -{ - return SetBoundsWithFlags(aBounds, 0); -} - NS_IMETHODIMP nsDocumentViewer::Move(int32_t aX, int32_t aY) { diff --git a/layout/base/nsIPresShell.h b/layout/base/nsIPresShell.h index 09d8d33a6721..5d27e37c62bd 100644 --- a/layout/base/nsIPresShell.h +++ b/layout/base/nsIPresShell.h @@ -429,12 +429,12 @@ public: * Reflow the frame model into a new width and height. The * coordinates for aWidth and aHeight must be in standard nscoord's. */ - virtual nsresult ResizeReflow(nscoord aWidth, nscoord aHeight, bool aHeightChanging = true) = 0; + virtual nsresult ResizeReflow(nscoord aWidth, nscoord aHeight) = 0; /** * Do the same thing as ResizeReflow but even if ResizeReflowOverride was * called previously. */ - virtual nsresult ResizeReflowIgnoreOverride(nscoord aWidth, nscoord aHeight, bool aHeightChanging) = 0; + virtual nsresult ResizeReflowIgnoreOverride(nscoord aWidth, nscoord aHeight) = 0; /** * Returns true if ResizeReflowOverride has been called. diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index 1641f94cf562..b6d64aa88418 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -1803,7 +1803,7 @@ PresShell::AsyncResizeEventCallback(nsITimer* aTimer, void* aPresShell) } nsresult -PresShell::ResizeReflow(nscoord aWidth, nscoord aHeight, bool aHeightChanging) +PresShell::ResizeReflow(nscoord aWidth, nscoord aHeight) { if (mZoomConstraintsClient) { // If we have a ZoomConstraintsClient and the available screen area @@ -1819,11 +1819,11 @@ PresShell::ResizeReflow(nscoord aWidth, nscoord aHeight, bool aHeightChanging) return NS_OK; } - return ResizeReflowIgnoreOverride(aWidth, aHeight, aHeightChanging); + return ResizeReflowIgnoreOverride(aWidth, aHeight); } nsresult -PresShell::ResizeReflowIgnoreOverride(nscoord aWidth, nscoord aHeight, bool aHeightChanging) +PresShell::ResizeReflowIgnoreOverride(nscoord aWidth, nscoord aHeight) { NS_PRECONDITION(!mIsReflowing, "Shouldn't be in reflow here!"); NS_PRECONDITION(aWidth != NS_UNCONSTRAINEDSIZE, @@ -1839,6 +1839,9 @@ PresShell::ResizeReflowIgnoreOverride(nscoord aWidth, nscoord aHeight, bool aHei return NS_ERROR_NOT_AVAILABLE; } + const bool isHeightChanging = + (mPresContext->GetVisibleArea().height != aHeight); + mPresContext->SetVisibleArea(nsRect(0, 0, aWidth, aHeight)); // There isn't anything useful we can do if the initial reflow hasn't happened. @@ -1866,7 +1869,7 @@ PresShell::ResizeReflowIgnoreOverride(nscoord aWidth, nscoord aHeight, bool aHei // XXX Do a full invalidate at the beginning so that invalidates along // the way don't have region accumulation issues? - if (aHeightChanging) { + if (isHeightChanging) { // For BSize changes driven by style, RestyleManager handles this. // For height:auto BSizes (i.e. layout-controlled), descendant // intrinsic sizes can't depend on them. So the only other case is @@ -3633,16 +3636,6 @@ PresShell::ScheduleViewManagerFlush(PaintType aType) } } -bool -FlushLayoutRecursive(nsIDocument* aDocument, - void* aData = nullptr) -{ - MOZ_ASSERT(!aData); - aDocument->EnumerateSubDocuments(FlushLayoutRecursive, nullptr); - aDocument->FlushPendingNotifications(Flush_Layout); - return true; -} - void PresShell::DispatchSynthMouseMove(WidgetGUIEvent* aEvent, bool aFlushOnHoverChange) @@ -3667,10 +3660,7 @@ PresShell::DispatchSynthMouseMove(WidgetGUIEvent* aEvent, hoverGenerationBefore != restyleManager->AsGecko()->GetHoverGeneration()) { // Flush so that the resulting reflow happens now so that our caller // can suppress any synthesized mouse moves caused by that reflow. - // This code only ever runs for the root document, but :hover changes - // can happen in descendant documents too, so make sure we flush - // all of them. - FlushLayoutRecursive(mDocument); + FlushPendingNotifications(Flush_Layout); } } diff --git a/layout/base/nsPresShell.h b/layout/base/nsPresShell.h index 72c0e59c5441..d6ede633e51d 100644 --- a/layout/base/nsPresShell.h +++ b/layout/base/nsPresShell.h @@ -118,8 +118,8 @@ public: virtual void BeginObservingDocument() override; virtual void EndObservingDocument() override; virtual nsresult Initialize(nscoord aWidth, nscoord aHeight) override; - virtual nsresult ResizeReflow(nscoord aWidth, nscoord aHeight, bool aHeightChanging = true) override; - virtual nsresult ResizeReflowIgnoreOverride(nscoord aWidth, nscoord aHeight, bool aHeightChanging) override; + virtual nsresult ResizeReflow(nscoord aWidth, nscoord aHeight) override; + virtual nsresult ResizeReflowIgnoreOverride(nscoord aWidth, nscoord aHeight) override; virtual nsIPageSequenceFrame* GetPageSequenceFrame() const override; virtual nsCanvasFrame* GetCanvasFrame() const override; diff --git a/layout/style/test/chrome/hover_helper.html b/layout/style/test/chrome/hover_helper.html index 37e50f69ebae..e1d070470791 100644 --- a/layout/style/test/chrome/hover_helper.html +++ b/layout/style/test/chrome/hover_helper.html @@ -146,111 +146,126 @@ function step6() { step6called = true; is(getComputedStyle(divtwo, "").backgroundColor, "transparent", ":hover does not apply"); + setResize("step7()"); synthesizeMouse(divtwoparent, 2, 5, moveEvent, window); - setTimeout(step7, 500); // time to detect oscillations if they exist } var step7called = false; function step7() { - is(step7called, false, "step7 called only once (more than two cycles of oscillation)"); - if (step7called) - return; + is(step7called, false, "step7 called only once"); step7called = true; - is(getComputedStyle(divtwo, "").backgroundColor, "transparent", - ":hover does not apply"); - setTimeout(step8, 500); // time to detect oscillations if they exist + if (getComputedStyle(iframe, "").width == "50px") { + // The two resize events may be coalesced into a single one. + step8(); + return; + } + is(getComputedStyle(divtwo, "").backgroundColor, "rgb(0, 255, 0)", + ":hover applies"); + setResize("step8()"); + /* expect to get a second resize from the oscillation */ } -/* test the same case with scrolltop */ - var step8called = false; function step8() { - is(step8called, false, "step8 called only once"); + is(step8called, false, "step8 called only once (more than two cycles of oscillation)"); + if (step8called) + return; step8called = true; - iframe.contentDocument.body.removeAttribute("onresize"); - /* move the mouse out of the way */ - synthesizeMouse(divtwoparent, 200, 5, moveEvent, window); - divtwoparent.scrollLeft = 5; - setResize("step9()"); - synthesizeMouse(divtwoparent, 2, 5, moveEvent, window); - /* mouse now over 7, 5 */ + is(getComputedStyle(divtwo, "").backgroundColor, "transparent", + ":hover does not apply"); + setTimeout(step9, 500); // time to detect oscillations if they exist } +/* test the same case with scrolltop */ + var step9called = false; function step9() { is(step9called, false, "step9 called only once"); step9called = true; - is(getComputedStyle(divtwo, "").backgroundColor, "rgb(0, 255, 0)", - ":hover applies"); + iframe.contentDocument.body.removeAttribute("onresize"); + /* move the mouse out of the way */ + synthesizeMouse(divtwoparent, 200, 5, moveEvent, window); + divtwoparent.scrollLeft = 5; setResize("step10()"); - divtwoparent.scrollLeft = 0; /* mouse now over 2,5 */ + synthesizeMouse(divtwoparent, 2, 5, moveEvent, window); + /* mouse now over 7, 5 */ } var step10called = false; function step10() { is(step10called, false, "step10 called only once"); step10called = true; - if (getComputedStyle(iframe, "").width == "100px") { - // The two resize events may be coalesced into a single one. - step11(); - return; - } - is(getComputedStyle(divtwo, "").backgroundColor, "transparent", - ":hover does not apply"); + is(getComputedStyle(divtwo, "").backgroundColor, "rgb(0, 255, 0)", + ":hover applies"); setResize("step11()"); - /* expect to get a second resize from the oscillation */ + divtwoparent.scrollLeft = 0; /* mouse now over 2,5 */ } var step11called = false; function step11() { - is(step11called, false, "step11 called only once (more than two cycles of oscillation)"); - if (step11called) - return; + is(step11called, false, "step11 called only once"); step11called = true; - is(getComputedStyle(divtwo, "").backgroundColor, "rgb(0, 255, 0)", - ":hover applies"); - setTimeout(step12, 500); // time to detect oscillations if they exist + if (getComputedStyle(iframe, "").width == "100px") { + // The two resize events may be coalesced into a single one. + step12(); + return; + } + is(getComputedStyle(divtwo, "").backgroundColor, "transparent", + ":hover does not apply"); + setResize("step12()"); + /* expect to get a second resize from the oscillation */ } var step12called = false; function step12() { - is(step12called, false, "step12 called only once"); + is(step12called, false, "step12 called only once (more than two cycles of oscillation)"); + if (step12called) + return; step12called = true; - setResize("step13()"); - divtwoparent.scrollLeft = 25; /* mouse now over 27,5 */ + is(getComputedStyle(divtwo, "").backgroundColor, "rgb(0, 255, 0)", + ":hover applies"); + setTimeout(step13, 500); // time to detect oscillations if they exist } var step13called = false; function step13() { is(step13called, false, "step13 called only once"); step13called = true; - is(getComputedStyle(divtwo, "").backgroundColor, "transparent", - ":hover does not apply"); setResize("step14()"); - divtwoparent.scrollLeft = 0; /* mouse now over 2,5 */ + divtwoparent.scrollLeft = 25; /* mouse now over 27,5 */ } var step14called = false; function step14() { is(step14called, false, "step14 called only once"); step14called = true; - if (getComputedStyle(iframe, "").width == "50px") { - // The two resize events may be coalesced into a single one. - step15(); - return; - } - is(getComputedStyle(divtwo, "").backgroundColor, "rgb(0, 255, 0)", - ":hover applies"); + is(getComputedStyle(divtwo, "").backgroundColor, "transparent", + ":hover does not apply"); setResize("step15()"); - /* expect to get a second resize from the oscillation */ + divtwoparent.scrollLeft = 0; /* mouse now over 2,5 */ } var step15called = false; function step15() { - is(step15called, false, "step15 called only once (more than two cycles of oscillation)"); - if (step15called) - return; + is(step15called, false, "step15 called only once"); step15called = true; + if (getComputedStyle(iframe, "").width == "50px") { + // The two resize events may be coalesced into a single one. + step16(); + return; + } + is(getComputedStyle(divtwo, "").backgroundColor, "rgb(0, 255, 0)", + ":hover applies"); + setResize("step16()"); + /* expect to get a second resize from the oscillation */ +} + +var step16called = false; +function step16() { + is(step16called, false, "step16 called only once (more than two cycles of oscillation)"); + if (step16called) + return; + step16called = true; is(getComputedStyle(divtwo, "").backgroundColor, "transparent", ":hover does not apply"); setTimeout(finish, 500); // time to detect oscillations if they exist diff --git a/layout/xul/nsResizerFrame.cpp b/layout/xul/nsResizerFrame.cpp index 77dabd552ea1..0e56da00b195 100644 --- a/layout/xul/nsResizerFrame.cpp +++ b/layout/xul/nsResizerFrame.cpp @@ -285,8 +285,7 @@ nsResizerFrame::HandleEvent(nsPresContext* aPresContext, } } else { - window->SetPositionAndSize(rect.x, rect.y, rect.width, rect.height, - nsIBaseWindow::eRepaint); // do the repaint. + window->SetPositionAndSize(rect.x, rect.y, rect.width, rect.height, true); // do the repaint. } doDefault = false; diff --git a/view/nsViewManager.cpp b/view/nsViewManager.cpp index 4b80ad67c6c9..0664726baa09 100644 --- a/view/nsViewManager.cpp +++ b/view/nsViewManager.cpp @@ -187,11 +187,9 @@ void nsViewManager::DoSetWindowDimensions(nscoord aWidth, nscoord aHeight) // We care about resizes even when one dimension is already zero. if (!oldDim.IsEqualEdges(newDim)) { // Don't resize the widget. It is already being set elsewhere. - - const bool isHeightChanging = (oldDim.height != aHeight); mRootView->SetDimensions(newDim, true, false); if (mPresShell) - mPresShell->ResizeReflow(aWidth, aHeight, isHeightChanging); + mPresShell->ResizeReflow(aWidth, aHeight); } } @@ -212,10 +210,10 @@ nsViewManager::ShouldDelayResize() const } void -nsViewManager::SetWindowDimensions(nscoord aWidth, nscoord aHeight, bool aDelayResize) +nsViewManager::SetWindowDimensions(nscoord aWidth, nscoord aHeight) { if (mRootView) { - if (!ShouldDelayResize() && !aDelayResize) { + if (!ShouldDelayResize()) { if (mDelayedResize != nsSize(NSCOORD_NONE, NSCOORD_NONE) && mDelayedResize != nsSize(aWidth, aHeight)) { // We have a delayed resize; that now obsolete size may already have diff --git a/view/nsViewManager.h b/view/nsViewManager.h index ca379d4b0758..037abd1de5fa 100644 --- a/view/nsViewManager.h +++ b/view/nsViewManager.h @@ -89,8 +89,7 @@ public: * @param aWidth of window in twips * @param aHeight of window in twips */ - void SetWindowDimensions(nscoord aWidth, nscoord aHeight, - bool aDelayResize = false); + void SetWindowDimensions(nscoord aWidth, nscoord aHeight); /** * Do any resizes that are pending. diff --git a/widget/nsIBaseWindow.idl b/widget/nsIBaseWindow.idl index 7da3fe1dcfe9..24289a70b38a 100644 --- a/widget/nsIBaseWindow.idl +++ b/widget/nsIBaseWindow.idl @@ -113,18 +113,12 @@ interface nsIBaseWindow : nsISupports */ void getSize(out long cx, out long cy); - /** - * The 'flags' argument to setPositionAndSize is a set of these bits. - */ - const unsigned long eRepaint = 1; - const unsigned long eDelayResize = 2; - /* Convenience function combining the SetPosition and SetSize into one call. Also is more efficient than calling both. */ void setPositionAndSize(in long x, in long y, in long cx, in long cy, - in unsigned long flags); + in boolean fRepaint); /* Convenience function combining the GetPosition and GetSize into one call. diff --git a/xpfe/appshell/nsChromeTreeOwner.cpp b/xpfe/appshell/nsChromeTreeOwner.cpp index 688137cb1a63..22e7dbc6bd04 100644 --- a/xpfe/appshell/nsChromeTreeOwner.cpp +++ b/xpfe/appshell/nsChromeTreeOwner.cpp @@ -357,7 +357,7 @@ NS_IMETHODIMP nsChromeTreeOwner::InitWindow(nativeWindow aParentNativeWindow, nsIWidget* parentWidget, int32_t x, int32_t y, int32_t cx, int32_t cy) { // Ignore widget parents for now. Don't think those are a vaild thing to call. - NS_ENSURE_SUCCESS(SetPositionAndSize(x, y, cx, cy, 0), NS_ERROR_FAILURE); + NS_ENSURE_SUCCESS(SetPositionAndSize(x, y, cx, cy, false), NS_ERROR_FAILURE); return NS_OK; } @@ -417,10 +417,10 @@ NS_IMETHODIMP nsChromeTreeOwner::GetSize(int32_t* cx, int32_t* cy) } NS_IMETHODIMP nsChromeTreeOwner::SetPositionAndSize(int32_t x, int32_t y, int32_t cx, - int32_t cy, uint32_t aFlags) + int32_t cy, bool fRepaint) { NS_ENSURE_STATE(mXULWindow); - return mXULWindow->SetPositionAndSize(x, y, cx, cy, aFlags); + return mXULWindow->SetPositionAndSize(x, y, cx, cy, fRepaint); } NS_IMETHODIMP nsChromeTreeOwner::GetPositionAndSize(int32_t* x, int32_t* y, int32_t* cx, diff --git a/xpfe/appshell/nsContentTreeOwner.cpp b/xpfe/appshell/nsContentTreeOwner.cpp index f7473a904765..695c76880706 100644 --- a/xpfe/appshell/nsContentTreeOwner.cpp +++ b/xpfe/appshell/nsContentTreeOwner.cpp @@ -599,7 +599,7 @@ NS_IMETHODIMP nsContentTreeOwner::InitWindow(nativeWindow aParentNativeWindow, nsIWidget* parentWidget, int32_t x, int32_t y, int32_t cx, int32_t cy) { // Ignore wigdet parents for now. Don't think those are a vaild thing to call. - NS_ENSURE_SUCCESS(SetPositionAndSize(x, y, cx, cy, 0), NS_ERROR_FAILURE); + NS_ENSURE_SUCCESS(SetPositionAndSize(x, y, cx, cy, false), NS_ERROR_FAILURE); return NS_OK; } @@ -659,10 +659,10 @@ NS_IMETHODIMP nsContentTreeOwner::GetSize(int32_t* aCX, int32_t* aCY) } NS_IMETHODIMP nsContentTreeOwner::SetPositionAndSize(int32_t aX, int32_t aY, - int32_t aCX, int32_t aCY, uint32_t aFlags) + int32_t aCX, int32_t aCY, bool aRepaint) { NS_ENSURE_STATE(mXULWindow); - return mXULWindow->SetPositionAndSize(aX, aY, aCX, aCY, aFlags); + return mXULWindow->SetPositionAndSize(aX, aY, aCX, aCY, aRepaint); } NS_IMETHODIMP nsContentTreeOwner::GetPositionAndSize(int32_t* aX, int32_t* aY, @@ -1058,8 +1058,7 @@ nsSiteWindow::SetDimensions(uint32_t aFlags, int32_t aX, int32_t aY, int32_t aCX, int32_t aCY) { // XXX we're ignoring aFlags - return mAggregator->SetPositionAndSize(aX, aY, aCX, aCY, - nsIBaseWindow::eRepaint); + return mAggregator->SetPositionAndSize(aX, aY, aCX, aCY, true); } NS_IMETHODIMP diff --git a/xpfe/appshell/nsWebShellWindow.cpp b/xpfe/appshell/nsWebShellWindow.cpp index 271de3093f24..46352447fe78 100644 --- a/xpfe/appshell/nsWebShellWindow.cpp +++ b/xpfe/appshell/nsWebShellWindow.cpp @@ -281,7 +281,7 @@ nsWebShellWindow::WindowResized(nsIWidget* aWidget, int32_t aWidth, int32_t aHei { nsCOMPtr shellAsWin(do_QueryInterface(mDocShell)); if (shellAsWin) { - shellAsWin->SetPositionAndSize(0, 0, aWidth, aHeight, 0); + shellAsWin->SetPositionAndSize(0, 0, aWidth, aHeight, false); } // Persist size, but not immediately, in case this OS is firing // repeated size events as the user drags the sizing handle diff --git a/xpfe/appshell/nsXULWindow.cpp b/xpfe/appshell/nsXULWindow.cpp index 139406581a2a..ea23e6124f97 100644 --- a/xpfe/appshell/nsXULWindow.cpp +++ b/xpfe/appshell/nsXULWindow.cpp @@ -641,7 +641,7 @@ NS_IMETHODIMP nsXULWindow::GetSize(int32_t* aCX, int32_t* aCY) } NS_IMETHODIMP nsXULWindow::SetPositionAndSize(int32_t aX, int32_t aY, - int32_t aCX, int32_t aCY, uint32_t aFlags) + int32_t aCX, int32_t aCY, bool aRepaint) { /* any attempt to set the window's size or position overrides the window's zoom state. this is important when these two states are competing while @@ -653,7 +653,7 @@ NS_IMETHODIMP nsXULWindow::SetPositionAndSize(int32_t aX, int32_t aY, DesktopToLayoutDeviceScale scale = mWindow->GetDesktopToDeviceScale(); DesktopRect rect = LayoutDeviceIntRect(aX, aY, aCX, aCY) / scale; nsresult rv = mWindow->Resize(rect.x, rect.y, rect.width, rect.height, - !!(aFlags & nsIBaseWindow::eRepaint)); + aRepaint); NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE); if (!mChromeLoaded) { // If we're called before the chrome is loaded someone obviously wants this