Changeset 125055 in webkit
- Timestamp:
- Aug 8, 2012 11:29:02 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 6 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r125054 r125055 1 2012-08-07 Ojan Vafai <ojan@chromium.org> 2 3 percentage height/width values in quirks mode are incorrectly resolved in flexbox children 4 https://bugs.webkit.org/show_bug.cgi?id=81809 5 6 Reviewed by Tony Chang. 7 8 * css3/flexbox/box-sizing-min-max-sizes-expected.txt: Added. 9 * css3/flexbox/box-sizing-min-max-sizes.html: Added. 10 * css3/flexbox/percentage-sizes-expected.txt: Added. 11 * css3/flexbox/percentage-sizes-quirks-expected.txt: Added. 12 * css3/flexbox/percentage-sizes-quirks.html: Added. 13 * css3/flexbox/percentage-sizes.html: Added. 14 1 15 2012-08-08 Andrew Scherkus <scherkus@chromium.org> 2 16 -
trunk/Source/WebCore/ChangeLog
r125054 r125055 1 2012-08-07 Ojan Vafai <ojan@chromium.org> 2 3 percentage height/width values in quirks mode are incorrectly resolved in flexbox children 4 https://bugs.webkit.org/show_bug.cgi?id=81809 5 6 Reviewed by Tony Chang. 7 8 When computing percentage logical heights we need to use the RenderBox helper methods 9 to make sure we handle all the edge cases correctly (e.g. walk up the containing block 10 ancestor chain in quirks mode until we find a definite size). 11 12 For widths, the containing block always has a definite size, so all we need to do 13 is call computeContentBoxLogicalWidth(valueForLength(...)), although I'm not sure 14 this does the right thing for the intrinsic sizing keywords. 15 16 Tests: css3/flexbox/box-sizing-min-max-sizes.html 17 css3/flexbox/percentage-sizes-quirks.html 18 css3/flexbox/percentage-sizes.html 19 20 * rendering/RenderBox.cpp: 21 (WebCore::RenderBox::computeLogicalClientHeight): 22 (WebCore): 23 * rendering/RenderBox.h: 24 (RenderBox): 25 * rendering/RenderFlexibleBox.cpp: 26 (WebCore::RenderFlexibleBox::computeMainAxisSizeForChild): 27 (WebCore::RenderFlexibleBox::preferredMainAxisContentExtentForChild): 28 (WebCore::RenderFlexibleBox::adjustChildSizeForMinAndMax): 29 * rendering/RenderFlexibleBox.h: 30 1 31 2012-08-08 Andrew Scherkus <scherkus@chromium.org> 2 32 -
trunk/Source/WebCore/rendering/RenderBox.cpp
r124773 r125055 2060 2060 logicalHeight = computeBorderBoxLogicalHeight(logicalHeight); 2061 2061 return logicalHeight; 2062 } 2063 2064 LayoutUnit RenderBox::computeLogicalClientHeight(SizeType heightType, const Length& height) 2065 { 2066 LayoutUnit heightIncludingScrollbar = computeContentLogicalHeightUsing(heightType, height); 2067 if (heightIncludingScrollbar == -1) 2068 return -1; 2069 return std::max(LayoutUnit(0), computeContentBoxLogicalHeight(heightIncludingScrollbar) - scrollbarLogicalHeight()); 2062 2070 } 2063 2071 -
trunk/Source/WebCore/rendering/RenderBox.h
r124662 r125055 343 343 LayoutUnit computeLogicalWidthInRegionUsing(SizeType, LayoutUnit availableLogicalWidth, const RenderBlock* containingBlock, RenderRegion*, LayoutUnit offsetFromLogicalTopOfFirstPage); 344 344 LayoutUnit computeLogicalHeightUsing(SizeType, const Length& height); 345 LayoutUnit computeLogicalClientHeight(SizeType, const Length& height); 345 346 LayoutUnit computeContentLogicalHeightUsing(SizeType, const Length& height); 346 347 LayoutUnit computeReplacedLogicalWidthUsing(SizeType, Length width) const; -
trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp
r124987 r125055 401 401 } 402 402 403 LayoutUnit RenderFlexibleBox::computeLogicalClientHeight(SizeType heightType, const Length& height) 404 { 405 LayoutUnit heightIncludingScrollbar = computeContentLogicalHeightUsing(heightType, height); 406 if (heightIncludingScrollbar == -1) 407 return -1; 408 return std::max(LayoutUnit(0), computeContentBoxLogicalHeight(heightIncludingScrollbar) - scrollbarLogicalHeight()); 403 LayoutUnit RenderFlexibleBox::computeMainAxisExtentForChild(RenderBox* child, SizeType sizeType, const Length& size, LayoutUnit maximumValue) 404 { 405 // FIXME: This is wrong for orthogonal flows. It should use the flexbox's writing-mode, not the child's in order 406 // to figure out the logical height/width. 407 if (isColumnFlow()) 408 return child->computeLogicalClientHeight(sizeType, size); 409 return child->computeContentBoxLogicalWidth(valueForLength(size, maximumValue, view())); 409 410 } 410 411 … … 605 606 return mainAxisExtent - mainAxisBorderAndPaddingExtentForChild(child); 606 607 } 607 LayoutUnit extent = minimumValueForLength(flexBasis, mainAxisContentExtent(), view()); 608 extent = isColumnFlow() ? child->computeContentBoxLogicalHeight(extent) : child->computeContentBoxLogicalWidth(extent); 609 return std::max(LayoutUnit(0), extent); 608 return std::max(LayoutUnit(0), computeMainAxisExtentForChild(child, MainOrPreferredSize, flexBasis, mainAxisContentExtent())); 610 609 } 611 610 … … 814 813 LayoutUnit RenderFlexibleBox::adjustChildSizeForMinAndMax(RenderBox* child, LayoutUnit childSize, LayoutUnit flexboxAvailableContentExtent) 815 814 { 815 // FIXME: Support intrinsic min/max lengths. 816 816 Length max = isHorizontalFlow() ? child->style()->maxWidth() : child->style()->maxHeight(); 817 if (max.isSpecified()) { 818 LayoutUnit maxExtent = computeMainAxisExtentForChild(child, MaxSize, max, flexboxAvailableContentExtent); 819 if (maxExtent != -1 && childSize > maxExtent) 820 childSize = maxExtent; 821 } 822 817 823 Length min = isHorizontalFlow() ? child->style()->minWidth() : child->style()->minHeight(); 818 RenderView* renderView = view(); 819 // FIXME: valueForLength isn't quite right in quirks mode: percentage heights should check parents until a value is found. 820 // https://bugs.webkit.org/show_bug.cgi?id=81809 821 if (max.isSpecified() && childSize > valueForLength(max, flexboxAvailableContentExtent, renderView)) 822 childSize = valueForLength(max, flexboxAvailableContentExtent, renderView); 823 824 if (min.isSpecified() && childSize < valueForLength(min, flexboxAvailableContentExtent, renderView)) 825 return valueForLength(min, flexboxAvailableContentExtent, renderView); 826 827 // FIXME: Support min/max sizes of fit-content, max-content and fill-available. 828 if (min.isAuto()) { 829 LayoutUnit minContent = hasOrthogonalFlow(child) ? child->logicalHeight() : child->minPreferredLogicalWidth(); 830 minContent -= mainAxisBorderAndPaddingExtentForChild(child); 831 return std::max(childSize, minContent); 832 } 833 834 return childSize; 824 LayoutUnit minExtent = 0; 825 if (min.isSpecified()) 826 minExtent = computeMainAxisExtentForChild(child, MinSize, min, flexboxAvailableContentExtent); 827 else if (min.isAuto()) { 828 minExtent = hasOrthogonalFlow(child) ? child->logicalHeight() : child->minPreferredLogicalWidth(); 829 minExtent -= mainAxisBorderAndPaddingExtentForChild(child); 830 } 831 return std::max(childSize, minExtent); 835 832 } 836 833 -
trunk/Source/WebCore/rendering/RenderFlexibleBox.h
r124987 r125055 86 86 LayoutUnit crossAxisContentExtent() const; 87 87 LayoutUnit mainAxisContentExtent(); 88 LayoutUnit compute LogicalClientHeight(SizeType, const Length& height);88 LayoutUnit computeMainAxisExtentForChild(RenderBox* child, SizeType, const Length& size, LayoutUnit maximumValue); 89 89 WritingMode transformedWritingMode() const; 90 90 LayoutUnit flowAwareBorderStart() const;
Note: See TracChangeset
for help on using the changeset viewer.