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) |