Chromium Code Reviews| Index: third_party/WebKit/Source/core/paint/PaintLayer.cpp |
| diff --git a/third_party/WebKit/Source/core/paint/PaintLayer.cpp b/third_party/WebKit/Source/core/paint/PaintLayer.cpp |
| index 5eed81877f073cfb7a536b2120991c542dc3b312..ea7fb5c09c7a28754151381bec080c5fb2124ff5 100644 |
| --- a/third_party/WebKit/Source/core/paint/PaintLayer.cpp |
| +++ b/third_party/WebKit/Source/core/paint/PaintLayer.cpp |
| @@ -1257,6 +1257,7 @@ void PaintLayer::removeOnlyThisLayer() |
| if (!m_parent) |
| return; |
| + bool didSetPaintInvalidation = false; |
| if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
| DisableCompositingQueryAsserts disabler; // We need the current compositing status. |
| if (isPaintInvalidationContainer()) { |
| @@ -1266,9 +1267,15 @@ void PaintLayer::removeOnlyThisLayer() |
| DisablePaintInvalidationStateAsserts disabler; |
| layoutObject()->invalidatePaintIncludingNonCompositingDescendants(); |
| layoutObject()->setShouldDoFullPaintInvalidationIncludingNonCompositingDescendants(); |
| + didSetPaintInvalidation = true; |
| } |
| } |
| + 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
|
| + if (PaintLayer* enclosingSelfPaintingLayer = m_parent->enclosingSelfPaintingLayer()) |
| + enclosingSelfPaintingLayer->mergeNeedsPaintPhaseFlagsFrom(*this); |
| + } |
| + |
| clipper().clearClipRectsIncludingDescendants(); |
| PaintLayer* nextSib = nextSibling(); |
| @@ -1297,6 +1304,19 @@ void PaintLayer::removeOnlyThisLayer() |
| void PaintLayer::insertOnlyThisLayer() |
|
pdr.
2016/04/08 19:46:07
LayoutObject::insertedIntoTree (which calls blink:
Xianzhu
2016/04/08 21:30:56
Yes.
|
| { |
| + // If the current paint invalidation container is not a stacking context and this object is |
| + // stacked content, creating this layer may cause this object and its |
| + // descendants to change paint invalidation container. Therefore we must eagerly invalidate |
| + // them on the original paint invalidation container before creating the layer. |
| + bool didSetPaintInvalidation = false; |
| + if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled() && layoutObject()->isRooted() && layoutObject()->styleRef().isStacked()) { |
| + const LayoutBoxModelObject& currentPaintInvalidationContainer = layoutObject()->containerForPaintInvalidation(); |
| + if (!currentPaintInvalidationContainer.styleRef().isStackingContext()) { |
| + layoutObject()->invalidatePaintIncludingNonSelfPaintingLayerDescendants(currentPaintInvalidationContainer); |
| + didSetPaintInvalidation = true; |
| + } |
| + } |
| + |
| if (!m_parent && layoutObject()->parent()) { |
| // We need to connect ourselves when our layoutObject() has a parent. |
| // Find our enclosingLayer and add ourselves. |
| @@ -1306,6 +1326,11 @@ void PaintLayer::insertOnlyThisLayer() |
| parentLayer->addChild(this, beforeChild); |
| } |
| + if (!didSetPaintInvalidation && isSelfPaintingLayer()) { |
| + if (PaintLayer* enclosingSelfPaintingLayer = m_parent->enclosingSelfPaintingLayer()) |
|
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->.
|
| + mergeNeedsPaintPhaseFlagsFrom(*enclosingSelfPaintingLayer); |
| + } |
| + |
| // Remove all descendant layers from the hierarchy and add them to the new position. |
| for (LayoutObject* curr = layoutObject()->slowFirstChild(); curr; curr = curr->nextSibling()) |
| curr->moveLayers(m_parent, this); |