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 1566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1577 return; | 1577 return; |
1578 } | 1578 } |
1579 | 1579 |
1580 if ((onlyNeededPositionedMovementLayout() && compositingState() != PaintsInt
oOwnBacking) | 1580 if ((onlyNeededPositionedMovementLayout() && compositingState() != PaintsInt
oOwnBacking) |
1581 || (shouldDoFullPaintInvalidationIfSelfPaintingLayer() | 1581 || (shouldDoFullPaintInvalidationIfSelfPaintingLayer() |
1582 && hasLayer() | 1582 && hasLayer() |
1583 && layer()->isSelfPaintingLayer())) { | 1583 && layer()->isSelfPaintingLayer())) { |
1584 setShouldDoFullPaintInvalidationAfterLayout(true); | 1584 setShouldDoFullPaintInvalidationAfterLayout(true); |
1585 } | 1585 } |
1586 | 1586 |
1587 if (!invalidatePaintIfNeeded(&newPaintInvalidationContainer, oldPaintInvalid
ationRect, oldPositionFromPaintInvalidationContainer)) | 1587 if (!invalidatePaintIfNeeded(newPaintInvalidationContainer, oldPaintInvalida
tionRect, oldPositionFromPaintInvalidationContainer)) |
1588 invalidatePaintForOverflowIfNeeded(); | 1588 invalidatePaintForOverflowIfNeeded(); |
1589 | 1589 |
1590 // Issue paint invalidations for any scrollbars if there is a scrollable are
a for this renderer. | 1590 // Issue paint invalidations for any scrollbars if there is a scrollable are
a for this renderer. |
1591 if (enclosingLayer()) { | 1591 if (enclosingLayer()) { |
1592 if (RenderLayerScrollableArea* area = enclosingLayer()->scrollableArea()
) { | 1592 if (RenderLayerScrollableArea* area = enclosingLayer()->scrollableArea()
) { |
1593 if (area->hasVerticalBarDamage()) | 1593 if (area->hasVerticalBarDamage()) |
1594 invalidatePaintRectangle(area->verticalBarDamage()); | 1594 invalidatePaintRectangle(area->verticalBarDamage()); |
1595 if (area->hasHorizontalBarDamage()) | 1595 if (area->hasHorizontalBarDamage()) |
1596 invalidatePaintRectangle(area->horizontalBarDamage()); | 1596 invalidatePaintRectangle(area->horizontalBarDamage()); |
1597 area->resetScrollbarDamage(); | 1597 area->resetScrollbarDamage(); |
(...skipping 2415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4013 | 4013 |
4014 // Only auto width objects can possibly shrink to avoid floats. | 4014 // Only auto width objects can possibly shrink to avoid floats. |
4015 return style()->width().isAuto(); | 4015 return style()->width().isAuto(); |
4016 } | 4016 } |
4017 | 4017 |
4018 bool RenderBox::avoidsFloats() const | 4018 bool RenderBox::avoidsFloats() const |
4019 { | 4019 { |
4020 return isReplaced() || hasOverflowClip() || isHR() || isLegend() || isWritin
gModeRoot() || isFlexItemIncludingDeprecated(); | 4020 return isReplaced() || hasOverflowClip() || isHR() || isLegend() || isWritin
gModeRoot() || isFlexItemIncludingDeprecated(); |
4021 } | 4021 } |
4022 | 4022 |
4023 InvalidationReason RenderBox::getPaintInvalidationReason(const RenderLayerModelO
bject* paintInvalidationContainer, | 4023 InvalidationReason RenderBox::getPaintInvalidationReason(const RenderLayerModelO
bject& paintInvalidationContainer, |
4024 const LayoutRect& oldBounds, const LayoutPoint& oldLocation, const LayoutRec
t& newBounds, const LayoutPoint& newLocation) | 4024 const LayoutRect& oldBounds, const LayoutPoint& oldLocation, const LayoutRec
t& newBounds, const LayoutPoint& newLocation) |
4025 { | 4025 { |
4026 InvalidationReason invalidationReason = RenderBoxModelObject::getPaintInvali
dationReason(paintInvalidationContainer, oldBounds, oldLocation, newBounds, newL
ocation); | 4026 InvalidationReason invalidationReason = RenderBoxModelObject::getPaintInvali
dationReason(paintInvalidationContainer, oldBounds, oldLocation, newBounds, newL
ocation); |
4027 if (invalidationReason != InvalidationNone && invalidationReason != Invalida
tionIncremental) | 4027 if (invalidationReason != InvalidationNone && invalidationReason != Invalida
tionIncremental) |
4028 return invalidationReason; | 4028 return invalidationReason; |
4029 | 4029 |
4030 // FIXME: The following checks should use old and new border box rects inste
ad of old and new bounds. | 4030 // FIXME: The following checks should use old and new border box rects inste
ad of old and new bounds. |
4031 | 4031 |
4032 if (style()->hasBorderRadius()) { | 4032 if (style()->hasBorderRadius()) { |
4033 // If a border-radius exists and width/height is smaller than | 4033 // If a border-radius exists and width/height is smaller than |
4034 // radius width/height, we cannot use delta-paint-invalidation. | 4034 // radius width/height, we cannot use delta-paint-invalidation. |
4035 RoundedRect oldRoundedRect = style()->getRoundedBorderFor(oldBounds); | 4035 RoundedRect oldRoundedRect = style()->getRoundedBorderFor(oldBounds); |
4036 RoundedRect newRoundedRect = style()->getRoundedBorderFor(newBounds); | 4036 RoundedRect newRoundedRect = style()->getRoundedBorderFor(newBounds); |
4037 if (oldRoundedRect.radii() != newRoundedRect.radii()) | 4037 if (oldRoundedRect.radii() != newRoundedRect.radii()) |
4038 return InvalidationBorderRadius; | 4038 return InvalidationBorderRadius; |
4039 } | 4039 } |
4040 | 4040 |
4041 if (oldBounds.width() != newBounds.width() && mustInvalidateBackgroundOrBord
erPaintOnWidthChange()) | 4041 if (oldBounds.width() != newBounds.width() && mustInvalidateBackgroundOrBord
erPaintOnWidthChange()) |
4042 return InvalidationBoundsChangeWithBackground; | 4042 return InvalidationBoundsChangeWithBackground; |
4043 if (oldBounds.height() != newBounds.height() && mustInvalidateBackgroundOrBo
rderPaintOnHeightChange()) | 4043 if (oldBounds.height() != newBounds.height() && mustInvalidateBackgroundOrBo
rderPaintOnHeightChange()) |
4044 return InvalidationBoundsChangeWithBackground; | 4044 return InvalidationBoundsChangeWithBackground; |
4045 | 4045 |
4046 return invalidationReason; | 4046 return invalidationReason; |
4047 } | 4047 } |
4048 | 4048 |
4049 void RenderBox::incrementallyInvalidatePaint(const RenderLayerModelObject* paint
InvalidationContainer, const LayoutRect& oldBounds, const LayoutRect& newBounds) | 4049 void RenderBox::incrementallyInvalidatePaint(const RenderLayerModelObject& paint
InvalidationContainer, const LayoutRect& oldBounds, const LayoutRect& newBounds) |
4050 { | 4050 { |
4051 RenderBoxModelObject::incrementallyInvalidatePaint(paintInvalidationContaine
r, oldBounds, newBounds); | 4051 RenderBoxModelObject::incrementallyInvalidatePaint(paintInvalidationContaine
r, oldBounds, newBounds); |
4052 | 4052 |
4053 if (!style()->hasBorder() && !style()->boxShadow() && !style()->hasBorderIma
geOutsets() && !style()->hasOutline()) | 4053 if (!style()->hasBorder() && !style()->boxShadow() && !style()->hasBorderIma
geOutsets() && !style()->hasOutline()) |
4054 return; | 4054 return; |
4055 | 4055 |
4056 RenderStyle* outlineStyle = this->outlineStyle(); | 4056 RenderStyle* outlineStyle = this->outlineStyle(); |
4057 LayoutUnit outlineWidth = outlineStyle->outlineSize(); | 4057 LayoutUnit outlineWidth = outlineStyle->outlineSize(); |
4058 LayoutBoxExtent insetShadowExtent = style()->getBoxShadowInsetExtent(); | 4058 LayoutBoxExtent insetShadowExtent = style()->getBoxShadowInsetExtent(); |
4059 LayoutUnit deltaWidth = absoluteValue(newBounds.width() - oldBounds.width())
; | 4059 LayoutUnit deltaWidth = absoluteValue(newBounds.width() - oldBounds.width())
; |
4060 if (deltaWidth) { | 4060 if (deltaWidth) { |
4061 LayoutUnit shadowLeft; | 4061 LayoutUnit shadowLeft; |
4062 LayoutUnit shadowRight; | 4062 LayoutUnit shadowRight; |
4063 style()->getBoxShadowHorizontalExtent(shadowLeft, shadowRight); | 4063 style()->getBoxShadowHorizontalExtent(shadowLeft, shadowRight); |
4064 LayoutUnit boxWidth = width(); | 4064 LayoutUnit boxWidth = width(); |
4065 LayoutUnit minInsetRightShadowExtent = std::min<LayoutUnit>(-insetShadow
Extent.right(), std::min<LayoutUnit>(newBounds.width(), oldBounds.width())); | 4065 LayoutUnit minInsetRightShadowExtent = std::min<LayoutUnit>(-insetShadow
Extent.right(), std::min<LayoutUnit>(newBounds.width(), oldBounds.width())); |
4066 LayoutUnit borderWidth = std::max<LayoutUnit>(borderRight(), std::max<La
youtUnit>(valueForLength(style()->borderTopRightRadius().width(), boxWidth), val
ueForLength(style()->borderBottomRightRadius().width(), boxWidth))); | 4066 LayoutUnit borderWidth = std::max<LayoutUnit>(borderRight(), std::max<La
youtUnit>(valueForLength(style()->borderTopRightRadius().width(), boxWidth), val
ueForLength(style()->borderBottomRightRadius().width(), boxWidth))); |
4067 LayoutUnit decorationsLeftWidth = std::max<LayoutUnit>(-outlineStyle->ou
tlineOffset(), borderWidth + minInsetRightShadowExtent) + std::max<LayoutUnit>(o
utlineWidth, -shadowLeft); | 4067 LayoutUnit decorationsLeftWidth = std::max<LayoutUnit>(-outlineStyle->ou
tlineOffset(), borderWidth + minInsetRightShadowExtent) + std::max<LayoutUnit>(o
utlineWidth, -shadowLeft); |
4068 LayoutUnit decorationsRightWidth = std::max<LayoutUnit>(-outlineStyle->o
utlineOffset(), borderWidth + minInsetRightShadowExtent) + std::max<LayoutUnit>(
outlineWidth, shadowRight); | 4068 LayoutUnit decorationsRightWidth = std::max<LayoutUnit>(-outlineStyle->o
utlineOffset(), borderWidth + minInsetRightShadowExtent) + std::max<LayoutUnit>(
outlineWidth, shadowRight); |
4069 LayoutRect rightRect(newBounds.x() + std::min(newBounds.width(), oldBoun
ds.width()) - decorationsLeftWidth, | 4069 LayoutRect rightRect(newBounds.x() + std::min(newBounds.width(), oldBoun
ds.width()) - decorationsLeftWidth, |
4070 newBounds.y(), | 4070 newBounds.y(), |
4071 deltaWidth + decorationsLeftWidth + decorationsRightWidth, | 4071 deltaWidth + decorationsLeftWidth + decorationsRightWidth, |
4072 std::max(newBounds.height(), oldBounds.height())); | 4072 std::max(newBounds.height(), oldBounds.height())); |
4073 LayoutUnit right = std::min<LayoutUnit>(newBounds.maxX(), oldBounds.maxX
()); | 4073 LayoutUnit right = std::min<LayoutUnit>(newBounds.maxX(), oldBounds.maxX
()); |
4074 if (rightRect.x() < right) { | 4074 if (rightRect.x() < right) { |
4075 rightRect.setWidth(std::min(rightRect.width(), right - rightRect.x()
)); | 4075 rightRect.setWidth(std::min(rightRect.width(), right - rightRect.x()
)); |
4076 invalidatePaintUsingContainer(paintInvalidationContainer, rightRect,
InvalidationIncremental); | 4076 invalidatePaintUsingContainer(&paintInvalidationContainer, rightRect
, InvalidationIncremental); |
4077 } | 4077 } |
4078 } | 4078 } |
4079 | 4079 |
4080 LayoutUnit deltaHeight = absoluteValue(newBounds.height() - oldBounds.height
()); | 4080 LayoutUnit deltaHeight = absoluteValue(newBounds.height() - oldBounds.height
()); |
4081 if (deltaHeight) { | 4081 if (deltaHeight) { |
4082 LayoutUnit shadowTop; | 4082 LayoutUnit shadowTop; |
4083 LayoutUnit shadowBottom; | 4083 LayoutUnit shadowBottom; |
4084 style()->getBoxShadowVerticalExtent(shadowTop, shadowBottom); | 4084 style()->getBoxShadowVerticalExtent(shadowTop, shadowBottom); |
4085 LayoutUnit boxHeight = height(); | 4085 LayoutUnit boxHeight = height(); |
4086 LayoutUnit minInsetBottomShadowExtent = std::min<LayoutUnit>(-insetShado
wExtent.bottom(), std::min<LayoutUnit>(newBounds.height(), oldBounds.height())); | 4086 LayoutUnit minInsetBottomShadowExtent = std::min<LayoutUnit>(-insetShado
wExtent.bottom(), std::min<LayoutUnit>(newBounds.height(), oldBounds.height())); |
4087 LayoutUnit borderHeight = std::max<LayoutUnit>(borderBottom(), std::max<
LayoutUnit>(valueForLength(style()->borderBottomLeftRadius().height(), boxHeight
), valueForLength(style()->borderBottomRightRadius().height(), boxHeight))); | 4087 LayoutUnit borderHeight = std::max<LayoutUnit>(borderBottom(), std::max<
LayoutUnit>(valueForLength(style()->borderBottomLeftRadius().height(), boxHeight
), valueForLength(style()->borderBottomRightRadius().height(), boxHeight))); |
4088 LayoutUnit decorationsTopHeight = std::max<LayoutUnit>(-outlineStyle->ou
tlineOffset(), borderHeight + minInsetBottomShadowExtent) + std::max<LayoutUnit>
(outlineWidth, -shadowTop); | 4088 LayoutUnit decorationsTopHeight = std::max<LayoutUnit>(-outlineStyle->ou
tlineOffset(), borderHeight + minInsetBottomShadowExtent) + std::max<LayoutUnit>
(outlineWidth, -shadowTop); |
4089 LayoutUnit decorationsBottomHeight = std::max<LayoutUnit>(-outlineStyle-
>outlineOffset(), borderHeight + minInsetBottomShadowExtent) + std::max<LayoutUn
it>(outlineWidth, shadowBottom); | 4089 LayoutUnit decorationsBottomHeight = std::max<LayoutUnit>(-outlineStyle-
>outlineOffset(), borderHeight + minInsetBottomShadowExtent) + std::max<LayoutUn
it>(outlineWidth, shadowBottom); |
4090 LayoutRect bottomRect(newBounds.x(), | 4090 LayoutRect bottomRect(newBounds.x(), |
4091 std::min(newBounds.maxY(), oldBounds.maxY()) - decorationsTopHeight, | 4091 std::min(newBounds.maxY(), oldBounds.maxY()) - decorationsTopHeight, |
4092 std::max(newBounds.width(), oldBounds.width()), | 4092 std::max(newBounds.width(), oldBounds.width()), |
4093 deltaHeight + decorationsTopHeight + decorationsBottomHeight); | 4093 deltaHeight + decorationsTopHeight + decorationsBottomHeight); |
4094 LayoutUnit bottom = std::min(newBounds.maxY(), oldBounds.maxY()); | 4094 LayoutUnit bottom = std::min(newBounds.maxY(), oldBounds.maxY()); |
4095 if (bottomRect.y() < bottom) { | 4095 if (bottomRect.y() < bottom) { |
4096 bottomRect.setHeight(std::min(bottomRect.height(), bottom - bottomRe
ct.y())); | 4096 bottomRect.setHeight(std::min(bottomRect.height(), bottom - bottomRe
ct.y())); |
4097 invalidatePaintUsingContainer(paintInvalidationContainer, bottomRect
, InvalidationIncremental); | 4097 invalidatePaintUsingContainer(&paintInvalidationContainer, bottomRec
t, InvalidationIncremental); |
4098 } | 4098 } |
4099 } | 4099 } |
4100 } | 4100 } |
4101 | 4101 |
4102 void RenderBox::markForPaginationRelayoutIfNeeded(SubtreeLayoutScope& layoutScop
e) | 4102 void RenderBox::markForPaginationRelayoutIfNeeded(SubtreeLayoutScope& layoutScop
e) |
4103 { | 4103 { |
4104 ASSERT(!needsLayout()); | 4104 ASSERT(!needsLayout()); |
4105 // If fragmentation height has changed, we need to lay out. No need to enter
the renderer if it | 4105 // If fragmentation height has changed, we need to lay out. No need to enter
the renderer if it |
4106 // is childless, though. | 4106 // is childless, though. |
4107 if (view()->layoutState()->pageLogicalHeightChanged() && slowFirstChild()) | 4107 if (view()->layoutState()->pageLogicalHeightChanged() && slowFirstChild()) |
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4647 return 0; | 4647 return 0; |
4648 | 4648 |
4649 if (!layoutState && !flowThreadContainingBlock()) | 4649 if (!layoutState && !flowThreadContainingBlock()) |
4650 return 0; | 4650 return 0; |
4651 | 4651 |
4652 RenderBlock* containerBlock = containingBlock(); | 4652 RenderBlock* containerBlock = containingBlock(); |
4653 return containerBlock->offsetFromLogicalTopOfFirstPage() + logicalTop(); | 4653 return containerBlock->offsetFromLogicalTopOfFirstPage() + logicalTop(); |
4654 } | 4654 } |
4655 | 4655 |
4656 } // namespace WebCore | 4656 } // namespace WebCore |
OLD | NEW |