Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009, 2010 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 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 432 m_secondaryBackingStoreBytes = 0; | 432 m_secondaryBackingStoreBytes = 0; |
| 433 | 433 |
| 434 Frame& frame = m_renderView->frameView()->frame(); | 434 Frame& frame = m_renderView->frameView()->frame(); |
| 435 LOG(Compositing, "\nUpdate %d of %s.\n", m_rootLayerUpdateCount, isMainF rame() ? "main frame" : frame.tree()->uniqueName().string().utf8().data()); | 435 LOG(Compositing, "\nUpdate %d of %s.\n", m_rootLayerUpdateCount, isMainF rame() ? "main frame" : frame.tree()->uniqueName().string().utf8().data()); |
| 436 } | 436 } |
| 437 #endif | 437 #endif |
| 438 | 438 |
| 439 if (needHierarchyUpdate) { | 439 if (needHierarchyUpdate) { |
| 440 // Update the hierarchy of the compositing layers. | 440 // Update the hierarchy of the compositing layers. |
| 441 Vector<GraphicsLayer*> childList; | 441 Vector<GraphicsLayer*> childList; |
| 442 HashSet<RenderLayer*> visited; | |
| 442 { | 443 { |
| 443 TRACE_EVENT0("blink_rendering", "RenderLayerCompositor::rebuildCompo sitingLayerTree"); | 444 TRACE_EVENT0("blink_rendering", "RenderLayerCompositor::rebuildCompo sitingLayerTree"); |
| 444 rebuildCompositingLayerTree(updateRoot, childList, 0); | 445 rebuildCompositingLayerTree(updateRoot, childList, visited, 0); |
| 445 } | 446 } |
| 446 | 447 |
| 447 // Host the document layer in the RenderView's root layer. | 448 // Host the document layer in the RenderView's root layer. |
| 448 if (isFullUpdate) { | 449 if (isFullUpdate) { |
| 449 // Even when childList is empty, don't drop out of compositing mode if there are | 450 // Even when childList is empty, don't drop out of compositing mode if there are |
| 450 // composited layers that we didn't hit in our traversal (e.g. becau se of visibility:hidden). | 451 // composited layers that we didn't hit in our traversal (e.g. becau se of visibility:hidden). |
| 451 if (childList.isEmpty() && !hasAnyAdditionalCompositedLayers(updateR oot)) | 452 if (childList.isEmpty() && !hasAnyAdditionalCompositedLayers(updateR oot)) |
| 452 destroyRootLayer(); | 453 destroyRootLayer(); |
| 453 else | 454 else |
| 454 m_rootContentLayer->setChildren(childList); | 455 m_rootContentLayer->setChildren(childList); |
| 455 } | 456 } |
| 456 } else if (needGeometryUpdate) { | 457 } else if (needGeometryUpdate) { |
| 457 // We just need to do a geometry update. This is only used for position: fixed scrolling; | 458 // We just need to do a geometry update. This is only used for position: fixed scrolling; |
| 458 // most of the time, geometry is updated via RenderLayer::styleChanged() . | 459 // most of the time, geometry is updated via RenderLayer::styleChanged() . |
| 459 updateLayerTreeGeometry(updateRoot, 0); | 460 HashSet<RenderLayer*> visited; |
| 461 updateLayerTreeGeometry(updateRoot, visited, 0); | |
| 460 } | 462 } |
| 461 | 463 |
| 462 #if !LOG_DISABLED | 464 #if !LOG_DISABLED |
| 463 if (compositingLogEnabled() && isFullUpdate && (needHierarchyUpdate || needG eometryUpdate)) { | 465 if (compositingLogEnabled() && isFullUpdate && (needHierarchyUpdate || needG eometryUpdate)) { |
| 464 double endTime = currentTime(); | 466 double endTime = currentTime(); |
| 465 LOG(Compositing, "Total layers primary secondary obligatory backin g (KB) secondary backing(KB) total backing (KB) update time (ms)\n"); | 467 LOG(Compositing, "Total layers primary secondary obligatory backin g (KB) secondary backing(KB) total backing (KB) update time (ms)\n"); |
| 466 | 468 |
| 467 LOG(Compositing, "%8d %11d %9d %20.2f %22.2f %22.2f %18.2f\n", | 469 LOG(Compositing, "%8d %11d %9d %20.2f %22.2f %22.2f %18.2f\n", |
| 468 m_obligateCompositedLayerCount + m_secondaryCompositedLayerCount, m_ obligateCompositedLayerCount, | 470 m_obligateCompositedLayerCount + m_secondaryCompositedLayerCount, m_ obligateCompositedLayerCount, |
| 469 m_secondaryCompositedLayerCount, m_obligatoryBackingStoreBytes / 102 4, m_secondaryBackingStoreBytes / 1024, (m_obligatoryBackingStoreBytes + m_secon daryBackingStoreBytes) / 1024, 1000.0 * (endTime - startTime)); | 471 m_secondaryCompositedLayerCount, m_obligatoryBackingStoreBytes / 102 4, m_secondaryBackingStoreBytes / 1024, (m_obligatoryBackingStoreBytes + m_secon daryBackingStoreBytes) / 1024, 1000.0 * (endTime - startTime)); |
| (...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1038 } | 1040 } |
| 1039 | 1041 |
| 1040 bool RenderLayerCompositor::canAccelerateVideoRendering(RenderVideo* o) const | 1042 bool RenderLayerCompositor::canAccelerateVideoRendering(RenderVideo* o) const |
| 1041 { | 1043 { |
| 1042 if (!m_hasAcceleratedCompositing) | 1044 if (!m_hasAcceleratedCompositing) |
| 1043 return false; | 1045 return false; |
| 1044 | 1046 |
| 1045 return o->supportsAcceleratedRendering(); | 1047 return o->supportsAcceleratedRendering(); |
| 1046 } | 1048 } |
| 1047 | 1049 |
| 1048 void RenderLayerCompositor::rebuildCompositingLayerTree(RenderLayer* layer, Vect or<GraphicsLayer*>& childLayersOfEnclosingLayer, int depth) | 1050 void RenderLayerCompositor::rebuildCompositingLayerTreeForLayerAndScrollParents( RenderLayer* curLayer, Vector<GraphicsLayer*>& childList, HashSet<RenderLayer*>& visited, HashMap<RenderLayer*, Vector<GraphicsLayer*> >& scrollParentChildLists , int depth) |
|
hartmanng
2013/09/06 01:46:38
I think this function could use an explanation in
Ian Vollick
2013/09/06 02:38:11
Done.
hartmanng
2013/09/06 20:35:20
Much better, I think this makes the purpose of the
Ian Vollick
2013/09/06 23:00:59
Done.
| |
| 1051 { | |
| 1052 ASSERT(curLayer->zIndex() >= 0 || !visited.contains(curLayer)); | |
| 1053 if (visited.contains(curLayer)) { | |
| 1054 HashMap<RenderLayer*, Vector<GraphicsLayer*> >::iterator it = scrollPare ntChildLists.find(curLayer); | |
| 1055 ASSERT(it != scrollParentChildLists.end()); | |
| 1056 childList.append(it->value); | |
| 1057 scrollParentChildLists.remove(it); | |
| 1058 return; | |
| 1059 } | |
| 1060 | |
| 1061 if (requiresCompositingForOverflowScrollingParent(curLayer)) { | |
| 1062 RenderLayer* scrollParent = curLayer->ancestorScrollingLayer(); | |
| 1063 if (!visited.contains(scrollParent)) { | |
| 1064 ASSERT(!scrollParentChildLists.contains(scrollParent)); | |
| 1065 Vector<GraphicsLayer*> scrollParentChildList; | |
| 1066 rebuildCompositingLayerTreeForLayerAndScrollParents(scrollParent, sc rollParentChildList, visited, scrollParentChildLists, depth); | |
| 1067 scrollParentChildLists.add(scrollParent, scrollParentChildList); | |
| 1068 } | |
| 1069 } | |
| 1070 | |
| 1071 rebuildCompositingLayerTree(curLayer, childList, visited, depth); | |
| 1072 } | |
| 1073 | |
| 1074 void RenderLayerCompositor::rebuildCompositingLayerTree(RenderLayer* layer, Vect or<GraphicsLayer*>& childLayersOfEnclosingLayer, HashSet<RenderLayer*>& visited, int depth) | |
| 1049 { | 1075 { |
| 1050 // Make the layer compositing if necessary, and set up clipping and content layers. | 1076 // Make the layer compositing if necessary, and set up clipping and content layers. |
| 1051 // Note that we can only do work here that is independent of whether the des cendant layers | 1077 // Note that we can only do work here that is independent of whether the des cendant layers |
| 1052 // have been processed. computeCompositingRequirements() will already have d one the repaint if necessary. | 1078 // have been processed. computeCompositingRequirements() will already have d one the repaint if necessary. |
| 1053 | 1079 |
| 1054 // Used for gathering UMA data about the effect on memory usage of promoting all layers | 1080 // Used for gathering UMA data about the effect on memory usage of promoting all layers |
| 1055 // that have a webkit-transition on opacity or transform and intersect the v iewport. | 1081 // that have a webkit-transition on opacity or transform and intersect the v iewport. |
| 1056 static double pixelsWithoutPromotingAllTransitions = 0.0; | 1082 static double pixelsWithoutPromotingAllTransitions = 0.0; |
| 1057 static double pixelsAddedByPromotingAllTransitions = 0.0; | 1083 static double pixelsAddedByPromotingAllTransitions = 0.0; |
| 1058 | 1084 |
| 1059 if (!depth) { | 1085 if (!depth) { |
| 1060 pixelsWithoutPromotingAllTransitions = 0.0; | 1086 pixelsWithoutPromotingAllTransitions = 0.0; |
| 1061 pixelsAddedByPromotingAllTransitions = 0.0; | 1087 pixelsAddedByPromotingAllTransitions = 0.0; |
| 1062 } | 1088 } |
| 1063 | 1089 |
| 1090 visited.add(layer); | |
| 1091 | |
| 1064 RenderLayerBacking* layerBacking = layer->backing(); | 1092 RenderLayerBacking* layerBacking = layer->backing(); |
| 1065 if (layerBacking) { | 1093 if (layerBacking) { |
| 1066 // The compositing state of all our children has been updated already, s o now | 1094 // The compositing state of all our children has been updated already, s o now |
| 1067 // we can compute and cache the composited bounds for this layer. | 1095 // we can compute and cache the composited bounds for this layer. |
| 1068 layerBacking->updateCompositedBounds(); | 1096 layerBacking->updateCompositedBounds(); |
| 1069 | 1097 |
| 1070 if (RenderLayer* reflection = layer->reflectionLayer()) { | 1098 if (RenderLayer* reflection = layer->reflectionLayer()) { |
| 1071 if (reflection->backing()) | 1099 if (reflection->backing()) |
| 1072 reflection->backing()->updateCompositedBounds(); | 1100 reflection->backing()->updateCompositedBounds(); |
| 1073 } | 1101 } |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 1096 | 1124 |
| 1097 // If this layer has backing, then we are collecting its children, otherwise appending | 1125 // If this layer has backing, then we are collecting its children, otherwise appending |
| 1098 // to the compositing child list of an enclosing layer. | 1126 // to the compositing child list of an enclosing layer. |
| 1099 Vector<GraphicsLayer*> layerChildren; | 1127 Vector<GraphicsLayer*> layerChildren; |
| 1100 Vector<GraphicsLayer*>& childList = layerBacking ? layerChildren : childLaye rsOfEnclosingLayer; | 1128 Vector<GraphicsLayer*>& childList = layerBacking ? layerChildren : childLaye rsOfEnclosingLayer; |
| 1101 | 1129 |
| 1102 #if !ASSERT_DISABLED | 1130 #if !ASSERT_DISABLED |
| 1103 LayerListMutationDetector mutationChecker(layer); | 1131 LayerListMutationDetector mutationChecker(layer); |
| 1104 #endif | 1132 #endif |
| 1105 | 1133 |
| 1134 // Visit the normal flow descendants first. We do this for the sake of scrol l | |
| 1135 // parents. A scroll parent is not a stacking context, so it will either app ear | |
| 1136 // in the normal flow tree, or in the positive z-order list (if it had a pos itioned | |
| 1137 // ancestor). Visiting the scroll parent ahead of time if it appears in one | |
| 1138 // of these lists is a simple matter since we have the lists in hand at this | |
| 1139 // level of the recursion, but it's tricker for layers in the normal flow tr ee, | |
| 1140 // so it will be easier to just process this ahead of time. | |
| 1141 Vector<GraphicsLayer*> normalFlowChildList; | |
| 1142 | |
| 1143 if (Vector<RenderLayer*>* normalFlowList = layer->normalFlowList()) { | |
| 1144 size_t listSize = normalFlowList->size(); | |
| 1145 for (size_t i = 0; i < listSize; ++i) { | |
| 1146 RenderLayer* curLayer = normalFlowList->at(i); | |
| 1147 rebuildCompositingLayerTree(curLayer, normalFlowChildList, visited, depth + 1); | |
| 1148 } | |
| 1149 } | |
| 1150 | |
| 1151 HashMap<RenderLayer*, Vector<GraphicsLayer*> > scrollParentChildLists; | |
| 1106 if (layer->isStackingContainer()) { | 1152 if (layer->isStackingContainer()) { |
| 1107 if (Vector<RenderLayer*>* negZOrderList = layer->negZOrderList()) { | 1153 if (Vector<RenderLayer*>* negZOrderList = layer->negZOrderList()) { |
| 1108 size_t listSize = negZOrderList->size(); | 1154 size_t listSize = negZOrderList->size(); |
| 1109 for (size_t i = 0; i < listSize; ++i) { | 1155 for (size_t i = 0; i < listSize; ++i) { |
| 1110 RenderLayer* curLayer = negZOrderList->at(i); | 1156 RenderLayer* curLayer = negZOrderList->at(i); |
| 1111 rebuildCompositingLayerTree(curLayer, childList, depth + 1); | 1157 rebuildCompositingLayerTreeForLayerAndScrollParents(curLayer, ch ildList, visited, scrollParentChildLists, depth + 1); |
| 1112 } | 1158 } |
| 1113 } | 1159 } |
| 1114 | 1160 |
| 1115 // If a negative z-order child is compositing, we get a foreground layer which needs to get parented. | 1161 // If a negative z-order child is compositing, we get a foreground layer which needs to get parented. |
| 1116 if (layerBacking && layerBacking->foregroundLayer()) | 1162 if (layerBacking && layerBacking->foregroundLayer()) |
| 1117 childList.append(layerBacking->foregroundLayer()); | 1163 childList.append(layerBacking->foregroundLayer()); |
| 1118 } | 1164 } |
| 1119 | 1165 |
| 1120 if (Vector<RenderLayer*>* normalFlowList = layer->normalFlowList()) { | 1166 childList.append(normalFlowChildList); |
| 1121 size_t listSize = normalFlowList->size(); | |
| 1122 for (size_t i = 0; i < listSize; ++i) { | |
| 1123 RenderLayer* curLayer = normalFlowList->at(i); | |
| 1124 rebuildCompositingLayerTree(curLayer, childList, depth + 1); | |
| 1125 } | |
| 1126 } | |
| 1127 | 1167 |
| 1128 if (layer->isStackingContainer()) { | 1168 if (layer->isStackingContainer()) { |
| 1129 if (Vector<RenderLayer*>* posZOrderList = layer->posZOrderList()) { | 1169 if (Vector<RenderLayer*>* posZOrderList = layer->posZOrderList()) { |
| 1130 size_t listSize = posZOrderList->size(); | 1170 size_t listSize = posZOrderList->size(); |
| 1131 for (size_t i = 0; i < listSize; ++i) { | 1171 for (size_t i = 0; i < listSize; ++i) { |
| 1132 RenderLayer* curLayer = posZOrderList->at(i); | 1172 RenderLayer* curLayer = posZOrderList->at(i); |
| 1133 rebuildCompositingLayerTree(curLayer, childList, depth + 1); | 1173 rebuildCompositingLayerTreeForLayerAndScrollParents(curLayer, ch ildList, visited, scrollParentChildLists, depth + 1); |
| 1134 } | 1174 } |
| 1135 } | 1175 } |
| 1136 } | 1176 } |
| 1137 | 1177 |
| 1138 if (layerBacking) { | 1178 if (layerBacking) { |
| 1139 bool parented = false; | 1179 bool parented = false; |
| 1140 if (layer->renderer()->isRenderPart()) | 1180 if (layer->renderer()->isRenderPart()) |
| 1141 parented = parentFrameContentLayers(toRenderPart(layer->renderer())) ; | 1181 parented = parentFrameContentLayers(toRenderPart(layer->renderer())) ; |
| 1142 | 1182 |
| 1143 if (!parented) | 1183 if (!parented) |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1304 RenderLayerBacking* backing = layer->backing(); | 1344 RenderLayerBacking* backing = layer->backing(); |
| 1305 GraphicsLayer* hostingLayer = backing->parentForSublayers(); | 1345 GraphicsLayer* hostingLayer = backing->parentForSublayers(); |
| 1306 GraphicsLayer* rootLayer = innerCompositor->rootGraphicsLayer(); | 1346 GraphicsLayer* rootLayer = innerCompositor->rootGraphicsLayer(); |
| 1307 if (hostingLayer->children().size() != 1 || hostingLayer->children()[0] != r ootLayer) { | 1347 if (hostingLayer->children().size() != 1 || hostingLayer->children()[0] != r ootLayer) { |
| 1308 hostingLayer->removeAllChildren(); | 1348 hostingLayer->removeAllChildren(); |
| 1309 hostingLayer->addChild(rootLayer); | 1349 hostingLayer->addChild(rootLayer); |
| 1310 } | 1350 } |
| 1311 return true; | 1351 return true; |
| 1312 } | 1352 } |
| 1313 | 1353 |
| 1354 void RenderLayerCompositor::updateLayerTreeGeometryForLayerAndScrollParents(Rend erLayer* layer, HashSet<RenderLayer*>& visited, int depth) | |
| 1355 { | |
| 1356 ASSERT(layer->zIndex() >= 0 || !visited.contains(layer)); | |
| 1357 if (visited.contains(layer)) | |
| 1358 return; | |
| 1359 | |
| 1360 if (requiresCompositingForOverflowScrollingParent(layer)) { | |
| 1361 RenderLayer* scrollParent = layer->ancestorScrollingLayer(); | |
| 1362 if (!visited.contains(scrollParent)) | |
| 1363 updateLayerTreeGeometryForLayerAndScrollParents(scrollParent, visite d, depth); | |
| 1364 } | |
| 1365 | |
| 1366 updateLayerTreeGeometry(layer, visited, depth); | |
| 1367 } | |
| 1314 // This just updates layer geometry without changing the hierarchy. | 1368 // This just updates layer geometry without changing the hierarchy. |
| 1315 void RenderLayerCompositor::updateLayerTreeGeometry(RenderLayer* layer, int dept h) | 1369 void RenderLayerCompositor::updateLayerTreeGeometry(RenderLayer* layer, HashSet< RenderLayer*>& visited, int depth) |
| 1316 { | 1370 { |
| 1371 visited.add(layer); | |
| 1372 | |
| 1317 if (RenderLayerBacking* layerBacking = layer->backing()) { | 1373 if (RenderLayerBacking* layerBacking = layer->backing()) { |
| 1318 // The compositing state of all our children has been updated already, s o now | 1374 // The compositing state of all our children has been updated already, s o now |
| 1319 // we can compute and cache the composited bounds for this layer. | 1375 // we can compute and cache the composited bounds for this layer. |
| 1320 layerBacking->updateCompositedBounds(); | 1376 layerBacking->updateCompositedBounds(); |
| 1321 | 1377 |
| 1322 if (RenderLayer* reflection = layer->reflectionLayer()) { | 1378 if (RenderLayer* reflection = layer->reflectionLayer()) { |
| 1323 if (reflection->backing()) | 1379 if (reflection->backing()) |
| 1324 reflection->backing()->updateCompositedBounds(); | 1380 reflection->backing()->updateCompositedBounds(); |
| 1325 } | 1381 } |
| 1326 | 1382 |
| 1327 layerBacking->updateGraphicsLayerConfiguration(); | 1383 layerBacking->updateGraphicsLayerConfiguration(); |
| 1328 layerBacking->updateGraphicsLayerGeometry(); | 1384 layerBacking->updateGraphicsLayerGeometry(); |
| 1329 | 1385 |
| 1330 if (!layer->parent()) | 1386 if (!layer->parent()) |
| 1331 updateRootLayerPosition(); | 1387 updateRootLayerPosition(); |
| 1332 | 1388 |
| 1333 #if !LOG_DISABLED | 1389 #if !LOG_DISABLED |
| 1334 logLayerInfo(layer, depth); | 1390 logLayerInfo(layer, depth); |
| 1335 #else | 1391 #else |
| 1336 UNUSED_PARAM(depth); | 1392 UNUSED_PARAM(depth); |
| 1337 #endif | 1393 #endif |
| 1338 } | 1394 } |
| 1339 | 1395 |
| 1340 #if !ASSERT_DISABLED | 1396 #if !ASSERT_DISABLED |
| 1341 LayerListMutationDetector mutationChecker(layer); | 1397 LayerListMutationDetector mutationChecker(layer); |
| 1342 #endif | 1398 #endif |
| 1343 | 1399 |
| 1400 if (Vector<RenderLayer*>* normalFlowList = layer->normalFlowList()) { | |
| 1401 size_t listSize = normalFlowList->size(); | |
| 1402 for (size_t i = 0; i < listSize; ++i) | |
| 1403 updateLayerTreeGeometry(normalFlowList->at(i), visited, depth + 1); | |
| 1404 } | |
| 1405 | |
| 1344 if (layer->isStackingContainer()) { | 1406 if (layer->isStackingContainer()) { |
| 1345 if (Vector<RenderLayer*>* negZOrderList = layer->negZOrderList()) { | 1407 if (Vector<RenderLayer*>* negZOrderList = layer->negZOrderList()) { |
| 1346 size_t listSize = negZOrderList->size(); | 1408 size_t listSize = negZOrderList->size(); |
| 1347 for (size_t i = 0; i < listSize; ++i) | 1409 for (size_t i = 0; i < listSize; ++i) |
| 1348 updateLayerTreeGeometry(negZOrderList->at(i), depth + 1); | 1410 updateLayerTreeGeometryForLayerAndScrollParents(negZOrderList->a t(i), visited, depth + 1); |
| 1349 } | 1411 } |
| 1350 } | 1412 } |
| 1351 | 1413 |
| 1352 if (Vector<RenderLayer*>* normalFlowList = layer->normalFlowList()) { | |
| 1353 size_t listSize = normalFlowList->size(); | |
| 1354 for (size_t i = 0; i < listSize; ++i) | |
| 1355 updateLayerTreeGeometry(normalFlowList->at(i), depth + 1); | |
| 1356 } | |
| 1357 | |
| 1358 if (layer->isStackingContainer()) { | 1414 if (layer->isStackingContainer()) { |
| 1359 if (Vector<RenderLayer*>* posZOrderList = layer->posZOrderList()) { | 1415 if (Vector<RenderLayer*>* posZOrderList = layer->posZOrderList()) { |
| 1360 size_t listSize = posZOrderList->size(); | 1416 size_t listSize = posZOrderList->size(); |
| 1361 for (size_t i = 0; i < listSize; ++i) | 1417 for (size_t i = 0; i < listSize; ++i) |
| 1362 updateLayerTreeGeometry(posZOrderList->at(i), depth + 1); | 1418 updateLayerTreeGeometryForLayerAndScrollParents(posZOrderList->a t(i), visited, depth + 1); |
| 1363 } | 1419 } |
| 1364 } | 1420 } |
| 1365 } | 1421 } |
| 1366 | 1422 |
| 1367 // Recurs down the RenderLayer tree until its finds the compositing descendants of compositingAncestor and updates their geometry. | 1423 // Recurs down the RenderLayer tree until its finds the compositing descendants of compositingAncestor and updates their geometry. |
| 1368 void RenderLayerCompositor::updateCompositingDescendantGeometry(RenderLayer* com positingAncestor, RenderLayer* layer, bool compositedChildrenOnly) | 1424 void RenderLayerCompositor::updateCompositingDescendantGeometry(RenderLayer* com positingAncestor, RenderLayer* layer, bool compositedChildrenOnly) |
| 1369 { | 1425 { |
| 1370 if (layer != compositingAncestor) { | 1426 if (layer != compositingAncestor) { |
| 1371 if (RenderLayerBacking* layerBacking = layer->backing()) { | 1427 if (RenderLayerBacking* layerBacking = layer->backing()) { |
| 1372 layerBacking->updateCompositedBounds(); | 1428 layerBacking->updateCompositedBounds(); |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1748 // Return true if the given layer has some ancestor in the RenderLayer hierarchy that clips, | 1804 // Return true if the given layer has some ancestor in the RenderLayer hierarchy that clips, |
| 1749 // up to the enclosing compositing ancestor. This is required because compositin g layers are parented | 1805 // up to the enclosing compositing ancestor. This is required because compositin g layers are parented |
| 1750 // according to the z-order hierarchy, yet clipping goes down the renderer hiera rchy. | 1806 // according to the z-order hierarchy, yet clipping goes down the renderer hiera rchy. |
| 1751 // Thus, a RenderLayer can be clipped by a RenderLayer that is an ancestor in th e renderer hierarchy, | 1807 // Thus, a RenderLayer can be clipped by a RenderLayer that is an ancestor in th e renderer hierarchy, |
| 1752 // but a sibling in the z-order hierarchy. | 1808 // but a sibling in the z-order hierarchy. |
| 1753 bool RenderLayerCompositor::clippedByAncestor(RenderLayer* layer) const | 1809 bool RenderLayerCompositor::clippedByAncestor(RenderLayer* layer) const |
| 1754 { | 1810 { |
| 1755 if (!layer->isComposited() || !layer->parent()) | 1811 if (!layer->isComposited() || !layer->parent()) |
| 1756 return false; | 1812 return false; |
| 1757 | 1813 |
| 1758 RenderLayer* compositingAncestor = layer->ancestorCompositingLayer(); | 1814 // Scroll children use their scrolling ancestor as their clip root. |
| 1815 RenderLayer* compositingAncestor = requiresCompositingForOverflowScrollingPa rent(layer) | |
| 1816 ? layer->ancestorScrollingLayer() | |
| 1817 : layer->ancestorCompositingLayer(); | |
| 1818 | |
| 1759 if (!compositingAncestor) | 1819 if (!compositingAncestor) |
| 1760 return false; | 1820 return false; |
| 1761 | 1821 |
| 1762 // If the compositingAncestor clips, that will be taken care of by clipsComp ositingDescendants(), | 1822 // If the compositingAncestor clips, that will be taken care of by clipsComp ositingDescendants(), |
| 1763 // so we only care about clipping between its first child that is our ancest or (the computeClipRoot), | 1823 // so we only care about clipping between its first child that is our ancest or (the computeClipRoot), |
| 1764 // and layer. | 1824 // and layer. |
| 1765 RenderLayer* computeClipRoot = 0; | 1825 RenderLayer* computeClipRoot = 0; |
| 1766 RenderLayer* curr = layer; | 1826 RenderLayer* curr = layer; |
| 1767 while (curr) { | 1827 while (curr) { |
| 1768 RenderLayer* next = curr->parent(); | 1828 RenderLayer* next = curr->parent(); |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1970 return renderer->hasFilter(); | 2030 return renderer->hasFilter(); |
| 1971 } | 2031 } |
| 1972 | 2032 |
| 1973 bool RenderLayerCompositor::requiresCompositingForBlending(RenderObject* rendere r) const | 2033 bool RenderLayerCompositor::requiresCompositingForBlending(RenderObject* rendere r) const |
| 1974 { | 2034 { |
| 1975 return renderer->hasBlendMode(); | 2035 return renderer->hasBlendMode(); |
| 1976 } | 2036 } |
| 1977 | 2037 |
| 1978 bool RenderLayerCompositor::requiresCompositingForOverflowScrollingParent(const RenderLayer* layer) const | 2038 bool RenderLayerCompositor::requiresCompositingForOverflowScrollingParent(const RenderLayer* layer) const |
| 1979 { | 2039 { |
| 1980 if (!layer->compositorDrivenAcceleratedScrollingEnabled()) | 2040 return !!layer->scrollParent(); |
| 1981 return false; | |
| 1982 | |
| 1983 // A layer scrolls with its containing block. So to find the overflow scroll ing layer | |
| 1984 // that we scroll with respect to, we must ascend the layer tree until we re ach the | |
| 1985 // first overflow scrolling div at or above our containing block. I will ref er to this | |
| 1986 // layer as our 'scrolling ancestor'. | |
| 1987 // | |
| 1988 // Now, if we reside in a normal flow list, then we will naturally scroll wi th our scrolling | |
| 1989 // ancestor, and we need not be composited. If, on the other hand, we reside in a z-order | |
| 1990 // list, and on our walk upwards to our scrolling ancestor we find no layer that is a stacking | |
| 1991 // context, then we know that in the stacking tree, we will not be in the su btree rooted at | |
| 1992 // our scrolling ancestor, and we will therefore not scroll with it. In this case, we must | |
| 1993 // be a composited layer since the compositor will need to take special meas ures to ensure | |
| 1994 // that we scroll with our scrolling ancestor and it cannot do this if we do not promote. | |
| 1995 RenderLayer* scrollParent = layer->ancestorScrollingLayer(); | |
| 1996 | |
| 1997 if (!scrollParent || scrollParent->isStackingContext()) | |
| 1998 return false; | |
| 1999 | |
| 2000 // If we hit a stacking context on our way up to the ancestor scrolling laye r, it will already | |
| 2001 // be composited due to an overflow scrolling parent, so we don't need to. | |
| 2002 for (RenderLayer* ancestor = layer->parent(); ancestor && ancestor != scroll Parent; ancestor = ancestor->parent()) { | |
| 2003 if (ancestor->isStackingContext()) | |
| 2004 return false; | |
| 2005 } | |
| 2006 | |
| 2007 return true; | |
| 2008 } | 2041 } |
| 2009 | 2042 |
| 2010 bool RenderLayerCompositor::requiresCompositingForOutOfFlowClipping(const Render Layer* layer) const | 2043 bool RenderLayerCompositor::requiresCompositingForOutOfFlowClipping(const Render Layer* layer) const |
| 2011 { | 2044 { |
| 2012 return layer->compositorDrivenAcceleratedScrollingEnabled() && layer->isUncl ippedDescendant(); | 2045 return layer->compositorDrivenAcceleratedScrollingEnabled() && layer->isUncl ippedDescendant(); |
| 2013 } | 2046 } |
| 2014 | 2047 |
| 2015 bool RenderLayerCompositor::requiresCompositingForPosition(RenderObject* rendere r, const RenderLayer* layer, RenderLayer::ViewportConstrainedNotCompositedReason * viewportConstrainedNotCompositedReason) const | 2048 bool RenderLayerCompositor::requiresCompositingForPosition(RenderObject* rendere r, const RenderLayer* layer, RenderLayer::ViewportConstrainedNotCompositedReason * viewportConstrainedNotCompositedReason) const |
| 2016 { | 2049 { |
| 2017 // position:fixed elements that create their own stacking context (e.g. have an explicit z-index, | 2050 // position:fixed elements that create their own stacking context (e.g. have an explicit z-index, |
| (...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2734 } else if (graphicsLayer == m_scrollLayer.get()) { | 2767 } else if (graphicsLayer == m_scrollLayer.get()) { |
| 2735 name = "Frame Scrolling Layer"; | 2768 name = "Frame Scrolling Layer"; |
| 2736 } else { | 2769 } else { |
| 2737 ASSERT_NOT_REACHED(); | 2770 ASSERT_NOT_REACHED(); |
| 2738 } | 2771 } |
| 2739 | 2772 |
| 2740 return name; | 2773 return name; |
| 2741 } | 2774 } |
| 2742 | 2775 |
| 2743 } // namespace WebCore | 2776 } // namespace WebCore |
| OLD | NEW |