From c58035b973225751962efb2a5500117b286ed0f4 Mon Sep 17 00:00:00 2001 From: Markus Stange Date: Tue, 3 Jun 2014 15:55:58 +0200 Subject: [PATCH] Bug 1018461 - Allow active scrolling inside SVG. Should give a big tscrollx win. r=roc --- layout/generic/nsGfxScrollFrame.cpp | 29 +++++++---------------------- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/layout/generic/nsGfxScrollFrame.cpp b/layout/generic/nsGfxScrollFrame.cpp index 23ed8214ebf..a4d848e0a56 100644 --- a/layout/generic/nsGfxScrollFrame.cpp +++ b/layout/generic/nsGfxScrollFrame.cpp @@ -1798,22 +1798,9 @@ static void AdjustViews(nsIFrame* aFrame) } static bool -CanScrollWithBlitting(nsIFrame* aFrame) +NeedToInvalidateOnScroll(nsIFrame* aFrame) { - if (aFrame->GetStateBits() & NS_SCROLLFRAME_INVALIDATE_CONTENTS_ON_SCROLL) - return false; - - for (nsIFrame* f = aFrame; f; - f = nsLayoutUtils::GetCrossDocParentFrame(f)) { - if (nsSVGIntegrationUtils::UsingEffectsForFrame(f) || - f->IsFrameOfType(nsIFrame::eSVG) || - f->GetStateBits() & NS_FRAME_NO_COMPONENT_ALPHA) { - return false; - } - if (nsLayoutUtils::IsPopup(f)) - break; - } - return true; + return (aFrame->GetStateBits() & NS_SCROLLFRAME_INVALIDATE_CONTENTS_ON_SCROLL) != 0; } bool ScrollFrameHelper::IsIgnoringViewportClipping() const @@ -1900,14 +1887,12 @@ void ScrollFrameHelper::ScrollVisual(nsPoint aOldScrolledFramePos) AdjustViews(mScrolledFrame); // We need to call this after fixing up the view positions // to be consistent with the frame hierarchy. - bool canScrollWithBlitting = CanScrollWithBlitting(mOuter); + bool needToInvalidateOnScroll = NeedToInvalidateOnScroll(mOuter); mOuter->RemoveStateBits(NS_SCROLLFRAME_INVALIDATE_CONTENTS_ON_SCROLL); - if (IsScrollingActive()) { - if (!canScrollWithBlitting) { - MarkInactive(); - } + if (IsScrollingActive() && needToInvalidateOnScroll) { + MarkInactive(); } - if (canScrollWithBlitting) { + if (!needToInvalidateOnScroll) { MarkActive(); } @@ -2422,7 +2407,7 @@ ScrollFrameHelper::BuildDisplayList(nsDisplayListBuilder* aBuilder, if (aBuilder->IsPaintingToWindow()) { mScrollPosAtLastPaint = GetScrollPosition(); - if (IsScrollingActive() && !CanScrollWithBlitting(mOuter)) { + if (IsScrollingActive() && NeedToInvalidateOnScroll(mOuter)) { MarkInactive(); } if (IsScrollingActive()) {