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

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

Issue 1234183003: Revert 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/LayoutObject.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/layout/LayoutObject.cpp
diff --git a/Source/core/layout/LayoutObject.cpp b/Source/core/layout/LayoutObject.cpp
index c20b504fa6617132f02c64340e496033b1e0e1bb..0fe7c9728b8669ad334778f128161090e6034ca3 100644
--- a/Source/core/layout/LayoutObject.cpp
+++ b/Source/core/layout/LayoutObject.cpp
@@ -1836,6 +1836,11 @@
setShouldDoFullPaintInvalidation();
}
+static inline bool layoutObjectHasBackground(const LayoutObject* layoutObject)
+{
+ return layoutObject && layoutObject->hasBackground();
+}
+
void LayoutObject::styleWillChange(StyleDifference diff, const ComputedStyle& newStyle)
{
if (m_style) {
@@ -1879,6 +1884,37 @@
}
} else {
s_affectsParentBlock = false;
+ }
+
+ if (view()->frameView()) {
+ bool shouldBlitOnFixedBackgroundImage = false;
+ if (RuntimeEnabledFeatures::fastMobileScrollingEnabled()) {
+ // 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".
+ shouldBlitOnFixedBackgroundImage = true;
+ }
+ bool newStyleSlowScroll = !shouldBlitOnFixedBackgroundImage && newStyle.hasFixedBackgroundImage();
+ bool oldStyleSlowScroll = m_style && !shouldBlitOnFixedBackgroundImage && m_style->hasFixedBackgroundImage();
+
+ bool drawsRootBackground = isDocumentElement() || (isBody() && !layoutObjectHasBackground(document().documentElement()->layoutObject()));
+ if (drawsRootBackground && !shouldBlitOnFixedBackgroundImage) {
+ if (view()->compositor()->supportsFixedRootBackgroundCompositing()) {
+ if (newStyleSlowScroll && newStyle.hasEntirelyFixedBackground())
+ newStyleSlowScroll = false;
+
+ if (oldStyleSlowScroll && m_style->hasEntirelyFixedBackground())
+ oldStyleSlowScroll = false;
+ }
+ }
+
+ if (oldStyleSlowScroll != newStyleSlowScroll) {
+ if (oldStyleSlowScroll)
+ view()->frameView()->removeSlowRepaintObject();
+ if (newStyleSlowScroll)
+ view()->frameView()->addSlowRepaintObject();
+ }
}
// Elements with non-auto touch-action will send a SetTouchAction message
@@ -2437,9 +2473,6 @@
removeShapeImageClient(m_style->shapeOutside());
}
ResourceLoadPriorityOptimizer::resourceLoadPriorityOptimizer()->removeLayoutObject(this);
-
- if (frameView())
- setIsSlowRepaintObject(false);
}
void LayoutObject::insertedIntoTree()
@@ -3237,18 +3270,6 @@
setShouldDoFullPaintInvalidationIncludingNonCompositingDescendantsInternal(this);
}
-void LayoutObject::setIsSlowRepaintObject(bool isSlowRepaintObject)
-{
- ASSERT(frameView());
- if (m_bitfields.isSlowRepaintObject() == isSlowRepaintObject)
- return;
- m_bitfields.setIsSlowRepaintObject(isSlowRepaintObject);
- if (isSlowRepaintObject)
- frameView()->addSlowRepaintObject();
- else
- frameView()->removeSlowRepaintObject();
-}
-
} // namespace blink
#ifndef NDEBUG
« no previous file with comments | « Source/core/layout/LayoutObject.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698