Changeset 143948 in webkit


Ignore:
Timestamp:
Feb 25, 2013 10:56:19 AM (11 years ago)
Author:
alexis@webkit.org
Message:

transition-property property doesn't accept "all, <IDENT>".
https://bugs.webkit.org/show_bug.cgi?id=110074

Reviewed by Dean Jackson.

Source/WebCore:

http://dev.w3.org/csswg/css3-transitions/#transition-property-property
allows all, <IDENT> as a value for the transition-property property. In
fact thanks to http://trac.webkit.org/changeset/143019 we correctly
implemented that behavior for transition shorthand property while
fixing bugs on the previous implementation. We did introduce a
AnimationParseContext to track whether the parsing of the
transition-property was finished or not in relation to the keyword.
This patch extend that mechanism to the longhand by renaming the
boolean and the functions to use it in the context class and set it
correctly while parsing the longhand property.

Test: LayoutTests/transitions/transitions-parsing.html

  • css/CSSParser.cpp:

(WebCore::AnimationParseContext::AnimationParseContext):
(WebCore::AnimationParseContext::commitAnimationPropertyKeyword):
(WebCore::AnimationParseContext::animationPropertyKeywordAllowed):
(AnimationParseContext):
(WebCore::CSSParser::parseAnimationShorthand):
(WebCore::CSSParser::parseTransitionShorthand):
(WebCore::CSSParser::parseAnimationProperty): We can remove the
condition inShorthand() here, if 'none' is parsed then no more keyword
can appear, if 'all' is parsed then we can continue the parsing but
invalidate the property if another keyword is encountered. These
conditions are valid for the shorthand and the longhand.

LayoutTests:

Extend exising test to cover the bug.

  • transitions/transitions-parsing-expected.txt:
  • transitions/transitions-parsing.html:
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r143931 r143948  
     12013-02-25  Alexis Menard  <alexis@webkit.org>
     2
     3        transition-property property doesn't accept "all, <IDENT>".
     4        https://bugs.webkit.org/show_bug.cgi?id=110074
     5
     6        Reviewed by Dean Jackson.
     7
     8        Extend exising test to cover the bug.
     9
     10        * transitions/transitions-parsing-expected.txt:
     11        * transitions/transitions-parsing.html:
     12
    1132013-02-25  Sergio Villar Senin  <svillar@igalia.com>
    214
  • trunk/LayoutTests/transitions/transitions-parsing-expected.txt

    r143019 r143948  
    2727PASS style.webkitTransitionProperty is 'background-position, font-size, color'
    2828PASS computedStyle.webkitTransitionProperty is 'background-position, font-size, color'
     29PASS style.transitionProperty is 'all, font-size, color'
     30PASS computedStyle.transitionProperty is 'all, font-size, color'
     31PASS style.webkitTransitionProperty is 'all, font-size, color'
     32PASS computedStyle.webkitTransitionProperty is 'all, font-size, color'
     33PASS style.transitionProperty is 'font-size, color, all'
     34PASS computedStyle.transitionProperty is 'font-size, color, all'
     35PASS style.webkitTransitionProperty is 'font-size, color, all'
     36PASS computedStyle.webkitTransitionProperty is 'font-size, color, all'
     37PASS style.transitionProperty is 'font-size, all, color'
     38PASS computedStyle.transitionProperty is 'font-size, all, color'
     39PASS style.webkitTransitionProperty is 'font-size, all, color'
     40PASS computedStyle.webkitTransitionProperty is 'font-size, all, color'
    2941Invalid transition-property values.
    3042PASS style.transitionProperty is ''
  • trunk/LayoutTests/transitions/transitions-parsing.html

    r143019 r143948  
    5959shouldBe("style.webkitTransitionProperty", "'background-position, font-size, color'");
    6060shouldBe("computedStyle.webkitTransitionProperty", "'background-position, font-size, color'");
     61
     62style.transitionProperty = "all, font-size, color";
     63shouldBe("style.transitionProperty", "'all, font-size, color'");
     64shouldBe("computedStyle.transitionProperty", "'all, font-size, color'");
     65shouldBe("style.webkitTransitionProperty", "'all, font-size, color'");
     66shouldBe("computedStyle.webkitTransitionProperty", "'all, font-size, color'");
     67
     68style.transitionProperty = "font-size, color, all";
     69shouldBe("style.transitionProperty", "'font-size, color, all'");
     70shouldBe("computedStyle.transitionProperty", "'font-size, color, all'");
     71shouldBe("style.webkitTransitionProperty", "'font-size, color, all'");
     72shouldBe("computedStyle.webkitTransitionProperty", "'font-size, color, all'");
     73
     74style.transitionProperty = "font-size, all, color";
     75shouldBe("style.transitionProperty", "'font-size, all, color'");
     76shouldBe("computedStyle.transitionProperty", "'font-size, all, color'");
     77shouldBe("style.webkitTransitionProperty", "'font-size, all, color'");
     78shouldBe("computedStyle.webkitTransitionProperty", "'font-size, all, color'");
    6179
    6280debug("Invalid transition-property values.");
  • trunk/Source/WebCore/ChangeLog

    r143947 r143948  
     12013-02-25  Alexis Menard  <alexis@webkit.org>
     2
     3        transition-property property doesn't accept "all, <IDENT>".
     4        https://bugs.webkit.org/show_bug.cgi?id=110074
     5
     6        Reviewed by Dean Jackson.
     7
     8        http://dev.w3.org/csswg/css3-transitions/#transition-property-property
     9        allows all, <IDENT> as a value for the transition-property property. In
     10        fact thanks to http://trac.webkit.org/changeset/143019 we correctly
     11        implemented that behavior for transition shorthand property while
     12        fixing bugs on the previous implementation. We did introduce a
     13        AnimationParseContext to track whether the parsing of the
     14        transition-property was finished or not in relation to the keyword.
     15        This patch extend that mechanism to the longhand by renaming the
     16        boolean and the functions to use it in the context class and set it
     17        correctly while parsing the longhand property.
     18
     19        Test: LayoutTests/transitions/transitions-parsing.html
     20
     21        * css/CSSParser.cpp:
     22        (WebCore::AnimationParseContext::AnimationParseContext):
     23        (WebCore::AnimationParseContext::commitAnimationPropertyKeyword):
     24        (WebCore::AnimationParseContext::animationPropertyKeywordAllowed):
     25        (AnimationParseContext):
     26        (WebCore::CSSParser::parseAnimationShorthand):
     27        (WebCore::CSSParser::parseTransitionShorthand):
     28        (WebCore::CSSParser::parseAnimationProperty): We can remove the
     29        condition inShorthand() here, if 'none' is parsed then no more keyword
     30        can appear, if 'all' is parsed then we can continue the parsing but
     31        invalidate the property if another keyword is encountered. These
     32        conditions are valid for the shorthand and the longhand.
     33
    1342013-02-25  No'am Rosenthal  <noam@webkit.org>
    235
  • trunk/Source/WebCore/css/CSSParser.cpp

    r143028 r143948  
    203203public:
    204204    AnimationParseContext()
    205         : m_animationPropertyKeywordInShorthandAllowed(true)
     205        : m_animationPropertyKeywordAllowed(true)
    206206        , m_firstAnimationCommitted(false)
    207207        , m_hasSeenAnimationPropertyKeyword(false)
     
    219219    }
    220220
    221     void commitAnimationPropertyKeywordInShorthand()
     221    void commitAnimationPropertyKeyword()
    222222    {
    223         m_animationPropertyKeywordInShorthandAllowed = false;
    224     }
    225 
    226     bool animationPropertyKeywordInShorthandAllowed() const
     223        m_animationPropertyKeywordAllowed = false;
     224    }
     225
     226    bool animationPropertyKeywordAllowed() const
    227227    {
    228         return m_animationPropertyKeywordInShorthandAllowed;
     228        return m_animationPropertyKeywordAllowed;
    229229    }
    230230
     
    240240
    241241private:
    242     bool m_animationPropertyKeywordInShorthandAllowed;
     242    bool m_animationPropertyKeywordAllowed;
    243243    bool m_firstAnimationCommitted;
    244244    bool m_hasSeenAnimationPropertyKeyword;
     
    33093309
    33103310            // There are more values to process but 'none' or 'all' were already defined as the animation property, the declaration becomes invalid.
    3311             if (!context.animationPropertyKeywordInShorthandAllowed() && context.hasCommittedFirstAnimation())
     3311            if (!context.animationPropertyKeywordAllowed() && context.hasCommittedFirstAnimation())
    33123312                return false;
    33133313        }
     
    33673367
    33683368                // There are more values to process but 'none' or 'all' were already defined as the animation property, the declaration becomes invalid.
    3369                 if (!context.animationPropertyKeywordInShorthandAllowed() && context.hasCommittedFirstAnimation())
     3369                if (!context.animationPropertyKeywordAllowed() && context.hasCommittedFirstAnimation())
    33703370                    return false;
    33713371            }
     
    44294429        return cssValuePool().createIdentifierValue(result);
    44304430    if (equalIgnoringCase(value, "all")) {
    4431         if (inShorthand() && context.hasSeenAnimationPropertyKeyword())
    4432             context.commitAnimationPropertyKeywordInShorthand();
     4431        if (context.hasSeenAnimationPropertyKeyword())
     4432            context.commitAnimationPropertyKeyword();
    44334433        context.sawAnimationPropertyKeyword();
    44344434        return cssValuePool().createIdentifierValue(CSSValueAll);
    44354435    }
    44364436    if (equalIgnoringCase(value, "none")) {
    4437         if (inShorthand())
    4438             context.commitAnimationPropertyKeywordInShorthand();
     4437        context.commitAnimationPropertyKeyword();
    44394438        context.sawAnimationPropertyKeyword();
    44404439        return cssValuePool().createIdentifierValue(CSSValueNone);
     
    46044603                case CSSPropertyWebkitTransitionProperty:
    46054604                    currValue = parseAnimationProperty(context);
    4606                     if (value && context.hasSeenAnimationPropertyKeyword())
     4605                    if (value && !context.animationPropertyKeywordAllowed())
    46074606                        return false;
    46084607                    if (currValue)
Note: See TracChangeset for help on using the changeset viewer.