Changeset 126468 in webkit
- Timestamp:
- Aug 23, 2012 12:46:51 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r126465 r126468 1 2012-08-23 Shezan Baig <shezbaig.wk@gmail.com> 2 3 Flexbox doesn't need to compute logical height for stretched items in row flow 4 https://bugs.webkit.org/show_bug.cgi?id=94807 5 6 Reviewed by Tony Chang. 7 8 Change logicalHeightConstrainedByMinMax to 9 constrainLogicalHeightByMinMax. The new method doesn't compute the 10 MainOrPreferred logical height (that computation has been moved back to 11 computeLogicalHeight). RenderFlexibleBox now just constrains the 12 stretchedLogicalHeight by min/max. 13 14 No new tests. This is a cleanup of bug 94237. 15 16 * rendering/RenderBox.cpp: 17 (WebCore::RenderBox::constrainLogicalHeightByMinMax): Instead of 18 computing the MainOrPreferred logical height, just constrain the given 19 logical height by MinSize and MaxSize. 20 (WebCore::RenderBox::computeLogicalHeight): Compute the MainOrPreferred 21 logical height before constraining by min/max. 22 * rendering/RenderBox.h: 23 (RenderBox): 24 * rendering/RenderFlexibleBox.cpp: 25 (WebCore::RenderFlexibleBox::applyStretchAlignmentToChild): Use 26 constrainLogicalHeightByMinMax to constrain the stretchedLogicalHeight. 27 1 28 2012-08-23 Adam Barth <abarth@webkit.org> 2 29 -
trunk/Source/WebCore/rendering/RenderBox.cpp
r126437 r126468 434 434 } 435 435 436 LayoutUnit RenderBox:: logicalHeightConstrainedByMinMax(LayoutUnit availableHeight)436 LayoutUnit RenderBox::constrainLogicalHeightByMinMax(LayoutUnit logicalHeight) 437 437 { 438 438 RenderStyle* styleToUse = style(); 439 LayoutUnit result = computeLogicalHeightUsing(MainOrPreferredSize, styleToUse->logicalHeight()); 440 if (result == -1) 441 result = availableHeight; 442 LayoutUnit minH = computeLogicalHeightUsing(MinSize, styleToUse->logicalMinHeight()); // Leave as -1 if unset. 443 LayoutUnit maxH = styleToUse->logicalMaxHeight().isUndefined() ? result : computeLogicalHeightUsing(MaxSize, styleToUse->logicalMaxHeight()); 444 if (maxH == -1) 445 maxH = result; 446 result = min(maxH, result); 447 result = max(minH, result); 448 return result; 439 if (!styleToUse->logicalMaxHeight().isUndefined()) { 440 // Constrain by MaxSize. 441 LayoutUnit maxH = computeLogicalHeightUsing(MaxSize, styleToUse->logicalMaxHeight()); 442 if (maxH != -1) 443 logicalHeight = min(logicalHeight, maxH); 444 } 445 // Constrain by MinSize. 446 return max(logicalHeight, computeLogicalHeightUsing(MinSize, styleToUse->logicalMinHeight())); 449 447 } 450 448 … … 2014 2012 2015 2013 LayoutUnit heightResult; 2016 if (checkMinMaxHeight) 2017 heightResult = logicalHeightConstrainedByMinMax(logicalHeight()); 2018 else { 2014 if (checkMinMaxHeight) { 2015 heightResult = computeLogicalHeightUsing(MainOrPreferredSize, style()->logicalHeight()); 2016 if (heightResult == -1) 2017 heightResult = logicalHeight(); 2018 heightResult = constrainLogicalHeightByMinMax(heightResult); 2019 } else { 2019 2020 // The only times we don't check min/max height are when a fixed length has 2020 2021 // been given as an override. Just use that. The value has already been adjusted -
trunk/Source/WebCore/rendering/RenderBox.h
r126437 r126468 76 76 LayoutUnit logicalHeight() const { return style()->isHorizontalWritingMode() ? height() : width(); } 77 77 78 LayoutUnit logicalHeightConstrainedByMinMax(LayoutUnit);78 LayoutUnit constrainLogicalHeightByMinMax(LayoutUnit); 79 79 80 80 int pixelSnappedLogicalHeight() const { return style()->isHorizontalWritingMode() ? pixelSnappedHeight() : pixelSnappedWidth(); } -
trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp
r126257 r126468 1234 1234 { 1235 1235 if (!isColumnFlow() && child->style()->logicalHeight().isAuto()) { 1236 // FIXME: If the child has orthogonal flow, then it already has an override height set . How do we stretch?1236 // FIXME: If the child has orthogonal flow, then it already has an override height set, so use it. 1237 1237 if (!hasOrthogonalFlow(child)) { 1238 1238 LayoutUnit stretchedLogicalHeight = child->logicalHeight() + availableAlignmentSpaceForChild(lineCrossAxisExtent, child); 1239 LayoutUnit desiredLogicalHeight = child-> logicalHeightConstrainedByMinMax(stretchedLogicalHeight);1239 LayoutUnit desiredLogicalHeight = child->constrainLogicalHeightByMinMax(stretchedLogicalHeight); 1240 1240 1241 1241 // FIXME: Can avoid laying out here in some cases. See https://webkit.org/b/87905.
Note: See TracChangeset
for help on using the changeset viewer.