Changeset 93528 in webkit


Ignore:
Timestamp:
Aug 22, 2011 12:08:36 PM (13 years ago)
Author:
tony@chromium.org
Message:

Add CSS parsing of -webkit-flex-order
https://bugs.webkit.org/show_bug.cgi?id=65384

Source/WebCore:

The property is an int described here:
http://dev.w3.org/csswg/css3-flexbox/#flex-order

Doesn't do anything yet, just hooking it up.

Reviewed by Ojan Vafai.

  • css/CSSComputedStyleDeclaration.cpp:

(WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):

  • css/CSSParser.cpp:

(WebCore::CSSParser::parseValue):

  • css/CSSPropertyNames.in:
  • css/CSSStyleApplyProperty.cpp:

(WebCore::CSSStyleApplyProperty::CSSStyleApplyProperty):

  • css/CSSStyleSelector.cpp:

(WebCore::CSSStyleSelector::applyProperty):

  • rendering/style/RenderStyle.h:

(WebCore::InheritedFlags::flexOrder):
(WebCore::InheritedFlags::setFlexOrder):
(WebCore::InheritedFlags::initialFlexOrder):

  • rendering/style/StyleFlexibleBoxData.cpp:

(WebCore::StyleFlexibleBoxData::StyleFlexibleBoxData):
(WebCore::StyleFlexibleBoxData::operator==):

  • rendering/style/StyleFlexibleBoxData.h:

LayoutTests:

Reviewed by Ojan Vafai.

  • css3/flexbox/css-properties-expected.txt:
  • css3/flexbox/css-properties.html:
  • css3/flexbox/script-tests/css-properties.js:
Location:
trunk
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r93521 r93528  
     12011-08-22  Tony Chang  <tony@chromium.org>
     2
     3        Add CSS parsing of -webkit-flex-order
     4        https://bugs.webkit.org/show_bug.cgi?id=65384
     5
     6        Reviewed by Ojan Vafai.
     7
     8        * css3/flexbox/css-properties-expected.txt:
     9        * css3/flexbox/css-properties.html:
     10        * css3/flexbox/script-tests/css-properties.js:
     11
    1122011-08-22  Nate Chapin  <japhet@chromium.org>
    213
  • trunk/LayoutTests/css3/flexbox/css-properties-expected.txt

    r92001 r93528  
    99PASS div.style.display is "-webkit-inline-flexbox"
    1010PASS div.style.display is "block"
     11PASS flexitem.style.webkitFlexOrder is ""
     12PASS flexitem.style.webkitFlexOrder is "2"
     13PASS flexitem.style.webkitFlexOrder is "-1"
     14PASS flexitem.style.webkitFlexOrder is "0"
     15PASS flexitem.style.webkitFlexOrder is "0"
     16PASS flexitem.style.webkitFlexOrder is "0"
     17PASS flexitem.style.webkitFlexOrder is ""
    1118PASS successfullyParsed is true
    1219
  • trunk/LayoutTests/css3/flexbox/css-properties.html

    r92001 r93528  
    77<body>
    88<p id="description"></p>
     9<div id="flexbox">
     10    <div id="flexitem"></div>
     11</div>
    912<div id="console"></div>
    1013<script src="script-tests/css-properties.js"></script>
  • trunk/LayoutTests/css3/flexbox/script-tests/css-properties.js

    r92001 r93528  
    11description('Tests being able to set the display to -webkit-flexbox and -webkit-inline-flexbox.');
    22
    3 var div = document.createElement('div');
     3var div = document.getElementById("flexbox");
    44
    55div.style.display = '-webkit-flexbox';
     
    1818shouldBeEqualToString('div.style.display', 'block');
    1919
     20var flexitem = document.getElementById("flexitem");
     21shouldBeEqualToString('flexitem.style.webkitFlexOrder', '');
     22
     23flexitem.style.webkitFlexOrder = 2;
     24shouldBeEqualToString('flexitem.style.webkitFlexOrder', '2');
     25
     26flexitem.style.webkitFlexOrder = -1;
     27shouldBeEqualToString('flexitem.style.webkitFlexOrder', '-1');
     28
     29flexitem.style.webkitFlexOrder = 0;
     30shouldBeEqualToString('flexitem.style.webkitFlexOrder', '0');
     31
     32// -webkit-flex-order must be an integer.
     33flexitem.style.webkitFlexOrder = 1.5;
     34shouldBeEqualToString('flexitem.style.webkitFlexOrder', '0');
     35
     36flexitem.style.webkitFlexOrder = "test";
     37shouldBeEqualToString('flexitem.style.webkitFlexOrder', '0');
     38
     39flexitem.style.webkitFlexOrder = '';
     40shouldBeEqualToString('flexitem.style.webkitFlexOrder', '');
     41
    2042successfullyParsed = true;
  • trunk/Source/WebCore/ChangeLog

    r93526 r93528  
     12011-08-22  Tony Chang  <tony@chromium.org>
     2
     3        Add CSS parsing of -webkit-flex-order
     4        https://bugs.webkit.org/show_bug.cgi?id=65384
     5
     6        The property is an int described here:
     7        http://dev.w3.org/csswg/css3-flexbox/#flex-order
     8
     9        Doesn't do anything yet, just hooking it up.
     10
     11        Reviewed by Ojan Vafai.
     12
     13        * css/CSSComputedStyleDeclaration.cpp:
     14        (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
     15        * css/CSSParser.cpp:
     16        (WebCore::CSSParser::parseValue):
     17        * css/CSSPropertyNames.in:
     18        * css/CSSStyleApplyProperty.cpp:
     19        (WebCore::CSSStyleApplyProperty::CSSStyleApplyProperty):
     20        * css/CSSStyleSelector.cpp:
     21        (WebCore::CSSStyleSelector::applyProperty):
     22        * rendering/style/RenderStyle.h:
     23        (WebCore::InheritedFlags::flexOrder):
     24        (WebCore::InheritedFlags::setFlexOrder):
     25        (WebCore::InheritedFlags::initialFlexOrder):
     26        * rendering/style/StyleFlexibleBoxData.cpp:
     27        (WebCore::StyleFlexibleBoxData::StyleFlexibleBoxData):
     28        (WebCore::StyleFlexibleBoxData::operator==):
     29        * rendering/style/StyleFlexibleBoxData.h:
     30
    1312011-08-22  Adrienne Walker  <enne@google.com>
    232
  • trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp

    r93430 r93528  
    200200    CSSPropertyWebkitDashboardRegion,
    201201#endif
     202#if ENABLE(CSS3_FLEXBOX)
     203    CSSPropertyWebkitFlexOrder,
     204#endif
    202205    CSSPropertyWebkitFontSmoothing,
    203206    CSSPropertyWebkitHighlight,
     
    11001103        case CSSPropertyEmptyCells:
    11011104            return primitiveValueCache->createValue(style->emptyCells());
     1105#if ENABLE(CSS3_FLEXBOX)
     1106        case CSSPropertyWebkitFlexOrder:
     1107            return primitiveValueCache->createValue(style->flexOrder(), CSSPrimitiveValue::CSS_NUMBER);
     1108#endif
    11021109        case CSSPropertyFloat:
    11031110            return primitiveValueCache->createValue(style->floating());
  • trunk/Source/WebCore/css/CSSParser.cpp

    r93430 r93528  
    15371537        validPrimitive = id == CSSValueSrgb || id == CSSValueDefault;
    15381538        break;
     1539#if ENABLE(CSS3_FLEXBOX)
     1540    case CSSPropertyWebkitFlexOrder:
     1541        validPrimitive = validUnit(value, FInteger, true);
     1542        break;
     1543#endif
    15391544    case CSSPropertyWebkitMarquee: {
    15401545        const int properties[5] = { CSSPropertyWebkitMarqueeDirection, CSSPropertyWebkitMarqueeIncrement,
  • trunk/Source/WebCore/css/CSSPropertyNames.in

    r93430 r93528  
    243243-webkit-column-width
    244244-webkit-columns
     245#if defined(ENABLE_CSS3_FLEXBOX) && ENABLE_CSS3_FLEXBOX
     246-webkit-flex-order
     247#endif
    245248-webkit-font-size-delta
    246249-webkit-highlight
  • trunk/Source/WebCore/css/CSSStyleApplyProperty.cpp

    r92742 r93528  
    890890    setPropertyHandler(CSSPropertyCounterReset, new ApplyPropertyCounter<Reset>());
    891891
     892#if ENABLE(CSS3_FLEXBOX)
     893    setPropertyHandler(CSSPropertyWebkitFlexOrder, new ApplyPropertyDefault<int>(&RenderStyle::flexOrder, &RenderStyle::setFlexOrder, &RenderStyle::initialFlexOrder));
     894#endif
     895
    892896    setPropertyHandler(CSSPropertyFontStyle, new ApplyPropertyFont<FontItalic>(&FontDescription::italic, &FontDescription::setItalic, FontItalicOff));
    893897    setPropertyHandler(CSSPropertyFontVariant, new ApplyPropertyFont<FontSmallCaps>(&FontDescription::smallCaps, &FontDescription::setSmallCaps, FontSmallCapsOff));
  • trunk/Source/WebCore/css/CSSStyleSelector.cpp

    r93430 r93528  
    51115111    case CSSPropertyLetterSpacing:
    51125112    case CSSPropertyWordSpacing:
     5113#if ENABLE(CSS3_FLEXBOX)
     5114    case CSSPropertyWebkitFlexOrder:
     5115#endif
    51135116    case CSSPropertyFontStyle:
    51145117    case CSSPropertyFontVariant:
  • trunk/Source/WebCore/rendering/style/RenderStyle.h

    r93430 r93528  
    677677    float flexboxHeightPositiveFlex() const { return rareNonInheritedData->m_flexibleBox->m_heightPositiveFlex; }
    678678    float flexboxHeightNegativeFlex() const { return rareNonInheritedData->m_flexibleBox->m_heightNegativeFlex; }
     679    int flexOrder() const { return rareNonInheritedData->m_flexibleBox->m_flexOrder; }
    679680#endif
    680681
     
    10611062    void setFlexboxHeightPositiveFlex(float f) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_heightPositiveFlex, f); }
    10621063    void setFlexboxHeightNegativeFlex(float f) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_heightNegativeFlex, f); }
     1064    void setFlexOrder(int o) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexOrder, o); }
    10631065#endif
    10641066    void setMarqueeIncrement(const Length& f) { SET_VAR(rareNonInheritedData.access()->m_marquee, increment, f); }
     
    13151317    static float initialFlexboxHeightPositiveFlex() { return 0; }
    13161318    static float initialFlexboxHeightNegativeFlex() { return 0; }
     1319    static int initialFlexOrder() { return 1; }
    13171320    static int initialMarqueeLoopCount() { return -1; }
    13181321    static int initialMarqueeSpeed() { return 85; }
  • trunk/Source/WebCore/rendering/style/StyleFlexibleBoxData.cpp

    r91392 r93528  
    3838    , m_heightPositiveFlex(RenderStyle::initialFlexboxHeightPositiveFlex())
    3939    , m_heightNegativeFlex(RenderStyle::initialFlexboxHeightNegativeFlex())
     40    , m_flexOrder(RenderStyle::initialFlexOrder())
    4041{
    4142}
     
    4748    , m_heightPositiveFlex(o.m_heightPositiveFlex)
    4849    , m_heightNegativeFlex(o.m_heightNegativeFlex)
     50    , m_flexOrder(o.m_flexOrder)
    4951{
    5052}
     
    5355{
    5456    return m_widthPositiveFlex == o.m_widthPositiveFlex && m_widthNegativeFlex == o.m_widthNegativeFlex
    55         && m_heightPositiveFlex == o.m_heightPositiveFlex && m_heightNegativeFlex == o.m_heightNegativeFlex;
     57        && m_heightPositiveFlex == o.m_heightPositiveFlex && m_heightNegativeFlex == o.m_heightNegativeFlex
     58        && m_flexOrder == o.m_flexOrder;
    5659}
    5760
  • trunk/Source/WebCore/rendering/style/StyleFlexibleBoxData.h

    r91392 r93528  
    5050    float m_heightNegativeFlex;
    5151
     52    int m_flexOrder;
     53
    5254private:
    5355    StyleFlexibleBoxData();
Note: See TracChangeset for help on using the changeset viewer.