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

Unified Diff: Source/core/layout/compositing/CompositedDeprecatedPaintLayerMapping.cpp

Issue 1227763002: Avoid clearing pointers on layers still in the mapping's vector of layers. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/layout/compositing/CompositedDeprecatedPaintLayerMapping.cpp
diff --git a/Source/core/layout/compositing/CompositedDeprecatedPaintLayerMapping.cpp b/Source/core/layout/compositing/CompositedDeprecatedPaintLayerMapping.cpp
index 030f6e94a50b52a2f22f223f72005fe41dfd22bc..c735e00bebc94918b36a03bf4ed885fe99598eff 100644
--- a/Source/core/layout/compositing/CompositedDeprecatedPaintLayerMapping.cpp
+++ b/Source/core/layout/compositing/CompositedDeprecatedPaintLayerMapping.cpp
@@ -2302,11 +2302,20 @@ void CompositedDeprecatedPaintLayerMapping::removeLayerFromSquashingGraphicsLaye
void CompositedDeprecatedPaintLayerMapping::finishAccumulatingSquashingLayers(size_t nextSquashedLayerIndex)
{
- // Any additional squashed Layers in the array no longer exist, and removing invalidates the
- // squashingLayer contents.
if (nextSquashedLayerIndex < m_squashedLayers.size()) {
- for (size_t i = m_squashedLayers.size(); i > nextSquashedLayerIndex; --i)
- m_squashedLayers[i-1].paintLayer->setGroupedMapping(nullptr, DeprecatedPaintLayer::DoNotInvalidateLayerAndRemoveFromMapping);
+ // Any additional squashed Layers in the array no longer belong here, but they might have been
+ // added already at an earlier index. Clear pointers on those that do not appear in the valid set
+ // before removing all the extra entries.
+ for (size_t i = nextSquashedLayerIndex; i < m_squashedLayers.size(); ++i) {
+ DeprecatedPaintLayer* layerToRemove = m_squashedLayers[i].paintLayer;
+ size_t previousIndex = 0;
+ for (; previousIndex < nextSquashedLayerIndex; ++previousIndex) {
+ if (m_squashedLayers[previousIndex].paintLayer == layerToRemove)
+ break;
+ }
+ if (previousIndex == nextSquashedLayerIndex)
+ layerToRemove->setGroupedMapping(nullptr, DeprecatedPaintLayer::DoNotInvalidateLayerAndRemoveFromMapping);
+ }
m_squashedLayers.remove(nextSquashedLayerIndex, m_squashedLayers.size() - nextSquashedLayerIndex);
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698