Ignore:
Timestamp:
Jan 27, 2015, 11:39:22 AM (10 years ago)
Author:
[email protected]
Message:

CSSKeyframesRule::findRule() and deleteRule() should delete the last matching rule, not the first
https://bugs.webkit.org/show_bug.cgi?id=139732

Patch by Sylvain Galineau <[email protected]> on 2015-01-26
Reviewed by Dean Jackson and Darin Adler.

Source/WebCore:

No new tests because existing tests have been updated to verify this behavior.

  • css/CSSKeyframeRule.h:

(WebCore::StyleKeyframe::getKeys): Deleted.

  • css/StyleResolver.cpp:

(WebCore::StyleResolver::keyframeStylesForAnimation): use StyleKeyframe::keys().

  • css/CSSKeyframeRule.cpp:

(WebCore::StyleKeyframe::parseKeyString): Deleted. Moved to CSSParser.
(WebCore::StyleKeyframe::keyText): Build keyframe selector from Vector<double> representation.

  • css/CSSKeyframeRule.h:

(WebCore::StyleKeyframe::setKeyText): parse keyframe selector into Vector<double>.
(WebCore::StyleKeyframe::keys): Added. Returns vector representation of selector keys.
(WebCore::StyleKeyframe::getKeys): Deleted. Now keys().

  • css/CSSKeyframesRule.cpp:

(WebCore::StyleRuleKeyframes::findKeyframeIndex): Return last matching rule.

  • css/CSSParser.cpp:

(WebCore::CSSParser::parseKeyframeSelector): Added. Moved from StyleKeyframe.

  • css/CSSParser.h:

(WebCore::CSSParser::parseKeyframeSelector): Added. Moved from StyleKeyframe.

LayoutTests:

Update existing keyframes OM tests to check for findRule/deleteRule matching order i.e. find/delete last specified rule.

  • animations/keyframes-rule-expected.txt:
  • animations/keyframes-rule.html:
  • animations/unprefixed-keyframes-rule-expected.txt:
  • animations/unprefixed-keyframes-rule.html:
File:
1 edited

Legend:

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

    r176157 r179197  
    7373int StyleRuleKeyframes::findKeyframeIndex(const String& key) const
    7474{
    75     String percentageString;
    76     if (equalIgnoringCase(key, "from"))
    77         percentageString = ASCIILiteral("0%");
    78     else if (equalIgnoringCase(key, "to"))
    79         percentageString = ASCIILiteral("100%");
    80     else
    81         percentageString = key;
    82    
    83     for (unsigned i = 0; i < m_keyframes.size(); ++i) {
    84         if (m_keyframes[i]->keyText() == percentageString)
     75    Vector<double>&& keys = CSSParser::parseKeyframeSelector(key);
     76
     77    for (size_t i = m_keyframes.size(); i--; ) {
     78        if (m_keyframes[i]->keys() == keys)
    8579            return i;
    8680    }
     81
    8782    return -1;
    8883}
Note: See TracChangeset for help on using the changeset viewer.