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

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: Update naming 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
« no previous file with comments | « Source/core/rendering/RenderObject.h ('k') | Source/core/rendering/svg/RenderSVGBlock.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderObject.cpp
diff --git a/Source/core/rendering/RenderObject.cpp b/Source/core/rendering/RenderObject.cpp
index 9e72e470370fa9960797db03a40b95aec44e7459..24b2766dd754a427a99576d70f130d6ae607b61c 100644
--- a/Source/core/rendering/RenderObject.cpp
+++ b/Source/core/rendering/RenderObject.cpp
@@ -1598,7 +1598,7 @@ void RenderObject::invalidateTreeIfNeeded(const PaintInvalidationState& paintInv
{
// If we didn't need paint invalidation then our children don't need as well.
// Skip walking down the tree as everything should be fine below us.
- if (!shouldCheckForPaintInvalidation())
+ if (!shouldCheckForSelfOrChildPaintInvalidation())
return;
clearPaintInvalidationState();
@@ -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() || (canSelfInvalidateDuringTreeInvalidation() && !isSVG()))
setShouldDoFullPaintInvalidation(true);
- else if (!selfNeedsLayout())
+ else
paintInvalidationForWholeRenderer();
}
}
@@ -2099,12 +2101,14 @@ 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 (!diff.needsLayout() && !needsLayout()) {
+ // Invalidate before style change.
+ // FIXME: See FIXMEs in setStyle() before calling paintInvalidationForWholeRenderer
+ // for the reason of this paintInvalidationForWholeRenderer.
+ if (!canSelfInvalidateDuringTreeInvalidation() || isSVG())
+ paintInvalidationForWholeRenderer();
+ }
}
if (isFloating() && (m_style->floating() != newStyle.floating()))
@@ -3394,6 +3398,17 @@ bool RenderObject::isRelayoutBoundaryForInspector() const
return objectIsRelayoutBoundary(this);
}
+void RenderObject::setShouldDoFullPaintInvalidation(bool b)
Julien - ping for review 2014/07/18 18:49:44 I really think we should split the setting from th
+{
+ m_bitfields.setShouldDoFullPaintInvalidation(b);
+ if (!b)
+ return;
+
+ // Make sure our parent is marked so that the next invalidateTreeIfNeeded can reach this object.
+ for (RenderObject* p = parent(); p && !p->shouldCheckForSelfOrChildPaintInvalidation(); p = p->parent())
Julien - ping for review 2014/07/18 18:49:44 This is wrong for 2 reasons: - We shouldn't walk t
+ p->setChildNeedsPaintInvalidation(true);
+}
+
void RenderObject::clearPaintInvalidationState()
{
setShouldDoFullPaintInvalidation(false);
@@ -3403,6 +3418,7 @@ void RenderObject::clearPaintInvalidationState()
setShouldInvalidateOverflowForPaint(false);
setLayoutDidGetCalled(false);
setMayNeedPaintInvalidation(false);
+ setChildNeedsPaintInvalidation(false);
}
bool RenderObject::isAllowedToModifyRenderTreeStructure(Document& document)
« no previous file with comments | « Source/core/rendering/RenderObject.h ('k') | Source/core/rendering/svg/RenderSVGBlock.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698