| 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 ef6a026f77b402aab4fa4d816f4e805d3ca4472d..4a650a7f1f2886405e5c2f67614c7783e18a327f 100644
|
| --- a/third_party/WebKit/Source/core/layout/LayoutObject.cpp
|
| +++ b/third_party/WebKit/Source/core/layout/LayoutObject.cpp
|
| @@ -256,10 +256,6 @@ LayoutObject::LayoutObject(Node* node)
|
| #endif
|
| , m_bitfields(node)
|
| {
|
| - // TODO(wangxianzhu): Move this into initialization list when we enable the feature by default.
|
| - if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled())
|
| - m_previousPositionFromPaintInvalidationBacking = uninitializedPaintOffset();
|
| -
|
| #ifndef NDEBUG
|
| layoutObjectCounter().increment();
|
| #endif
|
| @@ -1217,13 +1213,12 @@ static void invalidatePaintRectangleOnWindow(const LayoutBoxModelObject& paintIn
|
|
|
| void LayoutObject::invalidatePaintUsingContainer(const LayoutBoxModelObject& paintInvalidationContainer, const LayoutRect& dirtyRect, PaintInvalidationReason invalidationReason) const
|
| {
|
| - // TODO(wangxianzhu): Enable the following assert after paint invalidation for spv2 is ready.
|
| - // ASSERT(!RuntimeEnabledFeatures::slimmingPaintV2Enabled());
|
| -
|
| if (paintInvalidationContainer.frameView()->shouldThrottleRendering())
|
| return;
|
|
|
| - ASSERT(gDisablePaintInvalidationStateAsserts || document().lifecycle().state() == DocumentLifecycle::InPaintInvalidation);
|
| + ASSERT(gDisablePaintInvalidationStateAsserts
|
| + || document().lifecycle().state() == DocumentLifecycle::InPaintInvalidation
|
| + || (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled() && document().lifecycle().state() == DocumentLifecycle::InPrePaintTreeWalk));
|
|
|
| if (dirtyRect.isEmpty())
|
| return;
|
| @@ -1332,6 +1327,7 @@ void LayoutObject::invalidatePaintRectangleNotInvalidatingDisplayItemClients(con
|
|
|
| void LayoutObject::invalidateTreeIfNeeded(PaintInvalidationState& paintInvalidationState)
|
| {
|
| + ASSERT(!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled());
|
| ASSERT(!needsLayout());
|
|
|
| // If we didn't need paint invalidation then our children don't need as well.
|
| @@ -1350,6 +1346,8 @@ void LayoutObject::invalidateTreeIfNeeded(PaintInvalidationState& paintInvalidat
|
|
|
| void LayoutObject::invalidatePaintOfSubtreesIfNeeded(PaintInvalidationState& childPaintInvalidationState)
|
| {
|
| + ASSERT(!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled());
|
| +
|
| for (LayoutObject* child = slowFirstChild(); child; child = child->nextSibling()) {
|
| if (!child->isOutOfFlowPositioned())
|
| child->invalidateTreeIfNeeded(childPaintInvalidationState);
|
| @@ -1393,7 +1391,6 @@ void LayoutObject::setPreviousSelectionRectForPaintInvalidation(const LayoutRect
|
| selectionPaintInvalidationMap->set(this, selectionRect);
|
| }
|
|
|
| -// TODO(wangxianzhu): Remove this for slimming paint v2 because we won't care about paint invalidation rects.
|
| inline void LayoutObject::invalidateSelectionIfNeeded(const LayoutBoxModelObject& paintInvalidationContainer, const PaintInvalidationState& paintInvalidationState, PaintInvalidationReason invalidationReason)
|
| {
|
| // Update selection rect when we are doing full invalidation (in case that the object is moved, composite status changed, etc.)
|
| @@ -1436,9 +1433,9 @@ PaintInvalidationReason LayoutObject::invalidatePaintIfNeeded(PaintInvalidationS
|
| return PaintInvalidationNone; // Don't invalidate paints if we're printing.
|
|
|
| const LayoutRect oldBounds = previousPaintInvalidationRect();
|
| - const LayoutPoint oldLocation = RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled() ? LayoutPoint() : previousPositionFromPaintInvalidationBacking();
|
| + const LayoutPoint oldLocation = previousPositionFromPaintInvalidationBacking();
|
| LayoutRect newBounds = boundsRectForPaintInvalidation(paintInvalidationContainer, &paintInvalidationState);
|
| - LayoutPoint newLocation = RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled() ? LayoutPoint() : PaintLayer::positionFromPaintInvalidationBacking(this, &paintInvalidationContainer, &paintInvalidationState);
|
| + LayoutPoint newLocation = PaintLayer::positionFromPaintInvalidationBacking(this, &paintInvalidationContainer, &paintInvalidationState);
|
|
|
| // Composited scrolling should not be included in the bounds and position tracking, because the graphics layer backing the scroller
|
| // does not move on scroll.
|
| @@ -1449,8 +1446,7 @@ PaintInvalidationReason LayoutObject::invalidatePaintIfNeeded(PaintInvalidationS
|
| }
|
|
|
| setPreviousPaintInvalidationRect(newBounds);
|
| - if (!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled())
|
| - setPreviousPositionFromPaintInvalidationBacking(newLocation);
|
| + setPreviousPositionFromPaintInvalidationBacking(newLocation);
|
|
|
| if (!shouldCheckForPaintInvalidationRegardlessOfPaintInvalidationState() && !paintInvalidationState.forcedSubtreeInvalidationWithinContainer()) {
|
| ASSERT(paintInvalidationState.forcedSubtreeInvalidationRectUpdateWithinContainer());
|
| @@ -2630,6 +2626,11 @@ LayoutObject* LayoutObject::containerCrossingFrameBoundaries() const
|
| return isLayoutView() ? frame()->ownerLayoutObject() : container();
|
| }
|
|
|
| +LayoutObject* LayoutObject::parentCrossingFrameBoundaries() const
|
| +{
|
| + return isLayoutView() ? frame()->ownerLayoutObject() : parent();
|
| +}
|
| +
|
| bool LayoutObject::isSelectionBorder() const
|
| {
|
| SelectionState st = getSelectionState();
|
| @@ -3445,6 +3446,14 @@ static PaintInvalidationReason documentLifecycleBasedPaintInvalidationReason(con
|
|
|
| inline void LayoutObject::markContainerChainForPaintInvalidation()
|
| {
|
| + if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) {
|
| + // We use PaintPropertyTreeBuilder, which walks layout tree in DOM order, for paint invalidation,
|
| + // so we need to mark paint invalidation flags also in DOM order (instead of containing block order).
|
| + for (LayoutObject* ancestor = this->parentCrossingFrameBoundaries(); ancestor && !ancestor->shouldCheckForPaintInvalidationRegardlessOfPaintInvalidationState(); ancestor = ancestor->parentCrossingFrameBoundaries())
|
| + ancestor->m_bitfields.setChildShouldCheckForPaintInvalidation(true);
|
| + return;
|
| + }
|
| +
|
| for (LayoutObject* container = this->containerCrossingFrameBoundaries(); container && !container->shouldCheckForPaintInvalidationRegardlessOfPaintInvalidationState(); container = container->containerCrossingFrameBoundaries())
|
| container->m_bitfields.setChildShouldCheckForPaintInvalidation(true);
|
| }
|
|
|