Changeset 201875 in webkit


Ignore:
Timestamp:
Jun 9, 2016 11:33:02 AM (8 years ago)
Author:
timothy_horton@apple.com
Message:

Writing-mode-dependent properties don't apply if their value is a variable
https://bugs.webkit.org/show_bug.cgi?id=158449
<rdar://problem/26662478>

Reviewed by Simon Fraser.

Source/WebCore:

Test: fast/css/variables/direction-dependent-variable-properties.html

  • css/CSSParser.cpp:

(WebCore::CSSParser::parseVariableDependentValue):

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

(WebCore::StyleResolver::resolvedVariableValue):
CSSVariableDependentValue stores the unresolved (direction-dependent) property ID,
because the property that it resolves to cannot be determined until style resolution time.
Plumb the requisite direction and writing mode information into parseVariableDependentValue
at style resolution time so that the property can be resolved to the correct
non-direction-dependent property for each use of the value.

LayoutTests:

  • fast/css/variables/direction-dependent-variable-properties-expected.html: Added.
  • fast/css/variables/direction-dependent-variable-properties.html: Added.

Add a test ensuring that direction-dependent properties work correctly,
including flipping when the direction is flipped.

Location:
trunk
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r201874 r201875  
     12016-06-09  Tim Horton  <timothy_horton@apple.com>
     2
     3        Writing-mode-dependent properties don't apply if their value is a variable
     4        https://bugs.webkit.org/show_bug.cgi?id=158449
     5        <rdar://problem/26662478>
     6
     7        Reviewed by Simon Fraser.
     8
     9        * fast/css/variables/direction-dependent-variable-properties-expected.html: Added.
     10        * fast/css/variables/direction-dependent-variable-properties.html: Added.
     11        Add a test ensuring that direction-dependent properties work correctly,
     12        including flipping when the direction is flipped.
     13
    1142016-06-09  Ryan Haddad  <ryanhaddad@apple.com>
    215
  • trunk/Source/WebCore/ChangeLog

    r201870 r201875  
     12016-06-09  Tim Horton  <timothy_horton@apple.com>
     2
     3        Writing-mode-dependent properties don't apply if their value is a variable
     4        https://bugs.webkit.org/show_bug.cgi?id=158449
     5        <rdar://problem/26662478>
     6
     7        Reviewed by Simon Fraser.
     8
     9        Test: fast/css/variables/direction-dependent-variable-properties.html
     10
     11        * css/CSSParser.cpp:
     12        (WebCore::CSSParser::parseVariableDependentValue):
     13        * css/CSSParser.h:
     14        * css/StyleResolver.cpp:
     15        (WebCore::StyleResolver::resolvedVariableValue):
     16        CSSVariableDependentValue stores the unresolved (direction-dependent) property ID,
     17        because the property that it resolves to cannot be determined until style resolution time.
     18        Plumb the requisite direction and writing mode information into parseVariableDependentValue
     19        at style resolution time so that the property can be resolved to the correct
     20        non-direction-dependent property for each use of the value.
     21
    1222016-06-09  Ryan Haddad  <ryanhaddad@apple.com>
    223
  • trunk/Source/WebCore/css/CSSParser.cpp

    r201759 r201875  
    18571857}
    18581858
    1859 RefPtr<CSSValue> CSSParser::parseVariableDependentValue(CSSPropertyID propID, const CSSVariableDependentValue& dependentValue, const CustomPropertyValueMap& customProperties)
     1859RefPtr<CSSValue> CSSParser::parseVariableDependentValue(CSSPropertyID propID, const CSSVariableDependentValue& dependentValue, const CustomPropertyValueMap& customProperties, TextDirection direction, WritingMode writingMode)
    18601860{
    18611861    m_valueList.reset(new CSSParserValueList());
    18621862    if (!dependentValue.valueList().buildParserValueListSubstitutingVariables(m_valueList.get(), customProperties))
    18631863        return nullptr;
    1864     if (!parseValue(dependentValue.propertyID(), false))
     1864
     1865    CSSPropertyID dependentValuePropertyID = dependentValue.propertyID();
     1866    if (CSSProperty::isDirectionAwareProperty(dependentValuePropertyID))
     1867        dependentValuePropertyID = CSSProperty::resolveDirectionAwareProperty(dependentValuePropertyID, direction, writingMode);
     1868
     1869    if (!parseValue(dependentValuePropertyID, false))
    18651870        return nullptr;
     1871
    18661872    for (auto& property : m_parsedProperties) {
    18671873        if (property.id() == propID)
  • trunk/Source/WebCore/css/CSSParser.h

    r201759 r201875  
    500500    void setCustomPropertyName(const AtomicString& propertyName) { m_customPropertyName = propertyName; }
    501501
    502     RefPtr<CSSValue> parseVariableDependentValue(CSSPropertyID, const CSSVariableDependentValue&, const CustomPropertyValueMap& customProperties);
     502    RefPtr<CSSValue> parseVariableDependentValue(CSSPropertyID, const CSSVariableDependentValue&, const CustomPropertyValueMap& customProperties, TextDirection, WritingMode);
    503503
    504504private:
  • trunk/Source/WebCore/css/StyleResolver.cpp

    r201818 r201875  
    16991699{
    17001700    CSSParser parser(m_state.document());
    1701     return parser.parseVariableDependentValue(propID, value, m_state.style()->customProperties());
     1701    return parser.parseVariableDependentValue(propID, value, m_state.style()->customProperties(), m_state.style()->direction(), m_state.style()->writingMode());
    17021702}
    17031703
Note: See TracChangeset for help on using the changeset viewer.