| 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 2160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2171 LayoutUnit logicalWidthResult = fillAvailableMeasure(availableLogicalWidth,
marginStart, marginEnd); | 2171 LayoutUnit logicalWidthResult = fillAvailableMeasure(availableLogicalWidth,
marginStart, marginEnd); |
| 2172 | 2172 |
| 2173 if (shrinkToAvoidFloats() && cb->containsFloats()) | 2173 if (shrinkToAvoidFloats() && cb->containsFloats()) |
| 2174 logicalWidthResult = min(logicalWidthResult, shrinkLogicalWidthToAvoidFl
oats(marginStart, marginEnd, cb, region, offsetFromLogicalTopOfFirstPage));
| 2174 logicalWidthResult = min(logicalWidthResult, shrinkLogicalWidthToAvoidFl
oats(marginStart, marginEnd, cb, region, offsetFromLogicalTopOfFirstPage));
|
| 2175 | 2175 |
| 2176 if (widthType == MainOrPreferredSize && sizesLogicalWidthToFitContent(widthT
ype)) | 2176 if (widthType == MainOrPreferredSize && sizesLogicalWidthToFitContent(widthT
ype)) |
| 2177 return max(minPreferredLogicalWidth(), min(maxPreferredLogicalWidth(), l
ogicalWidthResult)); | 2177 return max(minPreferredLogicalWidth(), min(maxPreferredLogicalWidth(), l
ogicalWidthResult)); |
| 2178 return logicalWidthResult; | 2178 return logicalWidthResult; |
| 2179 } | 2179 } |
| 2180 | 2180 |
| 2181 static bool flexItemHasStretchAlignment(const RenderObject* flexitem) | 2181 static bool columnFlexItemHasStretchAlignment(const RenderObject* flexitem) |
| 2182 { | 2182 { |
| 2183 RenderObject* parent = flexitem->parent(); | 2183 RenderObject* parent = flexitem->parent(); |
| 2184 // auto margins mean we don't stretch. Note that this function will only be
used for |
| 2185 // widths, so we don't have to check marginBefore/marginAfter. |
| 2186 ASSERT(parent->style()->isColumnFlexDirection()); |
| 2187 if (flexitem->style()->marginStart().isAuto() || flexitem->style()->marginEn
d().isAuto()) |
| 2188 return false; |
| 2184 return flexitem->style()->alignSelf() == AlignStretch || (flexitem->style()-
>alignSelf() == AlignAuto && parent->style()->alignItems() == AlignStretch); | 2189 return flexitem->style()->alignSelf() == AlignStretch || (flexitem->style()-
>alignSelf() == AlignAuto && parent->style()->alignItems() == AlignStretch); |
| 2185 } | 2190 } |
| 2186 | 2191 |
| 2187 static bool isStretchingColumnFlexItem(const RenderObject* flexitem) | 2192 static bool isStretchingColumnFlexItem(const RenderObject* flexitem) |
| 2188 { | 2193 { |
| 2189 RenderObject* parent = flexitem->parent(); | 2194 RenderObject* parent = flexitem->parent(); |
| 2190 if (parent->isDeprecatedFlexibleBox() && parent->style()->boxOrient() == VER
TICAL && parent->style()->boxAlign() == BSTRETCH) | 2195 if (parent->isDeprecatedFlexibleBox() && parent->style()->boxOrient() == VER
TICAL && parent->style()->boxAlign() == BSTRETCH) |
| 2191 return true; | 2196 return true; |
| 2192 | 2197 |
| 2193 // We don't stretch multiline flexboxes because they need to apply line spac
ing (align-content) first. | 2198 // We don't stretch multiline flexboxes because they need to apply line spac
ing (align-content) first. |
| 2194 if (parent->isFlexibleBox() && parent->style()->flexWrap() == FlexNoWrap &&
parent->style()->isColumnFlexDirection() && flexItemHasStretchAlignment(flexitem
)) | 2199 if (parent->isFlexibleBox() && parent->style()->flexWrap() == FlexNoWrap &&
parent->style()->isColumnFlexDirection() && columnFlexItemHasStretchAlignment(fl
exitem)) |
| 2195 return true; | 2200 return true; |
| 2196 return false; | 2201 return false; |
| 2197 } | 2202 } |
| 2198 | 2203 |
| 2199 bool RenderBox::sizesLogicalWidthToFitContent(SizeType widthType) const | 2204 bool RenderBox::sizesLogicalWidthToFitContent(SizeType widthType) const |
| 2200 { | 2205 { |
| 2201 // Marquees in WinIE are like a mixture of blocks and inline-blocks. They s
ize as though they're blocks, | 2206 // Marquees in WinIE are like a mixture of blocks and inline-blocks. They s
ize as though they're blocks, |
| 2202 // but they allow text to sit on the same line as the marquee. | 2207 // but they allow text to sit on the same line as the marquee. |
| 2203 if (isFloating() || (isInlineBlockOrInlineTable() && !isHTMLMarquee())) | 2208 if (isFloating() || (isInlineBlockOrInlineTable() && !isHTMLMarquee())) |
| 2204 return true; | 2209 return true; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 2220 return true; | 2225 return true; |
| 2221 } | 2226 } |
| 2222 | 2227 |
| 2223 // Flexible box items should shrink wrap, so we lay them out at their intrin
sic widths. | 2228 // Flexible box items should shrink wrap, so we lay them out at their intrin
sic widths. |
| 2224 // In the case of columns that have a stretch alignment, we go ahead and lay
out at the | 2229 // In the case of columns that have a stretch alignment, we go ahead and lay
out at the |
| 2225 // stretched size to avoid an extra layout when applying alignment. | 2230 // stretched size to avoid an extra layout when applying alignment. |
| 2226 if (parent()->isFlexibleBox()) { | 2231 if (parent()->isFlexibleBox()) { |
| 2227 // For multiline columns, we need to apply align-content first, so we ca
n't stretch now. | 2232 // For multiline columns, we need to apply align-content first, so we ca
n't stretch now. |
| 2228 if (!parent()->style()->isColumnFlexDirection() || parent()->style()->fl
exWrap() != FlexNoWrap) | 2233 if (!parent()->style()->isColumnFlexDirection() || parent()->style()->fl
exWrap() != FlexNoWrap) |
| 2229 return true; | 2234 return true; |
| 2230 if (!flexItemHasStretchAlignment(this)) | 2235 if (!columnFlexItemHasStretchAlignment(this)) |
| 2231 return true; | 2236 return true; |
| 2232 } | 2237 } |
| 2233 | 2238 |
| 2234 // Flexible horizontal boxes lay out children at their intrinsic widths. Al
so vertical boxes | 2239 // Flexible horizontal boxes lay out children at their intrinsic widths. Al
so vertical boxes |
| 2235 // that don't stretch their kids lay out their children at their intrinsic w
idths. | 2240 // that don't stretch their kids lay out their children at their intrinsic w
idths. |
| 2236 // FIXME: Think about block-flow here. | 2241 // FIXME: Think about block-flow here. |
| 2237 // https://bugs.webkit.org/show_bug.cgi?id=46473 | 2242 // https://bugs.webkit.org/show_bug.cgi?id=46473 |
| 2238 if (parent()->isDeprecatedFlexibleBox() && (parent()->style()->boxOrient() =
= HORIZONTAL || parent()->style()->boxAlign() != BSTRETCH)) | 2243 if (parent()->isDeprecatedFlexibleBox() && (parent()->style()->boxOrient() =
= HORIZONTAL || parent()->style()->boxAlign() != BSTRETCH)) |
| 2239 return true; | 2244 return true; |
| 2240 | 2245 |
| (...skipping 2350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4591 | 4596 |
| 4592 void RenderBox::reportStaticMembersMemoryUsage(MemoryInstrumentation* memoryInst
rumentation) | 4597 void RenderBox::reportStaticMembersMemoryUsage(MemoryInstrumentation* memoryInst
rumentation) |
| 4593 { | 4598 { |
| 4594 memoryInstrumentation->addRootObject(gOverrideHeightMap, WebCoreMemoryTypes:
:RenderingStructures); | 4599 memoryInstrumentation->addRootObject(gOverrideHeightMap, WebCoreMemoryTypes:
:RenderingStructures); |
| 4595 memoryInstrumentation->addRootObject(gOverrideWidthMap, WebCoreMemoryTypes::
RenderingStructures); | 4600 memoryInstrumentation->addRootObject(gOverrideWidthMap, WebCoreMemoryTypes::
RenderingStructures); |
| 4596 memoryInstrumentation->addRootObject(gOverrideContainingBlockLogicalHeightMa
p, WebCoreMemoryTypes::RenderingStructures); | 4601 memoryInstrumentation->addRootObject(gOverrideContainingBlockLogicalHeightMa
p, WebCoreMemoryTypes::RenderingStructures); |
| 4597 memoryInstrumentation->addRootObject(gOverrideContainingBlockLogicalWidthMap
, WebCoreMemoryTypes::RenderingStructures); | 4602 memoryInstrumentation->addRootObject(gOverrideContainingBlockLogicalWidthMap
, WebCoreMemoryTypes::RenderingStructures); |
| 4598 } | 4603 } |
| 4599 | 4604 |
| 4600 } // namespace WebCore | 4605 } // namespace WebCore |
| OLD | NEW |