| 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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 float oldShapeImageThreshold = oldStyle ? oldStyle->shapeImageThreshold() :
RenderStyle::initialShapeImageThreshold(); | 169 float oldShapeImageThreshold = oldStyle ? oldStyle->shapeImageThreshold() :
RenderStyle::initialShapeImageThreshold(); |
| 170 | 170 |
| 171 // FIXME: A future optimization would do a deep comparison for equality. (bu
g 100811) | 171 // FIXME: A future optimization would do a deep comparison for equality. (bu
g 100811) |
| 172 if (shapeOutside == oldShapeOutside && shapeMargin == oldShapeMargin && shap
eImageThreshold == oldShapeImageThreshold) | 172 if (shapeOutside == oldShapeOutside && shapeMargin == oldShapeMargin && shap
eImageThreshold == oldShapeImageThreshold) |
| 173 return; | 173 return; |
| 174 | 174 |
| 175 if (!shapeOutside) | 175 if (!shapeOutside) |
| 176 ShapeOutsideInfo::removeInfo(*this); | 176 ShapeOutsideInfo::removeInfo(*this); |
| 177 else | 177 else |
| 178 ShapeOutsideInfo::ensureInfo(*this).markShapeAsDirty(); | 178 ShapeOutsideInfo::ensureInfo(*this).markShapeAsDirty(); |
| 179 | |
| 180 if (shapeOutside || shapeOutside != oldShapeOutside) | |
| 181 markShapeOutsideDependentsForLayout(); | |
| 182 } | 179 } |
| 183 | 180 |
| 184 void RenderBox::updateFromStyle() | 181 void RenderBox::updateFromStyle() |
| 185 { | 182 { |
| 186 RenderBoxModelObject::updateFromStyle(); | 183 RenderBoxModelObject::updateFromStyle(); |
| 187 | 184 |
| 188 RenderStyle* styleToUse = style(); | 185 RenderStyle* styleToUse = style(); |
| 189 bool isRootObject = isDocumentElement(); | 186 bool isRootObject = isDocumentElement(); |
| 190 bool isViewObject = isRenderView(); | 187 bool isViewObject = isRenderView(); |
| 191 | 188 |
| 192 // The root and the RenderView always paint their backgrounds/borders. | 189 // The root and the RenderView always paint their backgrounds/borders. |
| 193 if (isRootObject || isViewObject) | 190 if (isRootObject || isViewObject) |
| 194 setHasBoxDecorationBackground(true); | 191 setHasBoxDecorationBackground(true); |
| 195 | 192 |
| 196 setFloating(!isOutOfFlowPositioned() && styleToUse->isFloating()); | |
| 197 | |
| 198 bool boxHasOverflowClip = false; | 193 bool boxHasOverflowClip = false; |
| 199 if (!styleToUse->isOverflowVisible() && isRenderBlock() && !isViewObject) { | 194 if (!styleToUse->isOverflowVisible() && isRenderBlock() && !isViewObject) { |
| 200 // If overflow has been propagated to the viewport, it has no effect her
e. | 195 // If overflow has been propagated to the viewport, it has no effect her
e. |
| 201 if (node() != document().viewportDefiningElement()) | 196 if (node() != document().viewportDefiningElement()) |
| 202 boxHasOverflowClip = true; | 197 boxHasOverflowClip = true; |
| 203 } | 198 } |
| 204 | 199 |
| 205 if (boxHasOverflowClip != hasOverflowClip()) { | 200 if (boxHasOverflowClip != hasOverflowClip()) { |
| 206 // FIXME: This shouldn't be required if we tracked the visual overflow | 201 // FIXME: This shouldn't be required if we tracked the visual overflow |
| 207 // generated by positioned children or self painting layers. crbug.com/3
45403 | 202 // generated by positioned children or self painting layers. crbug.com/3
45403 |
| (...skipping 994 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1202 return; | 1197 return; |
| 1203 | 1198 |
| 1204 AllowPaintInvalidationScope scoper(frameView()); | 1199 AllowPaintInvalidationScope scoper(frameView()); |
| 1205 | 1200 |
| 1206 if ((style()->borderImage().image() && style()->borderImage().image()->data(
) == image) || | 1201 if ((style()->borderImage().image() && style()->borderImage().image()->data(
) == image) || |
| 1207 (style()->maskBoxImage().image() && style()->maskBoxImage().image()->dat
a() == image)) { | 1202 (style()->maskBoxImage().image() && style()->maskBoxImage().image()->dat
a() == image)) { |
| 1208 setShouldDoFullPaintInvalidation(true); | 1203 setShouldDoFullPaintInvalidation(true); |
| 1209 return; | 1204 return; |
| 1210 } | 1205 } |
| 1211 | 1206 |
| 1212 ShapeValue* shapeOutsideValue = style()->shapeOutside(); | |
| 1213 if (!frameView()->isInPerformLayout() && isFloating() && shapeOutsideValue &
& shapeOutsideValue->image() && shapeOutsideValue->image()->data() == image) { | |
| 1214 ShapeOutsideInfo::ensureInfo(*this).markShapeAsDirty(); | |
| 1215 markShapeOutsideDependentsForLayout(); | |
| 1216 } | |
| 1217 | |
| 1218 if (!paintInvalidationLayerRectsForImage(image, style()->backgroundLayers(),
true)) | 1207 if (!paintInvalidationLayerRectsForImage(image, style()->backgroundLayers(),
true)) |
| 1219 paintInvalidationLayerRectsForImage(image, style()->maskLayers(), false)
; | 1208 paintInvalidationLayerRectsForImage(image, style()->maskLayers(), false)
; |
| 1220 } | 1209 } |
| 1221 | 1210 |
| 1222 bool RenderBox::paintInvalidationLayerRectsForImage(WrappedImagePtr image, const
FillLayer& layers, bool drawingBackground) | 1211 bool RenderBox::paintInvalidationLayerRectsForImage(WrappedImagePtr image, const
FillLayer& layers, bool drawingBackground) |
| 1223 { | 1212 { |
| 1224 RenderBox* layerRenderer = 0; | 1213 RenderBox* layerRenderer = 0; |
| 1225 if (drawingBackground && isDocumentElement()) | 1214 if (drawingBackground && isDocumentElement()) |
| 1226 layerRenderer = view(); | 1215 layerRenderer = view(); |
| 1227 else | 1216 else |
| (...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1770 containerWidthInInlineDirection = perpendicularContainingBlockLogica
lHeight(); | 1759 containerWidthInInlineDirection = perpendicularContainingBlockLogica
lHeight(); |
| 1771 LayoutUnit preferredWidth = computeLogicalWidthUsing(MainOrPreferredSize
, styleToUse->logicalWidth(), containerWidthInInlineDirection, cb); | 1760 LayoutUnit preferredWidth = computeLogicalWidthUsing(MainOrPreferredSize
, styleToUse->logicalWidth(), containerWidthInInlineDirection, cb); |
| 1772 computedValues.m_extent = constrainLogicalWidthByMinMax(preferredWidth,
containerWidthInInlineDirection, cb); | 1761 computedValues.m_extent = constrainLogicalWidthByMinMax(preferredWidth,
containerWidthInInlineDirection, cb); |
| 1773 } | 1762 } |
| 1774 | 1763 |
| 1775 // Margin calculations. | 1764 // Margin calculations. |
| 1776 computeMarginsForDirection(InlineDirection, cb, containerLogicalWidth, compu
tedValues.m_extent, computedValues.m_margins.m_start, | 1765 computeMarginsForDirection(InlineDirection, cb, containerLogicalWidth, compu
tedValues.m_extent, computedValues.m_margins.m_start, |
| 1777 computedValues.m_margins.m_end, style()->marginStart(), style()->marginE
nd()); | 1766 computedValues.m_margins.m_end, style()->marginStart(), style()->marginE
nd()); |
| 1778 | 1767 |
| 1779 if (!hasPerpendicularContainingBlock && containerLogicalWidth && containerLo
gicalWidth != (computedValues.m_extent + computedValues.m_margins.m_start + comp
utedValues.m_margins.m_end) | 1768 if (!hasPerpendicularContainingBlock && containerLogicalWidth && containerLo
gicalWidth != (computedValues.m_extent + computedValues.m_margins.m_start + comp
utedValues.m_margins.m_end) |
| 1780 && !isFloating() && !isInline() && !cb->isFlexibleBox()) { | 1769 && !isInline() && !cb->isFlexibleBox()) { |
| 1781 LayoutUnit newMargin = containerLogicalWidth - computedValues.m_extent -
cb->marginStartForChild(this); | 1770 LayoutUnit newMargin = containerLogicalWidth - computedValues.m_extent -
cb->marginStartForChild(this); |
| 1782 bool hasInvertedDirection = cb->style()->isLeftToRightDirection() != sty
le()->isLeftToRightDirection(); | 1771 bool hasInvertedDirection = cb->style()->isLeftToRightDirection() != sty
le()->isLeftToRightDirection(); |
| 1783 if (hasInvertedDirection) | 1772 if (hasInvertedDirection) |
| 1784 computedValues.m_margins.m_start = newMargin; | 1773 computedValues.m_margins.m_start = newMargin; |
| 1785 else | 1774 else |
| 1786 computedValues.m_margins.m_end = newMargin; | 1775 computedValues.m_margins.m_end = newMargin; |
| 1787 } | 1776 } |
| 1788 } | 1777 } |
| 1789 | 1778 |
| 1790 LayoutUnit RenderBox::fillAvailableMeasure(LayoutUnit availableLogicalWidth) con
st | 1779 LayoutUnit RenderBox::fillAvailableMeasure(LayoutUnit availableLogicalWidth) con
st |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1842 // auto margins mean we don't stretch. Note that this function will only be
used for | 1831 // auto margins mean we don't stretch. Note that this function will only be
used for |
| 1843 // widths, so we don't have to check marginBefore/marginAfter. | 1832 // widths, so we don't have to check marginBefore/marginAfter. |
| 1844 ASSERT(parent->style()->isColumnFlexDirection()); | 1833 ASSERT(parent->style()->isColumnFlexDirection()); |
| 1845 if (flexitem->style()->marginStart().isAuto() || flexitem->style()->marginEn
d().isAuto()) | 1834 if (flexitem->style()->marginStart().isAuto() || flexitem->style()->marginEn
d().isAuto()) |
| 1846 return false; | 1835 return false; |
| 1847 return flexitem->style()->alignSelf() == ItemPositionStretch || (flexitem->s
tyle()->alignSelf() == ItemPositionAuto && parent->style()->alignItems() == Item
PositionStretch); | 1836 return flexitem->style()->alignSelf() == ItemPositionStretch || (flexitem->s
tyle()->alignSelf() == ItemPositionAuto && parent->style()->alignItems() == Item
PositionStretch); |
| 1848 } | 1837 } |
| 1849 | 1838 |
| 1850 bool RenderBox::sizesLogicalWidthToFitContent(const Length& logicalWidth) const | 1839 bool RenderBox::sizesLogicalWidthToFitContent(const Length& logicalWidth) const |
| 1851 { | 1840 { |
| 1852 // Marquees in WinIE are like a mixture of blocks and inline-blocks. They s
ize as though they're blocks, | 1841 if (isInlineBlock()) |
| 1853 // but they allow text to sit on the same line as the marquee. | |
| 1854 if (isFloating() || isInlineBlock()) | |
| 1855 return true; | 1842 return true; |
| 1856 | 1843 |
| 1857 if (logicalWidth.type() == Intrinsic) | 1844 if (logicalWidth.type() == Intrinsic) |
| 1858 return true; | 1845 return true; |
| 1859 | 1846 |
| 1860 // Flexible box items should shrink wrap, so we lay them out at their intrin
sic widths. | 1847 // Flexible box items should shrink wrap, so we lay them out at their intrin
sic widths. |
| 1861 // In the case of columns that have a stretch alignment, we go ahead and lay
out at the | 1848 // In the case of columns that have a stretch alignment, we go ahead and lay
out at the |
| 1862 // stretched size to avoid an extra layout when applying alignment. | 1849 // stretched size to avoid an extra layout when applying alignment. |
| 1863 if (parent()->isFlexibleBox()) { | 1850 if (parent()->isFlexibleBox()) { |
| 1864 // For multiline columns, we need to apply align-content first, so we ca
n't stretch now. | 1851 // For multiline columns, we need to apply align-content first, so we ca
n't stretch now. |
| 1865 if (!parent()->style()->isColumnFlexDirection() || parent()->style()->fl
exWrap() != FlexNoWrap) | 1852 if (!parent()->style()->isColumnFlexDirection() || parent()->style()->fl
exWrap() != FlexNoWrap) |
| 1866 return true; | 1853 return true; |
| 1867 if (!columnFlexItemHasStretchAlignment(this)) | 1854 if (!columnFlexItemHasStretchAlignment(this)) |
| 1868 return true; | 1855 return true; |
| 1869 } | 1856 } |
| 1870 | 1857 |
| 1871 return false; | 1858 return false; |
| 1872 } | 1859 } |
| 1873 | 1860 |
| 1874 void RenderBox::computeMarginsForDirection(MarginDirection flowDirection, const
RenderBlock* containingBlock, LayoutUnit containerWidth, LayoutUnit childWidth,
LayoutUnit& marginStart, LayoutUnit& marginEnd, Length marginStartLength, Length
marginEndLength) const | 1861 void RenderBox::computeMarginsForDirection(MarginDirection flowDirection, const
RenderBlock* containingBlock, LayoutUnit containerWidth, LayoutUnit childWidth,
LayoutUnit& marginStart, LayoutUnit& marginEnd, Length marginStartLength, Length
marginEndLength) const |
| 1875 { | 1862 { |
| 1876 if (flowDirection == BlockDirection || isFloating() || isInline()) { | 1863 if (flowDirection == BlockDirection || isInline()) { |
| 1877 // Margins are calculated with respect to the logical width of | 1864 // Margins are calculated with respect to the logical width of |
| 1878 // the containing block (8.3) | 1865 // the containing block (8.3) |
| 1879 // Inline blocks/tables and floats don't have their margins increased. | 1866 // Inline blocks/tables and floats don't have their margins increased. |
| 1880 marginStart = minimumValueForLength(marginStartLength, containerWidth); | 1867 marginStart = minimumValueForLength(marginStartLength, containerWidth); |
| 1881 marginEnd = minimumValueForLength(marginEndLength, containerWidth); | 1868 marginEnd = minimumValueForLength(marginEndLength, containerWidth); |
| 1882 return; | 1869 return; |
| 1883 } | 1870 } |
| 1884 | 1871 |
| 1885 if (containingBlock->isFlexibleBox()) { | 1872 if (containingBlock->isFlexibleBox()) { |
| 1886 // We need to let flexbox handle the margin adjustment - otherwise, flex
box | 1873 // We need to let flexbox handle the margin adjustment - otherwise, flex
box |
| (...skipping 1486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3373 closestRenderer = renderer; | 3360 closestRenderer = renderer; |
| 3374 minDist = dist; | 3361 minDist = dist; |
| 3375 } | 3362 } |
| 3376 } | 3363 } |
| 3377 | 3364 |
| 3378 if (closestRenderer) | 3365 if (closestRenderer) |
| 3379 return closestRenderer->positionForPoint(adjustedPoint - closestRenderer
->locationOffset()); | 3366 return closestRenderer->positionForPoint(adjustedPoint - closestRenderer
->locationOffset()); |
| 3380 return createPositionWithAffinity(firstPositionInOrBeforeNode(nonPseudoNode(
))); | 3367 return createPositionWithAffinity(firstPositionInOrBeforeNode(nonPseudoNode(
))); |
| 3381 } | 3368 } |
| 3382 | 3369 |
| 3383 static bool isReplacedElement(Node* node) | |
| 3384 { | |
| 3385 // FIXME(sky): Remove this. | |
| 3386 return false; | |
| 3387 } | |
| 3388 | |
| 3389 bool RenderBox::avoidsFloats() const | |
| 3390 { | |
| 3391 return isReplaced() || isReplacedElement(node()) || hasOverflowClip() || isF
lexItemIncludingDeprecated(); | |
| 3392 } | |
| 3393 | |
| 3394 InvalidationReason RenderBox::getPaintInvalidationReason(const RenderLayerModelO
bject& paintInvalidationContainer, | 3370 InvalidationReason RenderBox::getPaintInvalidationReason(const RenderLayerModelO
bject& paintInvalidationContainer, |
| 3395 const LayoutRect& oldBounds, const LayoutPoint& oldLocation, const LayoutRec
t& newBounds, const LayoutPoint& newLocation) | 3371 const LayoutRect& oldBounds, const LayoutPoint& oldLocation, const LayoutRec
t& newBounds, const LayoutPoint& newLocation) |
| 3396 { | 3372 { |
| 3397 InvalidationReason invalidationReason = RenderBoxModelObject::getPaintInvali
dationReason(paintInvalidationContainer, oldBounds, oldLocation, newBounds, newL
ocation); | 3373 InvalidationReason invalidationReason = RenderBoxModelObject::getPaintInvali
dationReason(paintInvalidationContainer, oldBounds, oldLocation, newBounds, newL
ocation); |
| 3398 if (invalidationReason != InvalidationNone && invalidationReason != Invalida
tionIncremental) | 3374 if (invalidationReason != InvalidationNone && invalidationReason != Invalida
tionIncremental) |
| 3399 return invalidationReason; | 3375 return invalidationReason; |
| 3400 | 3376 |
| 3401 if (!style()->hasBackground() && !style()->hasBoxDecorations()) | 3377 if (!style()->hasBackground() && !style()->hasBoxDecorations()) |
| 3402 return invalidationReason; | 3378 return invalidationReason; |
| 3403 | 3379 |
| (...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3903 | 3879 |
| 3904 RenderBox::BoxDecorationData::BoxDecorationData(const RenderStyle& style) | 3880 RenderBox::BoxDecorationData::BoxDecorationData(const RenderStyle& style) |
| 3905 { | 3881 { |
| 3906 backgroundColor = style.colorIncludingFallback(CSSPropertyBackgroundColor); | 3882 backgroundColor = style.colorIncludingFallback(CSSPropertyBackgroundColor); |
| 3907 hasBackground = backgroundColor.alpha() || style.hasBackgroundImage(); | 3883 hasBackground = backgroundColor.alpha() || style.hasBackgroundImage(); |
| 3908 ASSERT(hasBackground == style.hasBackground()); | 3884 ASSERT(hasBackground == style.hasBackground()); |
| 3909 hasBorder = style.hasBorder(); | 3885 hasBorder = style.hasBorder(); |
| 3910 } | 3886 } |
| 3911 | 3887 |
| 3912 } // namespace blink | 3888 } // namespace blink |
| OLD | NEW |