| Index: Source/core/layout/LayoutBox.cpp
|
| diff --git a/Source/core/layout/LayoutBox.cpp b/Source/core/layout/LayoutBox.cpp
|
| index 32f145224f98f089742fad77885151311c8d025a..6f6ad20081f9adc363a66f834ccfaa6c949777fc 100644
|
| --- a/Source/core/layout/LayoutBox.cpp
|
| +++ b/Source/core/layout/LayoutBox.cpp
|
| @@ -166,16 +166,6 @@ void LayoutBox::styleWillChange(StyleDifference diff, const ComputedStyle& newSt
|
| {
|
| const ComputedStyle* oldStyle = style();
|
| if (oldStyle) {
|
| - // The background of the root element or the body element could propagate up to
|
| - // the canvas. Just dirty the entire canvas when our style changes substantially.
|
| - if ((diff.needsPaintInvalidation() || diff.needsLayout()) && node()
|
| - && (isHTMLHtmlElement(*node()) || isHTMLBodyElement(*node()))) {
|
| - view()->setShouldDoFullPaintInvalidation();
|
| -
|
| - if (oldStyle->hasEntirelyFixedBackground() != newStyle.hasEntirelyFixedBackground())
|
| - view()->compositor()->setNeedsUpdateFixedBackground();
|
| - }
|
| -
|
| // When a layout hint happens and an object's position style changes, we have to do a layout
|
| // to dirty the layout tree using the old position value now.
|
| if (diff.needsFullLayout() && parent() && oldStyle->position() != newStyle.position()) {
|
| @@ -3925,7 +3915,8 @@ PaintInvalidationReason LayoutBox::paintInvalidationReason(const LayoutBoxModelO
|
| && hasLayer() && layer()->transform() && !layer()->transform()->isIdentityOrTranslation())
|
| return PaintInvalidationBoundsChange;
|
|
|
| - if (!style()->hasBackground() && !style()->hasBoxDecorations()) {
|
| + bool paintsBackground = style()->hasBackground() && !isDocumentElement() && !backgroundStolenForBeingBody();
|
| + if (!paintsBackground && !style()->hasBoxDecorations()) {
|
| // We could let incremental invalidation cover non-composited scrollbars, but just
|
| // do a full invalidation because incremental invalidation will go away with slimming paint.
|
| if (invalidationReason == PaintInvalidationIncremental && hasNonCompositedScrollbars())
|
| @@ -3933,18 +3924,26 @@ PaintInvalidationReason LayoutBox::paintInvalidationReason(const LayoutBoxModelO
|
| return invalidationReason;
|
| }
|
|
|
| - if (style()->backgroundLayers().thisOrNextLayersUseContentBox() || style()->maskLayers().thisOrNextLayersUseContentBox()) {
|
| + if (paintsBackground && (style()->backgroundLayers().thisOrNextLayersUseContentBox() || style()->maskLayers().thisOrNextLayersUseContentBox())) {
|
| LayoutRect oldContentBoxRect = m_rareData ? m_rareData->m_previousContentBoxRect : LayoutRect();
|
| LayoutRect newContentBoxRect = contentBoxRect();
|
| if (oldContentBoxRect != newContentBoxRect)
|
| return PaintInvalidationContentBoxChange;
|
| }
|
|
|
| - if (style()->backgroundLayers().thisOrNextLayersHaveLocalAttachment()) {
|
| + if (paintsBackground && style()->backgroundLayers().thisOrNextLayersHaveLocalAttachment()) {
|
| LayoutRect oldLayoutOverflowRect = m_rareData ? m_rareData->m_previousLayoutOverflowRect : LayoutRect();
|
| LayoutRect newLayoutOverflowRect = layoutOverflowRect();
|
| - if (oldLayoutOverflowRect != newLayoutOverflowRect)
|
| - return PaintInvalidationLayoutOverflowBoxChange;
|
| + if (oldLayoutOverflowRect != newLayoutOverflowRect) {
|
| + // Background positioning for the LayoutView are based on the box of the root element.
|
| + // Whether full invalidation is needed will be checked with special logic in
|
| + // LayoutView::invalidatePaintIfNeeded. Here we only need to guarantee incremental
|
| + // painting is done for newly expanded area.
|
| + if (!isLayoutView())
|
| + return PaintInvalidationLayoutOverflowBoxChange;
|
| + if (invalidationReason < PaintInvalidationIncremental)
|
| + invalidationReason = PaintInvalidationIncremental;
|
| + }
|
| }
|
|
|
| LayoutSize oldBorderBoxSize = computePreviousBorderBoxSize(oldBounds.size());
|
| @@ -3969,11 +3968,13 @@ PaintInvalidationReason LayoutBox::paintInvalidationReason(const LayoutBoxModelO
|
| return PaintInvalidationBorderBoxChange;
|
| }
|
|
|
| + if (!paintsBackground)
|
| + return invalidationReason;
|
| +
|
| if (oldBorderBoxSize.width() != newBorderBoxSize.width() && mustInvalidateBackgroundOrBorderPaintOnWidthChange())
|
| return PaintInvalidationBorderBoxChange;
|
| if (oldBorderBoxSize.height() != newBorderBoxSize.height() && mustInvalidateBackgroundOrBorderPaintOnHeightChange())
|
| return PaintInvalidationBorderBoxChange;
|
| -
|
| return PaintInvalidationIncremental;
|
| }
|
|
|
| @@ -4684,7 +4685,7 @@ void LayoutBox::logicalExtentAfterUpdatingLogicalWidth(const LayoutUnit& newLogi
|
| setMarginRight(oldMarginRight);
|
| }
|
|
|
| -inline bool LayoutBox::mustInvalidateFillLayersPaintOnWidthChange(const FillLayer& layer) const
|
| +bool LayoutBox::mustInvalidateFillLayersPaintOnWidthChange(const FillLayer& layer) const
|
| {
|
| // Nobody will use multiple layers without wanting fancy positioning.
|
| if (layer.next())
|
|
|