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