| Index: third_party/WebKit/Source/core/paint/PaintInvalidator.cpp
|
| diff --git a/third_party/WebKit/Source/core/paint/PaintInvalidator.cpp b/third_party/WebKit/Source/core/paint/PaintInvalidator.cpp
|
| index 54bb8dc00a85b2f0d1823554bdbaef2251a1dafa..d36054ec52d98fa52668826212c5d0b95fbeee2c 100644
|
| --- a/third_party/WebKit/Source/core/paint/PaintInvalidator.cpp
|
| +++ b/third_party/WebKit/Source/core/paint/PaintInvalidator.cpp
|
| @@ -342,17 +342,9 @@ void PaintInvalidator::updatePaintInvalidationContainer(
|
| DCHECK(context.paintingLayer == object.paintingLayer());
|
| }
|
|
|
| -void PaintInvalidator::updateVisualRect(const LayoutObject& object,
|
| - PaintInvalidatorContext& context) {
|
| - Optional<ScopedUndoFrameViewContentClipAndScroll>
|
| - undoFrameViewContentClipAndScroll;
|
| -
|
| - if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled() &&
|
| - object.isLayoutView() && !object.isPaintInvalidationContainer()) {
|
| - undoFrameViewContentClipAndScroll.emplace(*toLayoutView(object).frameView(),
|
| - context);
|
| - }
|
| -
|
| +void PaintInvalidator::updateVisualRectIfNeeded(
|
| + const LayoutObject& object,
|
| + PaintInvalidatorContext& context) {
|
| // TODO(crbug.com/637313): Use GeometryMapper which now supports filter
|
| // geometry effects, after skia optimizes filter's mapRect operation.
|
| // TODO(crbug.com/648274): This is a workaround for multi-column contents.
|
| @@ -365,6 +357,50 @@ void PaintInvalidator::updateVisualRect(const LayoutObject& object,
|
| context.oldVisualRect = object.visualRect();
|
| context.oldLocation = objectPaintInvalidator.locationInBacking();
|
|
|
| + if (!needsVisualRectUpdate(object, context)) {
|
| +#if CHECK_VISUAL_RECT_UPDATE
|
| + updateVisualRect(object, context);
|
| + DCHECK(
|
| + (context.oldVisualRect.isEmpty() && context.newVisualRect.isEmpty()) ||
|
| + enclosingIntRect(context.oldVisualRect) ==
|
| + enclosingIntRect(context.newVisualRect))
|
| + << "Visual rect changed without needsPaintOffsetAndVisualRectUpdate:"
|
| + << " object=" << object.debugName()
|
| + << " old=" << context.oldVisualRect.toString()
|
| + << " new=" << context.newVisualRect.toString();
|
| + DCHECK(object.isText() || context.oldLocation == context.newLocation)
|
| + << "Location changed without needsPaintOffsetAndVisualRectUpdate:"
|
| + << " old=" << context.oldLocation.toString()
|
| + << " new=" << context.newLocation.toString();
|
| +#endif
|
| + context.newVisualRect = context.oldVisualRect;
|
| + context.newLocation = context.oldLocation;
|
| + return;
|
| + }
|
| +
|
| +#if DCHECK_IS_ON()
|
| + DCHECK(context.treeBuilderContext.updatedForSelf);
|
| +#endif
|
| + updateVisualRect(object, context);
|
| + object.getMutableForPainting().setVisualRect(context.newVisualRect);
|
| + objectPaintInvalidator.setLocationInBacking(context.newLocation);
|
| +}
|
| +
|
| +void PaintInvalidator::updateVisualRect(const LayoutObject& object,
|
| + PaintInvalidatorContext& context) {
|
| + // The paint offset should already be updated through
|
| + // PaintPropertyTreeBuilder::updatePropertiesForSelf.
|
| + DCHECK(context.treeBuilderContext.current.paintOffset ==
|
| + object.paintOffset());
|
| +
|
| + Optional<ScopedUndoFrameViewContentClipAndScroll>
|
| + undoFrameViewContentClipAndScroll;
|
| + if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled() &&
|
| + object.isLayoutView() && !object.isPaintInvalidationContainer()) {
|
| + undoFrameViewContentClipAndScroll.emplace(*toLayoutView(object).frameView(),
|
| + context);
|
| + }
|
| +
|
| IntSize adjustment = object.scrollAdjustmentForPaintInvalidation(
|
| *context.paintInvalidationContainer);
|
| context.newVisualRect = computeVisualRectInBacking(object, context);
|
| @@ -384,9 +420,6 @@ void PaintInvalidator::updateVisualRect(const LayoutObject& object,
|
| if (context.newVisualRect.isEmpty())
|
| context.newVisualRect.setLocation(context.newLocation);
|
| }
|
| -
|
| - object.getMutableForPainting().setVisualRect(context.newVisualRect);
|
| - objectPaintInvalidator.setLocationInBacking(context.newLocation);
|
| }
|
|
|
| void PaintInvalidator::invalidatePaintIfNeeded(
|
| @@ -415,11 +448,6 @@ void PaintInvalidator::invalidatePaintIfNeeded(
|
|
|
| object.getMutableForPainting().ensureIsReadyForPaintInvalidation();
|
|
|
| - // The paint offset should already be updated through
|
| - // PaintPropertyTreeBuilder::updatePropertiesForSelf.
|
| - DCHECK(context.treeBuilderContext.current.paintOffset ==
|
| - object.paintOffset());
|
| -
|
| updatePaintingLayer(object, context);
|
|
|
| if (object.document().printing() &&
|
| @@ -427,36 +455,13 @@ void PaintInvalidator::invalidatePaintIfNeeded(
|
| return; // Don't invalidate paints if we're printing.
|
|
|
| updatePaintInvalidationContainer(object, context);
|
| + updateVisualRectIfNeeded(object, context);
|
|
|
| - bool objectShouldCheckForPaintInvalidation =
|
| - object
|
| - .shouldCheckForPaintInvalidationRegardlessOfPaintInvalidationState();
|
| - if (!context.forcedSubtreeInvalidationFlags &&
|
| - !objectShouldCheckForPaintInvalidation) {
|
| -#if CHECK_VISUAL_RECT_UPDATE
|
| - updateVisualRect(object, context);
|
| - DCHECK(
|
| - (context.oldVisualRect.isEmpty() && context.newVisualRect.isEmpty()) ||
|
| - enclosingIntRect(context.oldVisualRect) ==
|
| - enclosingIntRect(context.newVisualRect))
|
| - << "Visual rect changed without needing paint invalidation:"
|
| - << " object=" << object.debugName()
|
| - << " old=" << context.oldVisualRect.toString()
|
| - << " new=" << context.newVisualRect.toString();
|
| - DCHECK(object.isText() || context.oldLocation == context.newLocation)
|
| - << "Location changed without needing paint invalidation:"
|
| - << " old=" << context.oldLocation.toString()
|
| - << " new=" << context.newLocation.toString();
|
| -#endif
|
| - return;
|
| - }
|
| -
|
| - updateVisualRect(object, context);
|
| -
|
| - if (!objectShouldCheckForPaintInvalidation &&
|
| - context.forcedSubtreeInvalidationFlags ==
|
| - PaintInvalidatorContext::ForcedSubtreeInvalidationRectUpdate) {
|
| - // We are done updating the visual rect. No other paint invalidation work to
|
| + if (!object
|
| + .shouldCheckForPaintInvalidationRegardlessOfPaintInvalidationState() &&
|
| + !(context.forcedSubtreeInvalidationFlags &
|
| + ~PaintInvalidatorContext::ForcedSubtreeVisualRectUpdate)) {
|
| + // We are done updating anything needed. No other paint invalidation work to
|
| // do for this object.
|
| return;
|
| }
|
| @@ -497,4 +502,12 @@ void PaintInvalidator::processPendingDelayedPaintInvalidations() {
|
| PaintInvalidationDelayedFull);
|
| }
|
|
|
| +bool PaintInvalidator::needsVisualRectUpdate(
|
| + const LayoutObject& object,
|
| + const PaintInvalidatorContext& context) {
|
| + return object.needsPaintOffsetAndVisualRectUpdate() ||
|
| + (context.forcedSubtreeInvalidationFlags &
|
| + ~PaintInvalidatorContext::ForcedSubtreeSlowPathRect);
|
| +}
|
| +
|
| } // namespace blink
|
|
|