Changeset 181218 in webkit
- Timestamp:
- Mar 7, 2015, 6:49:21 PM (10 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/Source/WebCore/ChangeLog ¶
r181216 r181218 1 2015-03-07 Simon Fraser <simon.fraser@apple.com> 2 3 Tidy up RenderLayerCompositor's CompositingState 4 https://bugs.webkit.org/show_bug.cgi?id=142445 5 6 Reviewed by Dan Bernstein. 7 8 Make CompositingState a private struct in RenderLayerCompositor. 9 Since it's a struct, remove the m_ prefix from its data members. 10 11 No behavior change. 12 13 * rendering/RenderLayerCompositor.cpp: 14 (WebCore::RenderLayerCompositor::CompositingState::CompositingState): 15 (WebCore::RenderLayerCompositor::computeCompositingRequirements): 16 (WebCore::CompositingState::CompositingState): Deleted. 17 * rendering/RenderLayerCompositor.h: 18 1 19 2015-03-07 Darin Adler <darin@apple.com> 2 20 -
TabularUnified trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp ¶
r181166 r181218 218 218 }; 219 219 220 struct CompositingState {220 struct RenderLayerCompositor::CompositingState { 221 221 CompositingState(RenderLayer* compAncestor, bool testOverlap = true) 222 : m_compositingAncestor(compAncestor)223 , m_subtreeIsCompositing(false)224 , m_testingOverlap(testOverlap)222 : compositingAncestor(compAncestor) 223 , subtreeIsCompositing(false) 224 , testingOverlap(testOverlap) 225 225 #if ENABLE(CSS_COMPOSITING) 226 , m_hasNotIsolatedCompositedBlendingDescendants(false)226 , hasNotIsolatedCompositedBlendingDescendants(false) 227 227 #endif 228 228 #if ENABLE(TREE_DEBUGGING) 229 , m_depth(0)229 , depth(0) 230 230 #endif 231 231 { … … 233 233 234 234 CompositingState(const CompositingState& other) 235 : m_compositingAncestor(other.m_compositingAncestor)236 , m_subtreeIsCompositing(other.m_subtreeIsCompositing)237 , m_testingOverlap(other.m_testingOverlap)235 : compositingAncestor(other.compositingAncestor) 236 , subtreeIsCompositing(other.subtreeIsCompositing) 237 , testingOverlap(other.testingOverlap) 238 238 #if ENABLE(CSS_COMPOSITING) 239 , m_hasNotIsolatedCompositedBlendingDescendants(other.m_hasNotIsolatedCompositedBlendingDescendants)239 , hasNotIsolatedCompositedBlendingDescendants(other.hasNotIsolatedCompositedBlendingDescendants) 240 240 #endif 241 241 #if ENABLE(TREE_DEBUGGING) 242 , m_depth(other.m_depth + 1)242 , depth(other.depth + 1) 243 243 #endif 244 244 { 245 245 } 246 246 247 RenderLayer* m_compositingAncestor;248 bool m_subtreeIsCompositing;249 bool m_testingOverlap;247 RenderLayer* compositingAncestor; 248 bool subtreeIsCompositing; 249 bool testingOverlap; 250 250 #if ENABLE(CSS_COMPOSITING) 251 bool m_hasNotIsolatedCompositedBlendingDescendants;251 bool hasNotIsolatedCompositedBlendingDescendants; 252 252 #endif 253 253 #if ENABLE(TREE_DEBUGGING) 254 int m_depth;254 int depth; 255 255 #endif 256 256 }; 257 258 257 259 258 #if !LOG_DISABLED … … 1239 1238 bool willBeComposited = needsToBeComposited(layer); 1240 1239 1241 RenderLayer::IndirectCompositingReason compositingReason = compositingState. m_subtreeIsCompositing ? RenderLayer::IndirectCompositingReason::Stacking : RenderLayer::IndirectCompositingReason::None;1240 RenderLayer::IndirectCompositingReason compositingReason = compositingState.subtreeIsCompositing ? RenderLayer::IndirectCompositingReason::Stacking : RenderLayer::IndirectCompositingReason::None; 1242 1241 bool haveComputedBounds = false; 1243 1242 LayoutRect absBounds; 1244 1243 1245 1244 // If we know for sure the layer is going to be composited, don't bother looking it up in the overlap map 1246 if (!willBeComposited && !overlapMap.isEmpty() && compositingState. m_testingOverlap) {1245 if (!willBeComposited && !overlapMap.isEmpty() && compositingState.testingOverlap) { 1247 1246 // If we're testing for overlap, we only need to composite if we overlap something that is already composited. 1248 1247 absBounds = enclosingLayoutRect(overlapMap.geometryMap().absoluteRect(layer.overlapBounds())); … … 1260 1259 // into. These children (the controls) always need to be promoted into their 1261 1260 // own layers to draw on top of the accelerated video. 1262 if (compositingState. m_compositingAncestor && compositingState.m_compositingAncestor->renderer().isVideo())1261 if (compositingState.compositingAncestor && compositingState.compositingAncestor->renderer().isVideo()) 1263 1262 compositingReason = RenderLayer::IndirectCompositingReason::Overlap; 1264 1263 #endif … … 1273 1272 // The children of this layer don't need to composite, unless there is 1274 1273 // a compositing layer among them, so start by inheriting the compositing 1275 // ancestor with m_subtreeIsCompositing set to false.1274 // ancestor with subtreeIsCompositing set to false. 1276 1275 CompositingState childState(compositingState); 1277 childState. m_subtreeIsCompositing = false;1276 childState.subtreeIsCompositing = false; 1278 1277 #if ENABLE(CSS_COMPOSITING) 1279 childState. m_hasNotIsolatedCompositedBlendingDescendants = false;1278 childState.hasNotIsolatedCompositedBlendingDescendants = false; 1280 1279 #endif 1281 1280 1282 1281 if (willBeComposited) { 1283 1282 // Tell the parent it has compositing descendants. 1284 compositingState. m_subtreeIsCompositing = true;1283 compositingState.subtreeIsCompositing = true; 1285 1284 // This layer now acts as the ancestor for kids. 1286 childState. m_compositingAncestor = &layer;1285 childState.compositingAncestor = &layer; 1287 1286 1288 1287 overlapMap.pushCompositingContainer(); 1289 1288 // This layer is going to be composited, so children can safely ignore the fact that there's an 1290 1289 // animation running behind this layer, meaning they can rely on the overlap map testing again. 1291 childState. m_testingOverlap = true;1290 childState.testingOverlap = true; 1292 1291 } 1293 1292 … … 1305 1304 // If we have to make a layer for this child, make one now so we can have a contents layer 1306 1305 // (since we need to ensure that the -ve z-order child renders underneath our contents). 1307 if (!willBeComposited && childState. m_subtreeIsCompositing) {1306 if (!willBeComposited && childState.subtreeIsCompositing) { 1308 1307 // make layer compositing 1309 1308 layer.setIndirectCompositingReason(RenderLayer::IndirectCompositingReason::BackgroundLayer); 1310 childState. m_compositingAncestor = &layer;1309 childState.compositingAncestor = &layer; 1311 1310 overlapMap.pushCompositingContainer(); 1312 1311 // This layer is going to be composited, so children can safely ignore the fact that there's an 1313 1312 // animation running behind this layer, meaning they can rely on the overlap map testing again 1314 childState. m_testingOverlap = true;1313 childState.testingOverlap = true; 1315 1314 willBeComposited = true; 1316 1315 } … … 1354 1353 // the overlap map. Layers that do not composite will draw into their 1355 1354 // compositing ancestor's backing, and so are still considered for overlap. 1356 if (childState. m_compositingAncestor && !childState.m_compositingAncestor->isRootLayer())1355 if (childState.compositingAncestor && !childState.compositingAncestor->isRootLayer()) 1357 1356 addToOverlapMap(overlapMap, layer, absBounds, haveComputedBounds); 1358 1357 1359 1358 #if ENABLE(CSS_COMPOSITING) 1360 layer.setHasNotIsolatedCompositedBlendingDescendants(childState. m_hasNotIsolatedCompositedBlendingDescendants);1359 layer.setHasNotIsolatedCompositedBlendingDescendants(childState.hasNotIsolatedCompositedBlendingDescendants); 1361 1360 ASSERT(!layer.hasNotIsolatedCompositedBlendingDescendants() || layer.hasNotIsolatedBlendingDescendants()); 1362 1361 #endif … … 1364 1363 RenderLayer::IndirectCompositingReason indirectCompositingReason; 1365 1364 if (!willBeComposited && canBeComposited(layer) 1366 && requiresCompositingForIndirectReason(layer.renderer(), childState. m_subtreeIsCompositing, anyDescendantHas3DTransform, indirectCompositingReason)) {1365 && requiresCompositingForIndirectReason(layer.renderer(), childState.subtreeIsCompositing, anyDescendantHas3DTransform, indirectCompositingReason)) { 1367 1366 layer.setIndirectCompositingReason(indirectCompositingReason); 1368 childState. m_compositingAncestor = &layer;1367 childState.compositingAncestor = &layer; 1369 1368 overlapMap.pushCompositingContainer(); 1370 1369 addToOverlapMapRecursive(overlapMap, layer); … … 1379 1378 1380 1379 // Subsequent layers in the parent stacking context also need to composite. 1381 if (childState. m_subtreeIsCompositing)1382 compositingState. m_subtreeIsCompositing = true;1380 if (childState.subtreeIsCompositing) 1381 compositingState.subtreeIsCompositing = true; 1383 1382 1384 1383 // Set the flag to say that this SC has compositing children. 1385 layer.setHasCompositingDescendant(childState. m_subtreeIsCompositing);1384 layer.setHasCompositingDescendant(childState.subtreeIsCompositing); 1386 1385 1387 1386 // setHasCompositingDescendant() may have changed the answer to needsToBeComposited() when clipping, … … 1392 1391 // Note that if the layer clips its descendants, there's no reason to propagate the child animation to the parent layers. That's because 1393 1392 // we know for sure the animation is contained inside the clipping rectangle, which is already added to the overlap map. 1394 if ((!childState. m_testingOverlap && !isCompositedClippingLayer) || isRunningAcceleratedTransformAnimation(layer.renderer()))1395 compositingState. m_testingOverlap = false;1393 if ((!childState.testingOverlap && !isCompositedClippingLayer) || isRunningAcceleratedTransformAnimation(layer.renderer())) 1394 compositingState.testingOverlap = false; 1396 1395 1397 1396 if (isCompositedClippingLayer) { 1398 1397 if (!willBeComposited) { 1399 childState. m_compositingAncestor = &layer;1398 childState.compositingAncestor = &layer; 1400 1399 overlapMap.pushCompositingContainer(); 1401 1400 addToOverlapMapRecursive(overlapMap, layer); … … 1407 1406 if ((willBeComposited && layer.hasBlendMode()) 1408 1407 || (layer.hasNotIsolatedCompositedBlendingDescendants() && !layer.isolatesCompositedBlending())) 1409 compositingState. m_hasNotIsolatedCompositedBlendingDescendants = true;1410 #endif 1411 1412 if (childState. m_compositingAncestor == &layer && !layer.isRootLayer())1408 compositingState.hasNotIsolatedCompositedBlendingDescendants = true; 1409 #endif 1410 1411 if (childState.compositingAncestor == &layer && !layer.isRootLayer()) 1413 1412 overlapMap.popCompositingContainer(); 1414 1413 … … 1416 1415 // to be composited, then we can drop out of compositing mode altogether. However, don't drop out of compositing mode 1417 1416 // if there are composited layers that we didn't hit in our traversal (e.g. because of visibility:hidden). 1418 if (layer.isRootLayer() && !childState. m_subtreeIsCompositing && !requiresCompositingLayer(layer) && !m_forceCompositingMode && !hasAnyAdditionalCompositedLayers(layer)) {1417 if (layer.isRootLayer() && !childState.subtreeIsCompositing && !requiresCompositingLayer(layer) && !m_forceCompositingMode && !hasAnyAdditionalCompositedLayers(layer)) { 1419 1418 // Don't drop out of compositing on iOS, because we may flash. See <rdar://problem/8348337>. 1420 1419 #if !PLATFORM(IOS) -
TabularUnified trunk/Source/WebCore/rendering/RenderLayerCompositor.h ¶
r181164 r181218 310 310 private: 311 311 class OverlapMap; 312 struct CompositingState; 312 313 313 314 // GraphicsLayerClient implementation … … 342 343 343 344 // Returns true if any layer's compositing changed 344 void computeCompositingRequirements(RenderLayer* ancestorLayer, RenderLayer&, OverlapMap&, structCompositingState&, bool& layersChanged, bool& descendantHas3DTransform);345 void computeCompositingRequirements(RenderLayer* ancestorLayer, RenderLayer&, OverlapMap&, CompositingState&, bool& layersChanged, bool& descendantHas3DTransform); 345 346 346 347 void computeRegionCompositingRequirements(RenderNamedFlowFragment*, OverlapMap&, CompositingState&, bool& layersChanged, bool& anyDescendantHas3DTransform);
Note:
See TracChangeset
for help on using the changeset viewer.