From a27c78da5a2191a27024c68b2f80a173af0a921c Mon Sep 17 00:00:00 2001 From: Robert O'Callahan Date: Mon, 29 Mar 2010 14:46:58 +1300 Subject: [PATCH] Bug 545049. Capture the pre-transform overflow area of a frame and use it in InvalidateOverflowArea. r=mats --- layout/base/nsCSSFrameConstructor.cpp | 4 ++-- layout/base/nsFrameManager.cpp | 2 +- layout/generic/nsContainerFrame.cpp | 2 +- layout/generic/nsFrame.cpp | 20 +++++++++++--------- layout/generic/nsIFrame.h | 1 + 5 files changed, 16 insertions(+), 13 deletions(-) diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index 8cb976556b41..9618daf3dac2 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -7211,7 +7211,7 @@ DoApplyRenderingChangeToTree(nsIFrame* aFrame, } #endif } else { - aFrame->Invalidate(aFrame->GetOverflowRect()); + aFrame->InvalidateOverflowRect(); } } } @@ -7303,7 +7303,7 @@ InvalidateCanvasIfNeeded(nsIPresShell* presShell, nsIContent* node) nsIViewManager::UpdateViewBatch batch(presShell->GetViewManager()); nsIFrame* rootFrame = presShell->GetRootFrame(); - rootFrame->Invalidate(rootFrame->GetOverflowRect()); + rootFrame->InvalidateOverflowRect(); batch.EndUpdateViewBatch(NS_VMREFRESH_DEFERRED); } diff --git a/layout/base/nsFrameManager.cpp b/layout/base/nsFrameManager.cpp index db9b03969b6e..d89399ae2189 100644 --- a/layout/base/nsFrameManager.cpp +++ b/layout/base/nsFrameManager.cpp @@ -534,7 +534,7 @@ nsFrameManager::RemoveFrame(nsIAtom* aListName, // that doesn't change the size of the parent.) // This has to sure to invalidate the entire overflow rect; this // is important in the presence of absolute positioning - aOldFrame->Invalidate(aOldFrame->GetOverflowRect()); + aOldFrame->InvalidateOverflowRect(); NS_ASSERTION(!aOldFrame->GetPrevContinuation() || // exception for nsCSSFrameConstructor::RemoveFloatingFirstLetterFrames diff --git a/layout/generic/nsContainerFrame.cpp b/layout/generic/nsContainerFrame.cpp index 87a1a93ad436..268fe7acc71d 100644 --- a/layout/generic/nsContainerFrame.cpp +++ b/layout/generic/nsContainerFrame.cpp @@ -1120,7 +1120,7 @@ nsContainerFrame::DeleteNextInFlowChild(nsPresContext* aPresContext, } } - aNextInFlow->Invalidate(aNextInFlow->GetOverflowRect()); + aNextInFlow->InvalidateOverflowRect(); // Take the next-in-flow out of the parent's child list #ifdef DEBUG diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index ee4898895ac7..e355927b553a 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -3825,7 +3825,7 @@ nsIFrame::InvalidateRectDifference(const nsRect& aR1, const nsRect& aR2) void nsIFrame::InvalidateOverflowRect() { - Invalidate(GetOverflowRect()); + Invalidate(GetOverflowRectRelativeToSelf()); } void @@ -3965,14 +3965,14 @@ nsIFrame::GetOverflowRectRelativeToParent() const nsRect nsIFrame::GetOverflowRectRelativeToSelf() const { - if (!(mState & NS_FRAME_MAY_BE_TRANSFORMED_OR_HAVE_RENDERING_OBSERVERS) || - !GetStyleDisplay()->HasTransform()) - return GetOverflowRect(); - nsRect* preEffectsBBox = static_cast - (Properties().Get(PreEffectsBBoxProperty())); - if (!preEffectsBBox) - return GetOverflowRect(); - return *preEffectsBBox; + if ((mState & NS_FRAME_MAY_BE_TRANSFORMED_OR_HAVE_RENDERING_OBSERVERS) && + GetStyleDisplay()->HasTransform()) { + nsRect* preTransformBBox = static_cast + (Properties().Get(PreTransformBBoxProperty())); + if (preTransformBBox) + return *preTransformBBox; + } + return GetOverflowRect(); } void @@ -5666,6 +5666,8 @@ nsIFrame::FinishAndStoreOverflow(nsRect* aOverflowArea, nsSize aNewSize) (mState & NS_FRAME_MAY_BE_TRANSFORMED_OR_HAVE_RENDERING_OBSERVERS) && GetStyleDisplay()->HasTransform(); if (hasTransform) { + Properties(). + Set(nsIFrame::PreTransformBBoxProperty(), new nsRect(*aOverflowArea)); /* Since our size might not actually have been computed yet, we need to make sure that we use the * correct dimensions by overriding the stored bounding rectangle with the value the caller has * ensured us we'll use. diff --git a/layout/generic/nsIFrame.h b/layout/generic/nsIFrame.h index 8b4baf381d47..565627994472 100644 --- a/layout/generic/nsIFrame.h +++ b/layout/generic/nsIFrame.h @@ -831,6 +831,7 @@ public: NS_DECLARE_FRAME_PROPERTY(OutlineInnerRectProperty, DestroyRect) NS_DECLARE_FRAME_PROPERTY(PreEffectsBBoxProperty, DestroyRect) + NS_DECLARE_FRAME_PROPERTY(PreTransformBBoxProperty, DestroyRect) NS_DECLARE_FRAME_PROPERTY(UsedMarginProperty, DestroyMargin) NS_DECLARE_FRAME_PROPERTY(UsedPaddingProperty, DestroyMargin)