Changeset 189567 in webkit
- Timestamp:
- Sep 10, 2015 4:58:24 AM (9 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 29 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r189566 r189567 1 2015-09-10 Sergio Villar Senin <svillar@igalia.com> 2 3 min-width/height should default to auto for flexbox items 4 https://bugs.webkit.org/show_bug.cgi?id=146020 5 6 Reviewed by David Hyatt. 7 8 Based on Blink's r193665, r194062, r194887 and r195930 by <cbiesinger@chromium.org>. 9 10 * TestExpectations: Removed passing flexbox tests. 11 * css3/flexbox/csswg/flex-flow-007.html: Added min-height: 0px. 12 * css3/flexbox/flexbox-baseline.html: Ditto. 13 * css3/flexbox/min-size-auto-expected.txt: Added. 14 * css3/flexbox/min-size-auto.html: Added. 15 * css3/flexbox/preferred-widths-orthogonal.html: Added min-height: 0px. 16 * fast/css/auto-min-size-expected.txt: Check default computed 17 styles for min-width/height for flex items. 18 * fast/css/auto-min-size.html: Ditto. 19 1 20 2015-09-10 ChangSeok Oh <changseok.oh@collabora.com> 2 21 -
trunk/LayoutTests/TestExpectations
r189542 r189567 204 204 webkit.org/b/136754 css3/flexbox/csswg/flex-lines/multi-line-wrap-reverse-column-reverse.html [ ImageOnlyFailure ] 205 205 webkit.org/b/136754 css3/flexbox/csswg/flex-lines/multi-line-wrap-with-column-reverse.html [ ImageOnlyFailure ] 206 webkit.org/b/136754 css3/flexbox/csswg/flex-margin-no-collapse.html [ ImageOnlyFailure ]207 206 webkit.org/b/136754 css3/flexbox/csswg/flexbox-flex-wrap-flexing.html [ ImageOnlyFailure ] 208 webkit.org/b/136754 css3/flexbox/csswg/flexbox_flex-0-0-0.html [ ImageOnlyFailure ]209 webkit.org/b/136754 css3/flexbox/csswg/flexbox_flex-0-1-0.html [ ImageOnlyFailure ]210 webkit.org/b/136754 css3/flexbox/csswg/flexbox_flex-0-N-0.html [ ImageOnlyFailure ]211 207 webkit.org/b/136754 css3/flexbox/csswg/flexbox_flex-natural-mixed-basis-auto.html [ ImageOnlyFailure ] 212 208 webkit.org/b/136754 css3/flexbox/csswg/flexbox_generated-container.html [ ImageOnlyFailure ] -
trunk/LayoutTests/css3/flexbox/csswg/flex-flow-007.html
r189541 r189567 23 23 height: 50px; 24 24 } 25 :not(#test) div { 26 min-height: 0px; 27 } 25 28 </style> 26 29 <body> -
trunk/LayoutTests/css3/flexbox/flexbox-baseline.html
r189541 r189567 74 74 should align with the middle 75 75 <div class="inline-flexbox" style="width: 40px; height: 40px"> 76 <div style="-webkit-writing-mode: vertical-rl; height: 20px; width: 40px; border-bottom: 1px solid black "></div>76 <div style="-webkit-writing-mode: vertical-rl; height: 20px; width: 40px; border-bottom: 1px solid black; min-height: 0px;"></div> 77 77 </div> 78 78 of the grey flexbox … … 112 112 should align with the middle 113 113 <div class="inline-flexbox column" style="width: 40px; height: 40px;"> 114 <div style="-webkit-writing-mode: vertical-rl; width: 40px; height: 20px; border-bottom: 1px solid black "></div>115 <div style="-webkit-writing-mode: vertical-rl; width: 40px; height: 20px "></div>114 <div style="-webkit-writing-mode: vertical-rl; width: 40px; height: 20px; border-bottom: 1px solid black; min-height: 0px;"></div> 115 <div style="-webkit-writing-mode: vertical-rl; width: 40px; height: 20px; min-height: 0px;"></div> 116 116 </div> 117 117 of the grey flexbox -
trunk/LayoutTests/css3/flexbox/preferred-widths-orthogonal.html
r189541 r189567 73 73 74 74 <div class="flexbox vertical-lr" data-expected-height=115 data-expect-width=80> 75 <div class="horizontal-tb nested" data-expected-height=80 data-expect-width=50 >75 <div class="horizontal-tb nested" data-expected-height=80 data-expect-width=50 style="min-height: 0px;"> 76 76 <div class="vertical-lr nested" data-expected-height=80 data-expect-width=30> 77 77 <div></div> … … 94 94 95 95 <div class="flexbox vertical-lr" data-expected-height=65 data-expect-width=70> 96 <div class="nested horizontal-tb" data-expected-height=30 data-expect-width=40 >96 <div class="nested horizontal-tb" data-expected-height=30 data-expect-width=40 style="min-height: 0px;"> 97 97 <div></div> 98 98 <div></div> -
trunk/LayoutTests/fast/css/auto-min-size-expected.txt
r189541 r189567 1 1 PASS div.style.minWidth is "" 2 2 PASS getComputedStyle(div)["min-width"] is "0px" 3 PASS div.style.minWidth is " "3 PASS div.style.minWidth is "auto" 4 4 PASS div.style.maxWidth is "" 5 5 PASS getComputedStyle(div).minWidth is "0px" … … 8 8 PASS div.style.minHeight is "" 9 9 PASS getComputedStyle(div)["min-height"] is "0px" 10 PASS div.style.minHeight is " "10 PASS div.style.minHeight is "auto" 11 11 PASS div.style.maxHeight is "" 12 12 PASS getComputedStyle(div).minHeight is "0px" 13 13 PASS div.style.minHeight is "0px" 14 14 PASS getComputedStyle(div)["min-height"] is "0px" 15 PASS flexitem.style.minWidth is "" 16 PASS getComputedStyle(flexitem)["min-width"] is "auto" 17 PASS flexitem.style.minWidth is "auto" 18 PASS flexitem.style.maxWidth is "" 19 PASS getComputedStyle(flexitem).minWidth is "auto" 20 PASS flexitem.style.minWidth is "0px" 21 PASS getComputedStyle(flexitem)["min-width"] is "0px" 22 PASS flexitem.style.minHeight is "" 23 PASS getComputedStyle(flexitem)["min-height"] is "auto" 24 PASS flexitem.style.minHeight is "auto" 25 PASS flexitem.style.maxHeight is "" 26 PASS getComputedStyle(flexitem).minHeight is "auto" 27 PASS flexitem.style.minHeight is "0px" 28 PASS getComputedStyle(flexitem)["min-height"] is "0px" 15 29 PASS successfullyParsed is true 16 30 -
trunk/LayoutTests/fast/css/auto-min-size.html
r189541 r189567 2 2 <script src='../../resources/js-test-pre.js'></script> 3 3 <div id=foo></div> 4 <div id="flexbox" style="display: flex;"><div id="flexitem"></div></div> 4 5 <script> 5 6 div = document.getElementById('foo'); … … 9 10 div.style.minWidth = 'auto'; 10 11 div.style.maxWidth = 'auto'; 11 shouldBe('div.style.minWidth', '" "');12 shouldBe('div.style.minWidth', '"auto"'); 12 13 shouldBe('div.style.maxWidth', '""'); 13 14 shouldBe('getComputedStyle(div).minWidth', '"0px"'); … … 22 23 div.style.minHeight = 'auto'; 23 24 div.style.maxHeight = 'auto'; 24 shouldBe('div.style.minHeight', '" "');25 shouldBe('div.style.minHeight', '"auto"'); 25 26 shouldBe('div.style.maxHeight', '""'); 26 27 shouldBe('getComputedStyle(div).minHeight', '"0px"'); … … 30 31 shouldBe('getComputedStyle(div)["min-height"]', '"0px"'); 31 32 33 var flexitem = document.getElementById("flexitem"); 34 shouldBe('flexitem.style.minWidth', '""'); 35 shouldBe('getComputedStyle(flexitem)["min-width"]', '"auto"'); 36 37 flexitem.style.minWidth = 'auto'; 38 flexitem.style.maxWidth = 'auto'; 39 shouldBe('flexitem.style.minWidth', '"auto"'); 40 shouldBe('flexitem.style.maxWidth', '""'); 41 shouldBe('getComputedStyle(flexitem).minWidth', '"auto"'); 42 43 flexitem.style.minWidth = 0; 44 shouldBe('flexitem.style.minWidth', '"0px"'); 45 shouldBe('getComputedStyle(flexitem)["min-width"]', '"0px"'); 46 47 shouldBe('flexitem.style.minHeight', '""'); 48 shouldBe('getComputedStyle(flexitem)["min-height"]', '"auto"'); 49 50 flexitem.style.minHeight = 'auto'; 51 flexitem.style.maxHeight = 'auto'; 52 shouldBe('flexitem.style.minHeight', '"auto"'); 53 shouldBe('flexitem.style.maxHeight', '""'); 54 shouldBe('getComputedStyle(flexitem).minHeight', '"auto"'); 55 56 flexitem.style.minHeight = 0; 57 shouldBe('flexitem.style.minHeight', '"0px"'); 58 shouldBe('getComputedStyle(flexitem)["min-height"]', '"0px"'); 32 59 </script> 33 60 <script src='../../resources/js-test-post.js'></script> -
trunk/Source/WebCore/ChangeLog
r189566 r189567 1 2015-09-10 Sergio Villar Senin <svillar@igalia.com> 2 3 min-width/height should default to auto for flexbox items 4 https://bugs.webkit.org/show_bug.cgi?id=146020 5 6 Reviewed by David Hyatt. 7 8 Based on Blink's r193665, r194062, r194887 and r195930 by <cbiesinger@chromium.org>. 9 10 As specified here 11 http://dev.w3.org/csswg/css-flexbox/#min-size-auto the default 12 value of min-{width|height} is auto for flex items. 13 14 In case this patch breaks any website (as it's changing the 15 default value of those properties) the fix is likely to add: 16 17 min-width: 0; 18 min-height: 0; 19 20 to any relevant flexitems. 21 22 Test: css3/flexbox/min-size-auto.html 23 24 * css/CSSComputedStyleDeclaration.cpp: 25 (WebCore::isFlexOrGrid): New helper method to identify grids and flexs. 26 (WebCore::ComputedStyleExtractor::propertyValue): Return auto 27 for flex items if min-width/height is auto. 28 * css/CSSParser.cpp: 29 (WebCore::CSSParser::parseValue): 30 * html/shadow/SliderThumbElement.cpp: 31 * rendering/RenderBox.cpp: 32 (WebCore::RenderBox::constrainLogicalHeightByMinMax): 33 (WebCore::RenderBox::constrainContentBoxLogicalHeightByMinMax): 34 (WebCore::RenderBox::computeLogicalWidthInRegionUsing): 35 (WebCore::RenderBox::computeLogicalHeight): 36 (WebCore::RenderBox::computeLogicalHeightUsing): 37 (WebCore::RenderBox::computeContentLogicalHeight): 38 (WebCore::RenderBox::computeContentAndScrollbarLogicalHeightUsing): 39 (WebCore::RenderBox::computeReplacedLogicalWidth): 40 (WebCore::RenderBox::computeReplacedLogicalWidthRespectingMinMaxWidth): 41 (WebCore::RenderBox::computeReplacedLogicalWidthUsing): 42 (WebCore::RenderBox::computeReplacedLogicalHeight): 43 (WebCore::RenderBox::computeReplacedLogicalHeightRespectingMinMaxHeight): 44 (WebCore::RenderBox::computeReplacedLogicalHeightUsing): 45 (WebCore::RenderBox::availableLogicalHeightUsing): 46 (WebCore::RenderBox::computePositionedLogicalWidth): 47 (WebCore::RenderBox::computePositionedLogicalWidthUsing): 48 (WebCore::RenderBox::computePositionedLogicalHeight): 49 (WebCore::RenderBox::computePositionedLogicalHeightUsing): 50 * rendering/RenderBox.h: 51 * rendering/RenderButton.h: 52 * rendering/RenderFlexibleBox.cpp: 53 (WebCore::RenderFlexibleBox::computeMainAxisExtentForChild): 54 (WebCore::RenderFlexibleBox::mainAxisExtentIsDefinite): 55 (WebCore::RenderFlexibleBox::mainAxisLengthIsIndefinite): 56 (WebCore::RenderFlexibleBox::adjustChildSizeForMinAndMax): 57 (WebCore::RenderFlexibleBox::mainAxisOverflowForChild): 58 * rendering/RenderFlexibleBox.h: 59 (WebCore::RenderFlexibleBox::isFlexibleBoxImpl): 60 * rendering/RenderFullScreen.h: 61 * rendering/RenderGrid.cpp: 62 (WebCore::RenderGrid::computeUsedBreadthOfSpecifiedLength): 63 * rendering/RenderMediaControlElements.h: 64 * rendering/RenderMenuList.cpp: 65 (WebCore::RenderMenuList::adjustInnerStyle): Do not longer set 66 the min-width explicitly. 67 * rendering/RenderMenuList.h: 68 * rendering/RenderMultiColumnSet.cpp: 69 (WebCore::RenderMultiColumnSet::calculateMaxColumnHeight): 70 * rendering/RenderNamedFlowFragment.cpp: 71 (WebCore::RenderNamedFlowFragment::maxPageLogicalHeight): 72 * rendering/RenderReplaced.cpp: 73 (WebCore::RenderReplaced::computeReplacedLogicalWidth): 74 (WebCore::RenderReplaced::computeReplacedLogicalHeight): 75 * rendering/RenderSlider.h: 76 * rendering/RenderTextControl.h: 77 * rendering/RenderTextControlSingleLine.cpp: 78 (WebCore::RenderTextControlSingleLine::createInnerBlockStyle): Do not longer set 79 the min-width explicitly. 80 * rendering/mathml/RenderMathMLBlock.h: 81 * rendering/style/RenderStyle.h: 82 1 83 2015-09-10 ChangSeok Oh <changseok.oh@collabora.com> 2 84 -
trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp
r189541 r189567 1900 1900 } 1901 1901 1902 inline static bool isFlexOrGrid(ContainerNode* element) 1903 { 1904 return element && element->computedStyle() && element->computedStyle()->isDisplayFlexibleOrGridBox(); 1905 } 1906 1902 1907 RefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propertyID, EUpdateLayout updateLayout) const 1903 1908 { … … 2493 2498 } 2494 2499 case CSSPropertyMinHeight: 2495 // FIXME: For flex-items, min-height:auto should compute to min-content. 2496 if (style->minHeight().isAuto()) 2500 if (style->minHeight().isAuto()) { 2501 if (isFlexOrGrid(styledNode->parentNode())) 2502 return cssValuePool.createIdentifierValue(CSSValueAuto); 2497 2503 return zoomAdjustedPixelValue(0, *style); 2504 } 2498 2505 return zoomAdjustedPixelValueForLength(style->minHeight(), *style); 2499 2506 case CSSPropertyMinWidth: 2500 // FIXME: For flex-items, min-width:auto should compute to min-content. 2501 if (style->minWidth().isAuto()) 2507 if (style->minWidth().isAuto()) { 2508 if (isFlexOrGrid(styledNode->parentNode())) 2509 return cssValuePool.createIdentifierValue(CSSValueAuto); 2502 2510 return zoomAdjustedPixelValue(0, *style); 2511 } 2503 2512 return zoomAdjustedPixelValueForLength(style->minWidth(), *style); 2504 2513 case CSSPropertyObjectFit: -
trunk/Source/WebCore/css/CSSParser.cpp
r189541 r189567 2255 2255 case CSSPropertyMinHeight: 2256 2256 case CSSPropertyWebkitMinLogicalHeight: 2257 validPrimitive = i sValidSize(valueWithCalculation);2257 validPrimitive = id == CSSValueAuto || isValidSize(valueWithCalculation); 2258 2258 break; 2259 2259 -
trunk/Source/WebCore/html/shadow/SliderThumbElement.cpp
r189541 r189567 122 122 private: 123 123 virtual void layout() override; 124 bool isFlexibleBoxImpl() const override { return true; } 124 125 }; 125 126 -
trunk/Source/WebCore/rendering/RenderBox.cpp
r189541 r189567 647 647 const RenderStyle& styleToUse = style(); 648 648 if (!styleToUse.logicalMaxHeight().isUndefined()) { 649 if (Optional<LayoutUnit> maxH = computeLogicalHeightUsing( styleToUse.logicalMaxHeight(), intrinsicContentHeight))649 if (Optional<LayoutUnit> maxH = computeLogicalHeightUsing(MaxSize, styleToUse.logicalMaxHeight(), intrinsicContentHeight)) 650 650 logicalHeight = std::min(logicalHeight, maxH.value()); 651 651 } 652 if (Optional<LayoutUnit> computedLogicalHeight = computeLogicalHeightUsing( styleToUse.logicalMinHeight(), intrinsicContentHeight))652 if (Optional<LayoutUnit> computedLogicalHeight = computeLogicalHeightUsing(MinSize, styleToUse.logicalMinHeight(), intrinsicContentHeight)) 653 653 return std::max(logicalHeight, computedLogicalHeight.value()); 654 654 return logicalHeight; … … 659 659 const RenderStyle& styleToUse = style(); 660 660 if (!styleToUse.logicalMaxHeight().isUndefined()) { 661 if (Optional<LayoutUnit> maxH = computeContentLogicalHeight( styleToUse.logicalMaxHeight(), intrinsicContentHeight))661 if (Optional<LayoutUnit> maxH = computeContentLogicalHeight(MaxSize, styleToUse.logicalMaxHeight(), intrinsicContentHeight)) 662 662 logicalHeight = std::min(logicalHeight, maxH.value()); 663 663 } 664 if (Optional<LayoutUnit> computedContentLogicalHeight = computeContentLogicalHeight( styleToUse.logicalMinHeight(), intrinsicContentHeight))664 if (Optional<LayoutUnit> computedContentLogicalHeight = computeContentLogicalHeight(MinSize, styleToUse.logicalMinHeight(), intrinsicContentHeight)) 665 665 return std::max(logicalHeight, computedContentLogicalHeight.value()); 666 666 return logicalHeight; … … 2440 2440 const RenderBlock* cb, RenderRegion* region) const 2441 2441 { 2442 ASSERT(widthType == MinSize || widthType == MainOrPreferredSize || !logicalWidth.isAuto()); 2443 if (widthType == MinSize && logicalWidth.isAuto()) 2444 return adjustBorderBoxLogicalWidthForBoxSizing(0); 2445 2442 2446 if (!logicalWidth.isIntrinsicOrAuto()) { 2443 2447 // FIXME: If the containing block flow is perpendicular to our direction we need to use the available logical height instead. … … 2756 2760 if (checkMinMaxHeight) { 2757 2761 LayoutUnit intrinsicHeight = computedValues.m_extent - borderAndPaddingLogicalHeight(); 2758 heightResult = computeLogicalHeightUsing( style().logicalHeight(), intrinsicHeight).valueOr(computedValues.m_extent);2762 heightResult = computeLogicalHeightUsing(MainOrPreferredSize, style().logicalHeight(), intrinsicHeight).valueOr(computedValues.m_extent); 2759 2763 heightResult = constrainLogicalHeightByMinMax(heightResult, intrinsicHeight); 2760 2764 } else { … … 2795 2799 } 2796 2800 2797 Optional<LayoutUnit> RenderBox::computeLogicalHeightUsing( const Length& height, Optional<LayoutUnit> intrinsicContentHeight) const2798 { 2799 if (Optional<LayoutUnit> logicalHeight = computeContentAndScrollbarLogicalHeightUsing(height , intrinsicContentHeight))2801 Optional<LayoutUnit> RenderBox::computeLogicalHeightUsing(SizeType heightType, const Length& height, Optional<LayoutUnit> intrinsicContentHeight) const 2802 { 2803 if (Optional<LayoutUnit> logicalHeight = computeContentAndScrollbarLogicalHeightUsing(heightType, height, intrinsicContentHeight)) 2800 2804 return adjustBorderBoxLogicalHeightForBoxSizing(logicalHeight.value()); 2801 2805 return Nullopt; 2802 2806 } 2803 2807 2804 Optional<LayoutUnit> RenderBox::computeContentLogicalHeight( const Length& height, Optional<LayoutUnit> intrinsicContentHeight) const2805 { 2806 if (Optional<LayoutUnit> heightIncludingScrollbar = computeContentAndScrollbarLogicalHeightUsing(height , intrinsicContentHeight))2808 Optional<LayoutUnit> RenderBox::computeContentLogicalHeight(SizeType heightType, const Length& height, Optional<LayoutUnit> intrinsicContentHeight) const 2809 { 2810 if (Optional<LayoutUnit> heightIncludingScrollbar = computeContentAndScrollbarLogicalHeightUsing(heightType, height, intrinsicContentHeight)) 2807 2811 return std::max<LayoutUnit>(0, adjustContentBoxLogicalHeightForBoxSizing(heightIncludingScrollbar) - scrollbarLogicalHeight()); 2808 2812 return Nullopt; … … 2821 2825 } 2822 2826 2823 Optional<LayoutUnit> RenderBox::computeContentAndScrollbarLogicalHeightUsing(const Length& height, Optional<LayoutUnit> intrinsicContentHeight) const 2824 { 2827 Optional<LayoutUnit> RenderBox::computeContentAndScrollbarLogicalHeightUsing(SizeType heightType, const Length& height, Optional<LayoutUnit> intrinsicContentHeight) const 2828 { 2829 if (height.isAuto()) 2830 return heightType == MinSize ? Optional<LayoutUnit>(0) : Nullopt; 2825 2831 // FIXME: The CSS sizing spec is considering changing what min-content/max-content should resolve to. 2826 2832 // If that happens, this code will have to change. … … 2941 2947 LayoutUnit RenderBox::computeReplacedLogicalWidth(ShouldComputePreferred shouldComputePreferred) const 2942 2948 { 2943 return computeReplacedLogicalWidthRespectingMinMaxWidth(computeReplacedLogicalWidthUsing( style().logicalWidth()), shouldComputePreferred);2949 return computeReplacedLogicalWidthRespectingMinMaxWidth(computeReplacedLogicalWidthUsing(MainOrPreferredSize, style().logicalWidth()), shouldComputePreferred); 2944 2950 } 2945 2951 2946 2952 LayoutUnit RenderBox::computeReplacedLogicalWidthRespectingMinMaxWidth(LayoutUnit logicalWidth, ShouldComputePreferred shouldComputePreferred) const 2947 2953 { 2948 LayoutUnit minLogicalWidth = (shouldComputePreferred == ComputePreferred && style().logicalMinWidth().isPercentOrCalculated()) || style().logicalMinWidth().isUndefined() ? logicalWidth : computeReplacedLogicalWidthUsing( style().logicalMinWidth());2949 LayoutUnit maxLogicalWidth = (shouldComputePreferred == ComputePreferred && style().logicalMaxWidth().isPercentOrCalculated()) || style().logicalMaxWidth().isUndefined() ? logicalWidth : computeReplacedLogicalWidthUsing( style().logicalMaxWidth());2954 LayoutUnit minLogicalWidth = (shouldComputePreferred == ComputePreferred && style().logicalMinWidth().isPercentOrCalculated()) || style().logicalMinWidth().isUndefined() ? logicalWidth : computeReplacedLogicalWidthUsing(MinSize, style().logicalMinWidth()); 2955 LayoutUnit maxLogicalWidth = (shouldComputePreferred == ComputePreferred && style().logicalMaxWidth().isPercentOrCalculated()) || style().logicalMaxWidth().isUndefined() ? logicalWidth : computeReplacedLogicalWidthUsing(MaxSize, style().logicalMaxWidth()); 2950 2956 return std::max(minLogicalWidth, std::min(logicalWidth, maxLogicalWidth)); 2951 2957 } 2952 2958 2953 LayoutUnit RenderBox::computeReplacedLogicalWidthUsing(Length logicalWidth) const 2954 { 2959 LayoutUnit RenderBox::computeReplacedLogicalWidthUsing(SizeType widthType, Length logicalWidth) const 2960 { 2961 ASSERT(widthType == MinSize || widthType == MainOrPreferredSize || !logicalWidth.isAuto()); 2962 if (widthType == MinSize && logicalWidth.isAuto()) 2963 return adjustContentBoxLogicalWidthForBoxSizing(0); 2964 2955 2965 switch (logicalWidth.type()) { 2956 2966 case Fixed: … … 2993 3003 LayoutUnit RenderBox::computeReplacedLogicalHeight() const 2994 3004 { 2995 return computeReplacedLogicalHeightRespectingMinMaxHeight(computeReplacedLogicalHeightUsing( style().logicalHeight()));3005 return computeReplacedLogicalHeightRespectingMinMaxHeight(computeReplacedLogicalHeightUsing(MainOrPreferredSize, style().logicalHeight())); 2996 3006 } 2997 3007 2998 3008 LayoutUnit RenderBox::computeReplacedLogicalHeightRespectingMinMaxHeight(LayoutUnit logicalHeight) const 2999 3009 { 3000 LayoutUnit minLogicalHeight = computeReplacedLogicalHeightUsing( style().logicalMinHeight());3001 LayoutUnit maxLogicalHeight = style().logicalMaxHeight().isUndefined() ? logicalHeight : computeReplacedLogicalHeightUsing( style().logicalMaxHeight());3010 LayoutUnit minLogicalHeight = computeReplacedLogicalHeightUsing(MinSize, style().logicalMinHeight()); 3011 LayoutUnit maxLogicalHeight = style().logicalMaxHeight().isUndefined() ? logicalHeight : computeReplacedLogicalHeightUsing(MaxSize, style().logicalMaxHeight()); 3002 3012 return std::max(minLogicalHeight, std::min(logicalHeight, maxLogicalHeight)); 3003 3013 } 3004 3014 3005 LayoutUnit RenderBox::computeReplacedLogicalHeightUsing(Length logicalHeight) const 3006 { 3015 LayoutUnit RenderBox::computeReplacedLogicalHeightUsing(SizeType heightType, Length logicalHeight) const 3016 { 3017 ASSERT(heightType == MinSize || heightType == MainOrPreferredSize || !logicalHeight.isAuto()); 3018 if (heightType == MinSize && logicalHeight.isAuto()) 3019 return adjustContentBoxLogicalHeightForBoxSizing(Optional<LayoutUnit>(0)); 3020 3007 3021 switch (logicalHeight.type()) { 3008 3022 case Fixed: … … 3087 3101 } 3088 3102 3089 if (Optional<LayoutUnit> heightIncludingScrollbar = computeContentAndScrollbarLogicalHeightUsing( h, Nullopt))3103 if (Optional<LayoutUnit> heightIncludingScrollbar = computeContentAndScrollbarLogicalHeightUsing(MainOrPreferredSize, h, Nullopt)) 3090 3104 return std::max<LayoutUnit>(0, adjustContentBoxLogicalHeightForBoxSizing(heightIncludingScrollbar) - scrollbarLogicalHeight()); 3091 3105 … … 3363 3377 3364 3378 // Calculate constraint equation values for 'width' case. 3365 computePositionedLogicalWidthUsing( style().logicalWidth(), containerBlock, containerDirection,3379 computePositionedLogicalWidthUsing(MainOrPreferredSize, style().logicalWidth(), containerBlock, containerDirection, 3366 3380 containerLogicalWidth, bordersPlusPadding, 3367 3381 logicalLeftLength, logicalRightLength, marginLogicalLeft, marginLogicalRight, … … 3372 3386 LogicalExtentComputedValues maxValues; 3373 3387 3374 computePositionedLogicalWidthUsing( style().logicalMaxWidth(), containerBlock, containerDirection,3388 computePositionedLogicalWidthUsing(MaxSize, style().logicalMaxWidth(), containerBlock, containerDirection, 3375 3389 containerLogicalWidth, bordersPlusPadding, 3376 3390 logicalLeftLength, logicalRightLength, marginLogicalLeft, marginLogicalRight, … … 3389 3403 LogicalExtentComputedValues minValues; 3390 3404 3391 computePositionedLogicalWidthUsing( style().logicalMinWidth(), containerBlock, containerDirection,3405 computePositionedLogicalWidthUsing(MinSize, style().logicalMinWidth(), containerBlock, containerDirection, 3392 3406 containerLogicalWidth, bordersPlusPadding, 3393 3407 logicalLeftLength, logicalRightLength, marginLogicalLeft, marginLogicalRight, … … 3434 3448 } 3435 3449 3436 void RenderBox::computePositionedLogicalWidthUsing( Length logicalWidth, const RenderBoxModelObject* containerBlock, TextDirection containerDirection,3450 void RenderBox::computePositionedLogicalWidthUsing(SizeType widthType, Length logicalWidth, const RenderBoxModelObject* containerBlock, TextDirection containerDirection, 3437 3451 LayoutUnit containerLogicalWidth, LayoutUnit bordersPlusPadding, 3438 3452 Length logicalLeft, Length logicalRight, Length marginLogicalLeft, Length marginLogicalRight, 3439 3453 LogicalExtentComputedValues& computedValues) const 3440 3454 { 3441 if (logicalWidth.isIntrinsic()) 3455 ASSERT(widthType == MinSize || widthType == MainOrPreferredSize || !logicalWidth.isAuto()); 3456 if (widthType == MinSize && logicalWidth.isAuto()) 3457 logicalWidth = Length(0, Fixed); 3458 else if (logicalWidth.isIntrinsic()) 3442 3459 logicalWidth = Length(computeIntrinsicLogicalWidthUsing(logicalWidth, containerLogicalWidth, bordersPlusPadding) - bordersPlusPadding, Fixed); 3443 3460 … … 3679 3696 // Calculate constraint equation values for 'height' case. 3680 3697 LayoutUnit logicalHeight = computedValues.m_extent; 3681 computePositionedLogicalHeightUsing( styleToUse.logicalHeight(), containerBlock, containerLogicalHeight, bordersPlusPadding, logicalHeight,3698 computePositionedLogicalHeightUsing(MainOrPreferredSize, styleToUse.logicalHeight(), containerBlock, containerLogicalHeight, bordersPlusPadding, logicalHeight, 3682 3699 logicalTopLength, logicalBottomLength, marginBefore, marginAfter, 3683 3700 computedValues); … … 3690 3707 LogicalExtentComputedValues maxValues; 3691 3708 3692 computePositionedLogicalHeightUsing( styleToUse.logicalMaxHeight(), containerBlock, containerLogicalHeight, bordersPlusPadding, logicalHeight,3709 computePositionedLogicalHeightUsing(MaxSize, styleToUse.logicalMaxHeight(), containerBlock, containerLogicalHeight, bordersPlusPadding, logicalHeight, 3693 3710 logicalTopLength, logicalBottomLength, marginBefore, marginAfter, 3694 3711 maxValues); … … 3706 3723 LogicalExtentComputedValues minValues; 3707 3724 3708 computePositionedLogicalHeightUsing( styleToUse.logicalMinHeight(), containerBlock, containerLogicalHeight, bordersPlusPadding, logicalHeight,3725 computePositionedLogicalHeightUsing(MinSize, styleToUse.logicalMinHeight(), containerBlock, containerLogicalHeight, bordersPlusPadding, logicalHeight, 3709 3726 logicalTopLength, logicalBottomLength, marginBefore, marginAfter, 3710 3727 minValues); … … 3762 3779 } 3763 3780 3764 void RenderBox::computePositionedLogicalHeightUsing( Length logicalHeightLength, const RenderBoxModelObject* containerBlock,3781 void RenderBox::computePositionedLogicalHeightUsing(SizeType heightType, Length logicalHeightLength, const RenderBoxModelObject* containerBlock, 3765 3782 LayoutUnit containerLogicalHeight, LayoutUnit bordersPlusPadding, LayoutUnit logicalHeight, 3766 3783 Length logicalTop, Length logicalBottom, Length marginBefore, Length marginAfter, 3767 3784 LogicalExtentComputedValues& computedValues) const 3768 3785 { 3786 ASSERT(heightType == MinSize || heightType == MainOrPreferredSize || !logicalHeightLength.isAuto()); 3787 if (heightType == MinSize && logicalHeightLength.isAuto()) 3788 logicalHeightLength = Length(0, Fixed); 3789 3769 3790 // 'top' and 'bottom' cannot both be 'auto' because 'top would of been 3770 3791 // converted to the static position in computePositionedLogicalHeight() -
trunk/Source/WebCore/rendering/RenderBox.h
r189541 r189567 422 422 423 423 LayoutUnit computeLogicalWidthInRegionUsing(SizeType, Length logicalWidth, LayoutUnit availableLogicalWidth, const RenderBlock* containingBlock, RenderRegion*) const; 424 Optional<LayoutUnit> computeLogicalHeightUsing( const Length& height, Optional<LayoutUnit> intrinsicContentHeight) const;425 Optional<LayoutUnit> computeContentLogicalHeight( const Length& height, Optional<LayoutUnit> intrinsicContentHeight) const;426 Optional<LayoutUnit> computeContentAndScrollbarLogicalHeightUsing( const Length& height, Optional<LayoutUnit> intrinsicContentHeight) const;427 LayoutUnit computeReplacedLogicalWidthUsing( Length width) const;424 Optional<LayoutUnit> computeLogicalHeightUsing(SizeType, const Length& height, Optional<LayoutUnit> intrinsicContentHeight) const; 425 Optional<LayoutUnit> computeContentLogicalHeight(SizeType, const Length& height, Optional<LayoutUnit> intrinsicContentHeight) const; 426 Optional<LayoutUnit> computeContentAndScrollbarLogicalHeightUsing(SizeType, const Length& height, Optional<LayoutUnit> intrinsicContentHeight) const; 427 LayoutUnit computeReplacedLogicalWidthUsing(SizeType, Length width) const; 428 428 LayoutUnit computeReplacedLogicalWidthRespectingMinMaxWidth(LayoutUnit logicalWidth, ShouldComputePreferred = ComputeActual) const; 429 LayoutUnit computeReplacedLogicalHeightUsing( Length height) const;429 LayoutUnit computeReplacedLogicalHeightUsing(SizeType, Length height) const; 430 430 LayoutUnit computeReplacedLogicalHeightRespectingMinMaxHeight(LayoutUnit logicalHeight) const; 431 431 … … 688 688 689 689 void computePositionedLogicalHeight(LogicalExtentComputedValues&) const; 690 void computePositionedLogicalWidthUsing( Length logicalWidth, const RenderBoxModelObject* containerBlock, TextDirection containerDirection,690 void computePositionedLogicalWidthUsing(SizeType, Length logicalWidth, const RenderBoxModelObject* containerBlock, TextDirection containerDirection, 691 691 LayoutUnit containerLogicalWidth, LayoutUnit bordersPlusPadding, 692 692 Length logicalLeft, Length logicalRight, Length marginLogicalLeft, Length marginLogicalRight, 693 693 LogicalExtentComputedValues&) const; 694 void computePositionedLogicalHeightUsing( Length logicalHeightLength, const RenderBoxModelObject* containerBlock,694 void computePositionedLogicalHeightUsing(SizeType, Length logicalHeightLength, const RenderBoxModelObject* containerBlock, 695 695 LayoutUnit containerLogicalHeight, LayoutUnit bordersPlusPadding, LayoutUnit logicalHeight, 696 696 Length logicalTop, Length logicalBottom, Length marginLogicalTop, Length marginLogicalBottom, -
trunk/Source/WebCore/rendering/RenderButton.h
r189541 r189567 77 77 void timerFired(); 78 78 79 bool isFlexibleBoxImpl() const override { return true; } 80 79 81 RenderTextFragment* m_buttonText; 80 82 RenderBlock* m_inner; -
trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp
r189541 r189567 456 456 if (size.isIntrinsic()) 457 457 child.layoutIfNeeded(); 458 return child.computeContentLogicalHeight(size , child.logicalHeight() - child.borderAndPaddingLogicalHeight());458 return child.computeContentLogicalHeight(sizeType, size, child.logicalHeight() - child.borderAndPaddingLogicalHeight()); 459 459 } 460 460 // FIXME: Figure out how this should work for regions and pass in the appropriate values. … … 645 645 { 646 646 return isHorizontalFlow() ? child.horizontalBorderAndPaddingExtent() : child.verticalBorderAndPaddingExtent(); 647 } 648 649 bool RenderFlexibleBox::mainAxisExtentIsDefinite() const 650 { 651 return isColumnFlow() ? hasDefiniteLogicalHeight() : hasDefiniteLogicalWidth(); 652 } 653 654 bool RenderFlexibleBox::mainAxisLengthIsIndefinite(const Length& flexBasis) const 655 { 656 return flexBasis.isAuto() || (flexBasis.isPercentOrCalculated() && !mainAxisExtentIsDefinite()); 647 657 } 648 658 … … 846 856 { 847 857 Length max = isHorizontalFlow() ? child.style().maxWidth() : child.style().maxHeight(); 848 if (max.isSpecifiedOrIntrinsic()) 849 childSize = std::min(childSize, computeMainAxisExtentForChild(child, MaxSize, max).valueOr(childSize)); 858 Optional<LayoutUnit> maxExtent = Nullopt; 859 if (max.isSpecifiedOrIntrinsic()) { 860 maxExtent = computeMainAxisExtentForChild(child, MaxSize, max); 861 childSize = std::min(childSize, maxExtent.valueOr(childSize)); 862 } 850 863 851 864 Length min = isHorizontalFlow() ? child.style().minWidth() : child.style().minHeight(); 852 865 if (min.isSpecifiedOrIntrinsic()) 853 866 return std::max(childSize, computeMainAxisExtentForChild(child, MinSize, min).valueOr(childSize)); 867 868 if (!isFlexibleBoxImpl() && min.isAuto() && mainAxisOverflowForChild(child) == OVISIBLE) { 869 // This is the implementation of CSS flexbox section 4.5 which defines the minimum size of "pure" flex 870 // items. For any other item the value should be 0, this also includes RenderFlexibleBox's derived clases 871 // (RenderButton, RenderFullScreen...) because that's just an implementation detail. 872 LayoutUnit contentSize = computeMainAxisExtentForChild(child, MinSize, Length(MinContent)).valueOr(0); 873 ASSERT(computeMainAxisExtentForChild(child, MinSize, Length(MinContent))); 874 contentSize = std::min(contentSize, maxExtent.valueOr(contentSize)); 875 876 Length mainSize = isHorizontalFlow() ? child.style().width() : child.style().height(); 877 if (!mainAxisLengthIsIndefinite(mainSize)) { 878 LayoutUnit resolvedMainSize = computeMainAxisExtentForChild(child, MainOrPreferredSize, mainSize).valueOr(0); 879 ASSERT(computeMainAxisExtentForChild(child, MainOrPreferredSize, mainSize)); 880 LayoutUnit specifiedSize = std::min(resolvedMainSize, maxExtent.valueOr(resolvedMainSize)); 881 882 return std::max(childSize, std::min(specifiedSize, contentSize)); 883 } 884 return std::max(childSize, contentSize); 885 } 854 886 return childSize; 855 887 } … … 1049 1081 if (hasAutoMarginsInCrossAxis(child)) 1050 1082 child.updateLogicalHeight(); 1083 } 1084 1085 EOverflow RenderFlexibleBox::mainAxisOverflowForChild(RenderBox& child) const 1086 { 1087 if (isHorizontalFlow()) 1088 return child.style().overflowX(); 1089 return child.style().overflowY(); 1051 1090 } 1052 1091 -
trunk/Source/WebCore/rendering/RenderFlexibleBox.h
r189541 r189567 123 123 LayoutUnit mainAxisScrollbarExtentForChild(RenderBox& child) const; 124 124 LayoutUnit preferredMainAxisContentExtentForChild(RenderBox& child, bool hasInfiniteLineLength); 125 EOverflow mainAxisOverflowForChild(RenderBox&) const; 125 126 126 127 void layoutFlexItems(bool relayoutChildren, Vector<LineContext>&); … … 158 159 void flipForWrapReverse(const Vector<LineContext>&, LayoutUnit crossAxisStartEdge); 159 160 161 bool mainAxisExtentIsDefinite() const; 162 bool mainAxisLengthIsIndefinite(const Length& flexBasis) const; 163 164 virtual bool isFlexibleBoxImpl() const { return false; }; 165 160 166 mutable OrderIterator m_orderIterator; 161 167 int m_numberOfInFlowChildrenOnFirstLine; -
trunk/Source/WebCore/rendering/RenderFullScreen.h
r189541 r189567 49 49 virtual bool isRenderFullScreen() const override { return true; } 50 50 virtual void willBeDestroyed() override; 51 bool isFlexibleBoxImpl() const override { return true; } 51 52 52 53 protected: -
trunk/Source/WebCore/rendering/RenderGrid.cpp
r189550 r189567 453 453 if (direction == ForColumns) 454 454 return valueForLength(trackLength, logicalWidth() - borderAndPaddingLogicalWidth()); 455 return valueForLength(trackLength, computeContentLogicalHeight( style().logicalHeight(), Nullopt).valueOr(0));455 return valueForLength(trackLength, computeContentLogicalHeight(MainOrPreferredSize, style().logicalHeight(), Nullopt).valueOr(0)); 456 456 } 457 457 -
trunk/Source/WebCore/rendering/RenderMediaControlElements.h
r189541 r189567 53 53 private: 54 54 virtual void layout() override; 55 bool isFlexibleBoxImpl() const override { return true; } 55 56 }; 56 57 -
trunk/Source/WebCore/rendering/RenderMenuList.cpp
r189541 r189567 114 114 innerStyle.setFlexShrink(1); 115 115 // min-width: 0; is needed for correct shrinking. 116 // FIXME: Remove this line when https://bugs.webkit.org/show_bug.cgi?id=111790 is fixed.117 116 innerStyle.setMinWidth(Length(0, Fixed)); 118 117 // Use margin:auto instead of align-items:center to get safe centering, i.e. -
trunk/Source/WebCore/rendering/RenderMenuList.h
r189541 r189567 137 137 void didUpdateActiveOption(int optionIndex); 138 138 139 bool isFlexibleBoxImpl() const override { return true; } 140 139 141 RenderText* m_buttonText; 140 142 RenderBlock* m_innerBlock; -
trunk/Source/WebCore/rendering/RenderMultiColumnSet.cpp
r189541 r189567 416 416 LayoutUnit maxColumnHeight = availableHeight ? availableHeight : RenderFlowThread::maxLogicalHeight(); 417 417 if (!multicolStyle.logicalMaxHeight().isUndefined()) 418 maxColumnHeight = std::min(maxColumnHeight, multicolBlock->computeContentLogicalHeight( multicolStyle.logicalMaxHeight(), Nullopt).valueOr(maxColumnHeight));418 maxColumnHeight = std::min(maxColumnHeight, multicolBlock->computeContentLogicalHeight(MaxSize, multicolStyle.logicalMaxHeight(), Nullopt).valueOr(maxColumnHeight)); 419 419 return heightAdjustedForSetOffset(maxColumnHeight); 420 420 } -
trunk/Source/WebCore/rendering/RenderNamedFlowFragment.cpp
r189541 r189567 186 186 187 187 const RenderStyle& styleToUse = parent()->style(); 188 return styleToUse.logicalMaxHeight().isUndefined() ? RenderFlowThread::maxLogicalHeight() : downcast<RenderBlock>(*parent()).computeReplacedLogicalHeightUsing( styleToUse.logicalMaxHeight());188 return styleToUse.logicalMaxHeight().isUndefined() ? RenderFlowThread::maxLogicalHeight() : downcast<RenderBlock>(*parent()).computeReplacedLogicalHeightUsing(MaxSize, styleToUse.logicalMaxHeight()); 189 189 } 190 190 -
trunk/Source/WebCore/rendering/RenderReplaced.cpp
r189541 r189567 384 384 { 385 385 if (style().logicalWidth().isSpecified() || style().logicalWidth().isIntrinsic()) 386 return computeReplacedLogicalWidthRespectingMinMaxWidth(computeReplacedLogicalWidthUsing( style().logicalWidth()), shouldComputePreferred);386 return computeReplacedLogicalWidthRespectingMinMaxWidth(computeReplacedLogicalWidthUsing(MainOrPreferredSize, style().logicalWidth()), shouldComputePreferred); 387 387 388 388 RenderBox* contentRenderer = embeddedContentBox(); … … 419 419 LayoutUnit logicalWidth; 420 420 if (RenderBlock* blockWithWidth = firstContainingBlockWithLogicalWidth(this)) 421 logicalWidth = blockWithWidth->computeReplacedLogicalWidthRespectingMinMaxWidth(blockWithWidth->computeReplacedLogicalWidthUsing( blockWithWidth->style().logicalWidth()), shouldComputePreferred);421 logicalWidth = blockWithWidth->computeReplacedLogicalWidthRespectingMinMaxWidth(blockWithWidth->computeReplacedLogicalWidthUsing(MainOrPreferredSize, blockWithWidth->style().logicalWidth()), shouldComputePreferred); 422 422 else 423 423 logicalWidth = containingBlock()->availableLogicalWidth(); … … 449 449 // 10.5 Content height: the 'height' property: http://www.w3.org/TR/CSS21/visudet.html#propdef-height 450 450 if (hasReplacedLogicalHeight()) 451 return computeReplacedLogicalHeightRespectingMinMaxHeight(computeReplacedLogicalHeightUsing( style().logicalHeight()));451 return computeReplacedLogicalHeightRespectingMinMaxHeight(computeReplacedLogicalHeightUsing(MainOrPreferredSize, style().logicalHeight())); 452 452 453 453 RenderBox* contentRenderer = embeddedContentBox(); -
trunk/Source/WebCore/rendering/RenderSlider.h
r189541 r189567 50 50 virtual bool requiresForcedStyleRecalcPropagation() const override { return true; } 51 51 virtual void layout() override; 52 53 bool isFlexibleBoxImpl() const override { return true; } 52 54 }; 53 55 -
trunk/Source/WebCore/rendering/RenderTextControl.h
r189541 r189567 106 106 virtual Optional<int> inlineBlockBaseline(LineDirectionMode direction) const override { return RenderBlock::inlineBlockBaseline(direction); } 107 107 108 private: 109 bool isFlexibleBoxImpl() const override { return true; } 108 110 }; 109 111 -
trunk/Source/WebCore/rendering/RenderTextControlSingleLine.cpp
r189541 r189567 356 356 innerBlockStyle.get().setFlexGrow(1); 357 357 // min-width: 0; is needed for correct shrinking. 358 // FIXME: Remove this line when https://bugs.webkit.org/show_bug.cgi?id=111790 is fixed.359 358 innerBlockStyle.get().setMinWidth(Length(0, Fixed)); 360 359 innerBlockStyle.get().setDisplay(BLOCK); -
trunk/Source/WebCore/rendering/mathml/RenderMathMLBlock.h
r189541 r189567 68 68 virtual bool isRenderMathMLBlock() const override final { return true; } 69 69 virtual const char* renderName() const override; 70 bool isFlexibleBoxImpl() const override { return true; } 70 71 }; 71 72 -
trunk/Source/WebCore/rendering/style/RenderStyle.h
r189541 r189567 1904 1904 static Length initialWordSpacing() { return Length(Fixed); } 1905 1905 static Length initialSize() { return Length(); } 1906 static Length initialMinSize() { return Length( Fixed); }1906 static Length initialMinSize() { return Length(); } 1907 1907 static Length initialMaxSize() { return Length(Undefined); } 1908 1908 static Length initialOffset() { return Length(); }
Note: See TracChangeset
for help on using the changeset viewer.