Bug 136774 - Generate toCSSStyleSheet using STYLE_SHEET_TYPE_CASTS
Summary: Generate toCSSStyleSheet using STYLE_SHEET_TYPE_CASTS
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Gyuyoung Kim
URL:
Keywords:
Depends on:
Blocks: 136773
  Show dependency treegraph
 
Reported: 2014-09-11 23:33 PDT by Gyuyoung Kim
Modified: 2014-09-14 21:07 PDT (History)
2 users (show)

See Also:


Attachments
Patch (6.31 KB, patch)
2014-09-11 23:34 PDT, Gyuyoung Kim
no flags Details | Formatted Diff | Diff
Patch for landing (6.56 KB, patch)
2014-09-14 17:20 PDT, Gyuyoung Kim
no flags Details | Formatted Diff | Diff
Patch for landing (6.56 KB, patch)
2014-09-14 19:31 PDT, Gyuyoung Kim
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Gyuyoung Kim 2014-09-11 23:33:41 PDT
As a step to use toFoo, this patch introduces STYLE_SHEET_TYPE_CASTS for toCSSStyleSheet(). This will help to detect wrong type cast. Additonally this patch helps to remove argument type of RefPtr.
Comment 1 Gyuyoung Kim 2014-09-11 23:34:26 PDT
Created attachment 238017 [details]
Patch
Comment 2 Gyuyoung Kim 2014-09-13 21:03:07 PDT
CC'ing Darin.
Comment 3 Darin Adler 2014-09-14 12:37:37 PDT
Comment on attachment 238017 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=238017&action=review

> Source/WebCore/dom/ProcessingInstruction.cpp:225
> -        static_cast<CSSStyleSheet*>(m_sheet.get())->contents().parseString(sheet);
> +        toCSSStyleSheet(m_sheet)->contents().parseString(sheet);

Since we are assuming m_sheet is non-null, it would be better style to write:

    toCSSStyleSheet(*m_sheet)->contents()

This ensures we don't compile in bogus null checks, although it’s possible the compiler is smart enough to not compile them anyway.

> Source/WebCore/dom/ProcessingInstruction.cpp:238
> -        static_cast<CSSStyleSheet*>(m_sheet.get())->contents().checkLoaded();
> +        toCSSStyleSheet(m_sheet)->contents().checkLoaded();

Ditto.

> Source/WebCore/inspector/InspectorCSSAgent.cpp:686
>              StyleSheet* styleSheet = list->item(i);

Should be StyleSheet& instead of StyleSheet*.
Comment 4 Gyuyoung Kim 2014-09-14 17:20:11 PDT
Created attachment 238096 [details]
Patch for landing
Comment 5 Gyuyoung Kim 2014-09-14 19:31:31 PDT
Created attachment 238101 [details]
Patch for landing
Comment 6 WebKit Commit Bot 2014-09-14 21:07:42 PDT
Comment on attachment 238101 [details]
Patch for landing

Clearing flags on attachment: 238101

Committed r173611: <http://trac.webkit.org/changeset/173611>
Comment 7 WebKit Commit Bot 2014-09-14 21:07:45 PDT
All reviewed patches have been landed.  Closing bug.