| 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 1259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1270 dirtyAncestorChainVisibleDescendantStatus(); | 1270 dirtyAncestorChainVisibleDescendantStatus(); |
| 1271 | 1271 |
| 1272 if (oldChild->enclosingPaginationLayer()) | 1272 if (oldChild->enclosingPaginationLayer()) |
| 1273 oldChild->clearPaginationRecursive(); | 1273 oldChild->clearPaginationRecursive(); |
| 1274 | 1274 |
| 1275 setNeedsRepaint(); | 1275 setNeedsRepaint(); |
| 1276 | 1276 |
| 1277 return oldChild; | 1277 return oldChild; |
| 1278 } | 1278 } |
| 1279 | 1279 |
| 1280 void PaintLayer::removeOnlyThisLayer() | 1280 void PaintLayer::removeOnlyThisLayerAfterStyleChange() |
| 1281 { | 1281 { |
| 1282 if (!m_parent) | 1282 if (!m_parent) |
| 1283 return; | 1283 return; |
| 1284 | 1284 |
| 1285 bool didSetPaintInvalidation = false; |
| 1285 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 1286 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
| 1286 DisableCompositingQueryAsserts disabler; // We need the current composit
ing status. | 1287 DisableCompositingQueryAsserts disabler; // We need the current composit
ing status. |
| 1287 if (isPaintInvalidationContainer()) { | 1288 if (isPaintInvalidationContainer()) { |
| 1288 // Our children will be reparented and contained by a new paint inva
lidation container, | 1289 // Our children will be reparented and contained by a new paint inva
lidation container, |
| 1289 // so need paint invalidation. CompositingUpdate can't see this laye
r (which has been | 1290 // so need paint invalidation. CompositingUpdate can't see this laye
r (which has been |
| 1290 // removed) so won't do this for us. | 1291 // removed) so won't do this for us. |
| 1291 DisablePaintInvalidationStateAsserts disabler; | 1292 DisablePaintInvalidationStateAsserts disabler; |
| 1292 layoutObject()->invalidatePaintIncludingNonCompositingDescendants(); | 1293 layoutObject()->invalidatePaintIncludingNonCompositingDescendants(); |
| 1293 layoutObject()->setShouldDoFullPaintInvalidationIncludingNonComposit
ingDescendants(); | 1294 layoutObject()->setShouldDoFullPaintInvalidationIncludingNonComposit
ingDescendants(); |
| 1295 didSetPaintInvalidation = true; |
| 1294 } | 1296 } |
| 1295 } | 1297 } |
| 1296 | 1298 |
| 1299 if (!didSetPaintInvalidation && isSelfPaintingLayer()) { |
| 1300 if (PaintLayer* enclosingSelfPaintingLayer = m_parent->enclosingSelfPain
tingLayer()) |
| 1301 enclosingSelfPaintingLayer->mergeNeedsPaintPhaseFlagsFrom(*this); |
| 1302 } |
| 1303 |
| 1297 clipper().clearClipRectsIncludingDescendants(); | 1304 clipper().clearClipRectsIncludingDescendants(); |
| 1298 | 1305 |
| 1299 PaintLayer* nextSib = nextSibling(); | 1306 PaintLayer* nextSib = nextSibling(); |
| 1300 | 1307 |
| 1301 // Remove the child reflection layer before moving other child layers. | 1308 // Remove the child reflection layer before moving other child layers. |
| 1302 // The reflection layer should not be moved to the parent. | 1309 // The reflection layer should not be moved to the parent. |
| 1303 if (PaintLayerReflectionInfo* reflectionInfo = this->reflectionInfo()) | 1310 if (PaintLayerReflectionInfo* reflectionInfo = this->reflectionInfo()) |
| 1304 removeChild(reflectionInfo->reflectionLayer()); | 1311 removeChild(reflectionInfo->reflectionLayer()); |
| 1305 | 1312 |
| 1306 // Now walk our kids and reattach them to our parent. | 1313 // Now walk our kids and reattach them to our parent. |
| 1307 PaintLayer* current = m_first; | 1314 PaintLayer* current = m_first; |
| 1308 while (current) { | 1315 while (current) { |
| 1309 PaintLayer* next = current->nextSibling(); | 1316 PaintLayer* next = current->nextSibling(); |
| 1310 removeChild(current); | 1317 removeChild(current); |
| 1311 m_parent->addChild(current, nextSib); | 1318 m_parent->addChild(current, nextSib); |
| 1312 | 1319 |
| 1313 // FIXME: We should call a specialized version of this function. | 1320 // FIXME: We should call a specialized version of this function. |
| 1314 current->updateLayerPositionsAfterLayout(); | 1321 current->updateLayerPositionsAfterLayout(); |
| 1315 current = next; | 1322 current = next; |
| 1316 } | 1323 } |
| 1317 | 1324 |
| 1318 // Remove us from the parent. | 1325 // Remove us from the parent. |
| 1319 m_parent->removeChild(this); | 1326 m_parent->removeChild(this); |
| 1320 m_layoutObject->destroyLayer(); | 1327 m_layoutObject->destroyLayer(); |
| 1321 } | 1328 } |
| 1322 | 1329 |
| 1323 void PaintLayer::insertOnlyThisLayer() | 1330 void PaintLayer::insertOnlyThisLayerAfterStyleChange() |
| 1324 { | 1331 { |
| 1325 if (!m_parent && layoutObject()->parent()) { | 1332 if (!m_parent && layoutObject()->parent()) { |
| 1326 // We need to connect ourselves when our layoutObject() has a parent. | 1333 // We need to connect ourselves when our layoutObject() has a parent. |
| 1327 // Find our enclosingLayer and add ourselves. | 1334 // Find our enclosingLayer and add ourselves. |
| 1328 PaintLayer* parentLayer = layoutObject()->parent()->enclosingLayer(); | 1335 PaintLayer* parentLayer = layoutObject()->parent()->enclosingLayer(); |
| 1329 ASSERT(parentLayer); | 1336 ASSERT(parentLayer); |
| 1330 PaintLayer* beforeChild = !parentLayer->reflectionInfo() || parentLayer-
>reflectionInfo()->reflectionLayer() != this ? layoutObject()->parent()->findNex
tLayer(parentLayer, layoutObject()) : 0; | 1337 PaintLayer* beforeChild = !parentLayer->reflectionInfo() || parentLayer-
>reflectionInfo()->reflectionLayer() != this ? layoutObject()->parent()->findNex
tLayer(parentLayer, layoutObject()) : 0; |
| 1331 parentLayer->addChild(this, beforeChild); | 1338 parentLayer->addChild(this, beforeChild); |
| 1332 } | 1339 } |
| 1333 | 1340 |
| 1334 // Remove all descendant layers from the hierarchy and add them to the new p
osition. | 1341 // Remove all descendant layers from the hierarchy and add them to the new p
osition. |
| 1335 for (LayoutObject* curr = layoutObject()->slowFirstChild(); curr; curr = cur
r->nextSibling()) | 1342 for (LayoutObject* curr = layoutObject()->slowFirstChild(); curr; curr = cur
r->nextSibling()) |
| 1336 curr->moveLayers(m_parent, this); | 1343 curr->moveLayers(m_parent, this); |
| 1337 | 1344 |
| 1345 // If the previous paint invalidation container is not a stacking context an
d this object is |
| 1346 // stacked content, creating this layer may cause this object and its descen
dants to change |
| 1347 // paint invalidation container. |
| 1348 bool didSetPaintInvalidation = false; |
| 1349 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled() && !layoutObject()->is
LayoutView() && layoutObject()->isRooted() && layoutObject()->styleRef().isTreat
edAsOrStackingContext()) { |
| 1350 const LayoutBoxModelObject& previousPaintInvalidationContainer = layoutO
bject()->parent()->containerForPaintInvalidation(); |
| 1351 if (!previousPaintInvalidationContainer.styleRef().isStackingContext())
{ |
| 1352 layoutObject()->invalidatePaintIncludingNonSelfPaintingLayerDescenda
nts(previousPaintInvalidationContainer); |
| 1353 didSetPaintInvalidation = true; |
| 1354 } |
| 1355 } |
| 1356 |
| 1357 if (!didSetPaintInvalidation && isSelfPaintingLayer()) { |
| 1358 if (PaintLayer* enclosingSelfPaintingLayer = m_parent->enclosingSelfPain
tingLayer()) |
| 1359 mergeNeedsPaintPhaseFlagsFrom(*enclosingSelfPaintingLayer); |
| 1360 } |
| 1361 |
| 1338 // Clear out all the clip rects. | 1362 // Clear out all the clip rects. |
| 1339 clipper().clearClipRectsIncludingDescendants(); | 1363 clipper().clearClipRectsIncludingDescendants(); |
| 1340 } | 1364 } |
| 1341 | 1365 |
| 1342 // Returns the layer reached on the walk up towards the ancestor. | 1366 // Returns the layer reached on the walk up towards the ancestor. |
| 1343 static inline const PaintLayer* accumulateOffsetTowardsAncestor(const PaintLayer
* layer, const PaintLayer* ancestorLayer, LayoutPoint& location) | 1367 static inline const PaintLayer* accumulateOffsetTowardsAncestor(const PaintLayer
* layer, const PaintLayer* ancestorLayer, LayoutPoint& location) |
| 1344 { | 1368 { |
| 1345 ASSERT(ancestorLayer != layer); | 1369 ASSERT(ancestorLayer != layer); |
| 1346 | 1370 |
| 1347 const LayoutBoxModelObject* layoutObject = layer->layoutObject(); | 1371 const LayoutBoxModelObject* layoutObject = layer->layoutObject(); |
| (...skipping 1488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2836 | 2860 |
| 2837 void showLayerTree(const blink::LayoutObject* layoutObject) | 2861 void showLayerTree(const blink::LayoutObject* layoutObject) |
| 2838 { | 2862 { |
| 2839 if (!layoutObject) { | 2863 if (!layoutObject) { |
| 2840 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n"); | 2864 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n"); |
| 2841 return; | 2865 return; |
| 2842 } | 2866 } |
| 2843 showLayerTree(layoutObject->enclosingLayer()); | 2867 showLayerTree(layoutObject->enclosingLayer()); |
| 2844 } | 2868 } |
| 2845 #endif | 2869 #endif |
| OLD | NEW |