Ignore:
Timestamp:
Jun 27, 2012, 5:04:32 PM (13 years ago)
Author:
[email protected]
Message:

Unreviewed, rolling out r121380.
http://trac.webkit.org/changeset/121380
https://bugs.webkit.org/show_bug.cgi?id=86525

Hits an ASSERT in debug.

Source/WebCore:

  • css/CSSComputedStyleDeclaration.cpp:

(WebCore):
(WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):

  • css/CSSParser.cpp:

(WebCore::isValidKeywordPropertyAndValue):
(WebCore::CSSParser::parseValue):
(WebCore::CSSParser::parseFlex):

  • css/CSSParser.h:
  • css/CSSProperty.cpp:

(WebCore::CSSProperty::isInheritedProperty):

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

(ApplyPropertyFlex):
(WebCore::ApplyPropertyFlex::applyInheritValue):
(WebCore::ApplyPropertyFlex::applyInitialValue):
(WebCore::ApplyPropertyFlex::applyValue):
(WebCore::ApplyPropertyFlex::createHandler):
(WebCore::ApplyPropertyFlex::getFlexValue):
(WebCore):
(WebCore::StyleBuilder::StyleBuilder):

  • css/StylePropertySet.cpp:

(WebCore::StylePropertySet::getPropertyValue):
(WebCore::StylePropertySet::asText):

  • css/StylePropertyShorthand.cpp:

(WebCore::webkitFlexFlowShorthand):
(WebCore::shorthandForProperty):

  • css/StylePropertyShorthand.h:

(WebCore):

  • css/StyleResolver.cpp:

(WebCore::StyleResolver::collectMatchingRulesForList):

LayoutTests:

  • css3/flexbox/flex-longhand-parsing-expected.txt: Removed.
  • css3/flexbox/flex-longhand-parsing.html: Removed.
  • css3/flexbox/flex-property-parsing-expected.txt:
  • css3/flexbox/flex-property-parsing.html:
  • fast/css/getComputedStyle/computed-style-expected.txt:
  • fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
  • fast/css/getComputedStyle/resources/property-names.js:
  • svg/css/getComputedStyle-basic-expected.txt:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/css/StyleBuilder.cpp

    r121380 r121387  
    17151715        return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue);
    17161716    }
     1717};
     1718
     1719class ApplyPropertyFlex {
     1720public:
     1721    static void applyInheritValue(StyleResolver* styleResolver)
     1722    {
     1723        ApplyPropertyDefaultBase<float, &RenderStyle::flexGrow, float, &RenderStyle::setFlexGrow, float, &RenderStyle::initialFlexGrow>::applyInheritValue(styleResolver);
     1724        ApplyPropertyDefaultBase<float, &RenderStyle::flexShrink, float, &RenderStyle::setFlexShrink, float, &RenderStyle::initialFlexShrink>::applyInheritValue(styleResolver);
     1725        ApplyPropertyDefaultBase<Length, &RenderStyle::flexBasis, Length, &RenderStyle::setFlexBasis, Length, &RenderStyle::initialFlexBasis>::applyInheritValue(styleResolver);
     1726    }
     1727
     1728    static void applyInitialValue(StyleResolver* styleResolver)
     1729    {
     1730        styleResolver->style()->setFlexGrow(RenderStyle::initialFlexGrow());
     1731        styleResolver->style()->setFlexShrink(RenderStyle::initialFlexShrink());
     1732        styleResolver->style()->setFlexBasis(RenderStyle::initialFlexBasis());
     1733    }
     1734
     1735    static void applyValue(StyleResolver* styleResolver, CSSValue* value)
     1736    {
     1737        if (value->isPrimitiveValue()) {
     1738            CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
     1739            if (primitiveValue->getIdent() == CSSValueNone) {
     1740                styleResolver->style()->setFlexGrow(0);
     1741                styleResolver->style()->setFlexShrink(0);
     1742                styleResolver->style()->setFlexBasis(Length(Auto));
     1743            }
     1744            return;
     1745        }
     1746
     1747        if (!value->isValueList())
     1748            return;
     1749        CSSValueList* valueList = static_cast<CSSValueList*>(value);
     1750        if (valueList->length() != 3)
     1751            return;
     1752
     1753        float flexValue = 0;
     1754        if (!getFlexValue(valueList->itemWithoutBoundsCheck(0), flexValue))
     1755            return;
     1756        styleResolver->style()->setFlexGrow(flexValue);
     1757
     1758        if (!getFlexValue(valueList->itemWithoutBoundsCheck(1), flexValue))
     1759            return;
     1760        styleResolver->style()->setFlexShrink(flexValue);
     1761
     1762        ApplyPropertyLength<&RenderStyle::flexBasis, &RenderStyle::setFlexBasis, &RenderStyle::initialFlexBasis, AutoEnabled>::applyValue(styleResolver, valueList->itemWithoutBoundsCheck(2));
     1763    }
     1764
     1765    static PropertyHandler createHandler()
     1766    {
     1767        return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue);
     1768    }
     1769private:
     1770    static bool getFlexValue(CSSValue* value, float& flexValue)
     1771    {
     1772        if (!value->isPrimitiveValue())
     1773            return false;
     1774        CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
     1775        if (!primitiveValue->isNumber())
     1776            return false;
     1777        flexValue = primitiveValue->getFloatValue();
     1778        return true;
     1779    }
     1780
    17171781};
    17181782
     
    19672031    setPropertyHandler(CSSPropertyWebkitAlignItems, ApplyPropertyDefault<EAlignItems, &RenderStyle::alignItems, EAlignItems, &RenderStyle::setAlignItems, EAlignItems, &RenderStyle::initialAlignItems>::createHandler());
    19682032    setPropertyHandler(CSSPropertyWebkitAlignSelf, ApplyPropertyDefault<EAlignItems, &RenderStyle::alignSelf, EAlignItems, &RenderStyle::setAlignSelf, EAlignItems, &RenderStyle::initialAlignSelf>::createHandler());
    1969     setPropertyHandler(CSSPropertyWebkitFlexBasis, ApplyPropertyLength<&RenderStyle::flexBasis, &RenderStyle::setFlexBasis, &RenderStyle::initialFlexBasis, AutoEnabled>::createHandler());
     2033    setPropertyHandler(CSSPropertyWebkitFlex, ApplyPropertyFlex::createHandler());
    19702034    setPropertyHandler(CSSPropertyWebkitFlexDirection, ApplyPropertyDefault<EFlexDirection, &RenderStyle::flexDirection, EFlexDirection, &RenderStyle::setFlexDirection, EFlexDirection, &RenderStyle::initialFlexDirection>::createHandler());
    1971     setPropertyHandler(CSSPropertyWebkitFlexGrow, ApplyPropertyDefault<float, &RenderStyle::flexGrow, float, &RenderStyle::setFlexGrow, float, &RenderStyle::initialFlexGrow>::createHandler());
    1972     setPropertyHandler(CSSPropertyWebkitFlexShrink, ApplyPropertyDefault<float, &RenderStyle::flexShrink, float, &RenderStyle::setFlexShrink, float, &RenderStyle::initialFlexShrink>::createHandler());
     2035    setPropertyHandler(CSSPropertyWebkitFlexFlow, ApplyPropertyExpanding<SuppressValue, CSSPropertyWebkitFlexDirection, CSSPropertyWebkitFlexWrap>::createHandler());
    19732036    setPropertyHandler(CSSPropertyWebkitFlexWrap, ApplyPropertyDefault<EFlexWrap, &RenderStyle::flexWrap, EFlexWrap, &RenderStyle::setFlexWrap, EFlexWrap, &RenderStyle::initialFlexWrap>::createHandler());
    19742037    setPropertyHandler(CSSPropertyWebkitJustifyContent, ApplyPropertyDefault<EJustifyContent, &RenderStyle::justifyContent, EJustifyContent, &RenderStyle::setJustifyContent, EJustifyContent, &RenderStyle::initialJustifyContent>::createHandler());
Note: See TracChangeset for help on using the changeset viewer.