| 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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 } | 159 } |
| 160 | 160 |
| 161 if (isOutOfFlowPositioned()) | 161 if (isOutOfFlowPositioned()) |
| 162 LayoutBlock::removePositionedObject(this); | 162 LayoutBlock::removePositionedObject(this); |
| 163 } | 163 } |
| 164 | 164 |
| 165 void LayoutBox::styleWillChange(StyleDifference diff, const ComputedStyle& newSt
yle) | 165 void LayoutBox::styleWillChange(StyleDifference diff, const ComputedStyle& newSt
yle) |
| 166 { | 166 { |
| 167 const ComputedStyle* oldStyle = style(); | 167 const ComputedStyle* oldStyle = style(); |
| 168 if (oldStyle) { | 168 if (oldStyle) { |
| 169 // The background of the root element or the body element could propagat
e up to | |
| 170 // the canvas. Just dirty the entire canvas when our style changes subst
antially. | |
| 171 if ((diff.needsPaintInvalidation() || diff.needsLayout()) && node() | |
| 172 && (isHTMLHtmlElement(*node()) || isHTMLBodyElement(*node()))) { | |
| 173 view()->setShouldDoFullPaintInvalidation(); | |
| 174 | |
| 175 if (oldStyle->hasEntirelyFixedBackground() != newStyle.hasEntirelyFi
xedBackground()) | |
| 176 view()->compositor()->setNeedsUpdateFixedBackground(); | |
| 177 } | |
| 178 | |
| 179 // When a layout hint happens and an object's position style changes, we
have to do a layout | 169 // When a layout hint happens and an object's position style changes, we
have to do a layout |
| 180 // to dirty the layout tree using the old position value now. | 170 // to dirty the layout tree using the old position value now. |
| 181 if (diff.needsFullLayout() && parent() && oldStyle->position() != newSty
le.position()) { | 171 if (diff.needsFullLayout() && parent() && oldStyle->position() != newSty
le.position()) { |
| 182 markContainerChainForLayout(); | 172 markContainerChainForLayout(); |
| 183 if (oldStyle->position() == StaticPosition) | 173 if (oldStyle->position() == StaticPosition) |
| 184 setShouldDoFullPaintInvalidation(); | 174 setShouldDoFullPaintInvalidation(); |
| 185 else if (newStyle.hasOutOfFlowPosition()) | 175 else if (newStyle.hasOutOfFlowPosition()) |
| 186 parent()->setChildNeedsLayout(); | 176 parent()->setChildNeedsLayout(); |
| 187 if (isFloating() && !isOutOfFlowPositioned() && newStyle.hasOutOfFlo
wPosition()) | 177 if (isFloating() && !isOutOfFlowPositioned() && newStyle.hasOutOfFlo
wPosition()) |
| 188 removeFloatingOrPositionedChildFromBlockLists(); | 178 removeFloatingOrPositionedChildFromBlockLists(); |
| (...skipping 3729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3918 return invalidationReason; | 3908 return invalidationReason; |
| 3919 | 3909 |
| 3920 // If the transform is not identity or translation, incremental invalidation
is not applicable | 3910 // If the transform is not identity or translation, incremental invalidation
is not applicable |
| 3921 // because the difference between oldBounds and newBounds doesn't cover all
area needing invalidation. | 3911 // because the difference between oldBounds and newBounds doesn't cover all
area needing invalidation. |
| 3922 // FIXME: Should also consider ancestor transforms since paintInvalidationCo
ntainer. crbug.com/426111. | 3912 // FIXME: Should also consider ancestor transforms since paintInvalidationCo
ntainer. crbug.com/426111. |
| 3923 if (invalidationReason == PaintInvalidationIncremental | 3913 if (invalidationReason == PaintInvalidationIncremental |
| 3924 && paintInvalidationContainer != this | 3914 && paintInvalidationContainer != this |
| 3925 && hasLayer() && layer()->transform() && !layer()->transform()->isIdenti
tyOrTranslation()) | 3915 && hasLayer() && layer()->transform() && !layer()->transform()->isIdenti
tyOrTranslation()) |
| 3926 return PaintInvalidationBoundsChange; | 3916 return PaintInvalidationBoundsChange; |
| 3927 | 3917 |
| 3928 if (!style()->hasBackground() && !style()->hasBoxDecorations()) { | 3918 bool paintsBackground = style()->hasBackground() && !isDocumentElement() &&
!backgroundStolenForBeingBody(); |
| 3919 if (!paintsBackground && !style()->hasBoxDecorations()) { |
| 3929 // We could let incremental invalidation cover non-composited scrollbars
, but just | 3920 // We could let incremental invalidation cover non-composited scrollbars
, but just |
| 3930 // do a full invalidation because incremental invalidation will go away
with slimming paint. | 3921 // do a full invalidation because incremental invalidation will go away
with slimming paint. |
| 3931 if (invalidationReason == PaintInvalidationIncremental && hasNonComposit
edScrollbars()) | 3922 if (invalidationReason == PaintInvalidationIncremental && hasNonComposit
edScrollbars()) |
| 3932 return PaintInvalidationBorderBoxChange; | 3923 return PaintInvalidationBorderBoxChange; |
| 3933 return invalidationReason; | 3924 return invalidationReason; |
| 3934 } | 3925 } |
| 3935 | 3926 |
| 3936 if (style()->backgroundLayers().thisOrNextLayersUseContentBox() || style()->
maskLayers().thisOrNextLayersUseContentBox()) { | 3927 if (paintsBackground && (style()->backgroundLayers().thisOrNextLayersUseCont
entBox() || style()->maskLayers().thisOrNextLayersUseContentBox())) { |
| 3937 LayoutRect oldContentBoxRect = m_rareData ? m_rareData->m_previousConten
tBoxRect : LayoutRect(); | 3928 LayoutRect oldContentBoxRect = m_rareData ? m_rareData->m_previousConten
tBoxRect : LayoutRect(); |
| 3938 LayoutRect newContentBoxRect = contentBoxRect(); | 3929 LayoutRect newContentBoxRect = contentBoxRect(); |
| 3939 if (oldContentBoxRect != newContentBoxRect) | 3930 if (oldContentBoxRect != newContentBoxRect) |
| 3940 return PaintInvalidationContentBoxChange; | 3931 return PaintInvalidationContentBoxChange; |
| 3941 } | 3932 } |
| 3942 | 3933 |
| 3943 if (style()->backgroundLayers().thisOrNextLayersHaveLocalAttachment()) { | 3934 if (paintsBackground && style()->backgroundLayers().thisOrNextLayersHaveLoca
lAttachment()) { |
| 3944 LayoutRect oldLayoutOverflowRect = m_rareData ? m_rareData->m_previousLa
youtOverflowRect : LayoutRect(); | 3935 LayoutRect oldLayoutOverflowRect = m_rareData ? m_rareData->m_previousLa
youtOverflowRect : LayoutRect(); |
| 3945 LayoutRect newLayoutOverflowRect = layoutOverflowRect(); | 3936 LayoutRect newLayoutOverflowRect = layoutOverflowRect(); |
| 3946 if (oldLayoutOverflowRect != newLayoutOverflowRect) | 3937 if (oldLayoutOverflowRect != newLayoutOverflowRect) { |
| 3947 return PaintInvalidationLayoutOverflowBoxChange; | 3938 // Background positioning for the LayoutView are based on the box of
the root element. |
| 3939 // Whether full invalidation is needed will be checked with special
logic in |
| 3940 // LayoutView::invalidatePaintIfNeeded. Here we only need to guarant
ee incremental |
| 3941 // painting is done for newly expanded area. |
| 3942 if (!isLayoutView()) |
| 3943 return PaintInvalidationLayoutOverflowBoxChange; |
| 3944 if (invalidationReason < PaintInvalidationIncremental) |
| 3945 invalidationReason = PaintInvalidationIncremental; |
| 3946 } |
| 3948 } | 3947 } |
| 3949 | 3948 |
| 3950 LayoutSize oldBorderBoxSize = computePreviousBorderBoxSize(oldBounds.size())
; | 3949 LayoutSize oldBorderBoxSize = computePreviousBorderBoxSize(oldBounds.size())
; |
| 3951 LayoutSize newBorderBoxSize = size(); | 3950 LayoutSize newBorderBoxSize = size(); |
| 3952 | 3951 |
| 3953 if (oldBorderBoxSize == newBorderBoxSize) | 3952 if (oldBorderBoxSize == newBorderBoxSize) |
| 3954 return invalidationReason; | 3953 return invalidationReason; |
| 3955 | 3954 |
| 3956 // See another hasNonCompositedScrollbars() callsite above. | 3955 // See another hasNonCompositedScrollbars() callsite above. |
| 3957 if (hasNonCompositedScrollbars()) | 3956 if (hasNonCompositedScrollbars()) |
| 3958 return PaintInvalidationBorderBoxChange; | 3957 return PaintInvalidationBorderBoxChange; |
| 3959 | 3958 |
| 3960 if (style()->hasVisualOverflowingEffect() || style()->hasAppearance() || sty
le()->hasFilter() || style()->resize() != RESIZE_NONE) | 3959 if (style()->hasVisualOverflowingEffect() || style()->hasAppearance() || sty
le()->hasFilter() || style()->resize() != RESIZE_NONE) |
| 3961 return PaintInvalidationBorderBoxChange; | 3960 return PaintInvalidationBorderBoxChange; |
| 3962 | 3961 |
| 3963 if (style()->hasBorderRadius()) { | 3962 if (style()->hasBorderRadius()) { |
| 3964 // If a border-radius exists and width/height is smaller than radius wid
th/height, | 3963 // If a border-radius exists and width/height is smaller than radius wid
th/height, |
| 3965 // we need to fully invalidate to cover the changed radius. | 3964 // we need to fully invalidate to cover the changed radius. |
| 3966 FloatRoundedRect oldRoundedRect = style()->getRoundedBorderFor(LayoutRec
t(LayoutPoint(0, 0), oldBorderBoxSize)); | 3965 FloatRoundedRect oldRoundedRect = style()->getRoundedBorderFor(LayoutRec
t(LayoutPoint(0, 0), oldBorderBoxSize)); |
| 3967 FloatRoundedRect newRoundedRect = style()->getRoundedBorderFor(LayoutRec
t(LayoutPoint(0, 0), newBorderBoxSize)); | 3966 FloatRoundedRect newRoundedRect = style()->getRoundedBorderFor(LayoutRec
t(LayoutPoint(0, 0), newBorderBoxSize)); |
| 3968 if (oldRoundedRect.radii() != newRoundedRect.radii()) | 3967 if (oldRoundedRect.radii() != newRoundedRect.radii()) |
| 3969 return PaintInvalidationBorderBoxChange; | 3968 return PaintInvalidationBorderBoxChange; |
| 3970 } | 3969 } |
| 3971 | 3970 |
| 3971 if (!paintsBackground) |
| 3972 return invalidationReason; |
| 3973 |
| 3972 if (oldBorderBoxSize.width() != newBorderBoxSize.width() && mustInvalidateBa
ckgroundOrBorderPaintOnWidthChange()) | 3974 if (oldBorderBoxSize.width() != newBorderBoxSize.width() && mustInvalidateBa
ckgroundOrBorderPaintOnWidthChange()) |
| 3973 return PaintInvalidationBorderBoxChange; | 3975 return PaintInvalidationBorderBoxChange; |
| 3974 if (oldBorderBoxSize.height() != newBorderBoxSize.height() && mustInvalidate
BackgroundOrBorderPaintOnHeightChange()) | 3976 if (oldBorderBoxSize.height() != newBorderBoxSize.height() && mustInvalidate
BackgroundOrBorderPaintOnHeightChange()) |
| 3975 return PaintInvalidationBorderBoxChange; | 3977 return PaintInvalidationBorderBoxChange; |
| 3976 | |
| 3977 return PaintInvalidationIncremental; | 3978 return PaintInvalidationIncremental; |
| 3978 } | 3979 } |
| 3979 | 3980 |
| 3980 void LayoutBox::incrementallyInvalidatePaint(const LayoutBoxModelObject& paintIn
validationContainer, const LayoutRect& oldBounds, const LayoutRect& newBounds, c
onst LayoutPoint& positionFromPaintInvalidationBacking) | 3981 void LayoutBox::incrementallyInvalidatePaint(const LayoutBoxModelObject& paintIn
validationContainer, const LayoutRect& oldBounds, const LayoutRect& newBounds, c
onst LayoutPoint& positionFromPaintInvalidationBacking) |
| 3981 { | 3982 { |
| 3982 LayoutObject::incrementallyInvalidatePaint(paintInvalidationContainer, oldBo
unds, newBounds, positionFromPaintInvalidationBacking); | 3983 LayoutObject::incrementallyInvalidatePaint(paintInvalidationContainer, oldBo
unds, newBounds, positionFromPaintInvalidationBacking); |
| 3983 | 3984 |
| 3984 bool hasBoxDecorations = style()->hasBoxDecorations(); | 3985 bool hasBoxDecorations = style()->hasBoxDecorations(); |
| 3985 if (!style()->hasBackground() && !hasBoxDecorations) | 3986 if (!style()->hasBackground() && !hasBoxDecorations) |
| 3986 return; | 3987 return; |
| (...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4677 computedValues.m_margins.m_start = marginStart(); | 4678 computedValues.m_margins.m_start = marginStart(); |
| 4678 computedValues.m_margins.m_end = marginEnd(); | 4679 computedValues.m_margins.m_end = marginEnd(); |
| 4679 | 4680 |
| 4680 setLogicalTop(oldLogicalTop); | 4681 setLogicalTop(oldLogicalTop); |
| 4681 setLogicalWidth(oldLogicalWidth); | 4682 setLogicalWidth(oldLogicalWidth); |
| 4682 setLogicalLeft(oldLogicalLeft); | 4683 setLogicalLeft(oldLogicalLeft); |
| 4683 setMarginLeft(oldMarginLeft); | 4684 setMarginLeft(oldMarginLeft); |
| 4684 setMarginRight(oldMarginRight); | 4685 setMarginRight(oldMarginRight); |
| 4685 } | 4686 } |
| 4686 | 4687 |
| 4687 inline bool LayoutBox::mustInvalidateFillLayersPaintOnWidthChange(const FillLaye
r& layer) const | 4688 bool LayoutBox::mustInvalidateFillLayersPaintOnWidthChange(const FillLayer& laye
r) const |
| 4688 { | 4689 { |
| 4689 // Nobody will use multiple layers without wanting fancy positioning. | 4690 // Nobody will use multiple layers without wanting fancy positioning. |
| 4690 if (layer.next()) | 4691 if (layer.next()) |
| 4691 return true; | 4692 return true; |
| 4692 | 4693 |
| 4693 // Make sure we have a valid image. | 4694 // Make sure we have a valid image. |
| 4694 StyleImage* img = layer.image(); | 4695 StyleImage* img = layer.image(); |
| 4695 if (!img || !img->canRender(*this, style()->effectiveZoom())) | 4696 if (!img || !img->canRender(*this, style()->effectiveZoom())) |
| 4696 return false; | 4697 return false; |
| 4697 | 4698 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4764 bool LayoutBox::canRenderBorderImage() const | 4765 bool LayoutBox::canRenderBorderImage() const |
| 4765 { | 4766 { |
| 4766 if (!style()->hasBorderDecoration()) | 4767 if (!style()->hasBorderDecoration()) |
| 4767 return false; | 4768 return false; |
| 4768 | 4769 |
| 4769 StyleImage* borderImage = style()->borderImage().image(); | 4770 StyleImage* borderImage = style()->borderImage().image(); |
| 4770 return borderImage && borderImage->canRender(*this, style()->effectiveZoom()
) && borderImage->isLoaded(); | 4771 return borderImage && borderImage->canRender(*this, style()->effectiveZoom()
) && borderImage->isLoaded(); |
| 4771 } | 4772 } |
| 4772 | 4773 |
| 4773 } // namespace blink | 4774 } // namespace blink |
| OLD | NEW |