Add support for fit-content etc
https://bugs.webkit.org/show_bug.cgi?id=38919

Patch by Elliott Sprehn <[email protected]> on 2012-06-20
Reviewed by Tony Chang.

Source/WebCore:

Implement the CSS3 intrinsic dimension keywords for width properties and
add most of the plumbing for height properties but don't expose them
yet since this patch doesn't enforce them (matching current Gecko).
http://dev.w3.org/csswg/css3-writing-modes/#intrinsic-sizing

This patch implements -webkit-min-content, -webkit-max-content,
-webkit-fill-available and -webkit-fit-content for all width
properties.

Tests: fast/css-intrinsic-dimensions/height-dynamic-property-value.html
       fast/css-intrinsic-dimensions/height-property-value.html
       fast/css-intrinsic-dimensions/max-width-constrained.html
       fast/css-intrinsic-dimensions/max-width-unconstrained.html
       fast/css-intrinsic-dimensions/min-width.html
       fast/css-intrinsic-dimensions/width-avoid-floats.html
       fast/css-intrinsic-dimensions/width-dynamic-property-value.html
       fast/css-intrinsic-dimensions/width-property-value.html
       fast/css-intrinsic-dimensions/width.html

* css/CSSParser.cpp: Add parser support for the new keywords.
(WebCore::CSSParser::parseValue):
* css/CSSPrimitiveValue.cpp:
(WebCore):
(WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
* css/CSSValueKeywords.in:
* css/LengthFunctions.cpp: Implement conversion functions.
(WebCore::minimumValueForLength):
(WebCore::valueForLength):
(WebCore::floatValueForLength):
* css/StyleBuilder.cpp:
(WebCore::ApplyPropertyLength::applyValue):
(WebCore::StyleBuilder::StyleBuilder): Clean up the template for old
   intrinsic values and add new values. Rename old intrinsic to
   LegacyIntrinsic and add support for the new dimension keywords as
   Intrinsic.
* platform/Length.h:
(WebCore::Length::isIntrinsicOrAuto):
(WebCore::Length::isLegacyIntrinsic): New method to check for old
    min-intrinsic and intrinsic keywords.
(WebCore::Length::isIntrinsic): New method to check for CSS3 intrinsic
    dimension keywords like min-content.
* rendering/RenderBox.cpp:
(WebCore::RenderBox::computeLogicalWidthInRegionUsing): Expose the max
   and min logical preferred widths as the new keywords.
(WebCore::RenderBox::sizesLogicalWidthToFitContent): Renamed method to
   be more consistent with the new MinContent naming in the spec.
* rendering/RenderBox.h:
(RenderBox):

LayoutTests:

Tests for CSS3 intrinsic dimension keywords as defined in the
writing modes spec. This tests the implementation for width and
ensures that height properties don't allow the new keywords yet
since they're not implemented by this patch.

* fast/css-intrinsic-dimensions/height-dynamic-property-value-expected.txt: Added.
* fast/css-intrinsic-dimensions/height-dynamic-property-value.html: Added.
* fast/css-intrinsic-dimensions/height-property-value-expected.txt: Added.
* fast/css-intrinsic-dimensions/height-property-value.html: Added.
* fast/css-intrinsic-dimensions/max-width-constrained-expected.html: Added.
* fast/css-intrinsic-dimensions/max-width-constrained.html: Added.
* fast/css-intrinsic-dimensions/max-width-unconstrained-expected.html: Added.
* fast/css-intrinsic-dimensions/max-width-unconstrained.html: Added.
* fast/css-intrinsic-dimensions/min-width-expected.html: Added.
* fast/css-intrinsic-dimensions/min-width.html: Added.
* fast/css-intrinsic-dimensions/width-avoid-floats-expected.html: Added.
* fast/css-intrinsic-dimensions/width-avoid-floats.html: Added.
* fast/css-intrinsic-dimensions/width-dynamic-property-value-expected.txt: Added.
* fast/css-intrinsic-dimensions/width-dynamic-property-value.html: Added.
* fast/css-intrinsic-dimensions/width-expected.html: Added.
* fast/css-intrinsic-dimensions/width-keyword-classes.css: Added.
(.min-content):
(.max-content):
(.fill-available):
(.fit-content):
(.max-width-min-content):
(.max-width-max-content):
(.max-width-fill-available):
(.max-width-fit-content):
(.min-width-min-content):
(.min-width-max-content):
(.min-width-fill-available):
(.min-width-fit-content):
* fast/css-intrinsic-dimensions/width-property-value-expected.txt: Added.
* fast/css-intrinsic-dimensions/width-property-value.html: Added.
* fast/css-intrinsic-dimensions/width.html: Added.

git-svn-id: svn://svn.chromium.org/blink/trunk@120849 bbb929c8-8fbe-4397-9dbb-9b2b20218538
25 files changed
tree: 2d2ebb68d039b5a0462eeaf696b03049ff40ea79
  1. third_party/