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

Side by Side 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: 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009, 2010, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2009, 2010, 2011 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 2020 matching lines...) Expand 10 before | Expand all | Expand 10 after
2031 void CompositedLayerMapping::setContentsNeedDisplayInRect(const LayoutRect& r, P aintInvalidationReason invalidationReason) 2031 void CompositedLayerMapping::setContentsNeedDisplayInRect(const LayoutRect& r, P aintInvalidationReason invalidationReason)
2032 { 2032 {
2033 ASSERT(!RuntimeEnabledFeatures::slimmingPaintSynchronizedPaintingEnabled()); 2033 ASSERT(!RuntimeEnabledFeatures::slimmingPaintSynchronizedPaintingEnabled());
2034 SetContentsNeedsDisplayInRectFunctor functor = { 2034 SetContentsNeedsDisplayInRectFunctor functor = {
2035 enclosingIntRect(LayoutRect(r.location() + m_owningLayer.subpixelAccumul ation(), r.size())), 2035 enclosingIntRect(LayoutRect(r.location() + m_owningLayer.subpixelAccumul ation(), r.size())),
2036 invalidationReason 2036 invalidationReason
2037 }; 2037 };
2038 ApplyToGraphicsLayers(this, functor, ApplyToContentLayers); 2038 ApplyToGraphicsLayers(this, functor, ApplyToContentLayers);
2039 } 2039 }
2040 2040
2041 void CompositedLayerMapping::invalidateDisplayItemClient(const DisplayItemClient Wrapper& displayItemClient, PaintInvalidationReason paintInvalidationReason, con st LayoutRect& previousPaintInvalidationRect, const LayoutRect& newPaintInvalida tionRect) 2041 struct InvalidateDisplayItemClientFunctor {
2042 void operator() (GraphicsLayer* layer) const
2043 {
2044 Vector<IntRect> layerPaintInvalidationRects;
2045 for (const auto& r : paintInvalidationRects) {
2046 IntRect intRect = enclosingIntRect(LayoutRect(r.location() + subpixe lAccumulation, r.size()));
2047 intRect.move(-layer->offsetFromLayoutObject());
2048 layerPaintInvalidationRects.append(intRect);
2049 }
2050 layer->invalidateDisplayItemClient(displayItemClient, invalidationReason , layerPaintInvalidationRects);
2051 }
2052
2053 const DisplayItemClientWrapper& displayItemClient;
2054 PaintInvalidationReason invalidationReason;
2055 Vector<LayoutRect> paintInvalidationRects;
2056 LayoutSize subpixelAccumulation;
2057 };
2058
2059 void CompositedLayerMapping::invalidateDisplayItemClient(const DisplayItemClient Wrapper& displayItemClient, PaintInvalidationReason paintInvalidationReason, con st Vector<LayoutRect>& paintInvalidationRects)
2042 { 2060 {
2043 ApplyToGraphicsLayers(this, [&displayItemClient, paintInvalidationReason, pr eviousPaintInvalidationRect, newPaintInvalidationRect](GraphicsLayer* layer) { 2061 InvalidateDisplayItemClientFunctor functor = { displayItemClient, paintInval idationReason, paintInvalidationRects, m_owningLayer.subpixelAccumulation() };
2044 layer->invalidateDisplayItemClient(displayItemClient, paintInvalidationR eason, enclosingIntRect(previousPaintInvalidationRect), enclosingIntRect(newPain tInvalidationRect)); 2062 ApplyToGraphicsLayers(this, functor, ApplyToContentLayers);
2045 }, ApplyToContentLayers);
2046 } 2063 }
2047 2064
2048 void CompositedLayerMapping::invalidateDisplayItemClientOnScrollingContentsLayer (const DisplayItemClientWrapper& displayItemClient, PaintInvalidationReason pain tInvalidationReason, const LayoutRect& previousPaintInvalidationRect, const Layo utRect& newPaintInvalidationRect) 2065 void CompositedLayerMapping::invalidateDisplayItemClientOnScrollingContentsLayer (const DisplayItemClientWrapper& displayItemClient, PaintInvalidationReason pain tInvalidationReason, const Vector<LayoutRect>& paintInvalidationRects)
2049 { 2066 {
2050 ApplyToGraphicsLayers(this, [&displayItemClient, paintInvalidationReason, pr eviousPaintInvalidationRect, newPaintInvalidationRect](GraphicsLayer* layer) { 2067 InvalidateDisplayItemClientFunctor functor = { displayItemClient, paintInval idationReason, paintInvalidationRects, m_owningLayer.subpixelAccumulation() };
2051 layer->invalidateDisplayItemClient(displayItemClient, paintInvalidationR eason, enclosingIntRect(previousPaintInvalidationRect), enclosingIntRect(newPain tInvalidationRect)); 2068 ApplyToGraphicsLayers(this, functor, ApplyToScrollingContentsLayer);
2052 }, ApplyToScrollingContentsLayer);
2053 } 2069 }
2054 2070
2055 const GraphicsLayerPaintInfo* CompositedLayerMapping::containingSquashedLayer(co nst LayoutObject* layoutObject, const Vector<GraphicsLayerPaintInfo>& layers, un signed maxSquashedLayerIndex) 2071 const GraphicsLayerPaintInfo* CompositedLayerMapping::containingSquashedLayer(co nst LayoutObject* layoutObject, const Vector<GraphicsLayerPaintInfo>& layers, un signed maxSquashedLayerIndex)
2056 { 2072 {
2057 for (size_t i = 0; i < layers.size() && i < maxSquashedLayerIndex; ++i) { 2073 for (size_t i = 0; i < layers.size() && i < maxSquashedLayerIndex; ++i) {
2058 if (layoutObject->isDescendantOf(layers[i].paintLayer->layoutObject())) 2074 if (layoutObject->isDescendantOf(layers[i].paintLayer->layoutObject()))
2059 return &layers[i]; 2075 return &layers[i];
2060 } 2076 }
2061 return nullptr; 2077 return nullptr;
2062 } 2078 }
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
2428 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) { 2444 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) {
2429 name = "Scrolling Block Selection Layer"; 2445 name = "Scrolling Block Selection Layer";
2430 } else { 2446 } else {
2431 ASSERT_NOT_REACHED(); 2447 ASSERT_NOT_REACHED();
2432 } 2448 }
2433 2449
2434 return name; 2450 return name;
2435 } 2451 }
2436 2452
2437 } // namespace blink 2453 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698