⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 200769 in webkit


Ignore:
Timestamp:
May 12, 2016, 5:47:21 AM (10 years ago)
Author:
commit-queue@webkit.org
Message:

Correctly handle prefixed and unprefixed variants in CSSStyleDeclaration
https://bugs.webkit.org/show_bug.cgi?id=157569
<rdar://problem/26223115>

Patch by Antoine Quint <Antoine Quint> on 2016-05-12
Reviewed by Dean Jackson.

Source/WebCore:

Tests: fast/css/prefixed-unprefixed-variant-style-declaration.html

fast/css/shorthand-omitted-initial-value-overrides-shorthand.html

We essentially revert the code added with https://bugs.webkit.org/show_bug.cgi?id=110011
which duplicated properties that had a prefixed or unprefixed variant. What we do now is
to return the value of the prefixed or unprefixed variant through a CSSStyleDeclaration,
but only return the properties specified by the author when reading from the cssText property.

  • css/CSSParser.cpp:

(WebCore::CSSParser::parseValue):
(WebCore::CSSParser::parseTransitionShorthand):
(WebCore::CSSParser::addPropertyWithPrefixingVariant): Deleted.

  • css/CSSParser.h:

Remove all code adding duplicated properties for the prefixed or unprefixed
variant of properties that exist in both forms.

  • css/CSSPropertyNames.in:

Treat transition properties as we do animation properties.

  • css/PropertySetCSSStyleDeclaration.cpp:

(WebCore::PropertySetCSSStyleDeclaration::getPropertyCSSValue):
(WebCore::PropertySetCSSStyleDeclaration::getPropertyValue):
Make these two methods call into the matching getXXXInternal() variant instead
of going through the property set directly so that they would correctly pick up
on the prefixed or unprefixed variant should there be one when the specified property
is not specified directly.

(WebCore::PropertySetCSSStyleDeclaration::getPropertyCSSValueInternal):
(WebCore::PropertySetCSSStyleDeclaration::getPropertyValueInternal):
We used to simply return the value for the given property from the property set, which
we still do but now also check if there is prefixed or unprefixed variant for the provided
property in case it was absent.

  • css/StyleProperties.cpp:

(WebCore::MutableStyleProperties::removeShorthandProperty):
Remove all code adding duplicated properties for the prefixed or unprefixed
variant of properties that exist in both forms.

(WebCore::StyleProperties::asText):
Drive-by fix to also handle the animation-play-state and -webkit-animation-play-state properties
when serializing to the shorthand.

(WebCore::MutableStyleProperties::removeProperty): Deleted.
(WebCore::MutableStyleProperties::removePrefixedOrUnprefixedProperty): Deleted.
(WebCore::MutableStyleProperties::setProperty): Deleted.
(WebCore::getIndexInShorthandVectorForPrefixingVariant): Deleted.
(WebCore::MutableStyleProperties::appendPrefixingVariantProperty): Deleted.
(WebCore::MutableStyleProperties::setPrefixingVariantProperty): Deleted.

  • css/StyleProperties.h:

Remove all code adding duplicated properties for the prefixed or unprefixed
variant of properties that exist in both forms.

LayoutTests:

  • animations/fill-mode-forwards-zero-duration.html:
  • animations/play-state-start-paused.html:

These two tests incorrectly expected a shorthand property not to reset
longhand properties that it covers to their initial values even if left
out of the shorthand.

  • animations/unprefixed-properties-expected.txt:
  • animations/unprefixed-properties.html:

This test incorrectly expected that setting an unprefixed property only would
lead to reading the prefixed property through the CSSOM return the empty string,
rather than the value set on the unprefixed property.

  • fast/css/prefixed-unprefixed-variant-style-declaration-expected.txt: Added.
  • fast/css/prefixed-unprefixed-variant-style-declaration.html: Added.

New test checking that setting one of two of a property's unprefixed and prefixed
variants correctly allows to read the style through the CSS OM for both variants,
while only serializing the property that was set through cssText.

  • fast/css/shorthand-omitted-initial-value-overrides-shorthand-expected.txt: Added.
  • fast/css/shorthand-omitted-initial-value-overrides-shorthand.html: Added.

New test checking that setting a longhand property and then the shorthand for that
longhand correctly resets the initial values, even if they were omitted in the shorthand.

Location:
trunk
Files:
4 added
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r200755 r200769  
     12016-05-12  Antoine Quint  <graouts@apple.com>
     2
     3        Correctly handle prefixed and unprefixed variants in CSSStyleDeclaration
     4        https://bugs.webkit.org/show_bug.cgi?id=157569
     5        <rdar://problem/26223115>
     6
     7        Reviewed by Dean Jackson.
     8
     9        * animations/fill-mode-forwards-zero-duration.html:
     10        * animations/play-state-start-paused.html:
     11        These two tests incorrectly expected a shorthand property not to reset
     12        longhand properties that it covers to their initial values even if left
     13        out of the shorthand.
     14
     15        * animations/unprefixed-properties-expected.txt:
     16        * animations/unprefixed-properties.html:
     17        This test incorrectly expected that setting an unprefixed property only would
     18        lead to reading the prefixed property through the CSSOM return the empty string,
     19        rather than the value set on the unprefixed property.
     20
     21        * fast/css/prefixed-unprefixed-variant-style-declaration-expected.txt: Added.
     22        * fast/css/prefixed-unprefixed-variant-style-declaration.html: Added.
     23        New test checking that setting one of two of a property's unprefixed and prefixed
     24        variants correctly allows to read the style through the CSS OM for both variants,
     25        while only serializing the property that was set through cssText.
     26
     27        * fast/css/shorthand-omitted-initial-value-overrides-shorthand-expected.txt: Added.
     28        * fast/css/shorthand-omitted-initial-value-overrides-shorthand.html: Added.
     29        New test checking that setting a longhand property and then the shorthand for that
     30        longhand correctly resets the initial values, even if they were omitted in the shorthand.
     31
    1322016-05-12  Manuel Rego Casasnovas  <rego@igalia.com>
    233
  • trunk/LayoutTests/animations/fill-mode-forwards-zero-duration.html

    r191540 r200769  
    1010      width: 100px;
    1111      background-color: blue;
    12       animation-fill-mode: forwards;
    13       animation: anim1 0 2s linear;
     12      animation: anim1 0 2s linear forwards;
    1413    }
    1514    @keyframes anim1 {
  • trunk/LayoutTests/animations/play-state-start-paused.html

    r200042 r200769  
    1414            height: 100px;
    1515            background-color: green;
    16             animation-delay: -0.5s;
    17             animation-play-state: paused;
    1816        }
    1917       
     
    2422       
    2523        .mover {
    26             animation: move 1s linear;
     24            animation: move 1s linear -0.5s paused;
    2725        }
    2826       
    2927        .slider {
    30             animation: slide 1s linear;
     28            animation: slide 1s linear -0.5s paused;
    3129        }
    3230       
  • trunk/LayoutTests/animations/unprefixed-properties-expected.txt

    r187813 r200769  
    77Parsing - Basic animation-name : waldo
    88PASS cssRule.type is 1
    9 PASS declaration.length is 2
     9PASS declaration.length is 1
    1010PASS declaration.getPropertyValue('animation-name') is 'waldo'
    1111PASS declaration.getPropertyValue('-webkit-animation-name') is 'waldo'
     
    1313Parsing - Multiple animation-names : waldo, wally
    1414PASS cssRule.type is 1
    15 PASS declaration.length is 2
     15PASS declaration.length is 1
    1616PASS declaration.getPropertyValue('animation-name') is 'waldo, wally'
    1717PASS declaration.getPropertyValue('-webkit-animation-name') is 'waldo, wally'
     
    2121Parsing - Basic animation-duration : 5s
    2222PASS cssRule.type is 1
    23 PASS declaration.length is 2
     23PASS declaration.length is 1
    2424PASS declaration.getPropertyValue('animation-duration') is '5s'
    2525PASS declaration.getPropertyValue('-webkit-animation-duration') is '5s'
     
    2727Parsing - Multiple animation-durations : 10s, 20ms
    2828PASS cssRule.type is 1
    29 PASS declaration.length is 2
     29PASS declaration.length is 1
    3030PASS declaration.getPropertyValue('animation-duration') is '10s, 20ms'
    3131PASS declaration.getPropertyValue('-webkit-animation-duration') is '10s, 20ms'
     
    3535Parsing - Basic animation-delay : 5s
    3636PASS cssRule.type is 1
    37 PASS declaration.length is 2
     37PASS declaration.length is 1
    3838PASS declaration.getPropertyValue('animation-delay') is '5s'
    3939PASS declaration.getPropertyValue('-webkit-animation-delay') is '5s'
     
    4141Parsing - Multiple animation-delays : 10s, 20ms
    4242PASS cssRule.type is 1
    43 PASS declaration.length is 2
     43PASS declaration.length is 1
    4444PASS declaration.getPropertyValue('animation-delay') is '10s, 20ms'
    4545PASS declaration.getPropertyValue('-webkit-animation-delay') is '10s, 20ms'
     
    4949Parsing - Basic animation-timing-function : ease-in-out
    5050PASS cssRule.type is 1
    51 PASS declaration.length is 2
     51PASS declaration.length is 1
    5252PASS declaration.getPropertyValue('animation-timing-function') is 'ease-in-out'
    5353PASS declaration.getPropertyValue('-webkit-animation-timing-function') is 'ease-in-out'
     
    5555Parsing - animation-timing-function with bezier : cubic-bezier(0.2, 0.3, 0.4, 0.5)
    5656PASS cssRule.type is 1
    57 PASS declaration.length is 2
     57PASS declaration.length is 1
    5858PASS declaration.getPropertyValue('animation-timing-function') is 'cubic-bezier(0.2, 0.3, 0.4, 0.5)'
    5959PASS declaration.getPropertyValue('-webkit-animation-timing-function') is 'cubic-bezier(0.2, 0.3, 0.4, 0.5)'
     
    6161Parsing - Multiple animation-timing-functions : ease-in, ease-out
    6262PASS cssRule.type is 1
    63 PASS declaration.length is 2
     63PASS declaration.length is 1
    6464PASS declaration.getPropertyValue('animation-timing-function') is 'ease-in, ease-out'
    6565PASS declaration.getPropertyValue('-webkit-animation-timing-function') is 'ease-in, ease-out'
     
    6969Parsing - Basic animation-iteration-count : 4
    7070PASS cssRule.type is 1
    71 PASS declaration.length is 2
     71PASS declaration.length is 1
    7272PASS declaration.getPropertyValue('animation-iteration-count') is '4'
    7373PASS declaration.getPropertyValue('-webkit-animation-iteration-count') is '4'
     
    7575Parsing - animation-iteration-count with keyword : infinite
    7676PASS cssRule.type is 1
    77 PASS declaration.length is 2
     77PASS declaration.length is 1
    7878PASS declaration.getPropertyValue('animation-iteration-count') is 'infinite'
    7979PASS declaration.getPropertyValue('-webkit-animation-iteration-count') is 'infinite'
     
    8181Parsing - Multiple animation-iteration-counts : 2, infinite, 4
    8282PASS cssRule.type is 1
    83 PASS declaration.length is 2
     83PASS declaration.length is 1
    8484PASS declaration.getPropertyValue('animation-iteration-count') is '2, infinite, 4'
    8585PASS declaration.getPropertyValue('-webkit-animation-iteration-count') is '2, infinite, 4'
     
    9090Parsing - Normal animation-direction : normal
    9191PASS cssRule.type is 1
    92 PASS declaration.length is 2
     92PASS declaration.length is 1
    9393PASS declaration.getPropertyValue('animation-direction') is 'normal'
    9494PASS declaration.getPropertyValue('-webkit-animation-direction') is 'normal'
     
    9696Parsing - Alternate animation-direction : alternate
    9797PASS cssRule.type is 1
    98 PASS declaration.length is 2
     98PASS declaration.length is 1
    9999PASS declaration.getPropertyValue('animation-direction') is 'alternate'
    100100PASS declaration.getPropertyValue('-webkit-animation-direction') is 'alternate'
     
    102102Parsing - Reverse animation-direction : reverse
    103103PASS cssRule.type is 1
    104 PASS declaration.length is 2
     104PASS declaration.length is 1
    105105PASS declaration.getPropertyValue('animation-direction') is 'reverse'
    106106PASS declaration.getPropertyValue('-webkit-animation-direction') is 'reverse'
     
    108108Parsing - Alternate Reverse animation-direction : alternate-reverse
    109109PASS cssRule.type is 1
    110 PASS declaration.length is 2
     110PASS declaration.length is 1
    111111PASS declaration.getPropertyValue('animation-direction') is 'alternate-reverse'
    112112PASS declaration.getPropertyValue('-webkit-animation-direction') is 'alternate-reverse'
     
    114114Parsing - Multiple animation-directions : alternate, alternate, normal
    115115PASS cssRule.type is 1
    116 PASS declaration.length is 2
     116PASS declaration.length is 1
    117117PASS declaration.getPropertyValue('animation-direction') is 'alternate, alternate, normal'
    118118PASS declaration.getPropertyValue('-webkit-animation-direction') is 'alternate, alternate, normal'
     
    123123Parsing - None animation-fill-mode : none
    124124PASS cssRule.type is 1
    125 PASS declaration.length is 2
     125PASS declaration.length is 1
    126126PASS declaration.getPropertyValue('animation-fill-mode') is 'none'
    127127PASS declaration.getPropertyValue('-webkit-animation-fill-mode') is 'none'
     
    129129Parsing - Forwards animation-fill-mode : forwards
    130130PASS cssRule.type is 1
    131 PASS declaration.length is 2
     131PASS declaration.length is 1
    132132PASS declaration.getPropertyValue('animation-fill-mode') is 'forwards'
    133133PASS declaration.getPropertyValue('-webkit-animation-fill-mode') is 'forwards'
     
    135135Parsing - Backwards animation-fill-mode : backwards
    136136PASS cssRule.type is 1
    137 PASS declaration.length is 2
     137PASS declaration.length is 1
    138138PASS declaration.getPropertyValue('animation-fill-mode') is 'backwards'
    139139PASS declaration.getPropertyValue('-webkit-animation-fill-mode') is 'backwards'
     
    141141Parsing - Both animation-fill-mode : both
    142142PASS cssRule.type is 1
    143 PASS declaration.length is 2
     143PASS declaration.length is 1
    144144PASS declaration.getPropertyValue('animation-fill-mode') is 'both'
    145145PASS declaration.getPropertyValue('-webkit-animation-fill-mode') is 'both'
     
    147147Parsing - Multiple animation-fill-modes : none, forwards, backwards, both
    148148PASS cssRule.type is 1
    149 PASS declaration.length is 2
     149PASS declaration.length is 1
    150150PASS declaration.getPropertyValue('animation-fill-mode') is 'none, forwards, backwards, both'
    151151PASS declaration.getPropertyValue('-webkit-animation-fill-mode') is 'none, forwards, backwards, both'
  • trunk/LayoutTests/animations/unprefixed-properties.html

    r187813 r200769  
    2828
    2929    declaration = cssRule.style;
    30     shouldBe("declaration.length", "2"); // We set both the prefixed and unprefixed version.
     30    shouldBe("declaration.length", "1");
    3131    shouldBe("declaration.getPropertyValue('" + property + "')", "'" + value + "'");
    3232    shouldBe("declaration.getPropertyValue('-webkit-" + property + "')", "'" + value + "'");
  • trunk/Source/WebCore/ChangeLog

    r200768 r200769  
     12016-05-12  Antoine Quint  <graouts@apple.com>
     2
     3        Correctly handle prefixed and unprefixed variants in CSSStyleDeclaration
     4        https://bugs.webkit.org/show_bug.cgi?id=157569
     5        <rdar://problem/26223115>
     6
     7        Reviewed by Dean Jackson.
     8
     9        Tests: fast/css/prefixed-unprefixed-variant-style-declaration.html
     10               fast/css/shorthand-omitted-initial-value-overrides-shorthand.html
     11
     12        We essentially revert the code added with https://bugs.webkit.org/show_bug.cgi?id=110011
     13        which duplicated properties that had a prefixed or unprefixed variant. What we do now is
     14        to return the value of the prefixed or unprefixed variant through a CSSStyleDeclaration,
     15        but only return the properties specified by the author when reading from the `cssText` property.
     16
     17        * css/CSSParser.cpp:
     18        (WebCore::CSSParser::parseValue):
     19        (WebCore::CSSParser::parseTransitionShorthand):
     20        (WebCore::CSSParser::addPropertyWithPrefixingVariant): Deleted.
     21        * css/CSSParser.h:
     22        Remove all code adding duplicated properties for the prefixed or unprefixed
     23        variant of properties that exist in both forms.
     24
     25        * css/CSSPropertyNames.in:
     26        Treat transition properties as we do animation properties.
     27
     28        * css/PropertySetCSSStyleDeclaration.cpp:
     29        (WebCore::PropertySetCSSStyleDeclaration::getPropertyCSSValue):
     30        (WebCore::PropertySetCSSStyleDeclaration::getPropertyValue):
     31        Make these two methods call into the matching getXXXInternal() variant instead
     32        of going through the property set directly so that they would correctly pick up
     33        on the prefixed or unprefixed variant should there be one when the specified property
     34        is not specified directly.
     35
     36        (WebCore::PropertySetCSSStyleDeclaration::getPropertyCSSValueInternal):
     37        (WebCore::PropertySetCSSStyleDeclaration::getPropertyValueInternal):
     38        We used to simply return the value for the given property from the property set, which
     39        we still do but now also check if there is prefixed or unprefixed variant for the provided
     40        property in case it was absent.
     41
     42        * css/StyleProperties.cpp:
     43        (WebCore::MutableStyleProperties::removeShorthandProperty):
     44        Remove all code adding duplicated properties for the prefixed or unprefixed
     45        variant of properties that exist in both forms.
     46
     47        (WebCore::StyleProperties::asText):
     48        Drive-by fix to also handle the animation-play-state and -webkit-animation-play-state properties
     49        when serializing to the shorthand.
     50
     51        (WebCore::MutableStyleProperties::removeProperty): Deleted.
     52        (WebCore::MutableStyleProperties::removePrefixedOrUnprefixedProperty): Deleted.
     53        (WebCore::MutableStyleProperties::setProperty): Deleted.
     54        (WebCore::getIndexInShorthandVectorForPrefixingVariant): Deleted.
     55        (WebCore::MutableStyleProperties::appendPrefixingVariantProperty): Deleted.
     56        (WebCore::MutableStyleProperties::setPrefixingVariantProperty): Deleted.
     57        * css/StyleProperties.h:
     58        Remove all code adding duplicated properties for the prefixed or unprefixed
     59        variant of properties that exist in both forms.
     60
    1612016-05-12  Commit Queue  <commit-queue@webkit.org>
    262
  • trunk/Source/WebCore/css/CSSParser.cpp

    r200755 r200769  
    16381638}
    16391639
    1640 void CSSParser::addPropertyWithPrefixingVariant(CSSPropertyID propId, PassRefPtr<CSSValue> value, bool important, bool implicit)
    1641 {
    1642     RefPtr<CSSValue> val = value.get();
    1643     addProperty(propId, value, important, implicit);
    1644 
    1645     CSSPropertyID prefixingVariant = prefixingVariantForPropertyId(propId);
    1646     if (prefixingVariant == propId)
    1647         return;
    1648 
    1649     if (m_currentShorthand) {
    1650         // We can't use ShorthandScope here as we can already be inside one (e.g we are parsing CSSTransition).
    1651         m_currentShorthand = prefixingVariantForPropertyId(m_currentShorthand);
    1652         addProperty(prefixingVariant, val.release(), important, implicit);
    1653         m_currentShorthand = prefixingVariantForPropertyId(m_currentShorthand);
    1654     } else
    1655         addProperty(prefixingVariant, val.release(), important, implicit);
    1656 }
    1657 
    16581640void CSSParser::addProperty(CSSPropertyID propId, PassRefPtr<CSSValue> value, bool important, bool implicit)
    16591641{
     
    27672749        AnimationParseContext context;
    27682750        if (parseAnimationProperty(propId, val, context)) {
    2769             addPropertyWithPrefixingVariant(propId, val.release(), important);
     2751            addProperty(propId, val.release(), important);
    27702752            return true;
    27712753        }
     
    39963978    // Now add all of the properties we found.
    39973979    for (i = 0; i < numProperties; ++i)
    3998         addPropertyWithPrefixingVariant(shorthand.properties()[i], values[i].release(), important);
     3980        addProperty(shorthand.properties()[i], values[i].release(), important);
    39993981
    40003982    return true;
  • trunk/Source/WebCore/css/CSSParser.h

    r200626 r200769  
    133133    std::unique_ptr<MediaQuery> parseMediaQuery(const String&);
    134134
    135     void addPropertyWithPrefixingVariant(CSSPropertyID, PassRefPtr<CSSValue>, bool important, bool implicit = false);
    136135    void addProperty(CSSPropertyID, PassRefPtr<CSSValue>, bool important, bool implicit = false);
    137136    void rollbackLastProperties(int num);
  • trunk/Source/WebCore/css/CSSPropertyNames.in

    r200510 r200769  
    349349top [Initial=initialOffset, Converter=LengthOrAuto]
    350350transition [Longhands=transition-property|transition-duration|transition-timing-function|transition-delay]
    351 transition-delay [SkipBuilder]
    352 transition-duration [SkipBuilder]
    353 transition-property [SkipBuilder]
    354 transition-timing-function [SkipBuilder]
     351transition-delay [AnimationProperty, NameForMethods=Delay]
     352transition-duration [AnimationProperty, NameForMethods=Duration]
     353transition-property [AnimationProperty, NameForMethods=Property]
     354transition-timing-function [AnimationProperty, NameForMethods=TimingFunction]
    355355
    356356unicode-bidi
  • trunk/Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp

    r200358 r200769  
    172172    if (!propertyID)
    173173        return nullptr;
    174     return cloneAndCacheForCSSOM(m_propertySet->getPropertyCSSValue(propertyID).get());
     174    return cloneAndCacheForCSSOM(getPropertyCSSValueInternal(propertyID).get());
    175175}
    176176
     
    183183    if (!propertyID)
    184184        return String();
    185     return m_propertySet->getPropertyValue(propertyID);
     185    return getPropertyValueInternal(propertyID);
    186186}
    187187
     
    265265RefPtr<CSSValue> PropertySetCSSStyleDeclaration::getPropertyCSSValueInternal(CSSPropertyID propertyID)
    266266{
    267     return m_propertySet->getPropertyCSSValue(propertyID);
     267    RefPtr<CSSValue> value = m_propertySet->getPropertyCSSValue(propertyID);
     268    if (value)
     269        return value;
     270
     271    CSSPropertyID prefixingVariant = prefixingVariantForPropertyId(propertyID);
     272    if (prefixingVariant != propertyID)
     273        return m_propertySet->getPropertyCSSValue(prefixingVariant);
     274
     275    return nullptr;
    268276}
    269277
    270278String PropertySetCSSStyleDeclaration::getPropertyValueInternal(CSSPropertyID propertyID)
    271 {
    272     return m_propertySet->getPropertyValue(propertyID);
     279{
     280    String value = m_propertySet->getPropertyValue(propertyID);
     281    if (!value.isEmpty())
     282        return value;
     283
     284    CSSPropertyID prefixingVariant = prefixingVariantForPropertyId(propertyID);
     285    if (prefixingVariant != propertyID)
     286        return m_propertySet->getPropertyValue(prefixingVariant);
     287
     288    return String();
    273289}
    274290
  • trunk/Source/WebCore/css/StyleProperties.cpp

    r200510 r200769  
    639639    if (!shorthand.length())
    640640        return false;
    641 
    642     bool ret = removePropertiesInSet(shorthand.properties(), shorthand.length());
    643 
    644     CSSPropertyID prefixingVariant = prefixingVariantForPropertyId(propertyID);
    645     if (prefixingVariant == propertyID)
    646         return ret;
    647 
    648     StylePropertyShorthand shorthandPrefixingVariant = shorthandForProperty(prefixingVariant);
    649     return removePropertiesInSet(shorthandPrefixingVariant.properties(), shorthandPrefixingVariant.length());
     641    return removePropertiesInSet(shorthand.properties(), shorthand.length());
    650642}
    651643
     
    673665    m_propertyVector.remove(foundPropertyIndex);
    674666
    675     removePrefixedOrUnprefixedProperty(propertyID);
    676 
    677667    return true;
    678668}
     
    695685
    696686    return true;
    697 }
    698 
    699 void MutableStyleProperties::removePrefixedOrUnprefixedProperty(CSSPropertyID propertyID)
    700 {
    701     int foundPropertyIndex = findPropertyIndex(prefixingVariantForPropertyId(propertyID));
    702     if (foundPropertyIndex == -1)
    703         return;
    704     m_propertyVector.remove(foundPropertyIndex);
    705687}
    706688
     
    802784
    803785            *toReplace = property;
    804             setPrefixingVariantProperty(property);
    805786            return true;
    806787        }
    807788    }
    808789
    809     return appendPrefixingVariantProperty(property);
    810 }
    811 
    812 static unsigned getIndexInShorthandVectorForPrefixingVariant(const CSSProperty& property, CSSPropertyID prefixingVariant)
    813 {
    814     if (!property.isSetFromShorthand())
    815         return 0;
    816 
    817     CSSPropertyID prefixedShorthand = prefixingVariantForPropertyId(property.shorthandID());
    818     return indexOfShorthandForLonghand(prefixedShorthand, matchingShorthandsForLonghand(prefixingVariant));
    819 }
    820 
    821 bool MutableStyleProperties::appendPrefixingVariantProperty(const CSSProperty& property)
    822 {
    823790    m_propertyVector.append(property);
    824     CSSPropertyID prefixingVariant = prefixingVariantForPropertyId(property.id());
    825     if (prefixingVariant == property.id())
    826         return true;
    827 
    828     m_propertyVector.append(CSSProperty(prefixingVariant, property.value(), property.isImportant(), property.isSetFromShorthand(), getIndexInShorthandVectorForPrefixingVariant(property, prefixingVariant), property.metadata().m_implicit));
    829791    return true;
    830 }
    831 
    832 void MutableStyleProperties::setPrefixingVariantProperty(const CSSProperty& property)
    833 {
    834     CSSPropertyID prefixingVariant = prefixingVariantForPropertyId(property.id());
    835     CSSProperty* toReplace = findCSSPropertyWithID(prefixingVariant);
    836     if (toReplace && prefixingVariant != property.id())
    837         *toReplace = CSSProperty(prefixingVariant, property.value(), property.isImportant(), property.isSetFromShorthand(), getIndexInShorthandVectorForPrefixingVariant(property, prefixingVariant), property.metadata().m_implicit);
    838792}
    839793
     
    926880            case CSSPropertyAnimationDirection:
    927881            case CSSPropertyAnimationFillMode:
     882            case CSSPropertyAnimationPlayState:
    928883                shorthandPropertyID = CSSPropertyAnimation;
    929884                break;
     
    1025980            case CSSPropertyWebkitAnimationDirection:
    1026981            case CSSPropertyWebkitAnimationFillMode:
     982            case CSSPropertyWebkitAnimationPlayState:
    1027983                shorthandPropertyID = CSSPropertyWebkitAnimation;
    1028984                break;
  • trunk/Source/WebCore/css/StyleProperties.h

    r198284 r200769  
    212212    bool setProperty(CSSPropertyID, CSSValueID identifier, bool important = false);
    213213    bool setProperty(CSSPropertyID, CSSPropertyID identifier, bool important = false);
    214     bool appendPrefixingVariantProperty(const CSSProperty&);
    215     void setPrefixingVariantProperty(const CSSProperty&);
    216214    bool setProperty(const CSSProperty&, CSSProperty* slot = nullptr);
    217215
    218216    bool removeProperty(CSSPropertyID, String* returnText = nullptr);
    219     void removePrefixedOrUnprefixedProperty(CSSPropertyID);
    220217    void removeBlockProperties();
    221218    bool removePropertiesInSet(const CSSPropertyID* set, unsigned length);
Note: See TracChangeset for help on using the changeset viewer.