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 33ebe5d70e5514d82cfa6dbdc943c3469146d4cd..1923fa81118bb5eee968a04893cdeb07e8ec8f87 100644 |
--- a/third_party/WebKit/Source/core/layout/LayoutObject.cpp |
+++ b/third_party/WebKit/Source/core/layout/LayoutObject.cpp |
@@ -1194,8 +1194,8 @@ static void invalidatePaintRectangleOnWindow(const LayoutBoxModelObject& paintIn |
void LayoutObject::invalidatePaintUsingContainer(const LayoutBoxModelObject& paintInvalidationContainer, const LayoutRect& dirtyRect, PaintInvalidationReason invalidationReason) const |
{ |
- if (RuntimeEnabledFeatures::slimmingPaintSynchronizedPaintingEnabled()) |
- return; |
+ // TODO(wangxianzhu): Enable the following assert after paint invalidation for spv2 is ready. |
+ // ASSERT(!RuntimeEnabledFeatures::slimmingPaintV2Enabled()); |
if (paintInvalidationContainer.frameView()->shouldThrottleRendering()) |
return; |
@@ -1227,22 +1227,20 @@ void LayoutObject::invalidatePaintUsingContainer(const LayoutBoxModelObject& pai |
void LayoutObject::invalidateDisplayItemClient(const DisplayItemClientWrapper& displayItemClient) const |
{ |
+ // TODO(wangxianzhu): Ensure correct bounds for the client will be or has been passed to PaintController. |
// 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; |
- // Only the object needs to be invalidated, so use an empty invalidation rect. |
- LayoutRect invalidationRect; |
if (const PaintLayer* paintInvalidationLayer = enclosingLayer->enclosingLayerForPaintInvalidationCrossingFrameBoundaries()) |
- paintInvalidationLayer->layoutObject()->invalidateDisplayItemClientOnBacking(displayItemClient, PaintInvalidationFull, invalidationRect, invalidationRect); |
- |
+ paintInvalidationLayer->layoutObject()->invalidateDisplayItemClientOnBacking(displayItemClient, PaintInvalidationFull, nullptr); |
enclosingLayer->setNeedsRepaint(); |
} |
} |
-void LayoutObject::invalidateDisplayItemClients(const LayoutBoxModelObject& paintInvalidationContainer, PaintInvalidationReason invalidationReason, const LayoutRect& previousPaintInvalidationRect, const LayoutRect& newPaintInvalidationRect) const |
+void LayoutObject::invalidateDisplayItemClients(const LayoutBoxModelObject& paintInvalidationContainer, PaintInvalidationReason invalidationReason, const LayoutRect* paintInvalidationRect) const |
{ |
- paintInvalidationContainer.invalidateDisplayItemClientOnBacking(*this, invalidationReason, previousPaintInvalidationRect, newPaintInvalidationRect); |
+ paintInvalidationContainer.invalidateDisplayItemClientOnBacking(*this, invalidationReason, paintInvalidationRect); |
if (PaintLayer* enclosingLayer = this->enclosingLayer()) |
enclosingLayer->setNeedsRepaint(); |
@@ -1255,7 +1253,7 @@ LayoutRect LayoutObject::boundsRectForPaintInvalidation(const LayoutBoxModelObje |
return PaintLayer::computePaintInvalidationRect(this, paintInvalidationContainer->layer(), paintInvalidationState); |
} |
-const LayoutBoxModelObject* LayoutObject::invalidatePaintRectangleInternal(LayoutRect& dirtyRect) const |
+const LayoutBoxModelObject* LayoutObject::invalidatePaintRectangleInternal(const LayoutRect& dirtyRect) const |
{ |
RELEASE_ASSERT(isRooted()); |
@@ -1266,26 +1264,25 @@ const LayoutBoxModelObject* LayoutObject::invalidatePaintRectangleInternal(Layou |
return nullptr; // Don't invalidate paints if we're printing. |
const LayoutBoxModelObject& paintInvalidationContainer = containerForPaintInvalidationOnRootedTree(); |
- PaintLayer::mapRectToPaintInvalidationBacking(this, &paintInvalidationContainer, dirtyRect); |
- invalidatePaintUsingContainer(paintInvalidationContainer, dirtyRect, PaintInvalidationRectangle); |
+ LayoutRect dirtyRectOnBacking = dirtyRect; |
+ PaintLayer::mapRectToPaintInvalidationBacking(this, &paintInvalidationContainer, dirtyRectOnBacking); |
+ invalidatePaintUsingContainer(paintInvalidationContainer, dirtyRectOnBacking, PaintInvalidationRectangle); |
+ |
+ if (PaintLayer* enclosingLayer = this->enclosingLayer()) |
chrishtr
2015/10/23 17:15:07
Why this change? Don't remember if I already asked
Xianzhu
2015/10/23 18:43:27
This should not be there. This should be done by i
|
+ enclosingLayer->setNeedsRepaint(); |
+ |
return &paintInvalidationContainer; |
} |
void LayoutObject::invalidatePaintRectangle(const LayoutRect& rect) const |
{ |
- LayoutRect dirtyRect(rect); |
- const LayoutBoxModelObject* paintInvalidationContainer = invalidatePaintRectangleInternal(dirtyRect); |
+ const LayoutBoxModelObject* paintInvalidationContainer = invalidatePaintRectangleInternal(rect); |
if (paintInvalidationContainer) { |
- invalidateDisplayItemClients(*paintInvalidationContainer, PaintInvalidationRectangle, dirtyRect, dirtyRect); |
+ // Don't need to change the paint invalidation bounds of the client, so pass nullptr. |
+ invalidateDisplayItemClients(*paintInvalidationContainer, PaintInvalidationRectangle, nullptr); |
} |
} |
-void LayoutObject::invalidatePaintRectangleNotInvalidatingDisplayItemClients(const LayoutRect& r) const |
-{ |
- LayoutRect dirtyRect(r); |
- invalidatePaintRectangleInternal(dirtyRect); |
-} |
- |
void LayoutObject::invalidateTreeIfNeeded(PaintInvalidationState& paintInvalidationState) |
{ |
ASSERT(!needsLayout()); |
@@ -1371,7 +1368,7 @@ inline void LayoutObject::invalidateSelectionIfNeeded(const LayoutBoxModelObject |
setPreviousSelectionRectForPaintInvalidation(newSelectionRect); |
if (shouldInvalidateSelection()) |
- invalidateDisplayItemClients(paintInvalidationContainer, PaintInvalidationSelection, oldSelectionRect, newSelectionRect); |
+ invalidateDisplayItemClients(paintInvalidationContainer, PaintInvalidationSelection, nullptr); |
if (fullInvalidation) |
return; |
@@ -1429,12 +1426,12 @@ PaintInvalidationReason LayoutObject::invalidatePaintIfNeeded(PaintInvalidationS |
// invalidation is issued. See crbug.com/508383 and crbug.com/515977. |
// This is a workaround to force display items to update paint offset. |
if (!RuntimeEnabledFeatures::slimmingPaintOffsetCachingEnabled() && paintInvalidationState.forcedSubtreeInvalidationWithinContainer()) |
- invalidateDisplayItemClients(paintInvalidationContainer, invalidationReason, oldBounds, newBounds); |
+ invalidateDisplayItemClients(paintInvalidationContainer, invalidationReason, &newBounds); |
return invalidationReason; |
} |
- invalidateDisplayItemClients(paintInvalidationContainer, invalidationReason, oldBounds, newBounds); |
+ invalidateDisplayItemClients(paintInvalidationContainer, invalidationReason, &newBounds); |
if (invalidationReason == PaintInvalidationIncremental) { |
incrementallyInvalidatePaint(paintInvalidationContainer, oldBounds, newBounds, newLocation); |
@@ -1446,29 +1443,6 @@ PaintInvalidationReason LayoutObject::invalidatePaintIfNeeded(PaintInvalidationS |
return invalidationReason; |
} |
-void LayoutObject::invalidatePaintIfNeededForSynchronizedPainting(const PaintInfo& paintInfo) |
-{ |
- ASSERT(RuntimeEnabledFeatures::slimmingPaintSynchronizedPaintingEnabled()); |
- ASSERT(document().lifecycle().state() == DocumentLifecycle::InPaint); |
- ASSERT(paintInfo.paintInvalidationState); |
- ASSERT(paintInfo.paintContainer()); |
- |
- PaintController& paintController = paintInfo.context->paintController(); |
- if (paintController.clientHasCheckedPaintInvalidation(displayItemClient())) { |
- ASSERT(paintController.clientCacheIsValid(displayItemClient()) |
- == (invalidatePaintIfNeeded(*paintInfo.paintInvalidationState, *paintInfo.paintContainer()) == PaintInvalidationNone)); |
- return; |
- } |
- |
- PaintInvalidationReason reason = invalidatePaintIfNeeded(*paintInfo.paintInvalidationState, *paintInfo.paintContainer()); |
- clearPaintInvalidationState(*paintInfo.paintInvalidationState); |
- |
- if (reason == PaintInvalidationDelayedFull) |
- paintInfo.paintInvalidationState->pushDelayedPaintInvalidationTarget(*this); |
- |
- paintController.setClientHasCheckedPaintInvalidation(displayItemClient()); |
-} |
- |
PaintInvalidationReason LayoutObject::paintInvalidationReason(const LayoutBoxModelObject& paintInvalidationContainer, |
const LayoutRect& oldBounds, const LayoutPoint& oldPositionFromPaintInvalidationBacking, |
const LayoutRect& newBounds, const LayoutPoint& newPositionFromPaintInvalidationBacking) const |
@@ -3364,10 +3338,12 @@ void traverseNonCompositingDescendants(LayoutObject& object, const LayoutObjectT |
void LayoutObject::invalidateDisplayItemClientForNonCompositingDescendantsOf(const LayoutObject& object) const |
{ |
// Not using enclosingCompositedContainer() directly because this object may be in an orphaned subtree. |
- const PaintLayer* enclosingLayer = this->enclosingLayer(); |
+ PaintLayer* enclosingLayer = this->enclosingLayer(); |
if (!enclosingLayer) |
return; |
+ enclosingLayer->setNeedsRepaint(); |
chrishtr
2015/10/23 17:15:07
Same question here.
Xianzhu
2015/10/23 18:43:27
This is needed for now for custom scrollbar parts
|
+ |
// This is valid because we want to invalidate the client in the display item list of the current backing. |
DisableCompositingQueryAsserts disabler; |
const PaintLayer* paintInvalidationLayer = enclosingLayer->enclosingLayerForPaintInvalidationCrossingFrameBoundaries(); |
@@ -3379,9 +3355,8 @@ void LayoutObject::invalidateDisplayItemClientForNonCompositingDescendantsOf(con |
explicit Functor(const LayoutBoxModelObject& paintInvalidationContainer) : m_paintInvalidationContainer(paintInvalidationContainer) { } |
void operator()(LayoutObject& object) const override |
{ |
- // Only the objects need to be invalidated, not any paint rectangles. |
- LayoutRect invalidationRect; |
- object.invalidateDisplayItemClients(m_paintInvalidationContainer, PaintInvalidationFull, invalidationRect, invalidationRect); |
+ // TODO(wangxianzhu): Ensure correct bounds for the client will be or has been passed to PaintController. |
+ object.invalidateDisplayItemClients(m_paintInvalidationContainer, PaintInvalidationFull, nullptr); |
} |
private: |
const LayoutBoxModelObject& m_paintInvalidationContainer; |
@@ -3400,7 +3375,10 @@ void LayoutObject::invalidatePaintOfPreviousPaintInvalidationRect(const LayoutBo |
LayoutRect invalidationRect = previousPaintInvalidationRect(); |
adjustInvalidationRectForCompositedScrolling(invalidationRect, paintInvalidationContainer); |
invalidatePaintUsingContainer(paintInvalidationContainer, invalidationRect, PaintInvalidationLayer); |
- invalidateDisplayItemClients(paintInvalidationContainer, PaintInvalidationLayer, invalidationRect, invalidationRect); |
+ |
+ // The PaintController may have changed. Pass the previous paint invalidation rect to the new PaintController. |
+ // The rect will be updated if it changes during the next paint invalidation. |
+ invalidateDisplayItemClients(paintInvalidationContainer, PaintInvalidationLayer, &invalidationRect); |
} |
void LayoutObject::invalidatePaintIncludingNonCompositingDescendants() |