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

Side by Side Diff: Source/core/layout/compositing/CompositedDeprecatedPaintLayerMapping.cpp

Issue 1209033009: Clear the groupedMapping parameter in layers when removed from the group (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Switch to enum 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 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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 178
179 CompositedDeprecatedPaintLayerMapping::~CompositedDeprecatedPaintLayerMapping() 179 CompositedDeprecatedPaintLayerMapping::~CompositedDeprecatedPaintLayerMapping()
180 { 180 {
181 // Hits in compositing/squashing/squash-onto-nephew.html. 181 // Hits in compositing/squashing/squash-onto-nephew.html.
182 DisableCompositingQueryAsserts disabler; 182 DisableCompositingQueryAsserts disabler;
183 183
184 // Do not leave the destroyed pointer dangling on any Layers that painted to this mapping's squashing layer. 184 // Do not leave the destroyed pointer dangling on any Layers that painted to this mapping's squashing layer.
185 for (size_t i = 0; i < m_squashedLayers.size(); ++i) { 185 for (size_t i = 0; i < m_squashedLayers.size(); ++i) {
186 DeprecatedPaintLayer* oldSquashedLayer = m_squashedLayers[i].paintLayer; 186 DeprecatedPaintLayer* oldSquashedLayer = m_squashedLayers[i].paintLayer;
187 if (oldSquashedLayer->groupedMapping() == this) { 187 if (oldSquashedLayer->groupedMapping() == this) {
188 oldSquashedLayer->setGroupedMapping(0, true); 188 oldSquashedLayer->setGroupedMapping(0, DeprecatedPaintLayer::DoNotIn validateLayerAndRemoveFromMapping);
189 oldSquashedLayer->setLostGroupedMapping(true); 189 oldSquashedLayer->setLostGroupedMapping(true);
190 } 190 }
191 } 191 }
192 192
193 updateClippingLayers(false, false); 193 updateClippingLayers(false, false);
194 updateOverflowControlsLayers(false, false, false, false); 194 updateOverflowControlsLayers(false, false, false, false);
195 updateChildTransformLayer(false); 195 updateChildTransformLayer(false);
196 updateForegroundLayer(false); 196 updateForegroundLayer(false);
197 updateBackgroundLayer(false); 197 updateBackgroundLayer(false);
198 updateMaskLayer(false); 198 updateMaskLayer(false);
(...skipping 2061 matching lines...) Expand 10 before | Expand all | Expand 10 after
2260 2260
2261 bool CompositedDeprecatedPaintLayerMapping::updateSquashingLayerAssignment(Depre catedPaintLayer* squashedLayer, const DeprecatedPaintLayer& owningLayer, size_t nextSquashedLayerIndex) 2261 bool CompositedDeprecatedPaintLayerMapping::updateSquashingLayerAssignment(Depre catedPaintLayer* squashedLayer, const DeprecatedPaintLayer& owningLayer, size_t nextSquashedLayerIndex)
2262 { 2262 {
2263 GraphicsLayerPaintInfo paintInfo; 2263 GraphicsLayerPaintInfo paintInfo;
2264 paintInfo.paintLayer = squashedLayer; 2264 paintInfo.paintLayer = squashedLayer;
2265 // NOTE: composited bounds are updated elsewhere 2265 // NOTE: composited bounds are updated elsewhere
2266 // NOTE: offsetFromLayoutObject is updated elsewhere 2266 // NOTE: offsetFromLayoutObject is updated elsewhere
2267 2267
2268 // Change tracking on squashing layers: at the first sign of something chang ed, just invalidate the layer. 2268 // Change tracking on squashing layers: at the first sign of something chang ed, just invalidate the layer.
2269 // FIXME: Perhaps we can find a tighter more clever mechanism later. 2269 // FIXME: Perhaps we can find a tighter more clever mechanism later.
2270 bool updatedAssignment = false;
2271 if (nextSquashedLayerIndex < m_squashedLayers.size()) { 2270 if (nextSquashedLayerIndex < m_squashedLayers.size()) {
2272 if (paintInfo.paintLayer != m_squashedLayers[nextSquashedLayerIndex].pai ntLayer) { 2271 if (paintInfo.paintLayer == m_squashedLayers[nextSquashedLayerIndex].pai ntLayer)
2273 compositor()->paintInvalidationOnCompositingChange(squashedLayer); 2272 return false;
2274 updatedAssignment = true; 2273
2275 m_squashedLayers[nextSquashedLayerIndex] = paintInfo; 2274 // Must invalidate before adding the squashed layer to the mapping.
2276 } 2275 compositor()->paintInvalidationOnCompositingChange(squashedLayer);
2276
2277 // Clear pointer on the previous entry.
2278 m_squashedLayers[nextSquashedLayerIndex].paintLayer->setGroupedMapping(n ullptr, DeprecatedPaintLayer::DoNotInvalidateLayerAndRemoveFromMapping);
2279 m_squashedLayers[nextSquashedLayerIndex] = paintInfo;
2277 } else { 2280 } else {
2281 // Must invalidate before adding the squashed layer to the mapping.
2278 compositor()->paintInvalidationOnCompositingChange(squashedLayer); 2282 compositor()->paintInvalidationOnCompositingChange(squashedLayer);
2279 m_squashedLayers.append(paintInfo); 2283 m_squashedLayers.append(paintInfo);
2280 updatedAssignment = true;
2281 } 2284 }
2282 squashedLayer->setGroupedMapping(this); 2285 squashedLayer->setGroupedMapping(this, DeprecatedPaintLayer::InvalidateLayer AndRemoveFromMapping);
2283 return updatedAssignment; 2286
2287 return true;
2284 } 2288 }
2285 2289
2286 void CompositedDeprecatedPaintLayerMapping::removeLayerFromSquashingGraphicsLaye r(const DeprecatedPaintLayer* layer) 2290 void CompositedDeprecatedPaintLayerMapping::removeLayerFromSquashingGraphicsLaye r(const DeprecatedPaintLayer* layer)
2287 { 2291 {
2288 size_t layerIndex = kNotFound; 2292 size_t layerIndex = 0;
2293 for (; layerIndex < m_squashedLayers.size(); ++layerIndex)
2294 if (m_squashedLayers[layerIndex].paintLayer == layer)
2295 break;
2289 2296
2290 for (size_t i = 0; i < m_squashedLayers.size(); ++i) { 2297 if (layerIndex == m_squashedLayers.size())
2291 if (m_squashedLayers[i].paintLayer == layer) {
2292 layerIndex = i;
2293 break;
2294 }
2295 }
2296
2297 if (layerIndex == kNotFound)
2298 return; 2298 return;
2299 2299
2300 m_squashedLayers.remove(layerIndex); 2300 m_squashedLayers.remove(layerIndex);
2301 } 2301 }
2302 2302
2303 void CompositedDeprecatedPaintLayerMapping::finishAccumulatingSquashingLayers(si ze_t nextSquashedLayerIndex) 2303 void CompositedDeprecatedPaintLayerMapping::finishAccumulatingSquashingLayers(si ze_t nextSquashedLayerIndex)
2304 { 2304 {
2305 // Any additional squashed Layers in the array no longer exist, and removing invalidates the squashingLayer contents. 2305 // Any additional squashed Layers in the array no longer exist, and removing invalidates the
2306 if (nextSquashedLayerIndex < m_squashedLayers.size()) 2306 // squashingLayer contents.
2307 if (nextSquashedLayerIndex < m_squashedLayers.size()) {
2308 for (size_t i = m_squashedLayers.size(); i > nextSquashedLayerIndex; --i )
2309 m_squashedLayers[i-1].paintLayer->setGroupedMapping(nullptr, Depreca tedPaintLayer::DoNotInvalidateLayerAndRemoveFromMapping);
2307 m_squashedLayers.remove(nextSquashedLayerIndex, m_squashedLayers.size() - nextSquashedLayerIndex); 2310 m_squashedLayers.remove(nextSquashedLayerIndex, m_squashedLayers.size() - nextSquashedLayerIndex);
2311 }
2308 } 2312 }
2309 2313
2310 String CompositedDeprecatedPaintLayerMapping::debugName(const GraphicsLayer* gra phicsLayer) 2314 String CompositedDeprecatedPaintLayerMapping::debugName(const GraphicsLayer* gra phicsLayer)
2311 { 2315 {
2312 String name; 2316 String name;
2313 if (graphicsLayer == m_graphicsLayer.get()) { 2317 if (graphicsLayer == m_graphicsLayer.get()) {
2314 name = m_owningLayer.debugName(); 2318 name = m_owningLayer.debugName();
2315 } else if (graphicsLayer == m_squashingContainmentLayer.get()) { 2319 } else if (graphicsLayer == m_squashingContainmentLayer.get()) {
2316 name = "Squashing Containment Layer"; 2320 name = "Squashing Containment Layer";
2317 } else if (graphicsLayer == m_squashingLayer.get()) { 2321 } else if (graphicsLayer == m_squashingLayer.get()) {
(...skipping 29 matching lines...) Expand all
2347 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) { 2351 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) {
2348 name = "Scrolling Block Selection Layer"; 2352 name = "Scrolling Block Selection Layer";
2349 } else { 2353 } else {
2350 ASSERT_NOT_REACHED(); 2354 ASSERT_NOT_REACHED();
2351 } 2355 }
2352 2356
2353 return name; 2357 return name;
2354 } 2358 }
2355 2359
2356 } // namespace blink 2360 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698