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

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: 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 2248 matching lines...) Expand 10 before | Expand all | Expand 10 after
2259 return pixelSnappedIntRect(bounds); 2259 return pixelSnappedIntRect(bounds);
2260 } 2260 }
2261 2261
2262 bool CompositedDeprecatedPaintLayerMapping::updateSquashingLayerAssignment(Depre catedPaintLayer* squashedLayer, const DeprecatedPaintLayer& owningLayer, size_t nextSquashedLayerIndex) 2262 bool CompositedDeprecatedPaintLayerMapping::updateSquashingLayerAssignment(Depre catedPaintLayer* squashedLayer, const DeprecatedPaintLayer& owningLayer, size_t nextSquashedLayerIndex)
2263 { 2263 {
2264 GraphicsLayerPaintInfo paintInfo; 2264 GraphicsLayerPaintInfo paintInfo;
2265 paintInfo.paintLayer = squashedLayer; 2265 paintInfo.paintLayer = squashedLayer;
2266 // NOTE: composited bounds are updated elsewhere 2266 // NOTE: composited bounds are updated elsewhere
2267 // NOTE: offsetFromLayoutObject is updated elsewhere 2267 // NOTE: offsetFromLayoutObject is updated elsewhere
2268 2268
2269 DeprecatedPaintLayer* formerLayer = nullptr;
2270 if (nextSquashedLayerIndex < m_squashedLayers.size()) {
2271 if (paintInfo.paintLayer == m_squashedLayers[nextSquashedLayerIndex].pai ntLayer)
2272 return false;
2273
2274 // Track previous entry, but don't remove it yet. We don't want to shuff le the vector.
2275 formerLayer = m_squashedLayers[nextSquashedLayerIndex].paintLayer;
2276 m_squashedLayers[nextSquashedLayerIndex] = paintInfo;
2277 } else {
2278 m_squashedLayers.append(paintInfo);
2279 }
2280 squashedLayer->setGroupedMapping(this);
2281
2269 // Change tracking on squashing layers: at the first sign of something chang ed, just invalidate the layer. 2282 // Change tracking on squashing layers: at the first sign of something chang ed, just invalidate the layer.
2270 // FIXME: Perhaps we can find a tighter more clever mechanism later. 2283 // FIXME: Perhaps we can find a tighter more clever mechanism later.
2271 bool updatedAssignment = false; 2284 compositor()->paintInvalidationOnCompositingChange(squashedLayer);
2272 if (nextSquashedLayerIndex < m_squashedLayers.size()) { 2285
2273 if (paintInfo.paintLayer != m_squashedLayers[nextSquashedLayerIndex].pai ntLayer) { 2286 // Reset the mapping on the previous entry
2274 compositor()->paintInvalidationOnCompositingChange(squashedLayer); 2287 if (formerLayer)
2275 updatedAssignment = true; 2288 formerLayer->setGroupedMapping(nullptr);
Stephen Chennney 2015/06/30 19:44:02 This unfortunately has the side effect of doing so
2276 m_squashedLayers[nextSquashedLayerIndex] = paintInfo; 2289
2277 } 2290 return true;
2278 } else {
2279 compositor()->paintInvalidationOnCompositingChange(squashedLayer);
2280 m_squashedLayers.append(paintInfo);
2281 updatedAssignment = true;
2282 }
2283 squashedLayer->setGroupedMapping(this);
2284 return updatedAssignment;
2285 } 2291 }
2286 2292
2287 void CompositedDeprecatedPaintLayerMapping::removeLayerFromSquashingGraphicsLaye r(const DeprecatedPaintLayer* layer) 2293 void CompositedDeprecatedPaintLayerMapping::removeLayerFromSquashingGraphicsLaye r(const DeprecatedPaintLayer* layer)
2288 { 2294 {
2289 size_t layerIndex = kNotFound; 2295 size_t layerIndex = 0;
2290 2296 for (; layerIndex < m_squashedLayers.size(); ++layerIndex) {
2291 for (size_t i = 0; i < m_squashedLayers.size(); ++i) { 2297 if (m_squashedLayers[layerIndex].paintLayer == layer) {
2292 if (m_squashedLayers[i].paintLayer == layer) {
2293 layerIndex = i;
2294 break; 2298 break;
2295 } 2299 }
2296 } 2300 }
2297 2301
2298 if (layerIndex == kNotFound) 2302 if (layerIndex == m_squashedLayers.size())
2299 return; 2303 return;
2300 2304
2301 m_squashedLayers.remove(layerIndex); 2305 m_squashedLayers.remove(layerIndex);
2302 } 2306 }
2303 2307
2304 void CompositedDeprecatedPaintLayerMapping::finishAccumulatingSquashingLayers(si ze_t nextSquashedLayerIndex) 2308 void CompositedDeprecatedPaintLayerMapping::finishAccumulatingSquashingLayers(si ze_t nextSquashedLayerIndex)
2305 { 2309 {
2306 // Any additional squashed Layers in the array no longer exist, and removing invalidates the squashingLayer contents. 2310 // Any additional squashed Layers in the array no longer exist, and removing invalidates the
2307 if (nextSquashedLayerIndex < m_squashedLayers.size()) 2311 // squashingLayer contents.
Stephen Chennney 2015/06/30 19:44:02 I'm having trouble interpreting this comment. Is i
2312 for (size_t i = nextSquashedLayerIndex ; i < m_squashedLayers.size(); ++i) {
2313 // Setting to nullptr removes from the vector, via removeLayerFromSquash ingGraphicsLayer,
2314 // except when the layer is being destroyed.
2315 m_squashedLayers[i].paintLayer->setGroupedMapping(nullptr);
Stephen Chennney 2015/06/30 19:44:02 See comment about, might be a real bad idea.
2316 }
2317
2318 if (nextSquashedLayerIndex < m_squashedLayers.size()) {
2308 m_squashedLayers.remove(nextSquashedLayerIndex, m_squashedLayers.size() - nextSquashedLayerIndex); 2319 m_squashedLayers.remove(nextSquashedLayerIndex, m_squashedLayers.size() - nextSquashedLayerIndex);
2309 } 2320 }
2310 2321
2311 String CompositedDeprecatedPaintLayerMapping::debugName(const GraphicsLayer* gra phicsLayer) 2322 String CompositedDeprecatedPaintLayerMapping::debugName(const GraphicsLayer* gra phicsLayer)
2312 { 2323 {
2313 String name; 2324 String name;
2314 if (graphicsLayer == m_graphicsLayer.get()) { 2325 if (graphicsLayer == m_graphicsLayer.get()) {
2315 name = m_owningLayer.debugName(); 2326 name = m_owningLayer.debugName();
2316 } else if (graphicsLayer == m_squashingContainmentLayer.get()) { 2327 } else if (graphicsLayer == m_squashingContainmentLayer.get()) {
2317 name = "Squashing Containment Layer"; 2328 name = "Squashing Containment Layer";
(...skipping 30 matching lines...) Expand all
2348 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) { 2359 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) {
2349 name = "Scrolling Block Selection Layer"; 2360 name = "Scrolling Block Selection Layer";
2350 } else { 2361 } else {
2351 ASSERT_NOT_REACHED(); 2362 ASSERT_NOT_REACHED();
2352 } 2363 }
2353 2364
2354 return name; 2365 return name;
2355 } 2366 }
2356 2367
2357 } // namespace blink 2368 } // namespace blink
OLDNEW
« 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