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

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

Issue 1585823002: Improve performance when calling PaintLayer::setNeedsRepaint() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@RemoveVisualRect
Patch Set: Created 4 years, 11 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: third_party/WebKit/Source/core/layout/LayoutObject.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutObject.cpp b/third_party/WebKit/Source/core/layout/LayoutObject.cpp
index a53c64682040896e7433533b73de6f314ee71f60..816d88cb044294ae24d0cea6294c5024e91ff7c3 100644
--- a/third_party/WebKit/Source/core/layout/LayoutObject.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutObject.cpp
@@ -1281,6 +1281,8 @@ void LayoutObject::invalidatePaintRectangle(const LayoutRect& rect) const
const LayoutBoxModelObject* paintInvalidationContainer = invalidatePaintRectangleInternal(rect);
if (paintInvalidationContainer)
invalidateDisplayItemClients(*paintInvalidationContainer, PaintInvalidationRectangle);
+ if (PaintLayer* enclosingLayer = this->enclosingLayer())
+ enclosingLayer->setNeedsRepaint();
}
void LayoutObject::invalidatePaintRectangleNotInvalidatingDisplayItemClients(const LayoutRect& r) const
@@ -1430,13 +1432,16 @@ PaintInvalidationReason LayoutObject::invalidatePaintIfNeeded(PaintInvalidationS
// mutation, but incurs no pixel difference (i.e. bounds stay the same) so no rect-based
// invalidation is issued. See crbug.com/508383 and crbug.com/515977.
// This is a workaround to force display items to update paint offset.
- if (!RuntimeEnabledFeatures::slimmingPaintOffsetCachingEnabled() && paintInvalidationState.forcedSubtreeInvalidationWithinContainer())
+ if (!RuntimeEnabledFeatures::slimmingPaintOffsetCachingEnabled() && paintInvalidationState.forcedSubtreeInvalidationWithinContainer()) {
invalidateDisplayItemClients(paintInvalidationContainer, invalidationReason);
+ paintInvalidationState.enclosingLayer().setNeedsRepaint();
+ }
return invalidationReason;
}
invalidateDisplayItemClients(paintInvalidationContainer, invalidationReason);
+ paintInvalidationState.enclosingLayer().setNeedsRepaint();
if (invalidationReason == PaintInvalidationIncremental) {
incrementallyInvalidatePaint(paintInvalidationContainer, oldBounds, newBounds, newLocation);
@@ -3405,11 +3410,20 @@ void LayoutObject::invalidateDisplayItemClientsIncludingNonCompositingDescendant
traverseNonCompositingDescendants(const_cast<LayoutObject&>(*this), [&paintInvalidationContainer, paintInvalidationReason](LayoutObject& object) {
object.invalidateDisplayItemClients(*paintInvalidationContainer, paintInvalidationReason);
+ if (object.hasLayer())
+ toLayoutBoxModelObject(object).layer()->setNeedsRepaint();
});
}
void LayoutObject::invalidatePaintOfPreviousPaintInvalidationRect(const LayoutBoxModelObject& paintInvalidationContainer, PaintInvalidationReason reason)
{
+ invalidatePaintOfPreviousPaintInvalidationRectNotSettingLayerNeedsRepaint(paintInvalidationContainer, reason);
+ if (PaintLayer* enclosingLayer = this->enclosingLayer())
+ enclosingLayer->setNeedsRepaint();
+}
+
+void LayoutObject::invalidatePaintOfPreviousPaintInvalidationRectNotSettingLayerNeedsRepaint(const LayoutBoxModelObject& paintInvalidationContainer, PaintInvalidationReason reason)
+{
chrishtr 2016/01/14 18:51:13 This looks like a copy of the old code. I expected
Xianzhu 2016/01/14 19:19:08 Now invalidateDisplayItemClients() doesn't set lay
chrishtr 2016/01/15 00:02:21 I understand the goal, but can't find where you ar
// These disablers are valid because we want to use the current compositing/invalidation status.
DisablePaintInvalidationStateAsserts invalidationDisabler;
DisableCompositingQueryAsserts compositingDisabler;
@@ -3431,7 +3445,9 @@ void LayoutObject::invalidatePaintIncludingNonCompositingDescendants()
// Since we're only painting non-composited layers, we know that they all share the same paintInvalidationContainer.
const LayoutBoxModelObject& paintInvalidationContainer = containerForPaintInvalidation();
traverseNonCompositingDescendants(*this, [&paintInvalidationContainer](LayoutObject& object) {
- object.invalidatePaintOfPreviousPaintInvalidationRect(paintInvalidationContainer, PaintInvalidationLayer);
+ object.invalidatePaintOfPreviousPaintInvalidationRectNotSettingLayerNeedsRepaint(paintInvalidationContainer, PaintInvalidationLayer);
+ if (object.hasLayer())
+ toLayoutBoxModelObject(object).layer()->setNeedsRepaint();
});
}
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutObject.h ('k') | third_party/WebKit/Source/core/layout/PaintInvalidationState.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698