Changeset 122264 in webkit
- Timestamp:
- Jul 10, 2012 2:45:27 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r122262 r122264 1 2012-07-10 Ojan Vafai <ojan@chromium.org> 2 3 Add support for min-height:auto and min-width:auto 4 https://bugs.webkit.org/show_bug.cgi?id=88437 5 6 Reviewed by Tony Chang. 7 8 * fast/css/auto-min-size-expected.txt: Added. 9 * fast/css/auto-min-size.html: Added. 10 * fast/css/deprecated-flexbox-auto-min-size.html: Added. 11 * platform/chromium-linux/fast/css/deprecated-flexbox-auto-min-size-expected.txt: Added. 12 1 13 2012-07-10 Joshua Bell <jsbell@chromium.org> 2 14 -
trunk/Source/WebCore/ChangeLog
r122255 r122264 1 2012-07-10 Ojan Vafai <ojan@chromium.org> 2 3 Add support for min-height:auto and min-width:auto 4 https://bugs.webkit.org/show_bug.cgi?id=88437 5 6 Reviewed by Tony Chang. 7 8 Right now auto does the same thing as min-height/min-width:0. 9 For flex-items it should be the same as min-content (followup patch). 10 http://dev.w3.org/csswg/css3-flexbox/#min-size-auto 11 12 Tests: fast/css/auto-min-size.html 13 fast/css/deprecated-flexbox-auto-min-size.html 14 15 * WebCore.order: 16 * css/CSSComputedStyleDeclaration.cpp: 17 (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): 18 Return 0px for the computed value of auto. 19 20 * css/CSSParser.cpp: 21 (WebCore::CSSParser::validWidth): 22 (WebCore): 23 (WebCore::CSSParser::validHeight): 24 (WebCore::CSSParser::parseValue): 25 * css/CSSParser.h: 26 (CSSParser): 27 Restructure width/height parsing to reduce code duplication and make it easier 28 to add auto as a valid min value. 29 30 * platform/efl/RenderThemeEfl.cpp: 31 (WebCore::RenderThemeEfl::adjustSizeConstraints): 32 This code was unnecessarily checking intrinsicOrAuto since auto was previously 33 not an allowed value for minWidth/minHeight. 34 35 * rendering/RenderBox.cpp: 36 (WebCore::RenderBox::computeLogicalWidthInRegion): 37 (WebCore::RenderBox::computeLogicalWidthInRegionUsing): 38 (WebCore::RenderBox::sizesLogicalWidthToFitContent): 39 (WebCore::RenderBox::computeLogicalHeight): 40 (WebCore::RenderBox::computeLogicalHeightUsing): 41 (WebCore::RenderBox::computeContentLogicalHeightUsing): 42 (WebCore::RenderBox::computeReplacedLogicalWidth): 43 (WebCore::RenderBox::computeReplacedLogicalWidthRespectingMinMaxWidth): 44 (WebCore::RenderBox::computeReplacedLogicalWidthUsing): 45 (WebCore::RenderBox::computeReplacedLogicalHeight): 46 (WebCore::RenderBox::computeReplacedLogicalHeightRespectingMinMaxHeight): 47 (WebCore::RenderBox::computeReplacedLogicalHeightUsing): 48 (WebCore::RenderBox::computePositionedLogicalWidth): 49 (WebCore::RenderBox::computePositionedLogicalWidthUsing): 50 (WebCore::RenderBox::computePositionedLogicalHeight): 51 (WebCore::RenderBox::computePositionedLogicalHeightUsing): 52 Need to pass a SizeType to all these methods so that we know if the Length 53 we're working with is a min length since auto has a different meaning now 54 for min lengths. 55 56 * rendering/RenderBox.h: 57 (RenderBox): 58 * rendering/RenderDeprecatedFlexibleBox.cpp: 59 (WebCore::RenderDeprecatedFlexibleBox::allowedChildFlex): 60 * rendering/RenderFlexibleBox.cpp: 61 (WebCore::RenderFlexibleBox::computePreferredLogicalWidths): 62 (WebCore::RenderFlexibleBox::computeAvailableFreeSpace): 63 (WebCore::RenderFlexibleBox::lineBreakLength): 64 (WebCore::RenderFlexibleBox::adjustChildSizeForMinAndMax): 65 * rendering/RenderReplaced.cpp: 66 (WebCore::RenderReplaced::computeReplacedLogicalWidth): 67 (WebCore::RenderReplaced::computeReplacedLogicalHeight): 68 * rendering/RenderScrollbarPart.cpp: 69 (WebCore::calcScrollbarThicknessUsing): 70 (WebCore::RenderScrollbarPart::computeScrollbarWidth): 71 (WebCore::RenderScrollbarPart::computeScrollbarHeight): 72 * rendering/style/RenderStyle.h: 73 Default minHeight/minWidth to auto instead of 0px. 74 1 75 2012-07-10 Xianzhu Wang <wangxianzhu@chromium.org> 2 76 -
trunk/Source/WebCore/WebCore.order
r121330 r122264 1677 1677 __ZNK7WebCore9RenderBox27shouldComputeSizeAsReplacedEv 1678 1678 __ZNK7WebCore11RenderStyle12logicalWidthEv 1679 __ZN7WebCore9RenderBox24computeLogicalWidthUsingENS_16 LogicalWidthTypeEi1679 __ZN7WebCore9RenderBox24computeLogicalWidthUsingENS_16SizeTypeEi 1680 1680 __ZNK7WebCore11RenderStyle11marginStartEv 1681 1681 __ZNK7WebCore11RenderStyle9marginEndEv 1682 __ZNK7WebCore9RenderBox28sizesToIntrinsicLogicalWidthENS_16 LogicalWidthTypeE1682 __ZNK7WebCore9RenderBox28sizesToIntrinsicLogicalWidthENS_16SizeTypeE 1683 1683 __ZNK7WebCore11RenderBlock26isInlineBlockOrInlineTableEv 1684 1684 __ZNK7WebCore11RenderStyle15logicalMaxWidthEv -
trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp
r121513 r122264 1857 1857 } 1858 1858 case CSSPropertyMinHeight: 1859 // FIXME: For flex-items, min-height:auto should compute to min-content. 1860 if (style->minHeight().isAuto()) 1861 return zoomAdjustedPixelValue(0, style.get()); 1859 1862 return zoomAdjustedPixelValueForLength(style->minHeight(), style.get()); 1860 1863 case CSSPropertyMinWidth: 1864 // FIXME: For flex-items, min-width:auto should compute to min-content. 1865 if (style->minWidth().isAuto()) 1866 return zoomAdjustedPixelValue(0, style.get()); 1861 1867 return zoomAdjustedPixelValueForLength(style->minWidth(), style.get()); 1862 1868 case CSSPropertyOpacity: -
trunk/Source/WebCore/css/CSSParser.cpp
r121874 r122264 1570 1570 } 1571 1571 1572 bool CSSParser::validWidth(CSSParserValue* value) 1573 { 1574 int id = value->id; 1575 if (id == CSSValueIntrinsic || id == CSSValueMinIntrinsic || id == CSSValueWebkitMinContent || id == CSSValueWebkitMaxContent || id == CSSValueWebkitFillAvailable || id == CSSValueWebkitFitContent) 1576 return true; 1577 return !id && validUnit(value, FLength | FPercent | FNonNeg); 1578 } 1579 1580 // FIXME: Combine this with validWidth when we support fit-content, et al, for heights. 1581 bool CSSParser::validHeight(CSSParserValue* value) 1582 { 1583 int id = value->id; 1584 if (id == CSSValueIntrinsic || id == CSSValueMinIntrinsic) 1585 return true; 1586 return !id && validUnit(value, FLength | FPercent | FNonNeg); 1587 } 1572 1588 1573 1589 void CSSParser::checkForOrphanedUnits() … … 1982 1998 break; 1983 1999 1984 case CSSPropertyMaxWidth: // <length> | <percentage> | none | inherit2000 case CSSPropertyMaxWidth: 1985 2001 case CSSPropertyWebkitMaxLogicalWidth: 1986 if (id == CSSValueNone) { 1987 validPrimitive = true; 1988 break; 1989 } 1990 /* nobreak */ 1991 case CSSPropertyMinWidth: // <length> | <percentage> | inherit 2002 validPrimitive = (id == CSSValueNone || validWidth(value)); 2003 break; 2004 2005 case CSSPropertyMinWidth: 1992 2006 case CSSPropertyWebkitMinLogicalWidth: 1993 if (id == CSSValueIntrinsic || id == CSSValueMinIntrinsic || id == CSSValueWebkitMinContent || id == CSSValueWebkitMaxContent || id == CSSValueWebkitFillAvailable || id == CSSValueWebkitFitContent) 1994 validPrimitive = true; 1995 else 1996 validPrimitive = (!id && validUnit(value, FLength | FPercent | FNonNeg)); 1997 break; 1998 1999 case CSSPropertyMaxHeight: // <length> | <percentage> | none | inherit 2007 case CSSPropertyWidth: 2008 case CSSPropertyWebkitLogicalWidth: 2009 validPrimitive = (id == CSSValueAuto || validWidth(value)); 2010 break; 2011 2012 case CSSPropertyMaxHeight: 2000 2013 case CSSPropertyWebkitMaxLogicalHeight: 2001 if (id == CSSValueNone) { 2002 validPrimitive = true; 2003 break; 2004 } 2005 /* nobreak */ 2006 case CSSPropertyMinHeight: // <length> | <percentage> | inherit 2014 validPrimitive = (id == CSSValueNone || validHeight(value)); 2015 break; 2016 2017 case CSSPropertyMinHeight: 2007 2018 case CSSPropertyWebkitMinLogicalHeight: 2008 if (id == CSSValueIntrinsic || id == CSSValueMinIntrinsic) 2009 validPrimitive = true; 2010 else 2011 validPrimitive = (!id && validUnit(value, FLength | FPercent | FNonNeg)); 2019 case CSSPropertyHeight: 2020 case CSSPropertyWebkitLogicalHeight: 2021 validPrimitive = (id == CSSValueAuto || validHeight(value)); 2012 2022 break; 2013 2023 … … 2026 2036 else 2027 2037 validPrimitive = (!id && validUnit(value, FLength | FPercent)); 2028 break;2029 2030 case CSSPropertyWidth: // <length> | <percentage> | auto | inherit2031 case CSSPropertyWebkitLogicalWidth:2032 if (id == CSSValueWebkitMinContent || id == CSSValueWebkitMaxContent || id == CSSValueWebkitFillAvailable || id == CSSValueWebkitFitContent) {2033 validPrimitive = true;2034 break;2035 }2036 /* nobreak */2037 case CSSPropertyHeight: // <length> | <percentage> | auto | inherit2038 case CSSPropertyWebkitLogicalHeight:2039 if (id == CSSValueAuto || id == CSSValueIntrinsic || id == CSSValueMinIntrinsic)2040 validPrimitive = true;2041 else if (!id && validUnit(value, FLength | FPercent | FNonNeg))2042 // ### handle multilength case where we allow relative units2043 validPrimitive = true;2044 2038 break; 2045 2039 -
trunk/Source/WebCore/css/CSSParser.h
r121551 r122264 380 380 bool inShorthand() const { return m_inParseShorthand; } 381 381 382 bool validWidth(CSSParserValue*); 383 bool validHeight(CSSParserValue*); 384 382 385 void checkForOrphanedUnits(); 383 386 -
trunk/Source/WebCore/platform/efl/RenderThemeEfl.cpp
r119547 r122264 83 83 const struct ThemePartDesc* desc = m_partDescs + (size_t)type; 84 84 85 if (style->minWidth().isIntrinsic OrAuto())85 if (style->minWidth().isIntrinsic()) 86 86 style->setMinWidth(desc->min.width()); 87 if (style->minHeight().isIntrinsic OrAuto())87 if (style->minHeight().isIntrinsic()) 88 88 style->setMinHeight(desc->min.height()); 89 89 -
trunk/Source/WebCore/rendering/RenderBox.cpp
r122244 r122264 1692 1692 else { 1693 1693 // Calculate LogicalWidth 1694 setLogicalWidth(computeLogicalWidthInRegionUsing( LogicalWidth, containerWidthInInlineDirection, cb, region, offsetFromLogicalTopOfFirstPage));1694 setLogicalWidth(computeLogicalWidthInRegionUsing(MainOrPreferredSize, containerWidthInInlineDirection, cb, region, offsetFromLogicalTopOfFirstPage)); 1695 1695 1696 1696 // Calculate MaxLogicalWidth 1697 1697 if (!styleToUse->logicalMaxWidth().isUndefined()) { 1698 LayoutUnit maxLogicalWidth = computeLogicalWidthInRegionUsing(Max LogicalWidth, containerWidthInInlineDirection, cb, region, offsetFromLogicalTopOfFirstPage);1698 LayoutUnit maxLogicalWidth = computeLogicalWidthInRegionUsing(MaxSize, containerWidthInInlineDirection, cb, region, offsetFromLogicalTopOfFirstPage); 1699 1699 if (logicalWidth() > maxLogicalWidth) 1700 1700 setLogicalWidth(maxLogicalWidth); … … 1702 1702 1703 1703 // Calculate MinLogicalWidth 1704 LayoutUnit minLogicalWidth = computeLogicalWidthInRegionUsing(Min LogicalWidth, containerWidthInInlineDirection, cb, region, offsetFromLogicalTopOfFirstPage);1704 LayoutUnit minLogicalWidth = computeLogicalWidthInRegionUsing(MinSize, containerWidthInInlineDirection, cb, region, offsetFromLogicalTopOfFirstPage); 1705 1705 if (logicalWidth() < minLogicalWidth) 1706 1706 setLogicalWidth(minLogicalWidth); … … 1728 1728 } 1729 1729 1730 LayoutUnit RenderBox::computeLogicalWidthInRegionUsing( LogicalWidthType widthType, LayoutUnit availableLogicalWidth,1730 LayoutUnit RenderBox::computeLogicalWidthInRegionUsing(SizeType widthType, LayoutUnit availableLogicalWidth, 1731 1731 const RenderBlock* cb, RenderRegion* region, LayoutUnit offsetFromLogicalTopOfFirstPage) 1732 1732 { 1733 LayoutUnit logicalWidthResult = logicalWidth();1734 1733 RenderStyle* styleToUse = style(); 1735 1734 Length logicalWidth; 1736 if (widthType == LogicalWidth)1735 if (widthType == MainOrPreferredSize) 1737 1736 logicalWidth = styleToUse->logicalWidth(); 1738 else if (widthType == Min LogicalWidth)1737 else if (widthType == MinSize) 1739 1738 logicalWidth = styleToUse->logicalMinWidth(); 1740 1739 else … … 1743 1742 ASSERT(!logicalWidth.isUndefined()); 1744 1743 1745 if (logicalWidth.isIntrinsicOrAuto()) { 1746 RenderView* renderView = view(); 1747 LayoutUnit marginStart = minimumValueForLength(styleToUse->marginStart(), availableLogicalWidth, renderView); 1748 LayoutUnit marginEnd = minimumValueForLength(styleToUse->marginEnd(), availableLogicalWidth, renderView); 1749 logicalWidthResult = availableLogicalWidth - marginStart - marginEnd; 1750 1751 // shrinkToAvoidFloats() is only true for width: auto so the below code works correctly for 1752 // width: fill-available since no case matches and it returns the logicalWidthResult from above. 1753 if (shrinkToAvoidFloats() && cb->containsFloats()) 1754 logicalWidthResult = min(logicalWidthResult, shrinkLogicalWidthToAvoidFloats(marginStart, marginEnd, cb, region, offsetFromLogicalTopOfFirstPage)); 1755 1756 if (logicalWidth.type() == MinContent) 1757 logicalWidthResult = minPreferredLogicalWidth(); 1758 else if (logicalWidth.type() == MaxContent) 1759 logicalWidthResult = maxPreferredLogicalWidth(); 1760 else if (logicalWidth.type() == FitContent || (logicalWidth.type() != FillAvailable && sizesLogicalWidthToFitContent(widthType))) 1761 logicalWidthResult = max(minPreferredLogicalWidth(), min(maxPreferredLogicalWidth(), logicalWidthResult)); 1762 1763 } else // FIXME: If the containing block flow is perpendicular to our direction we need to use the available logical height instead. 1764 logicalWidthResult = computeBorderBoxLogicalWidth(valueForLength(logicalWidth, availableLogicalWidth, view())); 1765 1744 // FIXME: minWidth:auto on a flex-item needs to go down the intrinsicOrAuto path below. 1745 if (widthType == MinSize && logicalWidth.isAuto()) 1746 return computeBorderBoxLogicalWidth(0); 1747 1748 if (!logicalWidth.isIntrinsicOrAuto()) { 1749 // FIXME: If the containing block flow is perpendicular to our direction we need to use the available logical height instead. 1750 return computeBorderBoxLogicalWidth(valueForLength(logicalWidth, availableLogicalWidth, view())); 1751 } 1752 1753 if (logicalWidth.type() == MinContent) 1754 return minPreferredLogicalWidth(); 1755 if (logicalWidth.type() == MaxContent) 1756 return maxPreferredLogicalWidth(); 1757 1758 RenderView* renderView = view(); 1759 LayoutUnit marginStart = minimumValueForLength(styleToUse->marginStart(), availableLogicalWidth, renderView); 1760 LayoutUnit marginEnd = minimumValueForLength(styleToUse->marginEnd(), availableLogicalWidth, renderView); 1761 LayoutUnit logicalWidthResult = availableLogicalWidth - marginStart - marginEnd; 1762 1763 // shrinkToAvoidFloats() is only true for width: auto so the below code works correctly for 1764 // width: fill-available since no case matches and it returns the logicalWidthResult from above. 1765 if (shrinkToAvoidFloats() && cb->containsFloats()) 1766 logicalWidthResult = min(logicalWidthResult, shrinkLogicalWidthToAvoidFloats(marginStart, marginEnd, cb, region, offsetFromLogicalTopOfFirstPage)); 1767 1768 if (logicalWidth.type() == FitContent || (logicalWidth.type() != FillAvailable && sizesLogicalWidthToFitContent(widthType))) 1769 return max(minPreferredLogicalWidth(), min(maxPreferredLogicalWidth(), logicalWidthResult)); 1766 1770 return logicalWidthResult; 1767 1771 } 1768 1772 1769 bool RenderBox::sizesLogicalWidthToFitContent( LogicalWidthType widthType) const1773 bool RenderBox::sizesLogicalWidthToFitContent(SizeType widthType) const 1770 1774 { 1771 1775 // Marquees in WinIE are like a mixture of blocks and inline-blocks. They size as though they're blocks, … … 1776 1780 // This code may look a bit strange. Basically width:intrinsic should clamp the size when testing both 1777 1781 // min-width and width. max-width is only clamped if it is also intrinsic. 1778 Length logicalWidth = (widthType == Max LogicalWidth) ? style()->logicalMaxWidth() : style()->logicalWidth();1782 Length logicalWidth = (widthType == MaxSize) ? style()->logicalMaxWidth() : style()->logicalWidth(); 1779 1783 if (logicalWidth.type() == Intrinsic) 1780 1784 return true; … … 2013 2017 LayoutUnit heightResult; 2014 2018 if (checkMinMaxHeight) { 2015 heightResult = computeLogicalHeightUsing( styleToUse->logicalHeight());2019 heightResult = computeLogicalHeightUsing(MainOrPreferredSize, styleToUse->logicalHeight()); 2016 2020 if (heightResult == -1) 2017 2021 heightResult = logicalHeight(); 2018 LayoutUnit minH = computeLogicalHeightUsing( styleToUse->logicalMinHeight()); // Leave as -1 if unset.2019 LayoutUnit maxH = styleToUse->logicalMaxHeight().isUndefined() ? heightResult : computeLogicalHeightUsing( styleToUse->logicalMaxHeight());2022 LayoutUnit minH = computeLogicalHeightUsing(MinSize, styleToUse->logicalMinHeight()); // Leave as -1 if unset. 2023 LayoutUnit maxH = styleToUse->logicalMaxHeight().isUndefined() ? heightResult : computeLogicalHeightUsing(MaxSize, styleToUse->logicalMaxHeight()); 2020 2024 if (maxH == -1) 2021 2025 maxH = heightResult; … … 2064 2068 } 2065 2069 2066 LayoutUnit RenderBox::computeLogicalHeightUsing( const Length& height)2067 { 2068 LayoutUnit logicalHeight = computeContentLogicalHeightUsing(height );2070 LayoutUnit RenderBox::computeLogicalHeightUsing(SizeType heightType, const Length& height) 2071 { 2072 LayoutUnit logicalHeight = computeContentLogicalHeightUsing(heightType, height); 2069 2073 if (logicalHeight != -1) 2070 2074 logicalHeight = computeBorderBoxLogicalHeight(logicalHeight); … … 2072 2076 } 2073 2077 2074 LayoutUnit RenderBox::computeContentLogicalHeightUsing(const Length& height) 2075 { 2078 LayoutUnit RenderBox::computeContentLogicalHeightUsing(SizeType heightType, const Length& height) 2079 { 2080 // FIXME: For flexboxes, minHeight:auto should be min-content. 2081 if (height.isAuto()) 2082 return heightType == MinSize ? 0 : -1; 2083 2076 2084 LayoutUnit logicalHeight = -1; 2077 if (!height.isAuto()) { 2078 if (height.isFixed()) 2079 logicalHeight = height.value(); 2080 else if (height.isPercent()) 2081 logicalHeight = computePercentageLogicalHeight(height); 2082 else if (height.isViewportPercentage()) 2083 logicalHeight = valueForLength(height, 0, view()); 2084 } 2085 return logicalHeight; 2085 if (height.isFixed()) 2086 return height.value(); 2087 if (height.isPercent()) 2088 return computePercentageLogicalHeight(height); 2089 if (height.isViewportPercentage()) 2090 return valueForLength(height, 0, view()); 2091 return -1; 2086 2092 } 2087 2093 … … 2173 2179 LayoutUnit RenderBox::computeReplacedLogicalWidth(bool includeMaxWidth) const 2174 2180 { 2175 return computeReplacedLogicalWidthRespectingMinMaxWidth(computeReplacedLogicalWidthUsing( style()->logicalWidth()), includeMaxWidth);2181 return computeReplacedLogicalWidthRespectingMinMaxWidth(computeReplacedLogicalWidthUsing(MainOrPreferredSize, style()->logicalWidth()), includeMaxWidth); 2176 2182 } 2177 2183 2178 2184 LayoutUnit RenderBox::computeReplacedLogicalWidthRespectingMinMaxWidth(LayoutUnit logicalWidth, bool includeMaxWidth) const 2179 2185 { 2180 LayoutUnit minLogicalWidth = computeReplacedLogicalWidthUsing( style()->logicalMinWidth());2181 LayoutUnit maxLogicalWidth = !includeMaxWidth || style()->logicalMaxWidth().isUndefined() ? logicalWidth : computeReplacedLogicalWidthUsing( style()->logicalMaxWidth());2186 LayoutUnit minLogicalWidth = computeReplacedLogicalWidthUsing(MinSize, style()->logicalMinWidth()); 2187 LayoutUnit maxLogicalWidth = !includeMaxWidth || style()->logicalMaxWidth().isUndefined() ? logicalWidth : computeReplacedLogicalWidthUsing(MaxSize, style()->logicalMaxWidth()); 2182 2188 return max(minLogicalWidth, min(logicalWidth, maxLogicalWidth)); 2183 2189 } 2184 2190 2185 LayoutUnit RenderBox::computeReplacedLogicalWidthUsing(Length logicalWidth) const 2186 { 2191 LayoutUnit RenderBox::computeReplacedLogicalWidthUsing(SizeType sizeType, Length logicalWidth) const 2192 { 2193 // FIXME: For flexboxes, minWidth:auto should be min-content. 2194 if (sizeType == MinSize && logicalWidth.isAuto()) 2195 return computeContentBoxLogicalWidth(0); 2196 2187 2197 switch (logicalWidth.type()) { 2188 2198 case Fixed: … … 2209 2219 LayoutUnit RenderBox::computeReplacedLogicalHeight() const 2210 2220 { 2211 return computeReplacedLogicalHeightRespectingMinMaxHeight(computeReplacedLogicalHeightUsing( style()->logicalHeight()));2221 return computeReplacedLogicalHeightRespectingMinMaxHeight(computeReplacedLogicalHeightUsing(MainOrPreferredSize, style()->logicalHeight())); 2212 2222 } 2213 2223 2214 2224 LayoutUnit RenderBox::computeReplacedLogicalHeightRespectingMinMaxHeight(LayoutUnit logicalHeight) const 2215 2225 { 2216 LayoutUnit minLogicalHeight = computeReplacedLogicalHeightUsing( style()->logicalMinHeight());2217 LayoutUnit maxLogicalHeight = style()->logicalMaxHeight().isUndefined() ? logicalHeight : computeReplacedLogicalHeightUsing( style()->logicalMaxHeight());2226 LayoutUnit minLogicalHeight = computeReplacedLogicalHeightUsing(MinSize, style()->logicalMinHeight()); 2227 LayoutUnit maxLogicalHeight = style()->logicalMaxHeight().isUndefined() ? logicalHeight : computeReplacedLogicalHeightUsing(MaxSize, style()->logicalMaxHeight()); 2218 2228 return max(minLogicalHeight, min(logicalHeight, maxLogicalHeight)); 2219 2229 } 2220 2230 2221 LayoutUnit RenderBox::computeReplacedLogicalHeightUsing(Length logicalHeight) const 2222 { 2231 LayoutUnit RenderBox::computeReplacedLogicalHeightUsing(SizeType sizeType, Length logicalHeight) const 2232 { 2233 // FIXME: For flexboxes, minWidth:auto should be min-content. 2234 if (sizeType == MinSize && logicalHeight.isAuto()) 2235 return computeContentBoxLogicalHeight(0); 2236 2223 2237 switch (logicalHeight.type()) { 2224 2238 case Fixed: … … 2565 2579 LayoutUnit logicalWidthResult; 2566 2580 LayoutUnit logicalLeftResult; 2567 computePositionedLogicalWidthUsing( style()->logicalWidth(), containerBlock, containerDirection,2581 computePositionedLogicalWidthUsing(MainOrPreferredSize, style()->logicalWidth(), containerBlock, containerDirection, 2568 2582 containerLogicalWidth, bordersPlusPadding, 2569 2583 logicalLeftLength, logicalRightLength, marginLogicalLeft, marginLogicalRight, … … 2579 2593 LayoutUnit maxLogicalLeftPos; 2580 2594 2581 computePositionedLogicalWidthUsing( style()->logicalMaxWidth(), containerBlock, containerDirection,2595 computePositionedLogicalWidthUsing(MaxSize, style()->logicalMaxWidth(), containerBlock, containerDirection, 2582 2596 containerLogicalWidth, bordersPlusPadding, 2583 2597 logicalLeftLength, logicalRightLength, marginLogicalLeft, marginLogicalRight, … … 2599 2613 LayoutUnit minLogicalLeftPos; 2600 2614 2601 computePositionedLogicalWidthUsing( style()->logicalMinWidth(), containerBlock, containerDirection,2615 computePositionedLogicalWidthUsing(MinSize, style()->logicalMinWidth(), containerBlock, containerDirection, 2602 2616 containerLogicalWidth, bordersPlusPadding, 2603 2617 logicalLeftLength, logicalRightLength, marginLogicalLeft, marginLogicalRight, … … 2613 2627 2614 2628 if (stretchesToMinIntrinsicLogicalWidth() && logicalWidth() < minPreferredLogicalWidth() - bordersPlusPadding) { 2615 computePositionedLogicalWidthUsing( Length(minPreferredLogicalWidth() - bordersPlusPadding, Fixed), containerBlock, containerDirection,2629 computePositionedLogicalWidthUsing(MainOrPreferredSize, Length(minPreferredLogicalWidth() - bordersPlusPadding, Fixed), containerBlock, containerDirection, 2616 2630 containerLogicalWidth, bordersPlusPadding, 2617 2631 logicalLeftLength, logicalRightLength, marginLogicalLeft, marginLogicalRight, … … 2650 2664 } 2651 2665 2652 void RenderBox::computePositionedLogicalWidthUsing( Length logicalWidth, const RenderBoxModelObject* containerBlock, TextDirection containerDirection,2666 void RenderBox::computePositionedLogicalWidthUsing(SizeType widthSizeType, Length logicalWidth, const RenderBoxModelObject* containerBlock, TextDirection containerDirection, 2653 2667 LayoutUnit containerLogicalWidth, LayoutUnit bordersPlusPadding, 2654 2668 Length logicalLeft, Length logicalRight, Length marginLogicalLeft, Length marginLogicalRight, 2655 2669 LayoutUnit& logicalWidthValue, LayoutUnit& marginLogicalLeftValue, LayoutUnit& marginLogicalRightValue, LayoutUnit& logicalLeftPos) 2656 2670 { 2671 // FIXME: What should flex items do here since min-width:auto == min-width:min-content instead of min-width:auto == min-width:0. 2672 if (widthSizeType == MinSize && logicalWidth.isAuto()) 2673 logicalWidth = Length(0, Fixed); 2674 2657 2675 // 'left' and 'right' cannot both be 'auto' because one would of been 2658 2676 // converted to the static position already … … 2894 2912 2895 2913 // Calculate constraint equation values for 'height' case. 2896 computePositionedLogicalHeightUsing( styleToUse->logicalHeight(), containerBlock, containerLogicalHeight, bordersPlusPadding,2914 computePositionedLogicalHeightUsing(MainOrPreferredSize, styleToUse->logicalHeight(), containerBlock, containerLogicalHeight, bordersPlusPadding, 2897 2915 logicalTopLength, logicalBottomLength, marginBefore, marginAfter, 2898 2916 logicalHeightResult, marginBeforeAlias, marginAfterAlias, logicalTopPos); … … 2909 2927 LayoutUnit maxLogicalTopPos; 2910 2928 2911 computePositionedLogicalHeightUsing( styleToUse->logicalMaxHeight(), containerBlock, containerLogicalHeight, bordersPlusPadding,2929 computePositionedLogicalHeightUsing(MaxSize, styleToUse->logicalMaxHeight(), containerBlock, containerLogicalHeight, bordersPlusPadding, 2912 2930 logicalTopLength, logicalBottomLength, marginBefore, marginAfter, 2913 2931 maxLogicalHeight, maxMarginBefore, maxMarginAfter, maxLogicalTopPos); … … 2928 2946 LayoutUnit minLogicalTopPos; 2929 2947 2930 computePositionedLogicalHeightUsing( styleToUse->logicalMinHeight(), containerBlock, containerLogicalHeight, bordersPlusPadding,2948 computePositionedLogicalHeightUsing(MinSize, styleToUse->logicalMinHeight(), containerBlock, containerLogicalHeight, bordersPlusPadding, 2931 2949 logicalTopLength, logicalBottomLength, marginBefore, marginAfter, 2932 2950 minLogicalHeight, minMarginBefore, minMarginAfter, minLogicalTopPos); … … 2980 2998 } 2981 2999 2982 void RenderBox::computePositionedLogicalHeightUsing( Length logicalHeightLength, const RenderBoxModelObject* containerBlock,3000 void RenderBox::computePositionedLogicalHeightUsing(SizeType heightSizeType, Length logicalHeightLength, const RenderBoxModelObject* containerBlock, 2983 3001 LayoutUnit containerLogicalHeight, LayoutUnit bordersPlusPadding, 2984 3002 Length logicalTop, Length logicalBottom, Length marginBefore, Length marginAfter, 2985 3003 LayoutUnit& logicalHeightValue, LayoutUnit& marginBeforeValue, LayoutUnit& marginAfterValue, LayoutUnit& logicalTopPos) 2986 3004 { 3005 // FIXME: What should flex items do here since min-height:auto == min-height:min-content instead of min-height:auto == min-height:0. 3006 if (heightSizeType == MinSize && logicalHeightLength.isAuto()) 3007 logicalHeightLength = Length(0, Fixed); 3008 2987 3009 // 'top' and 'bottom' cannot both be 'auto' because 'top would of been 2988 3010 // converted to the static position in computePositionedLogicalHeight() … … 2993 3015 LayoutUnit logicalTopValue = 0; 2994 3016 3017 // FIXME: For non-flexboxes + min-height, this needs to treat non-flexboxes as 0. 2995 3018 bool logicalHeightIsAuto = logicalHeightLength.isAuto(); 2996 3019 bool logicalTopIsAuto = logicalTop.isAuto(); -
trunk/Source/WebCore/rendering/RenderBox.h
r121123 r122264 34 34 struct PaintInfo; 35 35 36 enum LogicalWidthType { LogicalWidth, MinLogicalWidth, MaxLogicalWidth};36 enum SizeType { MainOrPreferredSize, MinSize, MaxSize }; 37 37 38 38 enum OverlayScrollbarSizeRelevancy { IgnoreOverlayScrollbarSize, IncludeOverlayScrollbarSize }; … … 336 336 // Whether or not the element shrinks to its intrinsic width (rather than filling the width 337 337 // of a containing block). HTML4 buttons, <select>s, <input>s, legends, and floating/compact elements do this. 338 bool sizesLogicalWidthToFitContent( LogicalWidthType) const;338 bool sizesLogicalWidthToFitContent(SizeType) const; 339 339 virtual bool stretchesToMinIntrinsicLogicalWidth() const { return false; } 340 340 341 341 LayoutUnit shrinkLogicalWidthToAvoidFloats(LayoutUnit childMarginStart, LayoutUnit childMarginEnd, const RenderBlock* cb, RenderRegion*, LayoutUnit offsetFromLogicalTopOfFirstPage); 342 342 343 LayoutUnit computeLogicalWidthInRegionUsing( LogicalWidthType, LayoutUnit availableLogicalWidth, const RenderBlock* containingBlock, RenderRegion*, LayoutUnit offsetFromLogicalTopOfFirstPage);344 LayoutUnit computeLogicalHeightUsing( const Length& height);345 LayoutUnit computeContentLogicalHeightUsing( const Length& height);346 LayoutUnit computeReplacedLogicalWidthUsing( Length width) const;343 LayoutUnit computeLogicalWidthInRegionUsing(SizeType, LayoutUnit availableLogicalWidth, const RenderBlock* containingBlock, RenderRegion*, LayoutUnit offsetFromLogicalTopOfFirstPage); 344 LayoutUnit computeLogicalHeightUsing(SizeType, const Length& height); 345 LayoutUnit computeContentLogicalHeightUsing(SizeType, const Length& height); 346 LayoutUnit computeReplacedLogicalWidthUsing(SizeType, Length width) const; 347 347 LayoutUnit computeReplacedLogicalWidthRespectingMinMaxWidth(LayoutUnit logicalWidth, bool includeMaxWidth = true) const; 348 LayoutUnit computeReplacedLogicalHeightUsing( Length height) const;348 LayoutUnit computeReplacedLogicalHeightUsing(SizeType, Length height) const; 349 349 LayoutUnit computeReplacedLogicalHeightRespectingMinMaxHeight(LayoutUnit logicalHeight) const; 350 350 … … 541 541 542 542 void computePositionedLogicalHeight(); 543 void computePositionedLogicalWidthUsing( Length logicalWidth, const RenderBoxModelObject* containerBlock, TextDirection containerDirection,543 void computePositionedLogicalWidthUsing(SizeType, Length logicalWidth, const RenderBoxModelObject* containerBlock, TextDirection containerDirection, 544 544 LayoutUnit containerLogicalWidth, LayoutUnit bordersPlusPadding, 545 545 Length logicalLeft, Length logicalRight, Length marginLogicalLeft, Length marginLogicalRight, 546 546 LayoutUnit& logicalWidthValue, LayoutUnit& marginLogicalLeftValue, LayoutUnit& marginLogicalRightValue, LayoutUnit& logicalLeftPos); 547 void computePositionedLogicalHeightUsing( Length logicalHeight, const RenderBoxModelObject* containerBlock,547 void computePositionedLogicalHeightUsing(SizeType, Length logicalHeight, const RenderBoxModelObject* containerBlock, 548 548 LayoutUnit containerLogicalHeight, LayoutUnit bordersPlusPadding, 549 549 Length logicalTop, Length logicalBottom, Length marginLogicalTop, Length marginLogicalBottom, -
trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp
r121123 r122264 1064 1064 else if (child->style()->minWidth().type() == MinIntrinsic) 1065 1065 minWidth = child->minPreferredLogicalWidth(); 1066 else if (child->style()->minWidth().type() == Auto) 1067 minWidth = 0; 1066 1068 1067 1069 LayoutUnit allowedShrinkage = min<LayoutUnit>(0, minWidth - width); 1068 1070 return allowedShrinkage; 1069 1071 } else { 1070 if (child->style()->minHeight().isFixed()) { 1072 Length minHeight = child->style()->minHeight(); 1073 if (minHeight.isFixed() || minHeight.isAuto()) { 1071 1074 LayoutUnit minHeight = child->style()->minHeight().value(); 1072 1075 LayoutUnit height = child->overrideLogicalContentHeight(); -
trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp
r121611 r122264 156 156 157 157 RenderStyle* styleToUse = style(); 158 // FIXME: This should probably be checking for isSpecified since you should be able to use percentage, calc or viewport relative values for width. 158 159 if (styleToUse->logicalWidth().isFixed() && styleToUse->logicalWidth().value() > 0) 159 160 m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = computeContentBoxLogicalWidth(styleToUse->logicalWidth().value()); … … 205 206 m_minPreferredLogicalWidth += scrollbarWidth; 206 207 208 // FIXME: This should probably be checking for isSpecified since you should be able to use percentage, calc or viewport relative values for min-width. 207 209 if (styleToUse->logicalMinWidth().isFixed() && styleToUse->logicalMinWidth().value() > 0) { 208 210 m_maxPreferredLogicalWidth = std::max(m_maxPreferredLogicalWidth, computeContentBoxLogicalWidth(styleToUse->logicalMinWidth().value())); … … 210 212 } 211 213 214 // FIXME: This should probably be checking for isSpecified since you should be able to use percentage, calc or viewport relative values for maxWidth. 212 215 if (styleToUse->logicalMaxWidth().isFixed()) { 213 216 m_maxPreferredLogicalWidth = std::min(m_maxPreferredLogicalWidth, computeContentBoxLogicalWidth(styleToUse->logicalMaxWidth().value())); … … 596 599 contentExtent = overrideLogicalContentHeight(); 597 600 else { 598 LayoutUnit heightResult = computeContentLogicalHeightUsing( style()->logicalHeight());601 LayoutUnit heightResult = computeContentLogicalHeightUsing(MainOrPreferredSize, style()->logicalHeight()); 599 602 if (heightResult == -1) 600 603 heightResult = preferredMainAxisExtent; 601 LayoutUnit minHeight = computeContentLogicalHeightUsing( style()->logicalMinHeight()); // Leave as -1 if unset.602 LayoutUnit maxHeight = style()->logicalMaxHeight().isUndefined() ? heightResult : computeContentLogicalHeightUsing( style()->logicalMaxHeight());604 LayoutUnit minHeight = computeContentLogicalHeightUsing(MinSize, style()->logicalMinHeight()); // Leave as -1 if unset. 605 LayoutUnit maxHeight = style()->logicalMaxHeight().isUndefined() ? heightResult : computeContentLogicalHeightUsing(MaxSize, style()->logicalMaxHeight()); 603 606 if (maxHeight == -1) 604 607 maxHeight = heightResult; … … 772 775 return mainAxisContentExtent(); 773 776 774 LayoutUnit height = computeContentLogicalHeightUsing( style()->logicalHeight());777 LayoutUnit height = computeContentLogicalHeightUsing(MainOrPreferredSize, style()->logicalHeight()); 775 778 if (height == -1) 776 779 height = MAX_LAYOUT_UNIT; 777 LayoutUnit maxHeight = computeContentLogicalHeightUsing( style()->logicalMaxHeight());780 LayoutUnit maxHeight = computeContentLogicalHeightUsing(MaxSize, style()->logicalMaxHeight()); 778 781 if (maxHeight != -1) 779 782 height = std::min(height, maxHeight); … … 790 793 if (max.isSpecified() && childSize > valueForLength(max, flexboxAvailableContentExtent, renderView)) 791 794 childSize = valueForLength(max, flexboxAvailableContentExtent, renderView); 795 // FIXME: Treat auto min values as min-content. 792 796 if (min.isSpecified() && childSize < valueForLength(min, flexboxAvailableContentExtent, renderView)) 793 797 childSize = valueForLength(min, flexboxAvailableContentExtent, renderView); -
trunk/Source/WebCore/rendering/RenderReplaced.cpp
r121123 r122264 316 316 { 317 317 if (style()->logicalWidth().isSpecified()) 318 return computeReplacedLogicalWidthRespectingMinMaxWidth(computeReplacedLogicalWidthUsing( style()->logicalWidth()), includeMaxWidth);318 return computeReplacedLogicalWidthRespectingMinMaxWidth(computeReplacedLogicalWidthUsing(MainOrPreferredSize, style()->logicalWidth()), includeMaxWidth); 319 319 320 320 RenderBox* contentRenderer = embeddedContentBox(); … … 341 341 // of 'width' is: (used height) * (intrinsic ratio) 342 342 if (intrinsicRatio && ((heightIsAuto && !hasIntrinsicWidth && hasIntrinsicHeight) || !heightIsAuto)) { 343 LayoutUnit logicalHeight = computeReplacedLogicalHeightUsing( style()->logicalHeight());343 LayoutUnit logicalHeight = computeReplacedLogicalHeightUsing(MainOrPreferredSize, style()->logicalHeight()); 344 344 return computeReplacedLogicalWidthRespectingMinMaxWidth(roundToInt(round(logicalHeight * intrinsicRatio))); 345 345 } … … 353 353 LayoutUnit logicalWidth; 354 354 if (RenderBlock* blockWithWidth = firstContainingBlockWithLogicalWidth(this)) 355 logicalWidth = blockWithWidth->computeReplacedLogicalWidthRespectingMinMaxWidth(blockWithWidth->computeReplacedLogicalWidthUsing( blockWithWidth->style()->logicalWidth()), false);355 logicalWidth = blockWithWidth->computeReplacedLogicalWidthRespectingMinMaxWidth(blockWithWidth->computeReplacedLogicalWidthUsing(MainOrPreferredSize, blockWithWidth->style()->logicalWidth()), false); 356 356 else 357 357 logicalWidth = containingBlock()->availableLogicalWidth(); … … 385 385 // 10.5 Content height: the 'height' property: http://www.w3.org/TR/CSS21/visudet.html#propdef-height 386 386 if (hasReplacedLogicalHeight()) 387 return computeReplacedLogicalHeightRespectingMinMaxHeight(computeReplacedLogicalHeightUsing( style()->logicalHeight()));387 return computeReplacedLogicalHeightRespectingMinMaxHeight(computeReplacedLogicalHeightUsing(MainOrPreferredSize, style()->logicalHeight())); 388 388 389 389 RenderBox* contentRenderer = embeddedContentBox(); -
trunk/Source/WebCore/rendering/RenderScrollbarPart.cpp
r118076 r122264 80 80 } 81 81 82 static int calcScrollbarThicknessUsing( const Length& length, int containingLength, RenderView* renderView)82 static int calcScrollbarThicknessUsing(SizeType sizeType, const Length& length, int containingLength, RenderView* renderView) 83 83 { 84 if ( length.isIntrinsicOrAuto())85 return ScrollbarTheme::theme()->scrollbarThickness();86 return minimumValueForLength(length, containingLength, renderView);84 if (!length.isIntrinsicOrAuto() || (sizeType == MinSize && length.isAuto())) 85 return minimumValueForLength(length, containingLength, renderView); 86 return ScrollbarTheme::theme()->scrollbarThickness(); 87 87 } 88 88 … … 93 93 RenderView* renderView = view(); 94 94 int visibleSize = m_scrollbar->owningRenderer()->width() - m_scrollbar->owningRenderer()->borderLeft() - m_scrollbar->owningRenderer()->borderRight(); 95 int w = calcScrollbarThicknessUsing( style()->width(), visibleSize, renderView);96 int minWidth = calcScrollbarThicknessUsing( style()->minWidth(), visibleSize, renderView);97 int maxWidth = style()->maxWidth().isUndefined() ? w : calcScrollbarThicknessUsing( style()->maxWidth(), visibleSize, renderView);95 int w = calcScrollbarThicknessUsing(MainOrPreferredSize, style()->width(), visibleSize, renderView); 96 int minWidth = calcScrollbarThicknessUsing(MinSize, style()->minWidth(), visibleSize, renderView); 97 int maxWidth = style()->maxWidth().isUndefined() ? w : calcScrollbarThicknessUsing(MaxSize, style()->maxWidth(), visibleSize, renderView); 98 98 setWidth(max(minWidth, min(maxWidth, w))); 99 99 … … 109 109 RenderView* renderView = view(); 110 110 int visibleSize = m_scrollbar->owningRenderer()->height() - m_scrollbar->owningRenderer()->borderTop() - m_scrollbar->owningRenderer()->borderBottom(); 111 int h = calcScrollbarThicknessUsing( style()->height(), visibleSize, renderView);112 int minHeight = calcScrollbarThicknessUsing( style()->minHeight(), visibleSize, renderView);113 int maxHeight = style()->maxHeight().isUndefined() ? h : calcScrollbarThicknessUsing( style()->maxHeight(), visibleSize, renderView);111 int h = calcScrollbarThicknessUsing(MainOrPreferredSize, style()->height(), visibleSize, renderView); 112 int minHeight = calcScrollbarThicknessUsing(MinSize, style()->minHeight(), visibleSize, renderView); 113 int maxHeight = style()->maxHeight().isUndefined() ? h : calcScrollbarThicknessUsing(MaxSize, style()->maxHeight(), visibleSize, renderView); 114 114 setHeight(max(minHeight, min(maxHeight, h))); 115 115 -
trunk/Source/WebCore/rendering/style/RenderStyle.h
r121352 r122264 1589 1589 static int initialLetterWordSpacing() { return 0; } 1590 1590 static Length initialSize() { return Length(); } 1591 static Length initialMinSize() { return Length( 0, Fixed); }1591 static Length initialMinSize() { return Length(); } 1592 1592 static Length initialMaxSize() { return Length(Undefined); } 1593 1593 static Length initialOffset() { return Length(); }
Note: See TracChangeset
for help on using the changeset viewer.