WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
93210
CSSParser: Move enumeration to a common place (StylePropertyShorthand)
https://bugs.webkit.org/show_bug.cgi?id=93210
Summary
CSSParser: Move enumeration to a common place (StylePropertyShorthand)
Adenilson Cavalcanti Silva
Reported
2012-08-05 16:49:15 PDT
Current code in CSSParser::parseAnimationShorthand() has an enumeration declared with the same elements as another enumeration declared in StylePropertyShorthand. The issue is that this code depends on a different ordering of enum values (i.e. animationName) to avoid matching with other keywords like fill-mode/timing function, etc. I considered copying the original values and reordering in a static variable, but it may cause performance regressions. For while, it seems to make sense to at least have both enums in the same place.
Attachments
Moving the enum to a common place
(7.34 KB, patch)
2012-08-05 16:58 PDT
,
Adenilson Cavalcanti Silva
no flags
Details
Formatted Diff
Diff
Following the suggestion about naming the function
(7.41 KB, patch)
2012-08-21 09:55 PDT
,
Adenilson Cavalcanti Silva
dino
: review-
Details
Formatted Diff
Diff
Implementing reviewers suggestion: naming + comparing enum array length
(7.41 KB, patch)
2012-08-23 06:29 PDT
,
Adenilson Cavalcanti Silva
no flags
Details
Formatted Diff
Diff
Forgot a last unneeded namespace reference
(7.40 KB, patch)
2012-08-23 06:45 PDT
,
Adenilson Cavalcanti Silva
dino
: review-
Details
Formatted Diff
Diff
Changed method name, fixes in CL, etc.
(7.46 KB, patch)
2012-08-23 12:37 PDT
,
Adenilson Cavalcanti Silva
no flags
Details
Formatted Diff
Diff
Show Obsolete
(4)
View All
Add attachment
proposed patch, testcase, etc.
Adenilson Cavalcanti Silva
Comment 1
2012-08-05 16:58:09 PDT
Created
attachment 156575
[details]
Moving the enum to a common place
Alexis Menard (darktears)
Comment 2
2012-08-06 11:07:16 PDT
Comment on
attachment 156575
[details]
Moving the enum to a common place I think this move is useless but just clutter the history. Secondly webkitAnimationShorthandWorkaround is a bad name as we don't workaround anything here, we just parse differently as the spec is unclear on how we should parse. I'd rather move this code/refactor/whatever when the w3c spec bug is resolved and the parsing clarified.
Adenilson Cavalcanti Silva
Comment 3
2012-08-08 10:10:19 PDT
Alexis Thanks for the comments and I agree that the patch is not good. My question is: a) is this duplication of enumerations a problem that should be fixed? b) if so, what would be the best approach?
Alexis Menard (darktears)
Comment 4
2012-08-08 12:14:06 PDT
(In reply to
comment #3
)
> Alexis > > Thanks for the comments and I agree that the patch is not good. > > My question is: > > a) is this duplication of enumerations a problem that should be fixed?
> In a way we should
> b) if so, what would be the best approach?
Wait to see the spec clarified to analyse the best way to fix it.
Darin Adler
Comment 5
2012-08-14 12:43:52 PDT
Comment on
attachment 156575
[details]
Moving the enum to a common place View in context:
https://bugs.webkit.org/attachment.cgi?id=156575&action=review
> Source/WebCore/css/StylePropertyShorthand.h:83 > const StylePropertyShorthand& webkitAnimationShorthand(); > +const StylePropertyShorthand& webkitAnimationShorthandWorkaround();
Idea is fine, but adding the word “workaround” does not express what’s different about this list. webkitAnimationShorthandWithAnimationNameLast might be OK.
Adenilson Cavalcanti Silva
Comment 6
2012-08-21 09:55:28 PDT
Created
attachment 159704
[details]
Following the suggestion about naming the function Updated the patch to follow the suggestion about function name.
Adenilson Cavalcanti Silva
Comment 7
2012-08-22 08:38:18 PDT
Darin Thanks for the feedback, I agree that 'workaround' is not a good and proper name. The new patch has it fixed, would you mind to have a look on it again? (In reply to
comment #5
)
> (From update of
attachment 156575
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=156575&action=review
> > > Source/WebCore/css/StylePropertyShorthand.h:83 > > const StylePropertyShorthand& webkitAnimationShorthand(); > > +const StylePropertyShorthand& webkitAnimationShorthandWorkaround(); > > Idea is fine, but adding the word “workaround” does not express what’s different about this list. webkitAnimationShorthandWithAnimationNameLast might be OK.
Dean Jackson
Comment 8
2012-08-22 16:13:20 PDT
Comment on
attachment 159704
[details]
Following the suggestion about naming the function View in context:
https://bugs.webkit.org/attachment.cgi?id=159704&action=review
I wonder if webkitAnimationShorthandForParsing() is a better name? It makes it clear why we have this (annoying) duplication. I don't have a strong opinion either way. Otherwise, just some small fixes needed before r+.
> Source/WebCore/css/CSSParser.cpp:3064 > + const WebCore::StylePropertyShorthand& animationProperties = WebCore::webkitAnimationShorthandNameLast();
Why do you need the WebCore:: here?
> Source/WebCore/css/CSSParser.cpp:3071 > + ASSERT(numProperties == webkitAnimationShorthandNameLast().length()); > + ASSERT(webkitAnimationShorthand().length() == webkitAnimationShorthandNameLast().length());
You could compare to the animationProperties local variable.
> Source/WebCore/css/StylePropertyShorthand.cpp:275 > + static const CSSPropertyID animationPropertiesLast[] = {
Why not animationPropertiesNameLast to be consistent?
Adenilson Cavalcanti Silva
Comment 9
2012-08-23 06:29:10 PDT
Created
attachment 160147
[details]
Implementing reviewers suggestion: naming + comparing enum array length Implementing suggestions: naming + comparing array length
Adenilson Cavalcanti Silva
Comment 10
2012-08-23 06:38:01 PDT
Dean Thanks for the comments. I've just uploaded a new version of the patch, addressing your suggestions.
Adenilson Cavalcanti Silva
Comment 11
2012-08-23 06:45:20 PDT
Created
attachment 160151
[details]
Forgot a last unneeded namespace reference
Dean Jackson
Comment 12
2012-08-23 11:48:25 PDT
Comment on
attachment 160151
[details]
Forgot a last unneeded namespace reference View in context:
https://bugs.webkit.org/attachment.cgi?id=160151&action=review
Sorry, it's so close! Just some minor nits.
> Source/WebCore/ChangeLog:10 > + CSSParser::parseAnimationShorthand() uses an enumeration with the same elements as another enumeration > + present in StylePropertyShorthand, but with different ordering of values. It seems to make sense to > + have both enums in the same place.
"It seems to make sense to have both enums in the same place." -> "Put both enums in the same place".
> Source/WebCore/css/StylePropertyShorthand.cpp:271 > + // When we parse the animation shorthand we need to look for animation-name > + // last because otherwise it might match against the keywords for fill mode, > + // timing functions and infinite iteration. This means that animation names > + // that are the same as keywords (e.g. 'forwards') won't always match in the > + // shorthand. In that case they should be using longhands (or reconsidering > + // their approach). This is covered by the animations spec bug:
This was my fault in the original patch, but could you change "In that case they..." to "In that case authors..." to make it more clear?
> Source/WebCore/css/StylePropertyShorthand.cpp:286 > + CSSPropertyWebkitAnimationName > + }; > + > + > + DEFINE_STATIC_LOCAL(StylePropertyShorthand, webkitAnimationLonghandsNameLast, (animationPropertiesNameLast, WTF_ARRAY_LENGTH(animationPropertiesNameLast)));
Extra blank line above.
> Source/WebCore/css/StylePropertyShorthand.h:83 > const StylePropertyShorthand& webkitAnimationShorthand(); > +const StylePropertyShorthand& webkitAnimationShorthandNameLast();
I thought about this a bit more and I think the name should be webkitAnimationShorthandForParsing(). It makes it clear that there is only one reason why we have this duplication.
Adenilson Cavalcanti Silva
Comment 13
2012-08-23 12:37:13 PDT
Created
attachment 160214
[details]
Changed method name, fixes in CL, etc.
Dean Jackson
Comment 14
2012-08-23 15:34:21 PDT
Comment on
attachment 160214
[details]
Changed method name, fixes in CL, etc. Thanks for all the revisions.
WebKit Review Bot
Comment 15
2012-08-23 15:52:07 PDT
Comment on
attachment 160214
[details]
Changed method name, fixes in CL, etc. Clearing flags on attachment: 160214 Committed
r126491
: <
http://trac.webkit.org/changeset/126491
>
WebKit Review Bot
Comment 16
2012-08-23 15:52:12 PDT
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug