Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(696)

Unified Diff: Source/core/layout/LayoutBox.cpp

Issue 1240443003: Fix slow repaint object registration (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/layout/LayoutBox.cpp
diff --git a/Source/core/layout/LayoutBox.cpp b/Source/core/layout/LayoutBox.cpp
index 5329151be66562410cefd001d6464fd74a8cc854..5a8a5f7a7851e0a0377d93b65d0b768857c38615 100644
--- a/Source/core/layout/LayoutBox.cpp
+++ b/Source/core/layout/LayoutBox.cpp
@@ -245,6 +245,31 @@ void LayoutBox::styleDidChange(StyleDifference diff, const ComputedStyle* oldSty
if (LayoutMultiColumnSpannerPlaceholder* placeholder = this->spannerPlaceholder())
placeholder->layoutObjectInFlowThreadStyleDidChange(oldStyle);
+
+ updateSlowRepaintStatusAfterStyleChange();
+}
+
+
Ian Vollick 2015/07/14 02:27:11 nit: extra ws.
trchen 2015/07/14 03:36:37 Done.
+void LayoutBox::updateSlowRepaintStatusAfterStyleChange()
+{
+ if (!frameView())
+ return;
+
+ // On low-powered/mobile devices, preventing blitting on a scroll can cause noticeable delays
+ // when scrolling a page with a fixed background image. As an optimization, assuming there are
+ // no fixed positoned elements on the page, we can acclerate scrolling (via blitting) if we
+ // ignore the CSS property "background-attachment: fixed".
+ bool ignoreFixedBackgroundAttachment = RuntimeEnabledFeatures::fastMobileScrollingEnabled();
+ if (ignoreFixedBackgroundAttachment)
+ return;
+
+ bool isSlowRepaintObject = !isDocumentElement() && !backgroundStolenForBeingBody() && styleRef().hasFixedBackgroundImage();
Ian Vollick 2015/07/14 02:27:11 Sorry for the dumb question, but if the document e
trchen 2015/07/14 03:36:37 Ah, sorry I forgot to tell you the context. I made
+ if (isLayoutView() && view()->compositor()->supportsFixedRootBackgroundCompositing()) {
+ if (styleRef().hasEntirelyFixedBackground())
+ isSlowRepaintObject = false;
+ }
+
+ setIsSlowRepaintObject(isSlowRepaintObject);
}
void LayoutBox::updateShapeOutsideInfoAfterStyleChange(const ComputedStyle& style, const ComputedStyle* oldStyle)

Powered by Google App Engine
This is Rietveld 408576698