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

Unified Diff: third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp

Issue 1416053003: Let synchronized painting generate correct paint invalidation rects (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: For landing Created 5 years, 2 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/compositing/CompositedLayerMapping.cpp
diff --git a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
index 9187b0ba9ed49a9d287c91a905c75cd46244f9a0..819945a455e05094b4e5eb7ab1bdb36d04c7e4df 100644
--- a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
+++ b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
@@ -2030,7 +2030,9 @@ struct SetContentsNeedsDisplayInRectFunctor {
// r is in the coordinate space of the layer's layout object
void CompositedLayerMapping::setContentsNeedDisplayInRect(const LayoutRect& r, PaintInvalidationReason invalidationReason)
{
- ASSERT(!RuntimeEnabledFeatures::slimmingPaintSynchronizedPaintingEnabled());
+ // TODO(wangxianzhu): Enable the following assert after paint invalidation for spv2 is ready.
+ // ASSERT(!RuntimeEnabledFeatures::slimmingPaintV2Enabled());
+
SetContentsNeedsDisplayInRectFunctor functor = {
enclosingIntRect(LayoutRect(r.location() + m_owningLayer.subpixelAccumulation(), r.size())),
invalidationReason
@@ -2038,18 +2040,33 @@ void CompositedLayerMapping::setContentsNeedDisplayInRect(const LayoutRect& r, P
ApplyToGraphicsLayers(this, functor, ApplyToContentLayers);
}
-void CompositedLayerMapping::invalidateDisplayItemClient(const DisplayItemClientWrapper& displayItemClient, PaintInvalidationReason paintInvalidationReason, const LayoutRect& previousPaintInvalidationRect, const LayoutRect& newPaintInvalidationRect)
+struct InvalidateDisplayItemClientFunctor {
+ void operator() (GraphicsLayer* layer) const
+ {
+ IntRect visualRectOnLayer;
+ if (visualRect) {
+ visualRectOnLayer = enclosingIntRect(LayoutRect(visualRect->location() + subpixelAccumulation, visualRect->size()));
+ visualRectOnLayer.move(-layer->offsetFromLayoutObject());
+ }
+ layer->invalidateDisplayItemClient(displayItemClient, invalidationReason, visualRect ? &visualRectOnLayer : nullptr);
+ }
+
+ const DisplayItemClientWrapper& displayItemClient;
+ PaintInvalidationReason invalidationReason;
+ const LayoutRect* visualRect;
+ LayoutSize subpixelAccumulation;
+};
+
+void CompositedLayerMapping::invalidateDisplayItemClient(const DisplayItemClientWrapper& displayItemClient, PaintInvalidationReason paintInvalidationReason, const LayoutRect* visualRect)
{
- ApplyToGraphicsLayers(this, [&displayItemClient, paintInvalidationReason, previousPaintInvalidationRect, newPaintInvalidationRect](GraphicsLayer* layer) {
- layer->invalidateDisplayItemClient(displayItemClient, paintInvalidationReason, enclosingIntRect(previousPaintInvalidationRect), enclosingIntRect(newPaintInvalidationRect));
- }, ApplyToContentLayers);
+ InvalidateDisplayItemClientFunctor functor = { displayItemClient, paintInvalidationReason, visualRect, m_owningLayer.subpixelAccumulation() };
+ ApplyToGraphicsLayers(this, functor, ApplyToContentLayers);
}
-void CompositedLayerMapping::invalidateDisplayItemClientOnScrollingContentsLayer(const DisplayItemClientWrapper& displayItemClient, PaintInvalidationReason paintInvalidationReason, const LayoutRect& previousPaintInvalidationRect, const LayoutRect& newPaintInvalidationRect)
+void CompositedLayerMapping::invalidateDisplayItemClientOnScrollingContentsLayer(const DisplayItemClientWrapper& displayItemClient, PaintInvalidationReason paintInvalidationReason, const LayoutRect* visualRect)
{
- ApplyToGraphicsLayers(this, [&displayItemClient, paintInvalidationReason, previousPaintInvalidationRect, newPaintInvalidationRect](GraphicsLayer* layer) {
- layer->invalidateDisplayItemClient(displayItemClient, paintInvalidationReason, enclosingIntRect(previousPaintInvalidationRect), enclosingIntRect(newPaintInvalidationRect));
- }, ApplyToScrollingContentsLayer);
+ InvalidateDisplayItemClientFunctor functor = { displayItemClient, paintInvalidationReason, visualRect, m_owningLayer.subpixelAccumulation() };
+ ApplyToGraphicsLayers(this, functor, ApplyToScrollingContentsLayer);
}
const GraphicsLayerPaintInfo* CompositedLayerMapping::containingSquashedLayer(const LayoutObject* layoutObject, const Vector<GraphicsLayerPaintInfo>& layers, unsigned maxSquashedLayerIndex)

Powered by Google App Engine
This is Rietveld 408576698