RESOLVED FIXED 106418
Implement CSSGroupingRule for @host @-rules and @supports.
https://bugs.webkit.org/show_bug.cgi?id=106418
Summary Implement CSSGroupingRule for @host @-rules and @supports.
Takashi Sakamoto
Reported 2013-01-08 22:08:04 PST
These implementations is almost the same and now CSSHostRule, which is also the same as the implementations, will be added. So we need to refactor these implementations.
Attachments
Patch (27.65 KB, patch)
2013-01-09 00:02 PST, Takashi Sakamoto
no flags
WIP (27.31 KB, patch)
2013-01-09 22:24 PST, Takashi Sakamoto
no flags
Patch (33.92 KB, patch)
2013-01-10 00:33 PST, Takashi Sakamoto
no flags
WIP for checking Windows BuildBot (35.46 KB, patch)
2013-01-10 21:51 PST, Takashi Sakamoto
no flags
Patch for landing (35.40 KB, patch)
2013-01-10 22:50 PST, Takashi Sakamoto
no flags
Takashi Sakamoto
Comment 1 2013-01-09 00:02:39 PST
Pablo Flouret
Comment 2 2013-01-09 09:08:55 PST
Nice. You probably want to name the class CSSGroupingRule, as that's the name on the spec (http://dev.w3.org/csswg/css3-conditional/#cssgroupingrule)
Dimitri Glazkov (Google)
Comment 3 2013-01-09 09:37:38 PST
(In reply to comment #2) > Nice. You probably want to name the class CSSGroupingRule, as that's the name on the spec (http://dev.w3.org/csswg/css3-conditional/#cssgroupingrule) I like this suggestion.
Alexey Proskuryakov
Comment 4 2013-01-09 09:39:55 PST
> class CSSMediaRule and class WebKitCSSRegionRule can share most of their implementations I have doubts whether these classes are semantically close enough to share a public base class. This refactoring looks like it makes code much more confusing. Also, inlining bodies of these large functions just so that you could use templates is not good.
Dimitri Glazkov (Google)
Comment 5 2013-01-09 09:42:48 PST
Comment on attachment 181865 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=181865&action=review > Source/WebCore/ChangeLog:38 > + is "const" method, needs static_cast and const_cast. Does it need to be a const method?
Dimitri Glazkov (Google)
Comment 6 2013-01-09 09:44:15 PST
(In reply to comment #4) > > class CSSMediaRule and class WebKitCSSRegionRule can share most of their implementations > > I have doubts whether these classes are semantically close enough to share a public base class. This refactoring looks like it makes code much more confusing. I think the idea of sharing the code for all grouping rules is a good one. Not sure about this specific refactoring yet. > Also, inlining bodies of these large functions just so that you could use templates is not good.
Dimitri Glazkov (Google)
Comment 7 2013-01-09 10:06:23 PST
Comment on attachment 181865 [details] Patch I agree with Alexey, this patch looks sad because of gratuitous templating. The thing is, you almost don't need these templates and I am confident this refactoring can be done without them.
Antti Koivisto
Comment 8 2013-01-09 12:40:18 PST
Please don't try to use this for WebKitCSSRegionRule if it really doesn't share the interface. Also definitely no templates. Please explain in ChangeLog the real reason for doing this (@supports rules).
Dimitri Glazkov (Google)
Comment 9 2013-01-09 12:41:02 PST
(In reply to comment #8) > Please explain in ChangeLog the real reason for doing this (@supports rules). and @host rules.
Takashi Sakamoto
Comment 10 2013-01-09 22:24:13 PST
Takashi Sakamoto
Comment 11 2013-01-10 00:33:26 PST
Takashi Sakamoto
Comment 12 2013-01-10 00:37:30 PST
Thank you for reviewing. I uploaded a new patch. The differences between the previous one and this are: - No template, - Add @supports and @host @-rules to ChangeLog. - Add the spec URLs to ChangeLog. Talking about @region, interface CSSRegionStyleRule : CSSRule { attribute DOMString selectorText; readonly attribute CSSRuleList cssRules; unsigned long insertRule(DOMString rule, unsigned long index) raises(DOMException); void deleteRule(unsigned long index) raises(DOMException); }; c.f. http://dev.w3.org/csswg/css3-regions/#the-at-region-style-rule I think, this is the same as: interface CSSGroupingRule : CSSRule { readonly attribute CSSRuleList cssRules; unsigned long insertRule (DOMString rule, unsigned long index); void deleteRule (unsigned long index); } http://www.w3.org/TR/2012/WD-css3-conditional-20121213/#the-cssgroupingrule-interface Best regards, Takashi Sakamoto
Build Bot
Comment 13 2013-01-10 01:00:26 PST
Antti Koivisto
Comment 14 2013-01-10 02:19:16 PST
Comment on attachment 182080 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=182080&action=review Looks good. > Source/WebCore/ChangeLog:14 > + Since @supports and @host @-rules are dervied from CSSGroupingRule: > + http://www.w3.org/TR/2012/WD-css3-conditional/#the-cssgroupingrule-interface > + https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html#css-host-rule-interface > + we need CSSGroupingRule (WK102344 and WK104822). > + Since @media is also derived from CSSGroupingRule and @region has the > + same interface as CSSGroupingRule, modify to use CSSGroupingRule: > + http://dev.w3.org/csswg/css3-regions/#the-at-region-style-rule This is bit confusing. The reason you are adding CSSGroupingRule is to share code between CSSMediaRule, CSSSupportsRule and CSSHostRule. It would be good to spell it out. > Source/WebCore/WebCore.vcproj/WebCore.vcproj:36179 > + <FileConfiguration > + Name="Debug|Win32" > + ExcludedFromBuild="true" > + > > + <Tool You don't need this stuff (probably why windows build is failing). > Source/WebCore/css/CSSGroupingRule.cpp:46 > +CSSGroupingRule::CSSGroupingRule(StyleRuleBlock* groupRule, CSSStyleSheet* parent) For consistency we should probably rename StyleRuleBlock -> StyleRuleGroup in another patch. > Source/WebCore/css/CSSMediaRule.cpp:50 > + return static_cast<const StyleRuleMedia*>(m_groupRule.get())->mediaQueries(); You might want to add inlined accessors that do the casting. > Source/WebCore/css/WebKitCSSRegionRule.cpp:55 > + result.append(static_cast<const StyleRuleRegion*>(m_groupRule.get())->selectorList().selectorsText()); For this too.
Takashi Sakamoto
Comment 15 2013-01-10 21:51:47 PST
Created attachment 182265 [details] WIP for checking Windows BuildBot
Takashi Sakamoto
Comment 16 2013-01-10 22:02:53 PST
Comment on attachment 182080 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=182080&action=review Thank you for reviewing. >> Source/WebCore/ChangeLog:14 >> + http://dev.w3.org/csswg/css3-regions/#the-at-region-style-rule > > This is bit confusing. The reason you are adding CSSGroupingRule is to share code between CSSMediaRule, CSSSupportsRule and CSSHostRule. It would be good to spell it out. I see. I added the reason to the top of the description. >> Source/WebCore/WebCore.vcproj/WebCore.vcproj:36179 >> + <Tool > > You don't need this stuff (probably why windows build is failing). I found I missed CSSAllInOne.cpp. I'm now checking whether only the mistake (CSSAllInOne) causes windows build failure or not. >> Source/WebCore/css/CSSGroupingRule.cpp:46 >> +CSSGroupingRule::CSSGroupingRule(StyleRuleBlock* groupRule, CSSStyleSheet* parent) > > For consistency we should probably rename StyleRuleBlock -> StyleRuleGroup in another patch. I see. If no bug for the renaming, I will file a new bug. >> Source/WebCore/css/CSSMediaRule.cpp:50 >> + return static_cast<const StyleRuleMedia*>(m_groupRule.get())->mediaQueries(); > > You might want to add inlined accessors that do the casting. I see. Thanks. Done. >> Source/WebCore/css/WebKitCSSRegionRule.cpp:55 >> + result.append(static_cast<const StyleRuleRegion*>(m_groupRule.get())->selectorList().selectorsText()); > > For this too. Done.
Takashi Sakamoto
Comment 17 2013-01-10 22:50:40 PST
Created attachment 182268 [details] Patch for landing
WebKit Review Bot
Comment 18 2013-01-10 23:09:52 PST
Comment on attachment 182268 [details] Patch for landing Clearing flags on attachment: 182268 Committed r139409: <http://trac.webkit.org/changeset/139409>
WebKit Review Bot
Comment 19 2013-01-10 23:09:59 PST
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.