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

Unified Diff: Source/core/rendering/RenderObject.cpp

Issue 398343003: Use unified invalidation path for repaint-only style changes (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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/rendering/RenderObject.cpp
diff --git a/Source/core/rendering/RenderObject.cpp b/Source/core/rendering/RenderObject.cpp
index e710dc7c3fe1785aa206d528730dee1d9429b86f..c084df18940d034a45163e3fc8053183ad0f7aa4 100644
--- a/Source/core/rendering/RenderObject.cpp
+++ b/Source/core/rendering/RenderObject.cpp
@@ -2055,15 +2055,17 @@ void RenderObject::setStyle(PassRefPtr<RenderStyle> style)
container->setNeedsOverflowRecalcAfterStyleChange();
}
- if (updatedDiff.needsRepaint()) {
- // Invalidate paints with the new style, e.g., for example if we go from not having
- // an outline to having an outline.
-
- // The paintInvalidationForWholeRenderer() call is needed for non-layout changes to style. See the corresponding
- // comment in RenderObject::styleWillChange for why.
- if (needsLayout())
+ // FIXME: Should invalidate whole layer if updatedDiff.needsRepaintLayer(). crbug.com/394050.
+ if (diff.needsRepaintObject() || updatedDiff.needsRepaint()) {
+ // FIXME: For objects that don't save previousPaintInvalidationRect, we still need
+ // to invalidate now because their invalidateTreeIfNeeded won't invalidate themselves.
+ // crbug.com/394133.
+ // FIXME: Test of parentTransformDidChange in RenderSVGModelObject::invalidateTreeIfNeeded()
+ // prevents SVG objects from using unified invalidation for repaint-only style change.
+ // crbug.com/394619.
+ if (needsLayout() || (invalidatesSelfDuringTreeInvalidation() && !isSVG()))
setShouldDoFullPaintInvalidation(true);
- else if (!selfNeedsLayout())
+ else
paintInvalidationForWholeRenderer();
}
}
@@ -2099,14 +2101,6 @@ void RenderObject::styleWillChange(StyleDifference diff, const RenderStyle& newS
}
}
- // For style-only changes that need paint invalidation, we currently need to issue a paint invalidation before and after the style
- // change. The paint invalidation before style change is accomplished here. The paint invalidation after style change is accomplished
- // in RenderObject::setStyle.
- if (m_parent && diff.needsRepaintObject()) {
- if (!diff.needsLayout() && !needsLayout())
- paintInvalidationForWholeRenderer();
- }
-
if (isFloating() && (m_style->floating() != newStyle.floating()))
// For changes in float styles, we need to conceivably remove ourselves
// from the floating objects list.
@@ -3394,6 +3388,17 @@ bool RenderObject::isRelayoutBoundaryForInspector() const
return objectIsRelayoutBoundary(this);
}
+void RenderObject::setShouldDoFullPaintInvalidation(bool b)
+{
+ m_bitfields.setShouldDoFullPaintInvalidation(b);
+ if (!b)
+ return;
+
+ // Make sure our parent is marked as child needing invalidation.
dsinclair 2014/07/17 18:36:01 as child needing full paint invalidation
Xianzhu 2014/07/17 21:57:34 Updated.
+ for (RenderObject* p = parent(); p && !p->shouldCheckForPaintInvalidation(); p = p->parent())
+ p->setChildNeedsPaintInvalidation(true);
+}
+
void RenderObject::clearPaintInvalidationState()
{
setShouldDoFullPaintInvalidation(false);
@@ -3403,6 +3408,7 @@ void RenderObject::clearPaintInvalidationState()
setShouldInvalidateOverflowForPaint(false);
setLayoutDidGetCalled(false);
setMayNeedPaintInvalidation(false);
+ setChildNeedsPaintInvalidation(false);
}
bool RenderObject::isAllowedToModifyRenderTreeStructure(Document& document)

Powered by Google App Engine
This is Rietveld 408576698