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. More specifically, | |
1053 // rebuildCompositingLayreTree will call RenderLayerBacking::updateGraphicsLayer Geometry, and it's this | |
1054 // function that will pull values from a scroll parent's graphics layers. Unfort unately, | |
1055 // the childList needs to be populated as if we'd visited all the layers in pain t order. To work around | |
1056 // this, when we visit a scroll parent out of order, we'll set its additions to childList aside (in | |
1057 // scrollParentChildLists), and add them to the real childList when we visit the scroll parent in paint | |
1058 // order. | |
1059 void RenderLayerCompositor::rebuildCompositingLayerTreeForLayerAndScrollParents( RenderLayer* curLayer, Vector<GraphicsLayer*>& childList, HashSet<RenderLayer*>& visited, HashMap<RenderLayer*, Vector<GraphicsLayer*> >& scrollParentChildLists , int depth) | |
1060 { | |
1061 ASSERT(curLayer->zIndex() >= 0 || !visited.contains(curLayer)); | |
1062 if (visited.contains(curLayer)) { | |
1063 // We've already processed this layer, but since we processed it out of order, its | |
1064 // contribution to childList was not added. We must do that now. | |
1065 HashMap<RenderLayer*, Vector<GraphicsLayer*> >::iterator it = scrollPare ntChildLists.find(curLayer); | |
1066 ASSERT(it != scrollParentChildLists.end()); | |
1067 childList.append(it->value); | |
1068 scrollParentChildLists.remove(it); | |
1069 return; | |
1070 } | |
1071 | |
1072 if (requiresCompositingForOverflowScrollingParent(curLayer)) { | |
1073 RenderLayer* scrollParent = curLayer->ancestorScrollingLayer(); | |
1074 if (!visited.contains(scrollParent)) { | |
1075 ASSERT(!scrollParentChildLists.contains(scrollParent)); | |
1076 // We will populate scrollParentChildList rather than childList, sin ce we're visiting it | |
1077 // out of order. | |
1078 Vector<GraphicsLayer*> scrollParentChildList; | |
1079 rebuildCompositingLayerTreeForLayerAndScrollParents(scrollParent, sc rollParentChildList, visited, scrollParentChildLists, depth); | |
1080 // We will set aside the scrollParentChildList in scrollParentChildL ists so that we can | |
1081 // add it to childList when we visit the scrollParent normally. | |
1082 scrollParentChildLists.add(scrollParent, scrollParentChildList); | |
1083 } | |
1084 } | |
1085 | |
1086 rebuildCompositingLayerTree(curLayer, childList, visited, depth); | |
1087 } | |
1088 | |
1089 void RenderLayerCompositor::rebuildCompositingLayerTree(RenderLayer* layer, Vect or<GraphicsLayer*>& childLayersOfEnclosingLayer, HashSet<RenderLayer*>& visited, int depth) | |
1049 { | 1090 { |
1050 // Make the layer compositing if necessary, and set up clipping and content layers. | 1091 // 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 | 1092 // 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. | 1093 // have been processed. computeCompositingRequirements() will already have d one the repaint if necessary. |
1053 | 1094 |
1054 // Used for gathering UMA data about the effect on memory usage of promoting all layers | 1095 // 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. | 1096 // that have a webkit-transition on opacity or transform and intersect the v iewport. |
1056 static double pixelsWithoutPromotingAllTransitions = 0.0; | 1097 static double pixelsWithoutPromotingAllTransitions = 0.0; |
1057 static double pixelsAddedByPromotingAllTransitions = 0.0; | 1098 static double pixelsAddedByPromotingAllTransitions = 0.0; |
1058 | 1099 |
1059 if (!depth) { | 1100 if (!depth) { |
1060 pixelsWithoutPromotingAllTransitions = 0.0; | 1101 pixelsWithoutPromotingAllTransitions = 0.0; |
1061 pixelsAddedByPromotingAllTransitions = 0.0; | 1102 pixelsAddedByPromotingAllTransitions = 0.0; |
1062 } | 1103 } |
1063 | 1104 |
1105 visited.add(layer); | |
1106 | |
1064 RenderLayerBacking* layerBacking = layer->backing(); | 1107 RenderLayerBacking* layerBacking = layer->backing(); |
1065 if (layerBacking) { | 1108 if (layerBacking) { |
1066 // The compositing state of all our children has been updated already, s o now | 1109 // 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. | 1110 // we can compute and cache the composited bounds for this layer. |
1068 layerBacking->updateCompositedBounds(); | 1111 layerBacking->updateCompositedBounds(); |
1069 | 1112 |
1070 if (RenderLayer* reflection = layer->reflectionLayer()) { | 1113 if (RenderLayer* reflection = layer->reflectionLayer()) { |
1071 if (reflection->backing()) | 1114 if (reflection->backing()) |
1072 reflection->backing()->updateCompositedBounds(); | 1115 reflection->backing()->updateCompositedBounds(); |
1073 } | 1116 } |
(...skipping 22 matching lines...) Expand all Loading... | |
1096 | 1139 |
1097 // If this layer has backing, then we are collecting its children, otherwise appending | 1140 // If this layer has backing, then we are collecting its children, otherwise appending |
1098 // to the compositing child list of an enclosing layer. | 1141 // to the compositing child list of an enclosing layer. |
1099 Vector<GraphicsLayer*> layerChildren; | 1142 Vector<GraphicsLayer*> layerChildren; |
1100 Vector<GraphicsLayer*>& childList = layerBacking ? layerChildren : childLaye rsOfEnclosingLayer; | 1143 Vector<GraphicsLayer*>& childList = layerBacking ? layerChildren : childLaye rsOfEnclosingLayer; |
1101 | 1144 |
1102 #if !ASSERT_DISABLED | 1145 #if !ASSERT_DISABLED |
1103 LayerListMutationDetector mutationChecker(layer); | 1146 LayerListMutationDetector mutationChecker(layer); |
1104 #endif | 1147 #endif |
1105 | 1148 |
1149 // Visit the normal flow descendants first. We do this for the sake of scrol l | |
1150 // parents. A scroll parent is not a stacking context, so it will either app ear | |
1151 // in the normal flow tree, or in the positive z-order list (if it had a pos itioned | |
1152 // ancestor). Visiting the scroll parent ahead of time if it appears in one | |
1153 // of these lists is a simple matter since we have the lists in hand at this | |
1154 // level of the recursion, but it's tricker for layers in the normal flow tr ee, | |
1155 // so it will be easier to just process this ahead of time. | |
1156 Vector<GraphicsLayer*> normalFlowChildList; | |
1157 | |
1158 if (Vector<RenderLayer*>* normalFlowList = layer->normalFlowList()) { | |
1159 size_t listSize = normalFlowList->size(); | |
1160 for (size_t i = 0; i < listSize; ++i) { | |
1161 RenderLayer* curLayer = normalFlowList->at(i); | |
1162 rebuildCompositingLayerTree(curLayer, normalFlowChildList, visited, depth + 1); | |
enne (OOO)
2013/09/11 23:18:30
Could you just have all layers go through rebuildC
Ian Vollick
2013/09/12 03:17:52
sgtm. Done.
| |
1163 } | |
1164 } | |
1165 | |
1166 HashMap<RenderLayer*, Vector<GraphicsLayer*> > scrollParentChildLists; | |
1106 if (layer->isStackingContainer()) { | 1167 if (layer->isStackingContainer()) { |
1107 if (Vector<RenderLayer*>* negZOrderList = layer->negZOrderList()) { | 1168 if (Vector<RenderLayer*>* negZOrderList = layer->negZOrderList()) { |
1108 size_t listSize = negZOrderList->size(); | 1169 size_t listSize = negZOrderList->size(); |
1109 for (size_t i = 0; i < listSize; ++i) { | 1170 for (size_t i = 0; i < listSize; ++i) { |
1110 RenderLayer* curLayer = negZOrderList->at(i); | 1171 RenderLayer* curLayer = negZOrderList->at(i); |
1111 rebuildCompositingLayerTree(curLayer, childList, depth + 1); | 1172 rebuildCompositingLayerTreeForLayerAndScrollParents(curLayer, ch ildList, visited, scrollParentChildLists, depth + 1); |
1112 } | 1173 } |
1113 } | 1174 } |
1114 | 1175 |
1115 // If a negative z-order child is compositing, we get a foreground layer which needs to get parented. | 1176 // If a negative z-order child is compositing, we get a foreground layer which needs to get parented. |
1116 if (layerBacking && layerBacking->foregroundLayer()) | 1177 if (layerBacking && layerBacking->foregroundLayer()) |
1117 childList.append(layerBacking->foregroundLayer()); | 1178 childList.append(layerBacking->foregroundLayer()); |
1118 } | 1179 } |
1119 | 1180 |
1120 if (Vector<RenderLayer*>* normalFlowList = layer->normalFlowList()) { | 1181 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 | 1182 |
1128 if (layer->isStackingContainer()) { | 1183 if (layer->isStackingContainer()) { |
1129 if (Vector<RenderLayer*>* posZOrderList = layer->posZOrderList()) { | 1184 if (Vector<RenderLayer*>* posZOrderList = layer->posZOrderList()) { |
1130 size_t listSize = posZOrderList->size(); | 1185 size_t listSize = posZOrderList->size(); |
1131 for (size_t i = 0; i < listSize; ++i) { | 1186 for (size_t i = 0; i < listSize; ++i) { |
1132 RenderLayer* curLayer = posZOrderList->at(i); | 1187 RenderLayer* curLayer = posZOrderList->at(i); |
1133 rebuildCompositingLayerTree(curLayer, childList, depth + 1); | 1188 rebuildCompositingLayerTreeForLayerAndScrollParents(curLayer, ch ildList, visited, scrollParentChildLists, depth + 1); |
1134 } | 1189 } |
1135 } | 1190 } |
1136 } | 1191 } |
1137 | 1192 |
1138 if (layerBacking) { | 1193 if (layerBacking) { |
1139 bool parented = false; | 1194 bool parented = false; |
1140 if (layer->renderer()->isRenderPart()) | 1195 if (layer->renderer()->isRenderPart()) |
1141 parented = parentFrameContentLayers(toRenderPart(layer->renderer())) ; | 1196 parented = parentFrameContentLayers(toRenderPart(layer->renderer())) ; |
1142 | 1197 |
1143 if (!parented) | 1198 if (!parented) |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1325 RenderLayerBacking* backing = layer->backing(); | 1380 RenderLayerBacking* backing = layer->backing(); |
1326 GraphicsLayer* hostingLayer = backing->parentForSublayers(); | 1381 GraphicsLayer* hostingLayer = backing->parentForSublayers(); |
1327 GraphicsLayer* rootLayer = innerCompositor->rootGraphicsLayer(); | 1382 GraphicsLayer* rootLayer = innerCompositor->rootGraphicsLayer(); |
1328 if (hostingLayer->children().size() != 1 || hostingLayer->children()[0] != r ootLayer) { | 1383 if (hostingLayer->children().size() != 1 || hostingLayer->children()[0] != r ootLayer) { |
1329 hostingLayer->removeAllChildren(); | 1384 hostingLayer->removeAllChildren(); |
1330 hostingLayer->addChild(rootLayer); | 1385 hostingLayer->addChild(rootLayer); |
1331 } | 1386 } |
1332 return true; | 1387 return true; |
1333 } | 1388 } |
1334 | 1389 |
1390 // The purpose of this function is to ensure that we call updateLayerTreeGeometr y on layer's | |
1391 // scroll parent (if it has one) before we call it on layer. This is necessary b ecause updating | |
1392 // layer tree geometry for layer will use values we computed for its scroll pare nt. | |
1393 void RenderLayerCompositor::updateLayerTreeGeometryForLayerAndScrollParents(Rend erLayer* layer, HashSet<RenderLayer*>& visited, int depth) | |
1394 { | |
1395 ASSERT(layer->zIndex() >= 0 || !visited.contains(layer)); | |
1396 if (visited.contains(layer)) | |
1397 return; | |
1398 | |
1399 if (requiresCompositingForOverflowScrollingParent(layer)) { | |
1400 RenderLayer* scrollParent = layer->ancestorScrollingLayer(); | |
1401 if (!visited.contains(scrollParent)) | |
1402 updateLayerTreeGeometryForLayerAndScrollParents(scrollParent, visite d, depth); | |
1403 } | |
1404 | |
1405 updateLayerTreeGeometry(layer, visited, depth); | |
1406 } | |
1335 // This just updates layer geometry without changing the hierarchy. | 1407 // This just updates layer geometry without changing the hierarchy. |
1336 void RenderLayerCompositor::updateLayerTreeGeometry(RenderLayer* layer, int dept h) | 1408 void RenderLayerCompositor::updateLayerTreeGeometry(RenderLayer* layer, HashSet< RenderLayer*>& visited, int depth) |
1337 { | 1409 { |
1410 visited.add(layer); | |
1411 | |
1338 if (RenderLayerBacking* layerBacking = layer->backing()) { | 1412 if (RenderLayerBacking* layerBacking = layer->backing()) { |
1339 // The compositing state of all our children has been updated already, s o now | 1413 // The compositing state of all our children has been updated already, s o now |
1340 // we can compute and cache the composited bounds for this layer. | 1414 // we can compute and cache the composited bounds for this layer. |
1341 layerBacking->updateCompositedBounds(); | 1415 layerBacking->updateCompositedBounds(); |
1342 | 1416 |
1343 if (RenderLayer* reflection = layer->reflectionLayer()) { | 1417 if (RenderLayer* reflection = layer->reflectionLayer()) { |
1344 if (reflection->backing()) | 1418 if (reflection->backing()) |
1345 reflection->backing()->updateCompositedBounds(); | 1419 reflection->backing()->updateCompositedBounds(); |
1346 } | 1420 } |
1347 | 1421 |
1348 layerBacking->updateGraphicsLayerConfiguration(); | 1422 layerBacking->updateGraphicsLayerConfiguration(); |
1349 layerBacking->updateGraphicsLayerGeometry(); | 1423 layerBacking->updateGraphicsLayerGeometry(); |
1350 | 1424 |
1351 if (!layer->parent()) | 1425 if (!layer->parent()) |
1352 updateRootLayerPosition(); | 1426 updateRootLayerPosition(); |
1353 | 1427 |
1354 #if !LOG_DISABLED | 1428 #if !LOG_DISABLED |
1355 logLayerInfo(layer, depth); | 1429 logLayerInfo(layer, depth); |
1356 #else | 1430 #else |
1357 UNUSED_PARAM(depth); | 1431 UNUSED_PARAM(depth); |
1358 #endif | 1432 #endif |
1359 } | 1433 } |
1360 | 1434 |
1361 #if !ASSERT_DISABLED | 1435 #if !ASSERT_DISABLED |
1362 LayerListMutationDetector mutationChecker(layer); | 1436 LayerListMutationDetector mutationChecker(layer); |
1363 #endif | 1437 #endif |
1364 | 1438 |
1439 if (Vector<RenderLayer*>* normalFlowList = layer->normalFlowList()) { | |
1440 size_t listSize = normalFlowList->size(); | |
1441 for (size_t i = 0; i < listSize; ++i) | |
1442 updateLayerTreeGeometry(normalFlowList->at(i), visited, depth + 1); | |
1443 } | |
1444 | |
1365 if (layer->isStackingContainer()) { | 1445 if (layer->isStackingContainer()) { |
1366 if (Vector<RenderLayer*>* negZOrderList = layer->negZOrderList()) { | 1446 if (Vector<RenderLayer*>* negZOrderList = layer->negZOrderList()) { |
1367 size_t listSize = negZOrderList->size(); | 1447 size_t listSize = negZOrderList->size(); |
1368 for (size_t i = 0; i < listSize; ++i) | 1448 for (size_t i = 0; i < listSize; ++i) |
1369 updateLayerTreeGeometry(negZOrderList->at(i), depth + 1); | 1449 updateLayerTreeGeometryForLayerAndScrollParents(negZOrderList->a t(i), visited, depth + 1); |
1370 } | 1450 } |
1371 } | 1451 } |
1372 | 1452 |
1373 if (Vector<RenderLayer*>* normalFlowList = layer->normalFlowList()) { | |
1374 size_t listSize = normalFlowList->size(); | |
1375 for (size_t i = 0; i < listSize; ++i) | |
1376 updateLayerTreeGeometry(normalFlowList->at(i), depth + 1); | |
1377 } | |
1378 | |
1379 if (layer->isStackingContainer()) { | 1453 if (layer->isStackingContainer()) { |
1380 if (Vector<RenderLayer*>* posZOrderList = layer->posZOrderList()) { | 1454 if (Vector<RenderLayer*>* posZOrderList = layer->posZOrderList()) { |
1381 size_t listSize = posZOrderList->size(); | 1455 size_t listSize = posZOrderList->size(); |
1382 for (size_t i = 0; i < listSize; ++i) | 1456 for (size_t i = 0; i < listSize; ++i) |
1383 updateLayerTreeGeometry(posZOrderList->at(i), depth + 1); | 1457 updateLayerTreeGeometryForLayerAndScrollParents(posZOrderList->a t(i), visited, depth + 1); |
1384 } | 1458 } |
1385 } | 1459 } |
1386 } | 1460 } |
1387 | 1461 |
1388 // Recurs down the RenderLayer tree until its finds the compositing descendants of compositingAncestor and updates their geometry. | 1462 // Recurs down the RenderLayer tree until its finds the compositing descendants of compositingAncestor and updates their geometry. |
1389 void RenderLayerCompositor::updateCompositingDescendantGeometry(RenderLayer* com positingAncestor, RenderLayer* layer, bool compositedChildrenOnly) | 1463 void RenderLayerCompositor::updateCompositingDescendantGeometry(RenderLayer* com positingAncestor, RenderLayer* layer, bool compositedChildrenOnly) |
1390 { | 1464 { |
1391 if (layer != compositingAncestor) { | 1465 if (layer != compositingAncestor) { |
1392 if (RenderLayerBacking* layerBacking = layer->backing()) { | 1466 if (RenderLayerBacking* layerBacking = layer->backing()) { |
1393 layerBacking->updateCompositedBounds(); | 1467 layerBacking->updateCompositedBounds(); |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1764 | 1838 |
1765 return ""; | 1839 return ""; |
1766 } | 1840 } |
1767 #endif | 1841 #endif |
1768 | 1842 |
1769 // Return true if the given layer has some ancestor in the RenderLayer hierarchy that clips, | 1843 // Return true if the given layer has some ancestor in the RenderLayer hierarchy that clips, |
1770 // up to the enclosing compositing ancestor. This is required because compositin g layers are parented | 1844 // up to the enclosing compositing ancestor. This is required because compositin g layers are parented |
1771 // according to the z-order hierarchy, yet clipping goes down the renderer hiera rchy. | 1845 // according to the z-order hierarchy, yet clipping goes down the renderer hiera rchy. |
1772 // Thus, a RenderLayer can be clipped by a RenderLayer that is an ancestor in th e renderer hierarchy, | 1846 // Thus, a RenderLayer can be clipped by a RenderLayer that is an ancestor in th e renderer hierarchy, |
1773 // but a sibling in the z-order hierarchy. | 1847 // but a sibling in the z-order hierarchy. |
1774 bool RenderLayerCompositor::clippedByAncestor(RenderLayer* layer) const | 1848 bool RenderLayerCompositor::clippedByAncestor(const RenderLayer* layer) const |
1775 { | 1849 { |
1776 if (!layer->isComposited() || !layer->parent()) | 1850 if (!layer->isComposited() || !layer->parent()) |
1777 return false; | 1851 return false; |
1778 | 1852 |
1779 RenderLayer* compositingAncestor = layer->ancestorCompositingLayer(); | 1853 // Scroll children use their scrolling ancestor as their clip root. |
1854 RenderLayer* compositingAncestor = requiresCompositingForOverflowScrollingPa rent(layer) | |
1855 ? layer->ancestorScrollingLayer() | |
1856 : layer->ancestorCompositingLayer(); | |
1857 | |
1780 if (!compositingAncestor) | 1858 if (!compositingAncestor) |
1781 return false; | 1859 return false; |
1782 | 1860 |
1783 // If the compositingAncestor clips, that will be taken care of by clipsComp ositingDescendants(), | 1861 // If the compositingAncestor clips, that will be taken care of by clipsComp ositingDescendants(), |
1784 // so we only care about clipping between its first child that is our ancest or (the computeClipRoot), | 1862 // so we only care about clipping between its first child that is our ancest or (the computeClipRoot), |
1785 // and layer. | 1863 // and layer. |
1786 RenderLayer* computeClipRoot = 0; | 1864 const RenderLayer* computeClipRoot = 0; |
1787 RenderLayer* curr = layer; | 1865 const RenderLayer* curr = layer; |
1788 while (curr) { | 1866 while (curr) { |
1789 RenderLayer* next = curr->parent(); | 1867 const RenderLayer* next = curr->parent(); |
1790 if (next == compositingAncestor) { | 1868 if (next == compositingAncestor) { |
1791 computeClipRoot = curr; | 1869 computeClipRoot = curr; |
1792 break; | 1870 break; |
1793 } | 1871 } |
1794 curr = next; | 1872 curr = next; |
1795 } | 1873 } |
1796 | 1874 |
1797 if (!computeClipRoot || computeClipRoot == layer) | 1875 if (!computeClipRoot || computeClipRoot == layer) |
1798 return false; | 1876 return false; |
1799 | 1877 |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1991 return renderer->hasFilter(); | 2069 return renderer->hasFilter(); |
1992 } | 2070 } |
1993 | 2071 |
1994 bool RenderLayerCompositor::requiresCompositingForBlending(RenderObject* rendere r) const | 2072 bool RenderLayerCompositor::requiresCompositingForBlending(RenderObject* rendere r) const |
1995 { | 2073 { |
1996 return renderer->hasBlendMode(); | 2074 return renderer->hasBlendMode(); |
1997 } | 2075 } |
1998 | 2076 |
1999 bool RenderLayerCompositor::requiresCompositingForOverflowScrollingParent(const RenderLayer* layer) const | 2077 bool RenderLayerCompositor::requiresCompositingForOverflowScrollingParent(const RenderLayer* layer) const |
2000 { | 2078 { |
2001 if (!layer->compositorDrivenAcceleratedScrollingEnabled()) | 2079 return !!layer->scrollParent(); |
2002 return false; | |
2003 | |
2004 // A layer scrolls with its containing block. So to find the overflow scroll ing layer | |
2005 // that we scroll with respect to, we must ascend the layer tree until we re ach the | |
2006 // first overflow scrolling div at or above our containing block. I will ref er to this | |
2007 // layer as our 'scrolling ancestor'. | |
2008 // | |
2009 // Now, if we reside in a normal flow list, then we will naturally scroll wi th our scrolling | |
2010 // ancestor, and we need not be composited. If, on the other hand, we reside in a z-order | |
2011 // list, and on our walk upwards to our scrolling ancestor we find no layer that is a stacking | |
2012 // context, then we know that in the stacking tree, we will not be in the su btree rooted at | |
2013 // our scrolling ancestor, and we will therefore not scroll with it. In this case, we must | |
2014 // be a composited layer since the compositor will need to take special meas ures to ensure | |
2015 // that we scroll with our scrolling ancestor and it cannot do this if we do not promote. | |
2016 RenderLayer* scrollParent = layer->ancestorScrollingLayer(); | |
2017 | |
2018 if (!scrollParent || scrollParent->isStackingContext()) | |
2019 return false; | |
2020 | |
2021 // If we hit a stacking context on our way up to the ancestor scrolling laye r, it will already | |
2022 // be composited due to an overflow scrolling parent, so we don't need to. | |
2023 for (RenderLayer* ancestor = layer->parent(); ancestor && ancestor != scroll Parent; ancestor = ancestor->parent()) { | |
2024 if (ancestor->isStackingContext()) | |
2025 return false; | |
2026 } | |
2027 | |
2028 return true; | |
2029 } | 2080 } |
2030 | 2081 |
2031 bool RenderLayerCompositor::requiresCompositingForOutOfFlowClipping(const Render Layer* layer) const | 2082 bool RenderLayerCompositor::requiresCompositingForOutOfFlowClipping(const Render Layer* layer) const |
2032 { | 2083 { |
2033 return layer->compositorDrivenAcceleratedScrollingEnabled() && layer->isUncl ippedDescendant(); | 2084 return layer->compositorDrivenAcceleratedScrollingEnabled() && layer->isUncl ippedDescendant(); |
2034 } | 2085 } |
2035 | 2086 |
2036 bool RenderLayerCompositor::requiresCompositingForPosition(RenderObject* rendere r, const RenderLayer* layer, RenderLayer::ViewportConstrainedNotCompositedReason * viewportConstrainedNotCompositedReason) const | 2087 bool RenderLayerCompositor::requiresCompositingForPosition(RenderObject* rendere r, const RenderLayer* layer, RenderLayer::ViewportConstrainedNotCompositedReason * viewportConstrainedNotCompositedReason) const |
2037 { | 2088 { |
2038 // position:fixed elements that create their own stacking context (e.g. have an explicit z-index, | 2089 // 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... | |
2755 } else if (graphicsLayer == m_scrollLayer.get()) { | 2806 } else if (graphicsLayer == m_scrollLayer.get()) { |
2756 name = "Frame Scrolling Layer"; | 2807 name = "Frame Scrolling Layer"; |
2757 } else { | 2808 } else { |
2758 ASSERT_NOT_REACHED(); | 2809 ASSERT_NOT_REACHED(); |
2759 } | 2810 } |
2760 | 2811 |
2761 return name; | 2812 return name; |
2762 } | 2813 } |
2763 | 2814 |
2764 } // namespace WebCore | 2815 } // namespace WebCore |
OLD | NEW |