OLD | NEW |
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 2012 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2023 } | 2023 } |
2024 } | 2024 } |
2025 | 2025 |
2026 IntRect r; | 2026 IntRect r; |
2027 PaintInvalidationReason invalidationReason; | 2027 PaintInvalidationReason invalidationReason; |
2028 }; | 2028 }; |
2029 | 2029 |
2030 // r is in the coordinate space of the layer's layout object | 2030 // r is in the coordinate space of the layer's layout object |
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 // TODO(wangxianzhu): Enable the following assert after paint invalidation f
or spv2 is ready. |
| 2034 // ASSERT(!RuntimeEnabledFeatures::slimmingPaintV2Enabled()); |
| 2035 |
2034 SetContentsNeedsDisplayInRectFunctor functor = { | 2036 SetContentsNeedsDisplayInRectFunctor functor = { |
2035 enclosingIntRect(LayoutRect(r.location() + m_owningLayer.subpixelAccumul
ation(), r.size())), | 2037 enclosingIntRect(LayoutRect(r.location() + m_owningLayer.subpixelAccumul
ation(), r.size())), |
2036 invalidationReason | 2038 invalidationReason |
2037 }; | 2039 }; |
2038 ApplyToGraphicsLayers(this, functor, ApplyToContentLayers); | 2040 ApplyToGraphicsLayers(this, functor, ApplyToContentLayers); |
2039 } | 2041 } |
2040 | 2042 |
2041 void CompositedLayerMapping::invalidateDisplayItemClient(const DisplayItemClient
Wrapper& displayItemClient, PaintInvalidationReason paintInvalidationReason, con
st LayoutRect& previousPaintInvalidationRect, const LayoutRect& newPaintInvalida
tionRect) | 2043 struct InvalidateDisplayItemClientFunctor { |
| 2044 void operator() (GraphicsLayer* layer) const |
| 2045 { |
| 2046 IntRect visualRectOnLayer; |
| 2047 if (visualRect) { |
| 2048 visualRectOnLayer = enclosingIntRect(LayoutRect(visualRect->location
() + subpixelAccumulation, visualRect->size())); |
| 2049 visualRectOnLayer.move(-layer->offsetFromLayoutObject()); |
| 2050 } |
| 2051 layer->invalidateDisplayItemClient(displayItemClient, invalidationReason
, visualRect ? &visualRectOnLayer : nullptr); |
| 2052 } |
| 2053 |
| 2054 const DisplayItemClientWrapper& displayItemClient; |
| 2055 PaintInvalidationReason invalidationReason; |
| 2056 const LayoutRect* visualRect; |
| 2057 LayoutSize subpixelAccumulation; |
| 2058 }; |
| 2059 |
| 2060 void CompositedLayerMapping::invalidateDisplayItemClient(const DisplayItemClient
Wrapper& displayItemClient, PaintInvalidationReason paintInvalidationReason, con
st LayoutRect* visualRect) |
2042 { | 2061 { |
2043 ApplyToGraphicsLayers(this, [&displayItemClient, paintInvalidationReason, pr
eviousPaintInvalidationRect, newPaintInvalidationRect](GraphicsLayer* layer) { | 2062 InvalidateDisplayItemClientFunctor functor = { displayItemClient, paintInval
idationReason, visualRect, m_owningLayer.subpixelAccumulation() }; |
2044 layer->invalidateDisplayItemClient(displayItemClient, paintInvalidationR
eason, enclosingIntRect(previousPaintInvalidationRect), enclosingIntRect(newPain
tInvalidationRect)); | 2063 ApplyToGraphicsLayers(this, functor, ApplyToContentLayers); |
2045 }, ApplyToContentLayers); | |
2046 } | 2064 } |
2047 | 2065 |
2048 void CompositedLayerMapping::invalidateDisplayItemClientOnScrollingContentsLayer
(const DisplayItemClientWrapper& displayItemClient, PaintInvalidationReason pain
tInvalidationReason, const LayoutRect& previousPaintInvalidationRect, const Layo
utRect& newPaintInvalidationRect) | 2066 void CompositedLayerMapping::invalidateDisplayItemClientOnScrollingContentsLayer
(const DisplayItemClientWrapper& displayItemClient, PaintInvalidationReason pain
tInvalidationReason, const LayoutRect* visualRect) |
2049 { | 2067 { |
2050 ApplyToGraphicsLayers(this, [&displayItemClient, paintInvalidationReason, pr
eviousPaintInvalidationRect, newPaintInvalidationRect](GraphicsLayer* layer) { | 2068 InvalidateDisplayItemClientFunctor functor = { displayItemClient, paintInval
idationReason, visualRect, m_owningLayer.subpixelAccumulation() }; |
2051 layer->invalidateDisplayItemClient(displayItemClient, paintInvalidationR
eason, enclosingIntRect(previousPaintInvalidationRect), enclosingIntRect(newPain
tInvalidationRect)); | 2069 ApplyToGraphicsLayers(this, functor, ApplyToScrollingContentsLayer); |
2052 }, ApplyToScrollingContentsLayer); | |
2053 } | 2070 } |
2054 | 2071 |
2055 const GraphicsLayerPaintInfo* CompositedLayerMapping::containingSquashedLayer(co
nst LayoutObject* layoutObject, const Vector<GraphicsLayerPaintInfo>& layers, un
signed maxSquashedLayerIndex) | 2072 const GraphicsLayerPaintInfo* CompositedLayerMapping::containingSquashedLayer(co
nst LayoutObject* layoutObject, const Vector<GraphicsLayerPaintInfo>& layers, un
signed maxSquashedLayerIndex) |
2056 { | 2073 { |
2057 for (size_t i = 0; i < layers.size() && i < maxSquashedLayerIndex; ++i) { | 2074 for (size_t i = 0; i < layers.size() && i < maxSquashedLayerIndex; ++i) { |
2058 if (layoutObject->isDescendantOf(layers[i].paintLayer->layoutObject())) | 2075 if (layoutObject->isDescendantOf(layers[i].paintLayer->layoutObject())) |
2059 return &layers[i]; | 2076 return &layers[i]; |
2060 } | 2077 } |
2061 return nullptr; | 2078 return nullptr; |
2062 } | 2079 } |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2428 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) { | 2445 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) { |
2429 name = "Scrolling Block Selection Layer"; | 2446 name = "Scrolling Block Selection Layer"; |
2430 } else { | 2447 } else { |
2431 ASSERT_NOT_REACHED(); | 2448 ASSERT_NOT_REACHED(); |
2432 } | 2449 } |
2433 | 2450 |
2434 return name; | 2451 return name; |
2435 } | 2452 } |
2436 | 2453 |
2437 } // namespace blink | 2454 } // namespace blink |
OLD | NEW |