Chromium Code Reviews| Index: third_party/WebKit/Source/core/layout/LayoutBox.cpp |
| diff --git a/third_party/WebKit/Source/core/layout/LayoutBox.cpp b/third_party/WebKit/Source/core/layout/LayoutBox.cpp |
| index 6afb5f4d8739a566deca49491e37c711d15a3459..4a03e2280e1927d8d5bdbc38067b814060565c6a 100644 |
| --- a/third_party/WebKit/Source/core/layout/LayoutBox.cpp |
| +++ b/third_party/WebKit/Source/core/layout/LayoutBox.cpp |
| @@ -1481,10 +1481,30 @@ void LayoutBox::paintMask(const PaintInfo& paintInfo, const LayoutPoint& paintOf |
| void LayoutBox::imageChanged(WrappedImagePtr image, const IntRect*) |
| { |
| // TODO(chrishtr): support PaintInvalidationDelayedFull for animated border images. |
| - if ((style()->borderImage().image() && style()->borderImage().image()->data() == image) |
| - || (style()->maskBoxImage().image() && style()->maskBoxImage().image()->data() == image)) { |
| + if ((styleRef().borderImage().image() && styleRef().borderImage().image()->data() == image) |
| + || (styleRef().maskBoxImage().image() && styleRef().maskBoxImage().image()->data() == image)) { |
| setShouldDoFullPaintInvalidation(); |
| - return; |
| + } else { |
| + for (const FillLayer* layer = &styleRef().maskLayers(); layer; layer = layer->next()) { |
| + if (layer->image() && image == layer->image()->data()) { |
| + setShouldDoFullPaintInvalidation(); |
| + break; |
| + } |
| + } |
| + } |
| + |
| + if (!isDocumentElement() && !backgroundStolenForBeingBody()) { |
| + for (const FillLayer* layer = &styleRef().backgroundLayers(); layer; layer = layer->next()) { |
| + if (layer->image() && image == layer->image()->data()) { |
| + invalidateBackgroundObscurationStatus(); |
| + bool maybeAnimated = layer->image()->cachedImage() && layer->image()->cachedImage()->getImage() && layer->image()->cachedImage()->getImage()->maybeAnimated(); |
| + if (maybeAnimated) |
| + setMayNeedPaintInvalidationAnimatgedBackgroundImage(); |
| + else |
| + setShouldDoFullPaintInvalidation(); |
| + break; |
| + } |
| + } |
| } |
| ShapeValue* shapeOutsideValue = style()->shapeOutside(); |
| @@ -1495,9 +1515,6 @@ void LayoutBox::imageChanged(WrappedImagePtr image, const IntRect*) |
| markShapeOutsideDependentsForLayout(); |
| } |
| } |
| - |
| - if (!invalidatePaintOfLayerRectsForImage(image, style()->backgroundLayers(), true)) |
|
chrishtr
2016/08/09 22:07:54
Why is it ok to delete this?
Xianzhu
2016/08/09 23:07:14
Line 1499 became line 1487-1494. Line 1500 became
|
| - invalidatePaintOfLayerRectsForImage(image, style()->maskLayers(), false); |
| } |
| ResourcePriority LayoutBox::computeResourcePriority() const |
| @@ -1525,27 +1542,7 @@ ResourcePriority LayoutBox::computeResourcePriority() const |
| return ResourcePriority(isVisible ? ResourcePriority::Visible : ResourcePriority::NotVisible, screenArea); |
| } |
| -bool LayoutBox::invalidatePaintOfLayerRectsForImage(WrappedImagePtr image, const FillLayer& layers, bool drawingBackground) |
| -{ |
| - if (drawingBackground && (isDocumentElement() || backgroundStolenForBeingBody())) |
| - return false; |
| - for (const FillLayer* curLayer = &layers; curLayer; curLayer = curLayer->next()) { |
| - if (curLayer->image() && image == curLayer->image()->data()) { |
| - bool maybeAnimated = curLayer->image()->cachedImage() && curLayer->image()->cachedImage()->getImage() && curLayer->image()->cachedImage()->getImage()->maybeAnimated(); |
| - if (maybeAnimated && drawingBackground) |
| - setShouldDoFullPaintInvalidation(PaintInvalidationDelayedFull); |
| - else |
| - setShouldDoFullPaintInvalidation(); |
| - |
| - if (drawingBackground) |
| - invalidateBackgroundObscurationStatus(); |
| - return true; |
| - } |
| - } |
| - return false; |
| -} |
| - |
| -bool LayoutBox::intersectsVisibleViewport() |
| +bool LayoutBox::intersectsVisibleViewport() const |
| { |
| LayoutRect rect = visualOverflowRect(); |
| LayoutView* layoutView = view(); |
| @@ -1565,18 +1562,6 @@ PaintInvalidationReason LayoutBox::invalidatePaintIfNeeded(const PaintInvalidati |
| layer.setNeedsPaintPhaseDescendantBlockBackgrounds(); |
| } |
| - PaintInvalidationReason fullInvalidationReason = fullPaintInvalidationReason(); |
| - // If the current paint invalidation reason is PaintInvalidationDelayedFull, then this paint invalidation can delayed if the |
| - // LayoutBox in question is not on-screen. The logic to decide whether this is appropriate exists at the site of the original |
| - // paint invalidation that chose PaintInvalidationDelayedFull. |
| - if (fullInvalidationReason == PaintInvalidationDelayedFull) { |
| - if (!intersectsVisibleViewport()) |
| - return PaintInvalidationDelayedFull; |
| - |
| - // Reset state back to regular full paint invalidation if the object is onscreen. |
| - setShouldDoFullPaintInvalidation(PaintInvalidationFull); |
| - } |
| - |
| PaintInvalidationReason reason = LayoutBoxModelObject::invalidatePaintIfNeeded(paintInvalidationState); |
| if (PaintLayerScrollableArea* area = getScrollableArea()) |
| @@ -3978,9 +3963,21 @@ PaintInvalidationReason LayoutBox::getPaintInvalidationReason(const PaintInvalid |
| const LayoutRect& oldBounds, const LayoutPoint& oldLocation, const LayoutRect& newBounds, const LayoutPoint& newLocation) const |
| { |
| PaintInvalidationReason invalidationReason = LayoutBoxModelObject::getPaintInvalidationReason(paintInvalidationState, oldBounds, oldLocation, newBounds, newLocation); |
| - if (isFullPaintInvalidationReason(invalidationReason)) |
| + |
| + if (isFullPaintInvalidationReason(invalidationReason) && invalidationReason != PaintInvalidationDelayedFull) |
| return invalidationReason; |
| + if (mayNeedPaintInvalidationAnimatedBackgroundImage() && !backgroundIsKnownToBeObscured()) |
| + invalidationReason = PaintInvalidationDelayedFull; |
| + |
| + // If the current paint invalidation reason is PaintInvalidationDelayedFull, then this paint invalidation can delayed if the |
| + // LayoutBox in question is not on-screen. The logic to decide whether this is appropriate exists at the site of the original |
| + // paint invalidation that chose PaintInvalidationDelayedFull. |
| + if (invalidationReason == PaintInvalidationDelayedFull) { |
| + // Do regular full paint invalidation if the object is onscreen. |
| + return intersectsVisibleViewport() ? PaintInvalidationFull : PaintInvalidationDelayedFull; |
| + } |
| + |
| if (isLayoutView()) { |
| const LayoutView* layoutView = toLayoutView(this); |
| // In normal compositing mode, root background doesn't need to be invalidated for |