Summary: | Use is<>() / downcast<>() for CSSRule subclasses | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Chris Dumez <cdumez> | ||||||||
Component: | CSS | Assignee: | Chris Dumez <cdumez> | ||||||||
Status: | RESOLVED FIXED | ||||||||||
Severity: | Normal | CC: | benjamin, commit-queue, gyuyoung.kim, jake.nielsen.webkit, kling, rniwa | ||||||||
Priority: | P2 | ||||||||||
Version: | 528+ (Nightly build) | ||||||||||
Hardware: | Unspecified | ||||||||||
OS: | Unspecified | ||||||||||
Bug Depends on: | 137056 | ||||||||||
Bug Blocks: | |||||||||||
Attachments: |
|
Description
Chris Dumez
2014-10-02 15:37:06 PDT
Created attachment 239152 [details]
Patch
Comment on attachment 239152 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=239152&action=review > Source/WebCore/css/CSSFontFaceRule.h:54 > +SPECIALIZE_TYPE_TRAITS_CSS_RULE(CSSFontFaceRule, FONT_FACE_RULE) I would prefere CSSRule::FONT_FACE_RULE over FONT_FACE_RULE. A little more typing but I like that we follow the scope. > Source/WebCore/css/InspectorCSSOMWrappers.cpp:64 > + collect(downcast<CSSMediaRule>(cssRule)); cssRule is not null, shouldn't you use &downcast<CSSMediaRule>(*cssRule)) by you own rules? > Source/WebCore/css/InspectorCSSOMWrappers.cpp:68 > - collect(toCSSSupportsRule(cssRule)); > + collect(downcast<CSSSupportsRule>(cssRule)); ditto > Source/WebCore/css/InspectorCSSOMWrappers.cpp:73 > - collect(toWebKitCSSRegionRule(cssRule)); > + collect(downcast<WebKitCSSRegionRule>(cssRule)); ditto > Source/WebCore/inspector/InspectorCSSAgent.cpp:432 > CSSStyleRule* InspectorCSSAgent::asCSSStyleRule(CSSRule* rule) > { > - if (rule->type() != CSSRule::STYLE_RULE) > + ASSERT(rule); It would be nice to fix the call site to pass a CSSRule&, then remove the assertion. Comment on attachment 239152 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=239152&action=review >> Source/WebCore/css/CSSFontFaceRule.h:54 >> +SPECIALIZE_TYPE_TRAITS_CSS_RULE(CSSFontFaceRule, FONT_FACE_RULE) > > I would prefere CSSRule::FONT_FACE_RULE over FONT_FACE_RULE. A little more typing but I like that we follow the scope. Hmm, I already went the other way for http://trac.webkit.org/changeset/174236/trunk/Source/WebCore/css/CSSBasicShapes.h But why not. >> Source/WebCore/css/InspectorCSSOMWrappers.cpp:64 >> + collect(downcast<CSSMediaRule>(cssRule)); > > cssRule is not null, shouldn't you use &downcast<CSSMediaRule>(*cssRule)) by you own rules? I think you are confusing with is<>(). There is no null check in the downcast<>(). >> Source/WebCore/inspector/InspectorCSSAgent.cpp:432 >> + ASSERT(rule); > > It would be nice to fix the call site to pass a CSSRule&, then remove the assertion. I hesitated :) Ok, will do it. Created attachment 239163 [details]
Patch
Created attachment 239167 [details]
Patch
Comment on attachment 239167 [details] Patch Clearing flags on attachment: 239167 Committed r174253: <http://trac.webkit.org/changeset/174253> All reviewed patches have been landed. Closing bug. |