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

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

Issue 1234153003: Reland of 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
« no previous file with comments | « Source/core/layout/LayoutBox.h ('k') | Source/core/layout/LayoutObject.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/layout/LayoutBox.cpp
diff --git a/Source/core/layout/LayoutBox.cpp b/Source/core/layout/LayoutBox.cpp
index 5329151be66562410cefd001d6464fd74a8cc854..b420e059cf22f23d905d2cf4b78013cfca1ce4df 100644
--- a/Source/core/layout/LayoutBox.cpp
+++ b/Source/core/layout/LayoutBox.cpp
@@ -245,6 +245,33 @@
if (LayoutMultiColumnSpannerPlaceholder* placeholder = this->spannerPlaceholder())
placeholder->layoutObjectInFlowThreadStyleDidChange(oldStyle);
+
+ updateSlowRepaintStatusAfterStyleChange();
+}
+
+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;
+
+ // An object needs to be repainted on frame scroll when it has background-attachment:fixed.
+ // LayoutObject is responsible for painting root background, thus the root element (and the
+ // body element if html element has no background) skips painting backgrounds.
+ bool isSlowRepaintObject = !isDocumentElement() && !backgroundStolenForBeingBody() && styleRef().hasFixedBackgroundImage();
+ if (isLayoutView() && view()->compositor()->supportsFixedRootBackgroundCompositing()) {
+ if (styleRef().hasEntirelyFixedBackground())
+ isSlowRepaintObject = false;
+ }
+
+ setIsSlowRepaintObject(isSlowRepaintObject);
}
void LayoutBox::updateShapeOutsideInfoAfterStyleChange(const ComputedStyle& style, const ComputedStyle* oldStyle)
« no previous file with comments | « Source/core/layout/LayoutBox.h ('k') | Source/core/layout/LayoutObject.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698