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 // The purpose of this function is to ensure that we call rebuildCompostingLayer Tree on curLayer's |
| 1051 // scroll parent (if it has one) before we call it on curLayer. This is necessar y because rebuilding the | |
| 1052 // compositing layer tree for curLayer will use values we computed for the scrol l parent. Unfortunately, | |
|
enne (OOO)
2013/09/10 23:45:01
I understand why you need HashSet visited for upda
Ian Vollick
2013/09/11 17:57:52
There are two recursive functions in the RLC which
enne (OOO)
2013/09/11 23:18:30
Sad times. I missed that they both call updateGra
| |
| 1053 // the childList needs to be populated as if we'd visited all the layers in pain t order. To work around | |
| 1054 // this, when we visit a scroll parent out of order, we'll set its additions to childList aside (in | |
| 1055 // scrollParentChildLists), and add them to the real childList when we visit the scroll parent in paint | |
| 1056 // order. | |
| 1057 void RenderLayerCompositor::rebuildCompositingLayerTreeForLayerAndScrollParents( RenderLayer* curLayer, Vector<GraphicsLayer*>& childList, HashSet<RenderLayer*>& visited, HashMap<RenderLayer*, Vector<GraphicsLayer*> >& scrollParentChildLists , int depth) | |
| 1058 { | |
| 1059 ASSERT(curLayer->zIndex() >= 0 || !visited.contains(curLayer)); | |
| 1060 if (visited.contains(curLayer)) { | |
| 1061 // We've already processed this layer, but since we processed it out of order, its | |
| 1062 // contribution to childList was not added. We must do that now. | |
| 1063 HashMap<RenderLayer*, Vector<GraphicsLayer*> >::iterator it = scrollPare ntChildLists.find(curLayer); | |
| 1064 ASSERT(it != scrollParentChildLists.end()); | |
| 1065 childList.append(it->value); | |
| 1066 scrollParentChildLists.remove(it); | |
| 1067 return; | |
| 1068 } | |
| 1069 | |
| 1070 if (requiresCompositingForOverflowScrollingParent(curLayer)) { | |
| 1071 RenderLayer* scrollParent = curLayer->ancestorScrollingLayer(); | |
| 1072 if (!visited.contains(scrollParent)) { | |
| 1073 ASSERT(!scrollParentChildLists.contains(scrollParent)); | |
| 1074 // We will populate scrollParentChildList rather than childList, sin ce we're visiting it | |
| 1075 // out of order. | |
| 1076 Vector<GraphicsLayer*> scrollParentChildList; | |
| 1077 rebuildCompositingLayerTreeForLayerAndScrollParents(scrollParent, sc rollParentChildList, visited, scrollParentChildLists, depth); | |
| 1078 // We will set aside the scrollParentChildList in scrollParentChildL ists so that we can | |
| 1079 // add it to childList when we visit the scrollParent normally. | |
| 1080 scrollParentChildLists.add(scrollParent, scrollParentChildList); | |
| 1081 } | |
| 1082 } | |
| 1083 | |
| 1084 rebuildCompositingLayerTree(curLayer, childList, visited, depth); | |
| 1085 } | |
| 1086 | |
| 1087 void RenderLayerCompositor::rebuildCompositingLayerTree(RenderLayer* layer, Vect or<GraphicsLayer*>& childLayersOfEnclosingLayer, HashSet<RenderLayer*>& visited, int depth) | |
| 1049 { | 1088 { |
| 1050 // Make the layer compositing if necessary, and set up clipping and content layers. | 1089 // 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 | 1090 // 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. | 1091 // have been processed. computeCompositingRequirements() will already have d one the repaint if necessary. |
| 1053 | 1092 |
| 1054 // Used for gathering UMA data about the effect on memory usage of promoting all layers | 1093 // 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. | 1094 // that have a webkit-transition on opacity or transform and intersect the v iewport. |
| 1056 static double pixelsWithoutPromotingAllTransitions = 0.0; | 1095 static double pixelsWithoutPromotingAllTransitions = 0.0; |
| 1057 static double pixelsAddedByPromotingAllTransitions = 0.0; | 1096 static double pixelsAddedByPromotingAllTransitions = 0.0; |
| 1058 | 1097 |
| 1059 if (!depth) { | 1098 if (!depth) { |
| 1060 pixelsWithoutPromotingAllTransitions = 0.0; | 1099 pixelsWithoutPromotingAllTransitions = 0.0; |
| 1061 pixelsAddedByPromotingAllTransitions = 0.0; | 1100 pixelsAddedByPromotingAllTransitions = 0.0; |
| 1062 } | 1101 } |
| 1063 | 1102 |
| 1103 visited.add(layer); | |
| 1104 | |
| 1064 RenderLayerBacking* layerBacking = layer->backing(); | 1105 RenderLayerBacking* layerBacking = layer->backing(); |
| 1065 if (layerBacking) { | 1106 if (layerBacking) { |
| 1066 // The compositing state of all our children has been updated already, s o now | 1107 // 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. | 1108 // we can compute and cache the composited bounds for this layer. |
| 1068 layerBacking->updateCompositedBounds(); | 1109 layerBacking->updateCompositedBounds(); |
| 1069 | 1110 |
| 1070 if (RenderLayer* reflection = layer->reflectionLayer()) { | 1111 if (RenderLayer* reflection = layer->reflectionLayer()) { |
| 1071 if (reflection->backing()) | 1112 if (reflection->backing()) |
| 1072 reflection->backing()->updateCompositedBounds(); | 1113 reflection->backing()->updateCompositedBounds(); |
| 1073 } | 1114 } |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 1096 | 1137 |
| 1097 // If this layer has backing, then we are collecting its children, otherwise appending | 1138 // If this layer has backing, then we are collecting its children, otherwise appending |
| 1098 // to the compositing child list of an enclosing layer. | 1139 // to the compositing child list of an enclosing layer. |
| 1099 Vector<GraphicsLayer*> layerChildren; | 1140 Vector<GraphicsLayer*> layerChildren; |
| 1100 Vector<GraphicsLayer*>& childList = layerBacking ? layerChildren : childLaye rsOfEnclosingLayer; | 1141 Vector<GraphicsLayer*>& childList = layerBacking ? layerChildren : childLaye rsOfEnclosingLayer; |
| 1101 | 1142 |
| 1102 #if !ASSERT_DISABLED | 1143 #if !ASSERT_DISABLED |
| 1103 LayerListMutationDetector mutationChecker(layer); | 1144 LayerListMutationDetector mutationChecker(layer); |
| 1104 #endif | 1145 #endif |
| 1105 | 1146 |
| 1147 // Visit the normal flow descendants first. We do this for the sake of scrol l | |
| 1148 // parents. A scroll parent is not a stacking context, so it will either app ear | |
| 1149 // in the normal flow tree, or in the positive z-order list (if it had a pos itioned | |
| 1150 // ancestor). Visiting the scroll parent ahead of time if it appears in one | |
| 1151 // of these lists is a simple matter since we have the lists in hand at this | |
| 1152 // level of the recursion, but it's tricker for layers in the normal flow tr ee, | |
| 1153 // so it will be easier to just process this ahead of time. | |
| 1154 Vector<GraphicsLayer*> normalFlowChildList; | |
| 1155 | |
| 1156 if (Vector<RenderLayer*>* normalFlowList = layer->normalFlowList()) { | |
| 1157 size_t listSize = normalFlowList->size(); | |
| 1158 for (size_t i = 0; i < listSize; ++i) { | |
| 1159 RenderLayer* curLayer = normalFlowList->at(i); | |
| 1160 rebuildCompositingLayerTree(curLayer, normalFlowChildList, visited, depth + 1); | |
| 1161 } | |
| 1162 } | |
| 1163 | |
| 1164 HashMap<RenderLayer*, Vector<GraphicsLayer*> > scrollParentChildLists; | |
| 1106 if (layer->isStackingContainer()) { | 1165 if (layer->isStackingContainer()) { |
| 1107 if (Vector<RenderLayer*>* negZOrderList = layer->negZOrderList()) { | 1166 if (Vector<RenderLayer*>* negZOrderList = layer->negZOrderList()) { |
| 1108 size_t listSize = negZOrderList->size(); | 1167 size_t listSize = negZOrderList->size(); |
| 1109 for (size_t i = 0; i < listSize; ++i) { | 1168 for (size_t i = 0; i < listSize; ++i) { |
| 1110 RenderLayer* curLayer = negZOrderList->at(i); | 1169 RenderLayer* curLayer = negZOrderList->at(i); |
| 1111 rebuildCompositingLayerTree(curLayer, childList, depth + 1); | 1170 rebuildCompositingLayerTreeForLayerAndScrollParents(curLayer, ch ildList, visited, scrollParentChildLists, depth + 1); |
| 1112 } | 1171 } |
| 1113 } | 1172 } |
| 1114 | 1173 |
| 1115 // If a negative z-order child is compositing, we get a foreground layer which needs to get parented. | 1174 // If a negative z-order child is compositing, we get a foreground layer which needs to get parented. |
| 1116 if (layerBacking && layerBacking->foregroundLayer()) | 1175 if (layerBacking && layerBacking->foregroundLayer()) |
| 1117 childList.append(layerBacking->foregroundLayer()); | 1176 childList.append(layerBacking->foregroundLayer()); |
| 1118 } | 1177 } |
| 1119 | 1178 |
| 1120 if (Vector<RenderLayer*>* normalFlowList = layer->normalFlowList()) { | 1179 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 | 1180 |
| 1128 if (layer->isStackingContainer()) { | 1181 if (layer->isStackingContainer()) { |
| 1129 if (Vector<RenderLayer*>* posZOrderList = layer->posZOrderList()) { | 1182 if (Vector<RenderLayer*>* posZOrderList = layer->posZOrderList()) { |
| 1130 size_t listSize = posZOrderList->size(); | 1183 size_t listSize = posZOrderList->size(); |
| 1131 for (size_t i = 0; i < listSize; ++i) { | 1184 for (size_t i = 0; i < listSize; ++i) { |
| 1132 RenderLayer* curLayer = posZOrderList->at(i); | 1185 RenderLayer* curLayer = posZOrderList->at(i); |
| 1133 rebuildCompositingLayerTree(curLayer, childList, depth + 1); | 1186 rebuildCompositingLayerTreeForLayerAndScrollParents(curLayer, ch ildList, visited, scrollParentChildLists, depth + 1); |
| 1134 } | 1187 } |
| 1135 } | 1188 } |
| 1136 } | 1189 } |
| 1137 | 1190 |
| 1138 if (layerBacking) { | 1191 if (layerBacking) { |
| 1139 bool parented = false; | 1192 bool parented = false; |
| 1140 if (layer->renderer()->isRenderPart()) | 1193 if (layer->renderer()->isRenderPart()) |
| 1141 parented = parentFrameContentLayers(toRenderPart(layer->renderer())) ; | 1194 parented = parentFrameContentLayers(toRenderPart(layer->renderer())) ; |
| 1142 | 1195 |
| 1143 if (!parented) | 1196 if (!parented) |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1304 RenderLayerBacking* backing = layer->backing(); | 1357 RenderLayerBacking* backing = layer->backing(); |
| 1305 GraphicsLayer* hostingLayer = backing->parentForSublayers(); | 1358 GraphicsLayer* hostingLayer = backing->parentForSublayers(); |
| 1306 GraphicsLayer* rootLayer = innerCompositor->rootGraphicsLayer(); | 1359 GraphicsLayer* rootLayer = innerCompositor->rootGraphicsLayer(); |
| 1307 if (hostingLayer->children().size() != 1 || hostingLayer->children()[0] != r ootLayer) { | 1360 if (hostingLayer->children().size() != 1 || hostingLayer->children()[0] != r ootLayer) { |
| 1308 hostingLayer->removeAllChildren(); | 1361 hostingLayer->removeAllChildren(); |
| 1309 hostingLayer->addChild(rootLayer); | 1362 hostingLayer->addChild(rootLayer); |
| 1310 } | 1363 } |
| 1311 return true; | 1364 return true; |
| 1312 } | 1365 } |
| 1313 | 1366 |
| 1367 // The purpose of this function is to ensure that we call updateLayerTreeGeometr y on layer's | |
| 1368 // scroll parent (if it has one) before we call it on layer. This is necessary b ecause updating | |
| 1369 // layer tree geometry for layer will use values we computed for its scroll pare nt. | |
| 1370 void RenderLayerCompositor::updateLayerTreeGeometryForLayerAndScrollParents(Rend erLayer* layer, HashSet<RenderLayer*>& visited, int depth) | |
| 1371 { | |
| 1372 ASSERT(layer->zIndex() >= 0 || !visited.contains(layer)); | |
| 1373 if (visited.contains(layer)) | |
| 1374 return; | |
| 1375 | |
| 1376 if (requiresCompositingForOverflowScrollingParent(layer)) { | |
| 1377 RenderLayer* scrollParent = layer->ancestorScrollingLayer(); | |
| 1378 if (!visited.contains(scrollParent)) | |
| 1379 updateLayerTreeGeometryForLayerAndScrollParents(scrollParent, visite d, depth); | |
| 1380 } | |
| 1381 | |
| 1382 updateLayerTreeGeometry(layer, visited, depth); | |
| 1383 } | |
| 1314 // This just updates layer geometry without changing the hierarchy. | 1384 // This just updates layer geometry without changing the hierarchy. |
| 1315 void RenderLayerCompositor::updateLayerTreeGeometry(RenderLayer* layer, int dept h) | 1385 void RenderLayerCompositor::updateLayerTreeGeometry(RenderLayer* layer, HashSet< RenderLayer*>& visited, int depth) |
| 1316 { | 1386 { |
| 1387 visited.add(layer); | |
| 1388 | |
| 1317 if (RenderLayerBacking* layerBacking = layer->backing()) { | 1389 if (RenderLayerBacking* layerBacking = layer->backing()) { |
| 1318 // The compositing state of all our children has been updated already, s o now | 1390 // 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. | 1391 // we can compute and cache the composited bounds for this layer. |
| 1320 layerBacking->updateCompositedBounds(); | 1392 layerBacking->updateCompositedBounds(); |
| 1321 | 1393 |
| 1322 if (RenderLayer* reflection = layer->reflectionLayer()) { | 1394 if (RenderLayer* reflection = layer->reflectionLayer()) { |
| 1323 if (reflection->backing()) | 1395 if (reflection->backing()) |
| 1324 reflection->backing()->updateCompositedBounds(); | 1396 reflection->backing()->updateCompositedBounds(); |
| 1325 } | 1397 } |
| 1326 | 1398 |
| 1327 layerBacking->updateGraphicsLayerConfiguration(); | 1399 layerBacking->updateGraphicsLayerConfiguration(); |
| 1328 layerBacking->updateGraphicsLayerGeometry(); | 1400 layerBacking->updateGraphicsLayerGeometry(); |
| 1329 | 1401 |
| 1330 if (!layer->parent()) | 1402 if (!layer->parent()) |
| 1331 updateRootLayerPosition(); | 1403 updateRootLayerPosition(); |
| 1332 | 1404 |
| 1333 #if !LOG_DISABLED | 1405 #if !LOG_DISABLED |
| 1334 logLayerInfo(layer, depth); | 1406 logLayerInfo(layer, depth); |
| 1335 #else | 1407 #else |
| 1336 UNUSED_PARAM(depth); | 1408 UNUSED_PARAM(depth); |
| 1337 #endif | 1409 #endif |
| 1338 } | 1410 } |
| 1339 | 1411 |
| 1340 #if !ASSERT_DISABLED | 1412 #if !ASSERT_DISABLED |
| 1341 LayerListMutationDetector mutationChecker(layer); | 1413 LayerListMutationDetector mutationChecker(layer); |
| 1342 #endif | 1414 #endif |
| 1343 | 1415 |
| 1416 if (Vector<RenderLayer*>* normalFlowList = layer->normalFlowList()) { | |
| 1417 size_t listSize = normalFlowList->size(); | |
| 1418 for (size_t i = 0; i < listSize; ++i) | |
| 1419 updateLayerTreeGeometry(normalFlowList->at(i), visited, depth + 1); | |
| 1420 } | |
| 1421 | |
| 1344 if (layer->isStackingContainer()) { | 1422 if (layer->isStackingContainer()) { |
| 1345 if (Vector<RenderLayer*>* negZOrderList = layer->negZOrderList()) { | 1423 if (Vector<RenderLayer*>* negZOrderList = layer->negZOrderList()) { |
| 1346 size_t listSize = negZOrderList->size(); | 1424 size_t listSize = negZOrderList->size(); |
| 1347 for (size_t i = 0; i < listSize; ++i) | 1425 for (size_t i = 0; i < listSize; ++i) |
| 1348 updateLayerTreeGeometry(negZOrderList->at(i), depth + 1); | 1426 updateLayerTreeGeometryForLayerAndScrollParents(negZOrderList->a t(i), visited, depth + 1); |
| 1349 } | 1427 } |
| 1350 } | 1428 } |
| 1351 | 1429 |
| 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()) { | 1430 if (layer->isStackingContainer()) { |
| 1359 if (Vector<RenderLayer*>* posZOrderList = layer->posZOrderList()) { | 1431 if (Vector<RenderLayer*>* posZOrderList = layer->posZOrderList()) { |
| 1360 size_t listSize = posZOrderList->size(); | 1432 size_t listSize = posZOrderList->size(); |
| 1361 for (size_t i = 0; i < listSize; ++i) | 1433 for (size_t i = 0; i < listSize; ++i) |
| 1362 updateLayerTreeGeometry(posZOrderList->at(i), depth + 1); | 1434 updateLayerTreeGeometryForLayerAndScrollParents(posZOrderList->a t(i), visited, depth + 1); |
| 1363 } | 1435 } |
| 1364 } | 1436 } |
| 1365 } | 1437 } |
| 1366 | 1438 |
| 1367 // Recurs down the RenderLayer tree until its finds the compositing descendants of compositingAncestor and updates their geometry. | 1439 // 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) | 1440 void RenderLayerCompositor::updateCompositingDescendantGeometry(RenderLayer* com positingAncestor, RenderLayer* layer, bool compositedChildrenOnly) |
| 1369 { | 1441 { |
| 1370 if (layer != compositingAncestor) { | 1442 if (layer != compositingAncestor) { |
| 1371 if (RenderLayerBacking* layerBacking = layer->backing()) { | 1443 if (RenderLayerBacking* layerBacking = layer->backing()) { |
| 1372 layerBacking->updateCompositedBounds(); | 1444 layerBacking->updateCompositedBounds(); |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1743 | 1815 |
| 1744 return ""; | 1816 return ""; |
| 1745 } | 1817 } |
| 1746 #endif | 1818 #endif |
| 1747 | 1819 |
| 1748 // Return true if the given layer has some ancestor in the RenderLayer hierarchy that clips, | 1820 // 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 | 1821 // 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. | 1822 // 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, | 1823 // 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. | 1824 // but a sibling in the z-order hierarchy. |
| 1753 bool RenderLayerCompositor::clippedByAncestor(RenderLayer* layer) const | 1825 bool RenderLayerCompositor::clippedByAncestor(const RenderLayer* layer) const |
| 1754 { | 1826 { |
| 1755 if (!layer->isComposited() || !layer->parent()) | 1827 if (!layer->isComposited() || !layer->parent()) |
| 1756 return false; | 1828 return false; |
| 1757 | 1829 |
| 1758 RenderLayer* compositingAncestor = layer->ancestorCompositingLayer(); | 1830 // Scroll children use their scrolling ancestor as their clip root. |
| 1831 RenderLayer* compositingAncestor = requiresCompositingForOverflowScrollingPa rent(layer) | |
| 1832 ? layer->ancestorScrollingLayer() | |
| 1833 : layer->ancestorCompositingLayer(); | |
| 1834 | |
| 1759 if (!compositingAncestor) | 1835 if (!compositingAncestor) |
| 1760 return false; | 1836 return false; |
| 1761 | 1837 |
| 1762 // If the compositingAncestor clips, that will be taken care of by clipsComp ositingDescendants(), | 1838 // 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), | 1839 // so we only care about clipping between its first child that is our ancest or (the computeClipRoot), |
| 1764 // and layer. | 1840 // and layer. |
| 1765 RenderLayer* computeClipRoot = 0; | 1841 const RenderLayer* computeClipRoot = 0; |
| 1766 RenderLayer* curr = layer; | 1842 const RenderLayer* curr = layer; |
| 1767 while (curr) { | 1843 while (curr) { |
| 1768 RenderLayer* next = curr->parent(); | 1844 const RenderLayer* next = curr->parent(); |
| 1769 if (next == compositingAncestor) { | 1845 if (next == compositingAncestor) { |
| 1770 computeClipRoot = curr; | 1846 computeClipRoot = curr; |
| 1771 break; | 1847 break; |
| 1772 } | 1848 } |
| 1773 curr = next; | 1849 curr = next; |
| 1774 } | 1850 } |
| 1775 | 1851 |
| 1776 if (!computeClipRoot || computeClipRoot == layer) | 1852 if (!computeClipRoot || computeClipRoot == layer) |
| 1777 return false; | 1853 return false; |
| 1778 | 1854 |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1970 return renderer->hasFilter(); | 2046 return renderer->hasFilter(); |
| 1971 } | 2047 } |
| 1972 | 2048 |
| 1973 bool RenderLayerCompositor::requiresCompositingForBlending(RenderObject* rendere r) const | 2049 bool RenderLayerCompositor::requiresCompositingForBlending(RenderObject* rendere r) const |
| 1974 { | 2050 { |
| 1975 return renderer->hasBlendMode(); | 2051 return renderer->hasBlendMode(); |
| 1976 } | 2052 } |
| 1977 | 2053 |
| 1978 bool RenderLayerCompositor::requiresCompositingForOverflowScrollingParent(const RenderLayer* layer) const | 2054 bool RenderLayerCompositor::requiresCompositingForOverflowScrollingParent(const RenderLayer* layer) const |
| 1979 { | 2055 { |
| 1980 if (!layer->compositorDrivenAcceleratedScrollingEnabled()) | 2056 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 } | 2057 } |
| 2009 | 2058 |
| 2010 bool RenderLayerCompositor::requiresCompositingForOutOfFlowClipping(const Render Layer* layer) const | 2059 bool RenderLayerCompositor::requiresCompositingForOutOfFlowClipping(const Render Layer* layer) const |
| 2011 { | 2060 { |
| 2012 return layer->compositorDrivenAcceleratedScrollingEnabled() && layer->isUncl ippedDescendant(); | 2061 return layer->compositorDrivenAcceleratedScrollingEnabled() && layer->isUncl ippedDescendant(); |
| 2013 } | 2062 } |
| 2014 | 2063 |
| 2015 bool RenderLayerCompositor::requiresCompositingForPosition(RenderObject* rendere r, const RenderLayer* layer, RenderLayer::ViewportConstrainedNotCompositedReason * viewportConstrainedNotCompositedReason) const | 2064 bool RenderLayerCompositor::requiresCompositingForPosition(RenderObject* rendere r, const RenderLayer* layer, RenderLayer::ViewportConstrainedNotCompositedReason * viewportConstrainedNotCompositedReason) const |
| 2016 { | 2065 { |
| 2017 // position:fixed elements that create their own stacking context (e.g. have an explicit z-index, | 2066 // 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()) { | 2783 } else if (graphicsLayer == m_scrollLayer.get()) { |
| 2735 name = "Frame Scrolling Layer"; | 2784 name = "Frame Scrolling Layer"; |
| 2736 } else { | 2785 } else { |
| 2737 ASSERT_NOT_REACHED(); | 2786 ASSERT_NOT_REACHED(); |
| 2738 } | 2787 } |
| 2739 | 2788 |
| 2740 return name; | 2789 return name; |
| 2741 } | 2790 } |
| 2742 | 2791 |
| 2743 } // namespace WebCore | 2792 } // namespace WebCore |
| OLD | NEW |