intrinsic size keywords don't work for heights
authorsvillar@igalia.com <svillar@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 24 Jun 2015 13:36:00 +0000 (13:36 +0000)
committersvillar@igalia.com <svillar@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 24 Jun 2015 13:36:00 +0000 (13:36 +0000)
commit2cae6dd4bcb9b09bea0072304f6d6ca1f0c5a4e0
tree882dc8bd933a387186a08c4eb4be56820b59c24c
parentf935f49c67edd4c377dffb3df3f9e47346f96bf2
intrinsic size keywords don't work for heights
https://bugs.webkit.org/show_bug.cgi?id=113610

Reviewed by Darin Adler.

Source/WebCore:

Based on Blink's r148314 & r150355 by <cbiesinger@chromium.org>.

Adds intrinsic values support to heigh & min/max-height. This involves the
following changes:
- RenderBox needs to pass the content height through to computeLogicalHeight and
related functions, which needs it to resolve max-content, et. al.
- Make the callers pass the content height to this function. Some callers pass
logicalHeight() (adjusted for border/padding) which works because if
logicalHeight is not the content height, then it is the height we ended up using,
so the constrain* functions will just constrain to that value again.
- Parsing code needs to be adjusted to support intrinsic values for heights.

Tests: fast/css-intrinsic-dimensions/height-css-tables-collapsed.html
       fast/css-intrinsic-dimensions/height-css-tables.html
       fast/css-intrinsic-dimensions/height-flexbox.html
       fast/css-intrinsic-dimensions/height-positioned-replaced.html
       fast/css-intrinsic-dimensions/height-positioned.html
       fast/css-intrinsic-dimensions/height-replaced.html
       fast/css-intrinsic-dimensions/height-tables-collapsed.html
       fast/css-intrinsic-dimensions/height-tables.html
       fast/css-intrinsic-dimensions/height.html

* css/CSSParser.cpp:
(WebCore::CSSParser::isValidSize): Refactored from validateWidth and
validateHeight.
(WebCore::CSSParser::parseValue):
(WebCore::CSSParser::validateWidth): Deleted.
(WebCore::CSSParser::validateHeight): Deleted.
* css/CSSParser.h:
* platform/Length.h:
(WebCore::Length::isFillAvailable):
(WebCore::Length::isFitContent):
* rendering/RenderBox.cpp:
(WebCore::RenderBox::constrainLogicalHeightByMinMax):
(WebCore::RenderBox::constrainContentBoxLogicalHeightByMinMax):
(WebCore::RenderBox::computeLogicalHeight):
(WebCore::RenderBox::computeLogicalHeightUsing):
(WebCore::RenderBox::computeContentLogicalHeight):
(WebCore::RenderBox::computeIntrinsicLogicalContentHeightUsing):
(WebCore::RenderBox::computeContentAndScrollbarLogicalHeightUsing):
(WebCore::RenderBox::computePercentageLogicalHeight):
(WebCore::RenderBox::computeReplacedLogicalHeightUsing):
(WebCore::RenderBox::availableLogicalHeight):
(WebCore::RenderBox::availableLogicalHeightUsing):
(WebCore::RenderBox::computePositionedLogicalHeight):
(WebCore::RenderBox::computePositionedLogicalHeightUsing):
* rendering/RenderBox.h:
* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::computeMainAxisExtentForChild):
(WebCore::RenderFlexibleBox::applyStretchAlignmentToChild):
* rendering/RenderFlowThread.cpp:
(WebCore::RenderFlowThread::addForcedRegionBreak):
* rendering/RenderGrid.cpp:
(WebCore::RenderGrid::computeUsedBreadthOfSpecifiedLength):
(WebCore::RenderGrid::applyStretchAlignmentToChildIfNeeded):
* rendering/RenderMultiColumnSet.cpp:
(WebCore::RenderMultiColumnSet::calculateMaxColumnHeight):
* rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::hasReplacedLogicalHeight):
* rendering/RenderTable.cpp:
(WebCore::RenderTable::convertStyleLogicalHeightToComputedHeight):
(WebCore::RenderTable::layout):

LayoutTests:

Based on Blink's r148314 by <cbiesinger@chromium.org>.

* fast/css-intrinsic-dimensions/height-css-tables-collapsed-expected.html: Added.
* fast/css-intrinsic-dimensions/height-css-tables-collapsed.html: Added.
* fast/css-intrinsic-dimensions/height-css-tables-expected.html: Added.
* fast/css-intrinsic-dimensions/height-css-tables.html: Added.
* fast/css-intrinsic-dimensions/height-expected.html: Added.
* fast/css-intrinsic-dimensions/height-flexbox-expected.html: Added.
* fast/css-intrinsic-dimensions/height-flexbox.html: Added.
* fast/css-intrinsic-dimensions/height-positioned-expected.html: Added.
* fast/css-intrinsic-dimensions/height-positioned-replaced-expected.html: Added.
* fast/css-intrinsic-dimensions/height-positioned-replaced.html: Added.
* fast/css-intrinsic-dimensions/height-positioned.html: Added.
* fast/css-intrinsic-dimensions/height-property-value-expected.txt:
* fast/css-intrinsic-dimensions/height-property-value.html:
* fast/css-intrinsic-dimensions/height-property-value.html.orig: Copied from LayoutTests/fast/css-intrinsic-dimensions/height-property-value.html.
* fast/css-intrinsic-dimensions/height-replaced-expected.html: Added.
* fast/css-intrinsic-dimensions/height-replaced.html: Added.
* fast/css-intrinsic-dimensions/height-tables-collapsed-expected.html: Added.
* fast/css-intrinsic-dimensions/height-tables-collapsed.html: Added.
* fast/css-intrinsic-dimensions/height-tables-expected.html: Added.
* fast/css-intrinsic-dimensions/height-tables.html: Added.
* fast/css-intrinsic-dimensions/height.html: Added.
* fast/css-intrinsic-dimensions/resources/height-keyword-classes.css: Added.
(.min-content):
(.max-content):
(.fill-available):
(.fit-content):
(.max-height-min-content):
(.max-height-max-content):
(.max-height-fill-available):
(.max-height-fit-content):
(.min-height-min-content):
(.min-height-max-content):
(.min-height-fill-available):
(.min-height-fit-content):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@185908 268f45cc-cd09-0410-ab3c-d52691b4dbfc
35 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/css-intrinsic-dimensions/height-css-tables-collapsed-expected.html [new file with mode: 0644]
LayoutTests/fast/css-intrinsic-dimensions/height-css-tables-collapsed.html [new file with mode: 0644]
LayoutTests/fast/css-intrinsic-dimensions/height-css-tables-expected.html [new file with mode: 0644]
LayoutTests/fast/css-intrinsic-dimensions/height-css-tables.html [new file with mode: 0644]
LayoutTests/fast/css-intrinsic-dimensions/height-expected.html [new file with mode: 0644]
LayoutTests/fast/css-intrinsic-dimensions/height-flexbox-expected.html [new file with mode: 0644]
LayoutTests/fast/css-intrinsic-dimensions/height-flexbox.html [new file with mode: 0644]
LayoutTests/fast/css-intrinsic-dimensions/height-positioned-expected.html [new file with mode: 0644]
LayoutTests/fast/css-intrinsic-dimensions/height-positioned-replaced-expected.html [new file with mode: 0644]
LayoutTests/fast/css-intrinsic-dimensions/height-positioned-replaced.html [new file with mode: 0644]
LayoutTests/fast/css-intrinsic-dimensions/height-positioned.html [new file with mode: 0644]
LayoutTests/fast/css-intrinsic-dimensions/height-property-value-expected.txt
LayoutTests/fast/css-intrinsic-dimensions/height-property-value.html
LayoutTests/fast/css-intrinsic-dimensions/height-property-value.html.orig [new file with mode: 0644]
LayoutTests/fast/css-intrinsic-dimensions/height-replaced-expected.html [new file with mode: 0644]
LayoutTests/fast/css-intrinsic-dimensions/height-replaced.html [new file with mode: 0644]
LayoutTests/fast/css-intrinsic-dimensions/height-tables-collapsed-expected.html [new file with mode: 0644]
LayoutTests/fast/css-intrinsic-dimensions/height-tables-collapsed.html [new file with mode: 0644]
LayoutTests/fast/css-intrinsic-dimensions/height-tables-expected.html [new file with mode: 0644]
LayoutTests/fast/css-intrinsic-dimensions/height-tables.html [new file with mode: 0644]
LayoutTests/fast/css-intrinsic-dimensions/height.html [new file with mode: 0644]
LayoutTests/fast/css-intrinsic-dimensions/resources/height-keyword-classes.css [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/css/CSSParser.cpp
Source/WebCore/css/CSSParser.h
Source/WebCore/platform/Length.h
Source/WebCore/rendering/RenderBox.cpp
Source/WebCore/rendering/RenderBox.h
Source/WebCore/rendering/RenderFlexibleBox.cpp
Source/WebCore/rendering/RenderFlowThread.cpp
Source/WebCore/rendering/RenderGrid.cpp
Source/WebCore/rendering/RenderMultiColumnSet.cpp
Source/WebCore/rendering/RenderReplaced.cpp
Source/WebCore/rendering/RenderTable.cpp