Chromium Code Reviews| 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 1239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1250 setNeedsRepaint(); | 1250 setNeedsRepaint(); |
| 1251 | 1251 |
| 1252 return oldChild; | 1252 return oldChild; |
| 1253 } | 1253 } |
| 1254 | 1254 |
| 1255 void PaintLayer::removeOnlyThisLayer() | 1255 void PaintLayer::removeOnlyThisLayer() |
| 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()) { | |
|
pdr.
2016/04/08 19:46:07
Could we just check "if (!needsRepaint() && isSelf
Xianzhu
2016/04/08 21:30:55
No. First, needsRepaint flag is set during paint i
| |
| 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::insertOnlyThisLayer() |
|
pdr.
2016/04/08 19:46:07
LayoutObject::insertedIntoTree (which calls blink:
Xianzhu
2016/04/08 21:30:56
Yes.
| |
| 1299 { | 1306 { |
| 1307 // If the current paint invalidation container is not a stacking context and this object is | |
| 1308 // stacked content, creating this layer may cause this object and its | |
| 1309 // descendants to change paint invalidation container. Therefore we must eag erly invalidate | |
| 1310 // them on the original paint invalidation container before creating the lay er. | |
| 1311 bool didSetPaintInvalidation = false; | |
| 1312 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled() && layoutObject()->isR ooted() && layoutObject()->styleRef().isStacked()) { | |
| 1313 const LayoutBoxModelObject& currentPaintInvalidationContainer = layoutOb ject()->containerForPaintInvalidation(); | |
| 1314 if (!currentPaintInvalidationContainer.styleRef().isStackingContext()) { | |
| 1315 layoutObject()->invalidatePaintIncludingNonSelfPaintingLayerDescenda nts(currentPaintInvalidationContainer); | |
| 1316 didSetPaintInvalidation = true; | |
| 1317 } | |
| 1318 } | |
| 1319 | |
| 1300 if (!m_parent && layoutObject()->parent()) { | 1320 if (!m_parent && layoutObject()->parent()) { |
| 1301 // We need to connect ourselves when our layoutObject() has a parent. | 1321 // We need to connect ourselves when our layoutObject() has a parent. |
| 1302 // Find our enclosingLayer and add ourselves. | 1322 // Find our enclosingLayer and add ourselves. |
| 1303 PaintLayer* parentLayer = layoutObject()->parent()->enclosingLayer(); | 1323 PaintLayer* parentLayer = layoutObject()->parent()->enclosingLayer(); |
| 1304 ASSERT(parentLayer); | 1324 ASSERT(parentLayer); |
| 1305 PaintLayer* beforeChild = !parentLayer->reflectionInfo() || parentLayer- >reflectionInfo()->reflectionLayer() != this ? layoutObject()->parent()->findNex tLayer(parentLayer, layoutObject()) : 0; | 1325 PaintLayer* beforeChild = !parentLayer->reflectionInfo() || parentLayer- >reflectionInfo()->reflectionLayer() != this ? layoutObject()->parent()->findNex tLayer(parentLayer, layoutObject()) : 0; |
| 1306 parentLayer->addChild(this, beforeChild); | 1326 parentLayer->addChild(this, beforeChild); |
| 1307 } | 1327 } |
| 1308 | 1328 |
| 1329 if (!didSetPaintInvalidation && isSelfPaintingLayer()) { | |
| 1330 if (PaintLayer* enclosingSelfPaintingLayer = m_parent->enclosingSelfPain tingLayer()) | |
|
pdr.
2016/04/08 19:46:07
Similar to my comment in LayoutBoxModelObject::cre
Xianzhu
2016/04/08 21:30:55
Yes, because here it's using m_parent->.
| |
| 1331 mergeNeedsPaintPhaseFlagsFrom(*enclosingSelfPaintingLayer); | |
| 1332 } | |
| 1333 | |
| 1309 // Remove all descendant layers from the hierarchy and add them to the new p osition. | 1334 // 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()) | 1335 for (LayoutObject* curr = layoutObject()->slowFirstChild(); curr; curr = cur r->nextSibling()) |
| 1311 curr->moveLayers(m_parent, this); | 1336 curr->moveLayers(m_parent, this); |
| 1312 | 1337 |
| 1313 // Clear out all the clip rects. | 1338 // Clear out all the clip rects. |
| 1314 clipper().clearClipRectsIncludingDescendants(); | 1339 clipper().clearClipRectsIncludingDescendants(); |
| 1315 } | 1340 } |
| 1316 | 1341 |
| 1317 // Returns the layer reached on the walk up towards the ancestor. | 1342 // 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) | 1343 static inline const PaintLayer* accumulateOffsetTowardsAncestor(const PaintLayer * layer, const PaintLayer* ancestorLayer, LayoutPoint& location) |
| (...skipping 1559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2878 | 2903 |
| 2879 void showLayerTree(const blink::LayoutObject* layoutObject) | 2904 void showLayerTree(const blink::LayoutObject* layoutObject) |
| 2880 { | 2905 { |
| 2881 if (!layoutObject) { | 2906 if (!layoutObject) { |
| 2882 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n"); | 2907 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n"); |
| 2883 return; | 2908 return; |
| 2884 } | 2909 } |
| 2885 showLayerTree(layoutObject->enclosingLayer()); | 2910 showLayerTree(layoutObject->enclosingLayer()); |
| 2886 } | 2911 } |
| 2887 #endif | 2912 #endif |
| OLD | NEW |