| 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 2034 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2045 { | 2045 { |
| 2046 ApplyToGraphicsLayers(this, SetContentsNeedsDisplayFunctor(), ApplyToSquashi
ngLayer); | 2046 ApplyToGraphicsLayers(this, SetContentsNeedsDisplayFunctor(), ApplyToSquashi
ngLayer); |
| 2047 } | 2047 } |
| 2048 | 2048 |
| 2049 void CompositedLayerMapping::setContentsNeedDisplay() | 2049 void CompositedLayerMapping::setContentsNeedDisplay() |
| 2050 { | 2050 { |
| 2051 // FIXME: need to split out paint invalidations for the background. | 2051 // FIXME: need to split out paint invalidations for the background. |
| 2052 ApplyToGraphicsLayers(this, SetContentsNeedsDisplayFunctor(), ApplyToContent
Layers); | 2052 ApplyToGraphicsLayers(this, SetContentsNeedsDisplayFunctor(), ApplyToContent
Layers); |
| 2053 } | 2053 } |
| 2054 | 2054 |
| 2055 struct SetContentsNeedsDisplayInRectFunctor { | |
| 2056 void operator() (GraphicsLayer* layer) const | |
| 2057 { | |
| 2058 if (layer->drawsContent()) { | |
| 2059 IntRect layerDirtyRect = r; | |
| 2060 layerDirtyRect.move(-layer->offsetFromLayoutObject()); | |
| 2061 layer->setNeedsDisplayInRect(layerDirtyRect, invalidationReason, cli
ent); | |
| 2062 } | |
| 2063 } | |
| 2064 | |
| 2065 IntRect r; | |
| 2066 PaintInvalidationReason invalidationReason; | |
| 2067 const DisplayItemClient& client; | |
| 2068 }; | |
| 2069 | |
| 2070 // r is in the coordinate space of the layer's layout object | 2055 // r is in the coordinate space of the layer's layout object |
| 2071 void CompositedLayerMapping::setContentsNeedDisplayInRect(const LayoutRect& r, P
aintInvalidationReason invalidationReason, const DisplayItemClient& client) | 2056 void CompositedLayerMapping::setContentsNeedDisplayInRect(const LayoutRect& r, P
aintInvalidationReason invalidationReason, const DisplayItemClient& client) |
| 2072 { | 2057 { |
| 2073 // TODO(wangxianzhu): Enable the following assert after paint invalidation f
or spv2 is ready. | 2058 // TODO(wangxianzhu): Enable the following assert after paint invalidation f
or spv2 is ready. |
| 2074 // ASSERT(!RuntimeEnabledFeatures::slimmingPaintV2Enabled()); | 2059 // ASSERT(!RuntimeEnabledFeatures::slimmingPaintV2Enabled()); |
| 2075 | 2060 |
| 2076 SetContentsNeedsDisplayInRectFunctor functor = { | 2061 NeedsDisplayRecord record { |
| 2077 enclosingIntRect(LayoutRect(r.location() + m_owningLayer.subpixelAccumul
ation(), r.size())), | 2062 enclosingIntRect(LayoutRect(r.location() + m_owningLayer.subpixelAccumul
ation(), r.size())), |
| 2078 invalidationReason, | 2063 invalidationReason, |
| 2079 client | 2064 client |
| 2080 }; | 2065 }; |
| 2081 ApplyToGraphicsLayers(this, functor, ApplyToContentLayers); | 2066 |
| 2067 m_needsDisplayInRects.append(record); |
| 2068 } |
| 2069 |
| 2070 struct SetContentsNeedsDisplayInRectsFunctor { |
| 2071 void operator()(GraphicsLayer* layer) const |
| 2072 { |
| 2073 if (layer->drawsContent()) { |
| 2074 layer->setNeedsDisplayInRect(needsDisplayInRects); |
| 2075 } |
| 2076 } |
| 2077 |
| 2078 const Vector<NeedsDisplayRecord>& needsDisplayInRects; |
| 2079 }; |
| 2080 |
| 2081 void CompositedLayerMapping::finalizeInvalidations() |
| 2082 { |
| 2083 if (m_needsDisplayInRects.size()) { |
| 2084 SetContentsNeedsDisplayInRectsFunctor functor = { |
| 2085 m_needsDisplayInRects |
| 2086 }; |
| 2087 ApplyToGraphicsLayers(this, functor, ApplyToContentLayers); |
| 2088 m_needsDisplayInRects.clear(); |
| 2089 } |
| 2082 } | 2090 } |
| 2083 | 2091 |
| 2084 void CompositedLayerMapping::invalidateDisplayItemClient(const DisplayItemClient
& displayItemClient, PaintInvalidationReason paintInvalidationReason) | 2092 void CompositedLayerMapping::invalidateDisplayItemClient(const DisplayItemClient
& displayItemClient, PaintInvalidationReason paintInvalidationReason) |
| 2085 { | 2093 { |
| 2086 ApplyToGraphicsLayers(this, [&displayItemClient, paintInvalidationReason](Gr
aphicsLayer* layer) { | 2094 ApplyToGraphicsLayers(this, [&displayItemClient, paintInvalidationReason](Gr
aphicsLayer* layer) { |
| 2087 layer->invalidateDisplayItemClient(displayItemClient, paintInvalidationR
eason); | 2095 layer->invalidateDisplayItemClient(displayItemClient, paintInvalidationR
eason); |
| 2088 }, ApplyToContentLayers); | 2096 }, ApplyToContentLayers); |
| 2089 } | 2097 } |
| 2090 | 2098 |
| 2091 const GraphicsLayerPaintInfo* CompositedLayerMapping::containingSquashedLayer(co
nst LayoutObject* layoutObject, const Vector<GraphicsLayerPaintInfo>& layers, un
signed maxSquashedLayerIndex) | 2099 const GraphicsLayerPaintInfo* CompositedLayerMapping::containingSquashedLayer(co
nst LayoutObject* layoutObject, const Vector<GraphicsLayerPaintInfo>& layers, un
signed maxSquashedLayerIndex) |
| (...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2577 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { | 2585 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { |
| 2578 name = "Scrolling Contents Layer"; | 2586 name = "Scrolling Contents Layer"; |
| 2579 } else { | 2587 } else { |
| 2580 ASSERT_NOT_REACHED(); | 2588 ASSERT_NOT_REACHED(); |
| 2581 } | 2589 } |
| 2582 | 2590 |
| 2583 return name; | 2591 return name; |
| 2584 } | 2592 } |
| 2585 | 2593 |
| 2586 } // namespace blink | 2594 } // namespace blink |
| OLD | NEW |