Split flex into flex-grow/flex-shrink/flex-basis
authortony@chromium.org <tony@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 28 Jun 2012 18:06:09 +0000 (18:06 +0000)
committertony@chromium.org <tony@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 28 Jun 2012 18:06:09 +0000 (18:06 +0000)
commit092bb3c70e0b3723e0835432ec1814bfd70971b3
tree79d7214e9459df4e8cf56ac7e1ad23029bd835cf
parentf2f3c0e183154b0726c723ff81b236fe50661c70
Split flex into flex-grow/flex-shrink/flex-basis
https://bugs.webkit.org/show_bug.cgi?id=86525

Reviewed by Ojan Vafai.

Source/WebCore:

Split flex into 3 separate properties per the spec:
http://dev.w3.org/csswg/css3-flexbox/#flex-components

Tests: css3/flexbox/flex-longhand-parsing.html
       css3/flexbox/flex-property-parsing.html: Updated test results.

* css/CSSComputedStyleDeclaration.cpp:
(WebCore): -webkit-flex is no longer enumerable.
(WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): Add new css property names and use
getCSSPropertyValuesForShorthandProperties for WebkitFlex. Also sort flex propery names.
* css/CSSParser.cpp:
(WebCore::isValidKeywordPropertyAndValue): Fix indent.
(WebCore::CSSParser::parseValue): Add parsing for new properties and handle -webkit-flex: none.
(WebCore::CSSParser::parseFlex): Switch to new names (positive -> grow, negative -> shrink,
preferred size -> basis) and assign to longhand properties.
* css/CSSParser.h:
* css/CSSProperty.cpp:
(WebCore::CSSProperty::isInheritedProperty): Add new properties.
* css/CSSPropertyNames.in: Add new properties.
* css/StyleBuilder.cpp:
(WebCore::StyleBuilder::StyleBuilder): Delete special handling of applying flex and just use shorthand handlers.
* css/StylePropertySet.cpp:
(WebCore::StylePropertySet::getPropertyValue): Add new shorthand.
(WebCore::StylePropertySet::asText):
* css/StylePropertyShorthand.cpp:
(WebCore::webkitFlexShorthand): Add new shorthand.
(WebCore::shorthandForProperty):
* css/StylePropertyShorthand.h:
* css/StyleResolver.cpp:
(WebCore::StyleResolver::collectMatchingRulesForList): Add to list of properties applied by StyleBuilder.
Handle initial and inherit for flex.

LayoutTests:

If -webkit-flex is set to none, when the user reads the value back out, it is
now 0 0 auto. 'none' is for convenience, not an actual value.

* css3/flexbox/flex-longhand-parsing-expected.txt:
* css3/flexbox/flex-longhand-parsing.html: Test flex-grow, flex-shrink and flex-basis.
* css3/flexbox/flex-property-parsing-expected.txt:
* css3/flexbox/flex-property-parsing.html: Update results for 'none'.
* fast/css/getComputedStyle/computed-style-expected.txt:
* fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
* fast/css/getComputedStyle/resources/property-names.js: Remove -webkit-flex since it's no longer enumerable.
* svg/css/getComputedStyle-basic-expected.txt:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@121442 268f45cc-cd09-0410-ab3c-d52691b4dbfc
20 files changed:
LayoutTests/ChangeLog
LayoutTests/css3/flexbox/flex-longhand-parsing-expected.txt [new file with mode: 0644]
LayoutTests/css3/flexbox/flex-longhand-parsing.html [new file with mode: 0644]
LayoutTests/css3/flexbox/flex-property-parsing-expected.txt
LayoutTests/css3/flexbox/flex-property-parsing.html
LayoutTests/fast/css/getComputedStyle/computed-style-expected.txt
LayoutTests/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt
LayoutTests/fast/css/getComputedStyle/resources/property-names.js
LayoutTests/svg/css/getComputedStyle-basic-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/css/CSSComputedStyleDeclaration.cpp
Source/WebCore/css/CSSParser.cpp
Source/WebCore/css/CSSParser.h
Source/WebCore/css/CSSProperty.cpp
Source/WebCore/css/CSSPropertyNames.in
Source/WebCore/css/StyleBuilder.cpp
Source/WebCore/css/StylePropertySet.cpp
Source/WebCore/css/StylePropertyShorthand.cpp
Source/WebCore/css/StylePropertyShorthand.h
Source/WebCore/css/StyleResolver.cpp