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 2233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2244 layoutObject()->node()->document().compositorPendingAnimations().notifyCompo sitorAnimationStarted(monotonicTime, group); | 2244 layoutObject()->node()->document().compositorPendingAnimations().notifyCompo sitorAnimationStarted(monotonicTime, group); |
2245 } | 2245 } |
2246 | 2246 |
2247 IntRect CompositedDeprecatedPaintLayerMapping::pixelSnappedCompositedBounds() co nst | 2247 IntRect CompositedDeprecatedPaintLayerMapping::pixelSnappedCompositedBounds() co nst |
2248 { | 2248 { |
2249 LayoutRect bounds = m_compositedBounds; | 2249 LayoutRect bounds = m_compositedBounds; |
2250 bounds.move(m_owningLayer.subpixelAccumulation()); | 2250 bounds.move(m_owningLayer.subpixelAccumulation()); |
2251 return pixelSnappedIntRect(bounds); | 2251 return pixelSnappedIntRect(bounds); |
2252 } | 2252 } |
2253 | 2253 |
2254 void CompositedDeprecatedPaintLayerMapping::clearLayerGroupingIfNoPrecedingEntry (size_t indexToClear) | 2254 bool CompositedDeprecatedPaintLayerMapping::invalidateLayerIfNoPrecedingEntry(si ze_t indexToClear) |
2255 { | 2255 { |
2256 DeprecatedPaintLayer* layerToRemove = m_squashedLayers[indexToClear].paintLa yer; | 2256 DeprecatedPaintLayer* layerToRemove = m_squashedLayers[indexToClear].paintLa yer; |
2257 size_t previousIndex = 0; | 2257 size_t previousIndex = 0; |
2258 for (; previousIndex < indexToClear; ++previousIndex) { | 2258 for (; previousIndex < indexToClear; ++previousIndex) { |
2259 if (m_squashedLayers[previousIndex].paintLayer == layerToRemove) | 2259 if (m_squashedLayers[previousIndex].paintLayer == layerToRemove) |
2260 break; | 2260 break; |
2261 } | 2261 } |
2262 if (previousIndex == indexToClear) { | 2262 if (previousIndex == indexToClear && layerToRemove->groupedMapping() == this ) { |
2263 // Assert on incorrect mappings between layers and groups | 2263 compositor()->paintInvalidationOnCompositingChange(layerToRemove); |
2264 ASSERT(layerToRemove->groupedMapping() == this); | 2264 return true; |
chrishtr
2015/08/12 19:29:55
The new call site to this function may not satisfy
| |
2265 layerToRemove->setGroupedMapping(nullptr, DeprecatedPaintLayer::DoNotInv alidateLayerAndRemoveFromMapping); | |
2266 } | 2265 } |
2266 return false; | |
2267 } | 2267 } |
2268 | 2268 |
2269 bool CompositedDeprecatedPaintLayerMapping::updateSquashingLayerAssignment(Depre catedPaintLayer* squashedLayer, size_t nextSquashedLayerIndex) | 2269 bool CompositedDeprecatedPaintLayerMapping::updateSquashingLayerAssignment(Depre catedPaintLayer* squashedLayer, size_t nextSquashedLayerIndex) |
2270 { | 2270 { |
2271 GraphicsLayerPaintInfo paintInfo; | 2271 GraphicsLayerPaintInfo paintInfo; |
2272 paintInfo.paintLayer = squashedLayer; | 2272 paintInfo.paintLayer = squashedLayer; |
2273 // NOTE: composited bounds are updated elsewhere | 2273 // NOTE: composited bounds are updated elsewhere |
2274 // NOTE: offsetFromLayoutObject is updated elsewhere | 2274 // NOTE: offsetFromLayoutObject is updated elsewhere |
2275 | 2275 |
2276 // Change tracking on squashing layers: at the first sign of something chang ed, just invalidate the layer. | 2276 // Change tracking on squashing layers: at the first sign of something chang ed, just invalidate the layer. |
2277 // FIXME: Perhaps we can find a tighter more clever mechanism later. | 2277 // FIXME: Perhaps we can find a tighter more clever mechanism later. |
2278 if (nextSquashedLayerIndex < m_squashedLayers.size()) { | 2278 if (nextSquashedLayerIndex < m_squashedLayers.size()) { |
2279 if (paintInfo.paintLayer == m_squashedLayers[nextSquashedLayerIndex].pai ntLayer) | 2279 if (paintInfo.paintLayer == m_squashedLayers[nextSquashedLayerIndex].pai ntLayer) |
2280 return false; | 2280 return false; |
2281 | 2281 |
2282 // Must invalidate before adding the squashed layer to the mapping. | 2282 // Must invalidate before adding the squashed layer to the mapping. |
2283 compositor()->paintInvalidationOnCompositingChange(squashedLayer); | 2283 compositor()->paintInvalidationOnCompositingChange(squashedLayer); |
2284 | 2284 |
2285 // If the layer which was previously at |nextSquashedLayerIndex| is not earlier in the grouped mapping, invalidate its current | |
2286 // backing now, since it will move later or be removed from the squashin g layer. | |
2287 invalidateLayerIfNoPrecedingEntry(nextSquashedLayerIndex); | |
2288 | |
2285 m_squashedLayers.insert(nextSquashedLayerIndex, paintInfo); | 2289 m_squashedLayers.insert(nextSquashedLayerIndex, paintInfo); |
Stephen Chennney
2015/08/13 16:31:18
Because we insert here now ...
| |
2286 } else { | 2290 } else { |
2287 // Must invalidate before adding the squashed layer to the mapping. | 2291 // Must invalidate before adding the squashed layer to the mapping. |
2288 compositor()->paintInvalidationOnCompositingChange(squashedLayer); | 2292 compositor()->paintInvalidationOnCompositingChange(squashedLayer); |
2289 m_squashedLayers.append(paintInfo); | 2293 m_squashedLayers.append(paintInfo); |
2290 } | 2294 } |
2291 squashedLayer->setGroupedMapping(this, DeprecatedPaintLayer::InvalidateLayer AndRemoveFromMapping); | 2295 squashedLayer->setGroupedMapping(this, DeprecatedPaintLayer::InvalidateLayer AndRemoveFromMapping); |
2292 | 2296 |
2293 return true; | 2297 return true; |
2294 } | 2298 } |
2295 | 2299 |
(...skipping 23 matching lines...) Expand all Loading... | |
2319 return false; | 2323 return false; |
2320 } | 2324 } |
2321 #endif | 2325 #endif |
2322 | 2326 |
2323 void CompositedDeprecatedPaintLayerMapping::finishAccumulatingSquashingLayers(si ze_t nextSquashedLayerIndex) | 2327 void CompositedDeprecatedPaintLayerMapping::finishAccumulatingSquashingLayers(si ze_t nextSquashedLayerIndex) |
2324 { | 2328 { |
2325 if (nextSquashedLayerIndex < m_squashedLayers.size()) { | 2329 if (nextSquashedLayerIndex < m_squashedLayers.size()) { |
2326 // Any additional squashed Layers in the array no longer belong here, bu t they might have been | 2330 // Any additional squashed Layers in the array no longer belong here, bu t they might have been |
2327 // added already at an earlier index. Clear pointers on those that do no t appear in the valid set | 2331 // added already at an earlier index. Clear pointers on those that do no t appear in the valid set |
2328 // before removing all the extra entries. | 2332 // before removing all the extra entries. |
2329 for (size_t i = nextSquashedLayerIndex; i < m_squashedLayers.size(); ++i ) | 2333 for (size_t i = nextSquashedLayerIndex; i < m_squashedLayers.size(); ++i ) { |
2330 clearLayerGroupingIfNoPrecedingEntry(i); | 2334 if (invalidateLayerIfNoPrecedingEntry(i)) |
2335 m_squashedLayers[i].paintLayer->setGroupedMapping(nullptr, Depre catedPaintLayer::DoNotInvalidateLayerAndRemoveFromMapping); | |
Stephen Chennney
2015/08/13 16:31:18
... it's safe to only null here now. I think that'
chrishtr
2015/08/13 17:05:59
I think it's correct because the code here keeps t
| |
2336 } | |
2337 | |
2331 m_squashedLayers.remove(nextSquashedLayerIndex, m_squashedLayers.size() - nextSquashedLayerIndex); | 2338 m_squashedLayers.remove(nextSquashedLayerIndex, m_squashedLayers.size() - nextSquashedLayerIndex); |
2332 } | 2339 } |
2333 } | 2340 } |
2334 | 2341 |
2335 String CompositedDeprecatedPaintLayerMapping::debugName(const GraphicsLayer* gra phicsLayer) | 2342 String CompositedDeprecatedPaintLayerMapping::debugName(const GraphicsLayer* gra phicsLayer) |
2336 { | 2343 { |
2337 String name; | 2344 String name; |
2338 if (graphicsLayer == m_graphicsLayer.get()) { | 2345 if (graphicsLayer == m_graphicsLayer.get()) { |
2339 name = m_owningLayer.debugName(); | 2346 name = m_owningLayer.debugName(); |
2340 } else if (graphicsLayer == m_squashingContainmentLayer.get()) { | 2347 } else if (graphicsLayer == m_squashingContainmentLayer.get()) { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2372 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) { | 2379 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) { |
2373 name = "Scrolling Block Selection Layer"; | 2380 name = "Scrolling Block Selection Layer"; |
2374 } else { | 2381 } else { |
2375 ASSERT_NOT_REACHED(); | 2382 ASSERT_NOT_REACHED(); |
2376 } | 2383 } |
2377 | 2384 |
2378 return name; | 2385 return name; |
2379 } | 2386 } |
2380 | 2387 |
2381 } // namespace blink | 2388 } // namespace blink |
OLD | NEW |