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

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

Issue 1117753003: Fix under-invalidation about view background change caused by body style change (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 8 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/LayoutObject.cpp
diff --git a/Source/core/layout/LayoutObject.cpp b/Source/core/layout/LayoutObject.cpp
index 2a53e6c0bcf239ece950374033a7d277288384c1..27beeecfa72953c51c952fc5c61d46f1705bf98c 100644
--- a/Source/core/layout/LayoutObject.cpp
+++ b/Source/core/layout/LayoutObject.cpp
@@ -1749,6 +1749,13 @@ void LayoutObject::setStyle(PassRefPtr<ComputedStyle> style)
return;
}
+ // These are used later to check invalidation of document element caused by
+ // body background change. FIXME: This may be related to crbug.com/475115.
+ LayoutObject* oldViewBackgroundLayoutObject = nullptr;
+ LayoutView* layoutView = view();
+ if (RuntimeEnabledFeatures::slimmingPaintEnabled() && layoutView && isBody())
+ oldViewBackgroundLayoutObject = layoutView->backgroundLayoutObject();
+
StyleDifference diff;
if (m_style)
diff = m_style->visualInvalidationDiff(*style);
@@ -1772,6 +1779,18 @@ void LayoutObject::setStyle(PassRefPtr<ComputedStyle> style)
styleDidChange(diff, oldStyle.get());
+ if (RuntimeEnabledFeatures::slimmingPaintEnabled() && layoutView && isBody() && layoutView->backgroundLayoutObject() == this) {
chrishtr 2015/04/30 01:23:57 How about always invalidating the LayoutView and t
Xianzhu 2015/04/30 04:46:39 We don't need to invalidate the LayoutView, but th
chrishtr 2015/04/30 17:48:36 Yeah I mean just always invalidating both if one o
+ // The rootObject paints view's background. We need to invalidate it when
+ // view's background changes because of change of body's style.
+ if (LayoutObject* rootObject = document().documentElement()->layoutObject()) {
+ if (oldViewBackgroundLayoutObject != this
+ || (!oldStyle && m_style->hasBackground())
+ || (oldStyle && oldStyle->visitedDependentColor(CSSPropertyBackgroundColor) != m_style->visitedDependentColor(CSSPropertyBackgroundColor))
+ || (oldStyle && oldStyle->backgroundLayers() != m_style->backgroundLayers()))
+ rootObject->setShouldDoFullPaintInvalidation();
+ }
+ }
+
// FIXME: |this| might be destroyed here. This can currently happen for a LayoutTextFragment when
// its first-letter block gets an update in LayoutTextFragment::styleDidChange. For LayoutTextFragment(s),
// we will safely bail out with the doesNotNeedLayoutOrPaintInvalidation flag. We might want to broaden

Powered by Google App Engine
This is Rietveld 408576698