| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights
reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights
reserved. |
| 3 * | 3 * |
| 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. | 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. |
| 5 * | 5 * |
| 6 * Other contributors: | 6 * Other contributors: |
| 7 * Robert O'Callahan <roc+@cs.cmu.edu> | 7 * Robert O'Callahan <roc+@cs.cmu.edu> |
| 8 * David Baron <dbaron@fas.harvard.edu> | 8 * David Baron <dbaron@fas.harvard.edu> |
| 9 * Christian Biesinger <cbiesinger@web.de> | 9 * Christian Biesinger <cbiesinger@web.de> |
| 10 * Randall Jesup <rjesup@wgate.com> | 10 * Randall Jesup <rjesup@wgate.com> |
| (...skipping 1234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1245 dirtyAncestorChainVisibleDescendantStatus(); | 1245 dirtyAncestorChainVisibleDescendantStatus(); |
| 1246 | 1246 |
| 1247 if (oldChild->enclosingPaginationLayer()) | 1247 if (oldChild->enclosingPaginationLayer()) |
| 1248 oldChild->clearPaginationRecursive(); | 1248 oldChild->clearPaginationRecursive(); |
| 1249 | 1249 |
| 1250 setNeedsRepaint(); | 1250 setNeedsRepaint(); |
| 1251 | 1251 |
| 1252 return oldChild; | 1252 return oldChild; |
| 1253 } | 1253 } |
| 1254 | 1254 |
| 1255 void PaintLayer::removeOnlyThisLayer() | 1255 void PaintLayer::removeOnlyThisLayerAfterStyleChange() |
| 1256 { | 1256 { |
| 1257 if (!m_parent) | 1257 if (!m_parent) |
| 1258 return; | 1258 return; |
| 1259 | 1259 |
| 1260 bool didSetPaintInvalidation = false; |
| 1260 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 1261 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
| 1261 DisableCompositingQueryAsserts disabler; // We need the current composit
ing status. | 1262 DisableCompositingQueryAsserts disabler; // We need the current composit
ing status. |
| 1262 if (isPaintInvalidationContainer()) { | 1263 if (isPaintInvalidationContainer()) { |
| 1263 // Our children will be reparented and contained by a new paint inva
lidation container, | 1264 // Our children will be reparented and contained by a new paint inva
lidation container, |
| 1264 // so need paint invalidation. CompositingUpdate can't see this laye
r (which has been | 1265 // so need paint invalidation. CompositingUpdate can't see this laye
r (which has been |
| 1265 // removed) so won't do this for us. | 1266 // removed) so won't do this for us. |
| 1266 DisablePaintInvalidationStateAsserts disabler; | 1267 DisablePaintInvalidationStateAsserts disabler; |
| 1267 layoutObject()->invalidatePaintIncludingNonCompositingDescendants(); | 1268 layoutObject()->invalidatePaintIncludingNonCompositingDescendants(); |
| 1268 layoutObject()->setShouldDoFullPaintInvalidationIncludingNonComposit
ingDescendants(); | 1269 layoutObject()->setShouldDoFullPaintInvalidationIncludingNonComposit
ingDescendants(); |
| 1270 didSetPaintInvalidation = true; |
| 1269 } | 1271 } |
| 1270 } | 1272 } |
| 1271 | 1273 |
| 1274 if (!didSetPaintInvalidation && isSelfPaintingLayer()) { |
| 1275 if (PaintLayer* enclosingSelfPaintingLayer = m_parent->enclosingSelfPain
tingLayer()) |
| 1276 enclosingSelfPaintingLayer->mergeNeedsPaintPhaseFlagsFrom(*this); |
| 1277 } |
| 1278 |
| 1272 clipper().clearClipRectsIncludingDescendants(); | 1279 clipper().clearClipRectsIncludingDescendants(); |
| 1273 | 1280 |
| 1274 PaintLayer* nextSib = nextSibling(); | 1281 PaintLayer* nextSib = nextSibling(); |
| 1275 | 1282 |
| 1276 // Remove the child reflection layer before moving other child layers. | 1283 // Remove the child reflection layer before moving other child layers. |
| 1277 // The reflection layer should not be moved to the parent. | 1284 // The reflection layer should not be moved to the parent. |
| 1278 if (PaintLayerReflectionInfo* reflectionInfo = this->reflectionInfo()) | 1285 if (PaintLayerReflectionInfo* reflectionInfo = this->reflectionInfo()) |
| 1279 removeChild(reflectionInfo->reflectionLayer()); | 1286 removeChild(reflectionInfo->reflectionLayer()); |
| 1280 | 1287 |
| 1281 // Now walk our kids and reattach them to our parent. | 1288 // Now walk our kids and reattach them to our parent. |
| 1282 PaintLayer* current = m_first; | 1289 PaintLayer* current = m_first; |
| 1283 while (current) { | 1290 while (current) { |
| 1284 PaintLayer* next = current->nextSibling(); | 1291 PaintLayer* next = current->nextSibling(); |
| 1285 removeChild(current); | 1292 removeChild(current); |
| 1286 m_parent->addChild(current, nextSib); | 1293 m_parent->addChild(current, nextSib); |
| 1287 | 1294 |
| 1288 // FIXME: We should call a specialized version of this function. | 1295 // FIXME: We should call a specialized version of this function. |
| 1289 current->updateLayerPositionsAfterLayout(); | 1296 current->updateLayerPositionsAfterLayout(); |
| 1290 current = next; | 1297 current = next; |
| 1291 } | 1298 } |
| 1292 | 1299 |
| 1293 // Remove us from the parent. | 1300 // Remove us from the parent. |
| 1294 m_parent->removeChild(this); | 1301 m_parent->removeChild(this); |
| 1295 m_layoutObject->destroyLayer(); | 1302 m_layoutObject->destroyLayer(); |
| 1296 } | 1303 } |
| 1297 | 1304 |
| 1298 void PaintLayer::insertOnlyThisLayer() | 1305 void PaintLayer::insertOnlyThisLayerAfterStyleChange() |
| 1299 { | 1306 { |
| 1300 if (!m_parent && layoutObject()->parent()) { | 1307 if (!m_parent && layoutObject()->parent()) { |
| 1301 // We need to connect ourselves when our layoutObject() has a parent. | 1308 // We need to connect ourselves when our layoutObject() has a parent. |
| 1302 // Find our enclosingLayer and add ourselves. | 1309 // Find our enclosingLayer and add ourselves. |
| 1303 PaintLayer* parentLayer = layoutObject()->parent()->enclosingLayer(); | 1310 PaintLayer* parentLayer = layoutObject()->parent()->enclosingLayer(); |
| 1304 ASSERT(parentLayer); | 1311 ASSERT(parentLayer); |
| 1305 PaintLayer* beforeChild = !parentLayer->reflectionInfo() || parentLayer-
>reflectionInfo()->reflectionLayer() != this ? layoutObject()->parent()->findNex
tLayer(parentLayer, layoutObject()) : 0; | 1312 PaintLayer* beforeChild = !parentLayer->reflectionInfo() || parentLayer-
>reflectionInfo()->reflectionLayer() != this ? layoutObject()->parent()->findNex
tLayer(parentLayer, layoutObject()) : 0; |
| 1306 parentLayer->addChild(this, beforeChild); | 1313 parentLayer->addChild(this, beforeChild); |
| 1307 } | 1314 } |
| 1308 | 1315 |
| 1309 // Remove all descendant layers from the hierarchy and add them to the new p
osition. | 1316 // Remove all descendant layers from the hierarchy and add them to the new p
osition. |
| 1310 for (LayoutObject* curr = layoutObject()->slowFirstChild(); curr; curr = cur
r->nextSibling()) | 1317 for (LayoutObject* curr = layoutObject()->slowFirstChild(); curr; curr = cur
r->nextSibling()) |
| 1311 curr->moveLayers(m_parent, this); | 1318 curr->moveLayers(m_parent, this); |
| 1312 | 1319 |
| 1320 // If the previous paint invalidation container is not a stacking context an
d this object is |
| 1321 // stacked content, creating this layer may cause this object and its descen
dants to change |
| 1322 // paint invalidation container. |
| 1323 bool didSetPaintInvalidation = false; |
| 1324 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled() && !layoutObject()->is
LayoutView() && layoutObject()->isRooted() && layoutObject()->styleRef().isStack
ed()) { |
| 1325 const LayoutBoxModelObject& previousPaintInvalidationContainer = layoutO
bject()->parent()->containerForPaintInvalidation(); |
| 1326 if (!previousPaintInvalidationContainer.styleRef().isStackingContext())
{ |
| 1327 layoutObject()->invalidatePaintIncludingNonSelfPaintingLayerDescenda
nts(previousPaintInvalidationContainer); |
| 1328 didSetPaintInvalidation = true; |
| 1329 } |
| 1330 } |
| 1331 |
| 1332 if (!didSetPaintInvalidation && isSelfPaintingLayer()) { |
| 1333 if (PaintLayer* enclosingSelfPaintingLayer = m_parent->enclosingSelfPain
tingLayer()) |
| 1334 mergeNeedsPaintPhaseFlagsFrom(*enclosingSelfPaintingLayer); |
| 1335 } |
| 1336 |
| 1313 // Clear out all the clip rects. | 1337 // Clear out all the clip rects. |
| 1314 clipper().clearClipRectsIncludingDescendants(); | 1338 clipper().clearClipRectsIncludingDescendants(); |
| 1315 } | 1339 } |
| 1316 | 1340 |
| 1317 // Returns the layer reached on the walk up towards the ancestor. | 1341 // Returns the layer reached on the walk up towards the ancestor. |
| 1318 static inline const PaintLayer* accumulateOffsetTowardsAncestor(const PaintLayer
* layer, const PaintLayer* ancestorLayer, LayoutPoint& location) | 1342 static inline const PaintLayer* accumulateOffsetTowardsAncestor(const PaintLayer
* layer, const PaintLayer* ancestorLayer, LayoutPoint& location) |
| 1319 { | 1343 { |
| 1320 ASSERT(ancestorLayer != layer); | 1344 ASSERT(ancestorLayer != layer); |
| 1321 | 1345 |
| 1322 const LayoutBoxModelObject* layoutObject = layer->layoutObject(); | 1346 const LayoutBoxModelObject* layoutObject = layer->layoutObject(); |
| (...skipping 1555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2878 | 2902 |
| 2879 void showLayerTree(const blink::LayoutObject* layoutObject) | 2903 void showLayerTree(const blink::LayoutObject* layoutObject) |
| 2880 { | 2904 { |
| 2881 if (!layoutObject) { | 2905 if (!layoutObject) { |
| 2882 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n"); | 2906 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n"); |
| 2883 return; | 2907 return; |
| 2884 } | 2908 } |
| 2885 showLayerTree(layoutObject->enclosingLayer()); | 2909 showLayerTree(layoutObject->enclosingLayer()); |
| 2886 } | 2910 } |
| 2887 #endif | 2911 #endif |
| OLD | NEW |