| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) | 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) |
| 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) | 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) |
| 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv
ed. | 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv
ed. |
| 7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. | 7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. |
| 8 * | 8 * |
| 9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
| 10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 #include "core/layout/LayoutReplica.h" | 47 #include "core/layout/LayoutReplica.h" |
| 48 #include "core/layout/LayoutTableCell.h" | 48 #include "core/layout/LayoutTableCell.h" |
| 49 #include "core/layout/LayoutView.h" | 49 #include "core/layout/LayoutView.h" |
| 50 #include "core/layout/api/LineLayoutBox.h" | 50 #include "core/layout/api/LineLayoutBox.h" |
| 51 #include "core/layout/compositing/PaintLayerCompositor.h" | 51 #include "core/layout/compositing/PaintLayerCompositor.h" |
| 52 #include "core/layout/shapes/ShapeOutsideInfo.h" | 52 #include "core/layout/shapes/ShapeOutsideInfo.h" |
| 53 #include "core/page/AutoscrollController.h" | 53 #include "core/page/AutoscrollController.h" |
| 54 #include "core/page/Page.h" | 54 #include "core/page/Page.h" |
| 55 #include "core/page/scrolling/SnapCoordinator.h" | 55 #include "core/page/scrolling/SnapCoordinator.h" |
| 56 #include "core/paint/BackgroundImageGeometry.h" | 56 #include "core/paint/BackgroundImageGeometry.h" |
| 57 #include "core/paint/BoxPaintInvalidator.h" |
| 57 #include "core/paint/BoxPainter.h" | 58 #include "core/paint/BoxPainter.h" |
| 58 #include "core/paint/PaintLayer.h" | 59 #include "core/paint/PaintLayer.h" |
| 59 #include "core/style/ShadowList.h" | 60 #include "core/style/ShadowList.h" |
| 60 #include "platform/LengthFunctions.h" | 61 #include "platform/LengthFunctions.h" |
| 61 #include "platform/geometry/DoubleRect.h" | 62 #include "platform/geometry/DoubleRect.h" |
| 62 #include "platform/geometry/FloatQuad.h" | 63 #include "platform/geometry/FloatQuad.h" |
| 63 #include "platform/geometry/FloatRoundedRect.h" | 64 #include "platform/geometry/FloatRoundedRect.h" |
| 64 #include "wtf/PtrUtil.h" | 65 #include "wtf/PtrUtil.h" |
| 65 #include <algorithm> | 66 #include <algorithm> |
| 66 #include <math.h> | 67 #include <math.h> |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 clearExtraInlineAndBlockOffests(); | 126 clearExtraInlineAndBlockOffests(); |
| 126 | 127 |
| 127 if (isOutOfFlowPositioned()) | 128 if (isOutOfFlowPositioned()) |
| 128 LayoutBlock::removePositionedObject(this); | 129 LayoutBlock::removePositionedObject(this); |
| 129 removeFromPercentHeightContainer(); | 130 removeFromPercentHeightContainer(); |
| 130 if (isOrthogonalWritingModeRoot() && !documentBeingDestroyed()) | 131 if (isOrthogonalWritingModeRoot() && !documentBeingDestroyed()) |
| 131 unmarkOrthogonalWritingModeRoot(); | 132 unmarkOrthogonalWritingModeRoot(); |
| 132 | 133 |
| 133 ShapeOutsideInfo::removeInfo(*this); | 134 ShapeOutsideInfo::removeInfo(*this); |
| 134 | 135 |
| 136 BoxPaintInvalidator::boxWillBeDestroyed(*this); |
| 137 |
| 135 LayoutBoxModelObject::willBeDestroyed(); | 138 LayoutBoxModelObject::willBeDestroyed(); |
| 136 } | 139 } |
| 137 | 140 |
| 138 void LayoutBox::insertedIntoTree() | 141 void LayoutBox::insertedIntoTree() |
| 139 { | 142 { |
| 140 LayoutBoxModelObject::insertedIntoTree(); | 143 LayoutBoxModelObject::insertedIntoTree(); |
| 141 addScrollSnapMapping(); | 144 addScrollSnapMapping(); |
| 142 | 145 |
| 143 if (isOrthogonalWritingModeRoot()) | 146 if (isOrthogonalWritingModeRoot()) |
| 144 markOrthogonalWritingModeRoot(); | 147 markOrthogonalWritingModeRoot(); |
| (...skipping 1394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1539 setShouldDoFullPaintInvalidation(); | 1542 setShouldDoFullPaintInvalidation(); |
| 1540 | 1543 |
| 1541 if (drawingBackground) | 1544 if (drawingBackground) |
| 1542 invalidateBackgroundObscurationStatus(); | 1545 invalidateBackgroundObscurationStatus(); |
| 1543 return true; | 1546 return true; |
| 1544 } | 1547 } |
| 1545 } | 1548 } |
| 1546 return false; | 1549 return false; |
| 1547 } | 1550 } |
| 1548 | 1551 |
| 1549 bool LayoutBox::intersectsVisibleViewport() | 1552 bool LayoutBox::intersectsVisibleViewport() const |
| 1550 { | 1553 { |
| 1551 LayoutRect rect = visualOverflowRect(); | 1554 LayoutRect rect = visualOverflowRect(); |
| 1552 LayoutView* layoutView = view(); | 1555 LayoutView* layoutView = view(); |
| 1553 while (layoutView->frame()->ownerLayoutObject()) | 1556 while (layoutView->frame()->ownerLayoutObject()) |
| 1554 layoutView = layoutView->frame()->ownerLayoutObject()->view(); | 1557 layoutView = layoutView->frame()->ownerLayoutObject()->view(); |
| 1555 mapToVisualRectInAncestorSpace(layoutView, rect); | 1558 mapToVisualRectInAncestorSpace(layoutView, rect); |
| 1556 return rect.intersects(LayoutRect(layoutView->frameView()->getScrollableArea
()->visibleContentRectDouble())); | 1559 return rect.intersects(LayoutRect(layoutView->frameView()->getScrollableArea
()->visibleContentRectDouble())); |
| 1557 } | 1560 } |
| 1558 | 1561 |
| 1559 PaintInvalidationReason LayoutBox::invalidatePaintIfNeeded(const PaintInvalidati
onState& paintInvalidationState) | 1562 PaintInvalidationReason LayoutBox::invalidatePaintIfNeeded(const PaintInvalidati
onState& paintInvalidationState) |
| 1560 { | 1563 { |
| 1561 if (hasBoxDecorationBackground() | 1564 if (hasBoxDecorationBackground() |
| 1562 // We also paint overflow controls in background phase. | 1565 // We also paint overflow controls in background phase. |
| 1563 || (hasOverflowClip() && getScrollableArea()->hasOverflowControls())) { | 1566 || (hasOverflowClip() && getScrollableArea()->hasOverflowControls())) { |
| 1564 PaintLayer& layer = paintInvalidationState.paintingLayer(); | 1567 PaintLayer& layer = paintInvalidationState.paintingLayer(); |
| 1565 if (layer.layoutObject() != this) | 1568 if (layer.layoutObject() != this) |
| 1566 layer.setNeedsPaintPhaseDescendantBlockBackgrounds(); | 1569 layer.setNeedsPaintPhaseDescendantBlockBackgrounds(); |
| 1567 } | 1570 } |
| 1568 | 1571 |
| 1569 PaintInvalidationReason fullInvalidationReason = fullPaintInvalidationReason
(); | 1572 return LayoutBoxModelObject::invalidatePaintIfNeeded(paintInvalidationState)
; |
| 1570 // If the current paint invalidation reason is PaintInvalidationDelayedFull,
then this paint invalidation can delayed if the | 1573 } |
| 1571 // LayoutBox in question is not on-screen. The logic to decide whether this
is appropriate exists at the site of the original | |
| 1572 // paint invalidation that chose PaintInvalidationDelayedFull. | |
| 1573 if (fullInvalidationReason == PaintInvalidationDelayedFull) { | |
| 1574 if (!intersectsVisibleViewport()) | |
| 1575 return PaintInvalidationDelayedFull; | |
| 1576 | 1574 |
| 1577 // Reset state back to regular full paint invalidation if the object is
onscreen. | 1575 PaintInvalidationReason LayoutBox::invalidatePaintIfNeeded(const PaintInvalidato
rContext& context) const |
| 1578 setShouldDoFullPaintInvalidation(PaintInvalidationFull); | 1576 { |
| 1579 } | 1577 return BoxPaintInvalidator(*this, context).invalidatePaintIfNeeded(); |
| 1580 | |
| 1581 PaintInvalidationReason reason = LayoutBoxModelObject::invalidatePaintIfNeed
ed(paintInvalidationState); | |
| 1582 | |
| 1583 if (PaintLayerScrollableArea* area = getScrollableArea()) | |
| 1584 area->invalidatePaintOfScrollControlsIfNeeded(paintInvalidationState); | |
| 1585 | |
| 1586 // This is for the next invalidatePaintIfNeeded so must be at the end. | |
| 1587 savePreviousBoxSizesIfNeeded(); | |
| 1588 return reason; | |
| 1589 } | 1578 } |
| 1590 | 1579 |
| 1591 void LayoutBox::invalidatePaintOfSubtreesIfNeeded(const PaintInvalidationState&
childPaintInvalidationState) | 1580 void LayoutBox::invalidatePaintOfSubtreesIfNeeded(const PaintInvalidationState&
childPaintInvalidationState) |
| 1592 { | 1581 { |
| 1593 LayoutBoxModelObject::invalidatePaintOfSubtreesIfNeeded(childPaintInvalidati
onState); | 1582 LayoutBoxModelObject::invalidatePaintOfSubtreesIfNeeded(childPaintInvalidati
onState); |
| 1594 | 1583 |
| 1595 if (PaintLayer* layer = this->layer()) { | 1584 if (PaintLayer* layer = this->layer()) { |
| 1596 if (PaintLayerReflectionInfo* reflectionInfo = layer->reflectionInfo()) | 1585 if (PaintLayerReflectionInfo* reflectionInfo = layer->reflectionInfo()) |
| 1597 reflectionInfo->reflection()->invalidateTreeIfNeeded(childPaintInval
idationState); | 1586 reflectionInfo->reflection()->invalidateTreeIfNeeded(childPaintInval
idationState); |
| 1598 } | 1587 } |
| (...skipping 2369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3968 { | 3957 { |
| 3969 if (PaintLayerScrollableArea* scrollableArea = this->getScrollableArea()) { | 3958 if (PaintLayerScrollableArea* scrollableArea = this->getScrollableArea()) { |
| 3970 if (scrollableArea->hasHorizontalScrollbar() && !scrollableArea->layerFo
rHorizontalScrollbar()) | 3959 if (scrollableArea->hasHorizontalScrollbar() && !scrollableArea->layerFo
rHorizontalScrollbar()) |
| 3971 return true; | 3960 return true; |
| 3972 if (scrollableArea->hasVerticalScrollbar() && !scrollableArea->layerForV
erticalScrollbar()) | 3961 if (scrollableArea->hasVerticalScrollbar() && !scrollableArea->layerForV
erticalScrollbar()) |
| 3973 return true; | 3962 return true; |
| 3974 } | 3963 } |
| 3975 return false; | 3964 return false; |
| 3976 } | 3965 } |
| 3977 | 3966 |
| 3978 PaintInvalidationReason LayoutBox::getPaintInvalidationReason(const PaintInvalid
ationState& paintInvalidationState, | |
| 3979 const LayoutRect& oldBounds, const LayoutPoint& oldLocation, const LayoutRec
t& newBounds, const LayoutPoint& newLocation) const | |
| 3980 { | |
| 3981 PaintInvalidationReason invalidationReason = LayoutBoxModelObject::getPaintI
nvalidationReason(paintInvalidationState, oldBounds, oldLocation, newBounds, new
Location); | |
| 3982 if (isFullPaintInvalidationReason(invalidationReason)) | |
| 3983 return invalidationReason; | |
| 3984 | |
| 3985 if (isLayoutView()) { | |
| 3986 const LayoutView* layoutView = toLayoutView(this); | |
| 3987 // In normal compositing mode, root background doesn't need to be invali
dated for | |
| 3988 // box changes, because the background always covers the whole document
rect | |
| 3989 // and clipping is done by compositor()->m_containerLayer. Also the scro
llbars | |
| 3990 // are always composited. There are no other box decoration on the Layou
tView thus | |
| 3991 // we can safely exit here. | |
| 3992 if (layoutView->usesCompositing() && (!document().settings() || !documen
t().settings()->rootLayerScrolls())) | |
| 3993 return invalidationReason; | |
| 3994 } | |
| 3995 | |
| 3996 // If the transform is not identity or translation, incremental invalidation
is not applicable | |
| 3997 // because the difference between oldBounds and newBounds doesn't cover all
area needing invalidation. | |
| 3998 // FIXME: Should also consider ancestor transforms since paintInvalidationCo
ntainer. crbug.com/426111. | |
| 3999 if (invalidationReason == PaintInvalidationIncremental | |
| 4000 && paintInvalidationState.paintInvalidationContainer() != this | |
| 4001 && hasLayer() && layer()->transform() && !layer()->transform()->isIdenti
tyOrTranslation()) | |
| 4002 return PaintInvalidationBoundsChange; | |
| 4003 | |
| 4004 if (style()->backgroundLayers().thisOrNextLayersUseContentBox() || style()->
maskLayers().thisOrNextLayersUseContentBox() || style()->boxSizing() == BoxSizin
gBorderBox) { | |
| 4005 LayoutRect oldContentBoxRect = m_rareData ? m_rareData->m_previousConten
tBoxRect : LayoutRect(); | |
| 4006 LayoutRect newContentBoxRect = contentBoxRect(); | |
| 4007 if (oldContentBoxRect != newContentBoxRect) | |
| 4008 return PaintInvalidationContentBoxChange; | |
| 4009 } | |
| 4010 | |
| 4011 if (!style()->hasBackground() && !style()->hasBoxDecorations()) { | |
| 4012 // We could let incremental invalidation cover non-composited scrollbars
, but just | |
| 4013 // do a full invalidation because incremental invalidation will go away
with slimming paint. | |
| 4014 if (invalidationReason == PaintInvalidationIncremental && hasNonComposit
edScrollbars()) | |
| 4015 return PaintInvalidationBorderBoxChange; | |
| 4016 return invalidationReason; | |
| 4017 } | |
| 4018 | |
| 4019 if (style()->backgroundLayers().thisOrNextLayersHaveLocalAttachment()) { | |
| 4020 LayoutRect oldLayoutOverflowRect = m_rareData ? m_rareData->m_previousLa
youtOverflowRect : LayoutRect(); | |
| 4021 LayoutRect newLayoutOverflowRect = layoutOverflowRect(); | |
| 4022 if (oldLayoutOverflowRect != newLayoutOverflowRect) | |
| 4023 return PaintInvalidationLayoutOverflowBoxChange; | |
| 4024 } | |
| 4025 | |
| 4026 LayoutSize oldBorderBoxSize = computePreviousBorderBoxSize(oldBounds.size())
; | |
| 4027 LayoutSize newBorderBoxSize = size(); | |
| 4028 | |
| 4029 if (oldBorderBoxSize == newBorderBoxSize) | |
| 4030 return invalidationReason; | |
| 4031 | |
| 4032 // LayoutBox::incrementallyInvalidatePaint() depends on positionFromPaintInv
alidationBacking | |
| 4033 // which is not available when slimmingPaintOffsetCachingEnabled. | |
| 4034 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled() && (style()->
hasBoxDecorations() || style()->hasBackground())) | |
| 4035 return PaintInvalidationBorderBoxChange; | |
| 4036 | |
| 4037 // TODO(wangxianzhu): Remove incremental invalidation when we remove rect-ba
sed paint invalidation. | |
| 4038 // See another hasNonCompositedScrollbars() callsite above. | |
| 4039 if (hasNonCompositedScrollbars()) | |
| 4040 return PaintInvalidationBorderBoxChange; | |
| 4041 | |
| 4042 if (style()->hasVisualOverflowingEffect() || style()->hasAppearance() || sty
le()->hasFilterInducingProperty() || style()->resize() != RESIZE_NONE) | |
| 4043 return PaintInvalidationBorderBoxChange; | |
| 4044 | |
| 4045 if (style()->hasBorderRadius()) { | |
| 4046 // If a border-radius exists and width/height is smaller than radius wid
th/height, | |
| 4047 // we need to fully invalidate to cover the changed radius. | |
| 4048 FloatRoundedRect oldRoundedRect = style()->getRoundedBorderFor(LayoutRec
t(LayoutPoint(0, 0), oldBorderBoxSize)); | |
| 4049 FloatRoundedRect newRoundedRect = style()->getRoundedBorderFor(LayoutRec
t(LayoutPoint(0, 0), newBorderBoxSize)); | |
| 4050 if (oldRoundedRect.getRadii() != newRoundedRect.getRadii()) | |
| 4051 return PaintInvalidationBorderBoxChange; | |
| 4052 } | |
| 4053 | |
| 4054 if (oldBorderBoxSize.width() != newBorderBoxSize.width() && mustInvalidateBa
ckgroundOrBorderPaintOnWidthChange()) | |
| 4055 return PaintInvalidationBorderBoxChange; | |
| 4056 if (oldBorderBoxSize.height() != newBorderBoxSize.height() && mustInvalidate
BackgroundOrBorderPaintOnHeightChange()) | |
| 4057 return PaintInvalidationBorderBoxChange; | |
| 4058 | |
| 4059 return styleRef().hasBackground() || styleRef().hasBoxDecorations() ? PaintI
nvalidationIncremental : invalidationReason; | |
| 4060 } | |
| 4061 | |
| 4062 void LayoutBox::incrementallyInvalidatePaint(const LayoutBoxModelObject& paintIn
validationContainer, const LayoutRect& oldBounds, const LayoutRect& newBounds, c
onst LayoutPoint& positionFromPaintInvalidationBacking) | |
| 4063 { | |
| 4064 LayoutObject::incrementallyInvalidatePaint(paintInvalidationContainer, oldBo
unds, newBounds, positionFromPaintInvalidationBacking); | |
| 4065 | |
| 4066 bool hasBoxDecorations = style()->hasBoxDecorations(); | |
| 4067 if (!style()->hasBackground() && !hasBoxDecorations) | |
| 4068 return; | |
| 4069 | |
| 4070 LayoutSize oldBorderBoxSize = computePreviousBorderBoxSize(oldBounds.size())
; | |
| 4071 LayoutSize newBorderBoxSize = size(); | |
| 4072 | |
| 4073 // If border box size didn't change, LayoutObject's incrementallyInvalidateP
aint() is good. | |
| 4074 if (oldBorderBoxSize == newBorderBoxSize) | |
| 4075 return; | |
| 4076 | |
| 4077 // If size of the paint invalidation rect equals to size of border box, Layo
utObject::incrementallyInvalidatePaint() | |
| 4078 // is good for boxes having background without box decorations. | |
| 4079 ASSERT(oldBounds.location() == newBounds.location()); // Otherwise we won't
do incremental invalidation. | |
| 4080 if (!hasBoxDecorations | |
| 4081 && positionFromPaintInvalidationBacking == newBounds.location() | |
| 4082 && oldBorderBoxSize == oldBounds.size() | |
| 4083 && newBorderBoxSize == newBounds.size()) | |
| 4084 return; | |
| 4085 | |
| 4086 // Invalidate the right delta part and the right border of the old or new bo
x which has smaller width. | |
| 4087 LayoutUnit deltaWidth = absoluteValue(oldBorderBoxSize.width() - newBorderBo
xSize.width()); | |
| 4088 if (deltaWidth) { | |
| 4089 LayoutUnit smallerWidth = std::min(oldBorderBoxSize.width(), newBorderBo
xSize.width()); | |
| 4090 LayoutUnit borderTopRightRadiusWidth = valueForLength(style()->borderTop
RightRadius().width(), smallerWidth); | |
| 4091 LayoutUnit borderBottomRightRadiusWidth = valueForLength(style()->border
BottomRightRadius().width(), smallerWidth); | |
| 4092 LayoutUnit borderWidth = std::max(LayoutUnit(borderRight()), std::max(bo
rderTopRightRadiusWidth, borderBottomRightRadiusWidth)); | |
| 4093 LayoutRect rightDeltaRect(positionFromPaintInvalidationBacking.x() + sma
llerWidth - borderWidth, | |
| 4094 positionFromPaintInvalidationBacking.y(), | |
| 4095 deltaWidth + borderWidth, | |
| 4096 std::max(oldBorderBoxSize.height(), newBorderBoxSize.height())); | |
| 4097 invalidatePaintRectClippedByOldAndNewBounds(paintInvalidationContainer,
rightDeltaRect, oldBounds, newBounds); | |
| 4098 } | |
| 4099 | |
| 4100 // Invalidate the bottom delta part and the bottom border of the old or new
box which has smaller height. | |
| 4101 LayoutUnit deltaHeight = absoluteValue(oldBorderBoxSize.height() - newBorder
BoxSize.height()); | |
| 4102 if (deltaHeight) { | |
| 4103 LayoutUnit smallerHeight = std::min(oldBorderBoxSize.height(), newBorder
BoxSize.height()); | |
| 4104 LayoutUnit borderBottomLeftRadiusHeight = valueForLength(style()->border
BottomLeftRadius().height(), smallerHeight); | |
| 4105 LayoutUnit borderBottomRightRadiusHeight = valueForLength(style()->borde
rBottomRightRadius().height(), smallerHeight); | |
| 4106 LayoutUnit borderHeight = std::max(LayoutUnit(borderBottom()), std::max(
borderBottomLeftRadiusHeight, borderBottomRightRadiusHeight)); | |
| 4107 LayoutRect bottomDeltaRect(positionFromPaintInvalidationBacking.x(), | |
| 4108 positionFromPaintInvalidationBacking.y() + smallerHeight - borderHei
ght, | |
| 4109 std::max(oldBorderBoxSize.width(), newBorderBoxSize.width()), | |
| 4110 deltaHeight + borderHeight); | |
| 4111 invalidatePaintRectClippedByOldAndNewBounds(paintInvalidationContainer,
bottomDeltaRect, oldBounds, newBounds); | |
| 4112 } | |
| 4113 } | |
| 4114 | |
| 4115 void LayoutBox::invalidatePaintRectClippedByOldAndNewBounds(const LayoutBoxModel
Object& paintInvalidationContainer, const LayoutRect& rect, const LayoutRect& ol
dBounds, const LayoutRect& newBounds) | |
| 4116 { | |
| 4117 if (rect.isEmpty()) | |
| 4118 return; | |
| 4119 LayoutRect rectClippedByOldBounds = intersection(rect, oldBounds); | |
| 4120 LayoutRect rectClippedByNewBounds = intersection(rect, newBounds); | |
| 4121 // Invalidate only once if the clipped rects equal. | |
| 4122 if (rectClippedByOldBounds == rectClippedByNewBounds) { | |
| 4123 invalidatePaintUsingContainer(paintInvalidationContainer, rectClippedByO
ldBounds, PaintInvalidationIncremental); | |
| 4124 return; | |
| 4125 } | |
| 4126 // Invalidate the bigger one if one contains another. Otherwise invalidate b
oth. | |
| 4127 if (!rectClippedByNewBounds.contains(rectClippedByOldBounds)) | |
| 4128 invalidatePaintUsingContainer(paintInvalidationContainer, rectClippedByO
ldBounds, PaintInvalidationIncremental); | |
| 4129 if (!rectClippedByOldBounds.contains(rectClippedByNewBounds)) | |
| 4130 invalidatePaintUsingContainer(paintInvalidationContainer, rectClippedByN
ewBounds, PaintInvalidationIncremental); | |
| 4131 } | |
| 4132 | |
| 4133 void LayoutBox::markForPaginationRelayoutIfNeeded(SubtreeLayoutScope& layoutScop
e) | 3967 void LayoutBox::markForPaginationRelayoutIfNeeded(SubtreeLayoutScope& layoutScop
e) |
| 4134 { | 3968 { |
| 4135 ASSERT(!needsLayout()); | 3969 ASSERT(!needsLayout()); |
| 4136 // If fragmentation height has changed, we need to lay out. No need to enter
the layoutObject if it | 3970 // If fragmentation height has changed, we need to lay out. No need to enter
the layoutObject if it |
| 4137 // is childless, though. | 3971 // is childless, though. |
| 4138 if (view()->layoutState()->pageLogicalHeightChanged() && slowFirstChild()) | 3972 if (view()->layoutState()->pageLogicalHeightChanged() && slowFirstChild()) |
| 4139 layoutScope.setChildNeedsLayout(this); | 3973 layoutScope.setChildNeedsLayout(this); |
| 4140 } | 3974 } |
| 4141 | 3975 |
| 4142 void LayoutBox::markOrthogonalWritingModeRoot() | 3976 void LayoutBox::markOrthogonalWritingModeRoot() |
| (...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4645 return containerBlock->offsetFromLogicalTopOfFirstPage() + logicalTop(); | 4479 return containerBlock->offsetFromLogicalTopOfFirstPage() + logicalTop(); |
| 4646 } | 4480 } |
| 4647 | 4481 |
| 4648 void LayoutBox::setPageLogicalOffset(LayoutUnit offset) | 4482 void LayoutBox::setPageLogicalOffset(LayoutUnit offset) |
| 4649 { | 4483 { |
| 4650 if (!m_rareData && !offset) | 4484 if (!m_rareData && !offset) |
| 4651 return; | 4485 return; |
| 4652 ensureRareData().m_pageLogicalOffset = offset; | 4486 ensureRareData().m_pageLogicalOffset = offset; |
| 4653 } | 4487 } |
| 4654 | 4488 |
| 4655 bool LayoutBox::needToSavePreviousBoxSizes() | |
| 4656 { | |
| 4657 // If m_rareData is already created, always save. | |
| 4658 if (m_rareData) | |
| 4659 return true; | |
| 4660 | |
| 4661 LayoutSize paintInvalidationSize = previousPaintInvalidationRectSize(); | |
| 4662 // Don't save old box sizes if the paint rect is empty because we'll | |
| 4663 // full invalidate once the paint rect becomes non-empty. | |
| 4664 if (paintInvalidationSize.isEmpty()) | |
| 4665 return false; | |
| 4666 | |
| 4667 // If we use border-box sizing we need to track changes in the size of the c
ontent box. | |
| 4668 if (style()->boxSizing() == BoxSizingBorderBox) | |
| 4669 return true; | |
| 4670 | |
| 4671 // We need the old box sizes only when the box has background, decorations,
or masks. | |
| 4672 // Main LayoutView paints base background, thus interested in box size. | |
| 4673 if (!isLayoutView() && !style()->hasBackground() && !style()->hasBoxDecorati
ons() && !style()->hasMask()) | |
| 4674 return false; | |
| 4675 | |
| 4676 // No need to save old border box size if we can use size of the old paint | |
| 4677 // rect as the old border box size in the next invalidation. | |
| 4678 if (paintInvalidationSize != size()) | |
| 4679 return true; | |
| 4680 | |
| 4681 // Background and mask layers can depend on other boxes than border box. See
crbug.com/490533 | |
| 4682 if (style()->backgroundLayers().thisOrNextLayersUseContentBox() || style()->
backgroundLayers().thisOrNextLayersHaveLocalAttachment() | |
| 4683 || style()->maskLayers().thisOrNextLayersUseContentBox()) | |
| 4684 return true; | |
| 4685 | |
| 4686 return false; | |
| 4687 } | |
| 4688 | |
| 4689 void LayoutBox::savePreviousBoxSizesIfNeeded() | |
| 4690 { | |
| 4691 if (!needToSavePreviousBoxSizes()) | |
| 4692 return; | |
| 4693 | |
| 4694 LayoutBoxRareData& rareData = ensureRareData(); | |
| 4695 rareData.m_previousBorderBoxSize = size(); | |
| 4696 rareData.m_previousContentBoxRect = contentBoxRect(); | |
| 4697 rareData.m_previousLayoutOverflowRect = layoutOverflowRect(); | |
| 4698 } | |
| 4699 | |
| 4700 LayoutSize LayoutBox::computePreviousBorderBoxSize(const LayoutSize& previousBou
ndsSize) const | |
| 4701 { | |
| 4702 // PreviousBorderBoxSize is only valid when there is background or box decor
ations. | |
| 4703 ASSERT(style()->hasBackground() || style()->hasBoxDecorations()); | |
| 4704 | |
| 4705 if (m_rareData && m_rareData->m_previousBorderBoxSize.width() != -1) | |
| 4706 return m_rareData->m_previousBorderBoxSize; | |
| 4707 | |
| 4708 // We didn't save the old border box size because it was the same as the siz
e of oldBounds. | |
| 4709 return previousBoundsSize; | |
| 4710 } | |
| 4711 | |
| 4712 void LayoutBox::logicalExtentAfterUpdatingLogicalWidth(const LayoutUnit& newLogi
calTop, LayoutBox::LogicalExtentComputedValues& computedValues) | 4489 void LayoutBox::logicalExtentAfterUpdatingLogicalWidth(const LayoutUnit& newLogi
calTop, LayoutBox::LogicalExtentComputedValues& computedValues) |
| 4713 { | 4490 { |
| 4714 // FIXME: None of this is right for perpendicular writing-mode children. | 4491 // FIXME: None of this is right for perpendicular writing-mode children. |
| 4715 LayoutUnit oldLogicalWidth = logicalWidth(); | 4492 LayoutUnit oldLogicalWidth = logicalWidth(); |
| 4716 LayoutUnit oldLogicalLeft = logicalLeft(); | 4493 LayoutUnit oldLogicalLeft = logicalLeft(); |
| 4717 LayoutUnit oldMarginLeft = marginLeft(); | 4494 LayoutUnit oldMarginLeft = marginLeft(); |
| 4718 LayoutUnit oldMarginRight = marginRight(); | 4495 LayoutUnit oldMarginRight = marginRight(); |
| 4719 LayoutUnit oldLogicalTop = logicalTop(); | 4496 LayoutUnit oldLogicalTop = logicalTop(); |
| 4720 | 4497 |
| 4721 setLogicalTop(newLogicalTop); | 4498 setLogicalTop(newLogicalTop); |
| 4722 updateLogicalWidth(); | 4499 updateLogicalWidth(); |
| 4723 | 4500 |
| 4724 computedValues.m_extent = logicalWidth(); | 4501 computedValues.m_extent = logicalWidth(); |
| 4725 computedValues.m_position = logicalLeft(); | 4502 computedValues.m_position = logicalLeft(); |
| 4726 computedValues.m_margins.m_start = marginStart(); | 4503 computedValues.m_margins.m_start = marginStart(); |
| 4727 computedValues.m_margins.m_end = marginEnd(); | 4504 computedValues.m_margins.m_end = marginEnd(); |
| 4728 | 4505 |
| 4729 setLogicalTop(oldLogicalTop); | 4506 setLogicalTop(oldLogicalTop); |
| 4730 setLogicalWidth(oldLogicalWidth); | 4507 setLogicalWidth(oldLogicalWidth); |
| 4731 setLogicalLeft(oldLogicalLeft); | 4508 setLogicalLeft(oldLogicalLeft); |
| 4732 setMarginLeft(oldMarginLeft); | 4509 setMarginLeft(oldMarginLeft); |
| 4733 setMarginRight(oldMarginRight); | 4510 setMarginRight(oldMarginRight); |
| 4734 } | 4511 } |
| 4735 | 4512 |
| 4736 bool LayoutBox::mustInvalidateFillLayersPaintOnHeightChange(const FillLayer& lay
er) const | 4513 bool LayoutBox::mustInvalidateFillLayersPaintOnHeightChange(const FillLayer& lay
er) |
| 4737 { | 4514 { |
| 4738 // Nobody will use multiple layers without wanting fancy positioning. | 4515 // Nobody will use multiple layers without wanting fancy positioning. |
| 4739 if (layer.next()) | 4516 if (layer.next()) |
| 4740 return true; | 4517 return true; |
| 4741 | 4518 |
| 4742 // Make sure we have a valid image. | 4519 // Make sure we have a valid image. |
| 4743 StyleImage* img = layer.image(); | 4520 StyleImage* img = layer.image(); |
| 4744 if (!img || !img->canRender()) | 4521 if (!img || !img->canRender()) |
| 4745 return false; | 4522 return false; |
| 4746 | 4523 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 4765 return true; | 4542 return true; |
| 4766 if (img->isGeneratedImage() && layer.sizeLength().height().isAuto()) | 4543 if (img->isGeneratedImage() && layer.sizeLength().height().isAuto()) |
| 4767 return true; | 4544 return true; |
| 4768 } else if (img->usesImageContainerSize()) { | 4545 } else if (img->usesImageContainerSize()) { |
| 4769 return true; | 4546 return true; |
| 4770 } | 4547 } |
| 4771 | 4548 |
| 4772 return false; | 4549 return false; |
| 4773 } | 4550 } |
| 4774 | 4551 |
| 4775 bool LayoutBox::mustInvalidateFillLayersPaintOnWidthChange(const FillLayer& laye
r) const | 4552 bool LayoutBox::mustInvalidateFillLayersPaintOnWidthChange(const FillLayer& laye
r) |
| 4776 { | 4553 { |
| 4777 // Nobody will use multiple layers without wanting fancy positioning. | 4554 // Nobody will use multiple layers without wanting fancy positioning. |
| 4778 if (layer.next()) | 4555 if (layer.next()) |
| 4779 return true; | 4556 return true; |
| 4780 | 4557 |
| 4781 // Make sure we have a valid image. | 4558 // Make sure we have a valid image. |
| 4782 StyleImage* img = layer.image(); | 4559 StyleImage* img = layer.image(); |
| 4783 if (!img || !img->canRender()) | 4560 if (!img || !img->canRender()) |
| 4784 return false; | 4561 return false; |
| 4785 | 4562 |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4988 m_rareData->m_snapAreas->remove(&snapArea); | 4765 m_rareData->m_snapAreas->remove(&snapArea); |
| 4989 } | 4766 } |
| 4990 } | 4767 } |
| 4991 | 4768 |
| 4992 SnapAreaSet* LayoutBox::snapAreas() const | 4769 SnapAreaSet* LayoutBox::snapAreas() const |
| 4993 { | 4770 { |
| 4994 return m_rareData ? m_rareData->m_snapAreas.get() : nullptr; | 4771 return m_rareData ? m_rareData->m_snapAreas.get() : nullptr; |
| 4995 } | 4772 } |
| 4996 | 4773 |
| 4997 } // namespace blink | 4774 } // namespace blink |
| OLD | NEW |