Index: third_party/WebKit/Source/core/layout/LayoutObject.cpp |
diff --git a/third_party/WebKit/Source/core/layout/LayoutObject.cpp b/third_party/WebKit/Source/core/layout/LayoutObject.cpp |
index 3d88ac662d5321f3474c7c3bde5c182c35968670..da8a35d820792d74791eac15311111e869bc9b5b 100644 |
--- a/third_party/WebKit/Source/core/layout/LayoutObject.cpp |
+++ b/third_party/WebKit/Source/core/layout/LayoutObject.cpp |
@@ -1231,8 +1231,6 @@ void LayoutObject::invalidatePaintUsingContainer(const LayoutBoxModelObject& pai |
void LayoutObject::invalidateDisplayItemClient(const DisplayItemClient& displayItemClient) const |
{ |
- // TODO(wangxianzhu): Ensure correct bounds for the client will be or has been passed to PaintController. crbug.com/547119. |
- // Not using enclosingCompositedContainer() directly because this object may be in an orphaned subtree. |
if (PaintLayer* enclosingLayer = this->enclosingLayer()) { |
// This is valid because we want to invalidate the client in the display item list of the current backing. |
DisableCompositingQueryAsserts disabler; |
@@ -1242,19 +1240,38 @@ void LayoutObject::invalidateDisplayItemClient(const DisplayItemClient& displayI |
} |
} |
+#if ENABLE(ASSERT) |
+static void assertEnclosingSelfPaintingLayerHasSetNeedsRepaint(const LayoutObject& layoutObject) |
+{ |
+ PaintLayer* enclosingSelfPaintingLayer = nullptr; |
+ const LayoutObject* curr = &layoutObject; |
+ while (curr) { |
+ if (curr->hasLayer() && toLayoutBoxModelObject(curr)->hasSelfPaintingLayer()) { |
+ enclosingSelfPaintingLayer = toLayoutBoxModelObject(curr)->layer(); |
+ break; |
+ } |
+ // If the object has spannerPlaceholder(), it is a multicol spanner which is painted by |
+ // the layer of the placeholder instead of its own enclosing layer. |
+ curr = curr->spannerPlaceholder() ? curr->spannerPlaceholder() : curr->parent(); |
+ } |
+ ASSERT(!enclosingSelfPaintingLayer || enclosingSelfPaintingLayer->needsRepaint()); |
+} |
+#endif |
+ |
void LayoutObject::invalidateDisplayItemClients(const LayoutBoxModelObject& paintInvalidationContainer, PaintInvalidationReason invalidationReason) const |
{ |
- // It's caller's responsibility to ensure enclosingLayer's needsRepaint is set. |
- // Don't set the flag here because enclosingLayer() has cost and the caller can use |
- // various ways (e.g. PaintInvalidatinState::enclosingLayer()) to reduce the cost. |
- ASSERT(!enclosingLayer() || enclosingLayer()->needsRepaint()); |
+ // It's caller's responsibility to ensure enclosingSelfPaintingLayer's needsRepaint is set. |
+ // Don't set the flag here because getting enclosingSelfPaintLayer has cost and the caller can use |
+ // various ways (e.g. PaintInvalidatinState::enclosingSelfPaintingLayer()) to reduce the cost. |
+#if ENABLE(ASSERT) |
+ assertEnclosingSelfPaintingLayerHasSetNeedsRepaint(*this); |
+#endif |
paintInvalidationContainer.invalidateDisplayItemClientOnBacking(*this, invalidationReason); |
} |
void LayoutObject::invalidateDisplayItemClientsWithPaintInvalidationState(const LayoutBoxModelObject& paintInvalidationContainer, const PaintInvalidationState& paintInvalidationState, PaintInvalidationReason invalidationReason) const |
{ |
- ASSERT(&paintInvalidationState.enclosingLayer(*this) == enclosingLayer()); |
- paintInvalidationState.enclosingLayer(*this).setNeedsRepaint(); |
+ paintInvalidationState.enclosingSelfPaintingLayer(*this).setNeedsRepaint(); |
invalidateDisplayItemClients(paintInvalidationContainer, invalidationReason); |
} |
@@ -1389,6 +1406,12 @@ inline void LayoutObject::invalidateSelectionIfNeeded(const LayoutBoxModelObject |
PaintInvalidationReason LayoutObject::invalidatePaintIfNeeded(PaintInvalidationState& paintInvalidationState, const LayoutBoxModelObject& paintInvalidationContainer) |
{ |
+ if (styleRef().hasOutline()) { |
+ PaintLayer& layer = paintInvalidationState.enclosingSelfPaintingLayer(*this); |
+ if (layer.layoutObject() != this) |
+ layer.setNeedsPaintPhaseDescendantOutlines(); |
+ } |
+ |
LayoutView* v = view(); |
if (v->document().printing()) |
return PaintInvalidationNone; // Don't invalidate paints if we're printing. |
@@ -3418,10 +3441,12 @@ void LayoutObject::invalidateDisplayItemClientsIncludingNonCompositingDescendant |
void LayoutObject::invalidatePaintOfPreviousPaintInvalidationRect(const LayoutBoxModelObject& paintInvalidationContainer, PaintInvalidationReason reason) |
{ |
- // It's caller's responsibility to ensure enclosingLayer's needsRepaint is set. |
- // Don't set the flag here because enclosingLayer() has cost and the caller can use |
- // various ways (e.g. PaintInvalidatinState::enclosingLayer()) to reduce the cost. |
- ASSERT(!enclosingLayer() || enclosingLayer()->needsRepaint()); |
+ // It's caller's responsibility to ensure enclosingSelfPaintingLayer's needsRepaint is set. |
+ // Don't set the flag here because getting enclosingSelfPaintLayer has cost and the caller can use |
+ // various ways (e.g. PaintInvalidatinState::enclosingSelfPaintingLayer()) to reduce the cost. |
+#if ENABLE(ASSERT) |
+ assertEnclosingSelfPaintingLayerHasSetNeedsRepaint(*this); |
+#endif |
// These disablers are valid because we want to use the current compositing/invalidation status. |
DisablePaintInvalidationStateAsserts invalidationDisabler; |