<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[174253] trunk/Source/WebCore</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/174253">174253</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2014-10-02 18:40:12 -0700 (Thu, 02 Oct 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Use is&lt;&gt;() / downcast&lt;&gt;() for CSSRule subclasses
https://bugs.webkit.org/show_bug.cgi?id=137364

Reviewed by Benjamin Poulain.

Use is&lt;&gt;() / downcast&lt;&gt;() functions for CSSRule subclasses.

No new tests, no behavior change.

* css/CSSFontFaceRule.h:
* css/CSSImportRule.h:
* css/CSSMediaRule.h:
* css/CSSRule.h:
* css/CSSStyleRule.h:
* css/CSSSupportsRule.h:
* css/InspectorCSSOMWrappers.cpp:
(WebCore::InspectorCSSOMWrappers::collect):
* css/WebKitCSSKeyframesRule.h:
* css/WebKitCSSRegionRule.h:
* inspector/InspectorCSSAgent.cpp:
(WebCore::InspectorCSSAgent::asCSSStyleRule):
(WebCore::InspectorCSSAgent::collectStyleSheets):
(WebCore::InspectorCSSAgent::buildArrayForRuleList):
* inspector/InspectorStyleSheet.cpp:
(WebCore::asCSSRuleList):
(WebCore::fillMediaListChain):
(WebCore::InspectorStyleSheet::addRule):
(WebCore::InspectorStyleSheet::collectFlatRules):
* page/PageSerializer.cpp:
(WebCore::PageSerializer::serializeCSSStyleSheet):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorecssCSSFontFaceRuleh">trunk/Source/WebCore/css/CSSFontFaceRule.h</a></li>
<li><a href="#trunkSourceWebCorecssCSSImportRuleh">trunk/Source/WebCore/css/CSSImportRule.h</a></li>
<li><a href="#trunkSourceWebCorecssCSSMediaRuleh">trunk/Source/WebCore/css/CSSMediaRule.h</a></li>
<li><a href="#trunkSourceWebCorecssCSSRuleh">trunk/Source/WebCore/css/CSSRule.h</a></li>
<li><a href="#trunkSourceWebCorecssCSSStyleRuleh">trunk/Source/WebCore/css/CSSStyleRule.h</a></li>
<li><a href="#trunkSourceWebCorecssCSSSupportsRuleh">trunk/Source/WebCore/css/CSSSupportsRule.h</a></li>
<li><a href="#trunkSourceWebCorecssInspectorCSSOMWrapperscpp">trunk/Source/WebCore/css/InspectorCSSOMWrappers.cpp</a></li>
<li><a href="#trunkSourceWebCorecssWebKitCSSKeyframesRuleh">trunk/Source/WebCore/css/WebKitCSSKeyframesRule.h</a></li>
<li><a href="#trunkSourceWebCorecssWebKitCSSRegionRuleh">trunk/Source/WebCore/css/WebKitCSSRegionRule.h</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorCSSAgentcpp">trunk/Source/WebCore/inspector/InspectorCSSAgent.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorCSSAgenth">trunk/Source/WebCore/inspector/InspectorCSSAgent.h</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorStyleSheetcpp">trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp</a></li>
<li><a href="#trunkSourceWebCorepagePageSerializercpp">trunk/Source/WebCore/page/PageSerializer.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (174252 => 174253)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-10-03 00:37:47 UTC (rev 174252)
+++ trunk/Source/WebCore/ChangeLog        2014-10-03 01:40:12 UTC (rev 174253)
</span><span class="lines">@@ -1,3 +1,36 @@
</span><ins>+2014-10-02  Christophe Dumez  &lt;cdumez@apple.com&gt;
+
+        Use is&lt;&gt;() / downcast&lt;&gt;() for CSSRule subclasses
+        https://bugs.webkit.org/show_bug.cgi?id=137364
+
+        Reviewed by Benjamin Poulain.
+
+        Use is&lt;&gt;() / downcast&lt;&gt;() functions for CSSRule subclasses.
+
+        No new tests, no behavior change.
+
+        * css/CSSFontFaceRule.h:
+        * css/CSSImportRule.h:
+        * css/CSSMediaRule.h:
+        * css/CSSRule.h:
+        * css/CSSStyleRule.h:
+        * css/CSSSupportsRule.h:
+        * css/InspectorCSSOMWrappers.cpp:
+        (WebCore::InspectorCSSOMWrappers::collect):
+        * css/WebKitCSSKeyframesRule.h:
+        * css/WebKitCSSRegionRule.h:
+        * inspector/InspectorCSSAgent.cpp:
+        (WebCore::InspectorCSSAgent::asCSSStyleRule):
+        (WebCore::InspectorCSSAgent::collectStyleSheets):
+        (WebCore::InspectorCSSAgent::buildArrayForRuleList):
+        * inspector/InspectorStyleSheet.cpp:
+        (WebCore::asCSSRuleList):
+        (WebCore::fillMediaListChain):
+        (WebCore::InspectorStyleSheet::addRule):
+        (WebCore::InspectorStyleSheet::collectFlatRules):
+        * page/PageSerializer.cpp:
+        (WebCore::PageSerializer::serializeCSSStyleSheet):
+
</ins><span class="cx"> 2014-10-02  Dan Bernstein  &lt;mitz@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         &lt;rdar://problem/18531395&gt; REGRESSION (r173272): Crash in ResourceResponse::platformSuggestedFilename() when called on the null response
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSFontFaceRuleh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSFontFaceRule.h (174252 => 174253)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSFontFaceRule.h        2014-10-03 00:37:47 UTC (rev 174252)
+++ trunk/Source/WebCore/css/CSSFontFaceRule.h        2014-10-03 01:40:12 UTC (rev 174253)
</span><span class="lines">@@ -51,4 +51,6 @@
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><ins>+SPECIALIZE_TYPE_TRAITS_CSS_RULE(CSSFontFaceRule, CSSRule::FONT_FACE_RULE)
+
</ins><span class="cx"> #endif // CSSFontFaceRule_h
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSImportRuleh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSImportRule.h (174252 => 174253)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSImportRule.h        2014-10-03 00:37:47 UTC (rev 174252)
+++ trunk/Source/WebCore/css/CSSImportRule.h        2014-10-03 01:40:12 UTC (rev 174253)
</span><span class="lines">@@ -53,8 +53,8 @@
</span><span class="cx">     mutable RefPtr&lt;CSSStyleSheet&gt; m_styleSheetCSSOMWrapper;
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-CSS_RULE_TYPE_CASTS(CSSImportRule, CSSRule::IMPORT_RULE)
-
</del><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><ins>+SPECIALIZE_TYPE_TRAITS_CSS_RULE(CSSImportRule, CSSRule::IMPORT_RULE)
+
</ins><span class="cx"> #endif // CSSImportRule_h
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSMediaRuleh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSMediaRule.h (174252 => 174253)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSMediaRule.h        2014-10-03 00:37:47 UTC (rev 174252)
+++ trunk/Source/WebCore/css/CSSMediaRule.h        2014-10-03 01:40:12 UTC (rev 174253)
</span><span class="lines">@@ -50,8 +50,8 @@
</span><span class="cx">     mutable RefPtr&lt;MediaList&gt; m_mediaCSSOMWrapper;
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-CSS_RULE_TYPE_CASTS(CSSMediaRule, CSSRule::MEDIA_RULE)
-
</del><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><ins>+SPECIALIZE_TYPE_TRAITS_CSS_RULE(CSSMediaRule, CSSRule::MEDIA_RULE)
+
</ins><span class="cx"> #endif // CSSMediaRule_h
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSRuleh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSRule.h (174252 => 174253)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSRule.h        2014-10-03 00:37:47 UTC (rev 174252)
+++ trunk/Source/WebCore/css/CSSRule.h        2014-10-03 01:40:12 UTC (rev 174253)
</span><span class="lines">@@ -24,6 +24,7 @@
</span><span class="cx"> #define CSSRule_h
</span><span class="cx"> 
</span><span class="cx"> #include &lt;wtf/RefCounted.h&gt;
</span><ins>+#include &lt;wtf/TypeCasts.h&gt;
</ins><span class="cx"> #include &lt;wtf/text/WTFString.h&gt;
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -112,9 +113,11 @@
</span><span class="cx">     };
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-#define CSS_RULE_TYPE_CASTS(ToValueTypeName, predicate) \
-    TYPE_CASTS_BASE(ToValueTypeName, CSSRule, rule, rule-&gt;type() == predicate, rule.type() == predicate)
-
</del><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><ins>+#define SPECIALIZE_TYPE_TRAITS_CSS_RULE(ToValueTypeName, predicate) \
+SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::ToValueTypeName) \
+    static bool isType(const WebCore::CSSRule&amp; rule) { return rule.type() == WebCore::predicate; } \
+SPECIALIZE_TYPE_TRAITS_END()
+
</ins><span class="cx"> #endif // CSSRule_h
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSStyleRuleh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSStyleRule.h (174252 => 174253)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSStyleRule.h        2014-10-03 00:37:47 UTC (rev 174252)
+++ trunk/Source/WebCore/css/CSSStyleRule.h        2014-10-03 01:40:12 UTC (rev 174253)
</span><span class="lines">@@ -57,8 +57,8 @@
</span><span class="cx">     RefPtr&lt;StyleRuleCSSStyleDeclaration&gt; m_propertiesCSSOMWrapper;
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-CSS_RULE_TYPE_CASTS(CSSStyleRule, CSSRule::STYLE_RULE)
-
</del><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><ins>+SPECIALIZE_TYPE_TRAITS_CSS_RULE(CSSStyleRule, CSSRule::STYLE_RULE)
+
</ins><span class="cx"> #endif // CSSStyleRule_h
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSSupportsRuleh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSSupportsRule.h (174252 => 174253)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSSupportsRule.h        2014-10-03 00:37:47 UTC (rev 174252)
+++ trunk/Source/WebCore/css/CSSSupportsRule.h        2014-10-03 01:40:12 UTC (rev 174253)
</span><span class="lines">@@ -56,10 +56,10 @@
</span><span class="cx">     CSSSupportsRule(StyleRuleSupports*, CSSStyleSheet*);
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-CSS_RULE_TYPE_CASTS(CSSSupportsRule, CSSRule::SUPPORTS_RULE)
-
</del><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><ins>+SPECIALIZE_TYPE_TRAITS_CSS_RULE(CSSSupportsRule, CSSRule::SUPPORTS_RULE)
+
</ins><span class="cx"> #endif // ENABLE(CSS3_CONDITIONAL_RULES)
</span><span class="cx"> 
</span><span class="cx"> #endif // CSSSupportsRule_h
</span></span></pre></div>
<a id="trunkSourceWebCorecssInspectorCSSOMWrapperscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/InspectorCSSOMWrappers.cpp (174252 => 174253)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/InspectorCSSOMWrappers.cpp        2014-10-03 00:37:47 UTC (rev 174252)
+++ trunk/Source/WebCore/css/InspectorCSSOMWrappers.cpp        2014-10-03 01:40:12 UTC (rev 174253)
</span><span class="lines">@@ -58,23 +58,23 @@
</span><span class="cx">         CSSRule* cssRule = listType-&gt;item(i);
</span><span class="cx">         switch (cssRule-&gt;type()) {
</span><span class="cx">         case CSSRule::IMPORT_RULE:
</span><del>-            collect(toCSSImportRule(cssRule)-&gt;styleSheet());
</del><ins>+            collect(downcast&lt;CSSImportRule&gt;(*cssRule).styleSheet());
</ins><span class="cx">             break;
</span><span class="cx">         case CSSRule::MEDIA_RULE:
</span><del>-            collect(toCSSMediaRule(cssRule));
</del><ins>+            collect(downcast&lt;CSSMediaRule&gt;(cssRule));
</ins><span class="cx">             break;
</span><span class="cx"> #if ENABLE(CSS3_CONDITIONAL_RULES)
</span><span class="cx">         case CSSRule::SUPPORTS_RULE:
</span><del>-            collect(toCSSSupportsRule(cssRule));
</del><ins>+            collect(downcast&lt;CSSSupportsRule&gt;(cssRule));
</ins><span class="cx">             break;
</span><span class="cx"> #endif
</span><span class="cx"> #if ENABLE(CSS_REGIONS)
</span><span class="cx">         case CSSRule::WEBKIT_REGION_RULE:
</span><del>-            collect(toWebKitCSSRegionRule(cssRule));
</del><ins>+            collect(downcast&lt;WebKitCSSRegionRule&gt;(cssRule));
</ins><span class="cx">             break;
</span><span class="cx"> #endif
</span><span class="cx">         case CSSRule::STYLE_RULE:
</span><del>-            m_styleRuleToCSSOMWrapperMap.add(toCSSStyleRule(cssRule)-&gt;styleRule(), toCSSStyleRule(cssRule));
</del><ins>+            m_styleRuleToCSSOMWrapperMap.add(downcast&lt;CSSStyleRule&gt;(*cssRule).styleRule(), downcast&lt;CSSStyleRule&gt;(cssRule));
</ins><span class="cx">             break;
</span><span class="cx">         default:
</span><span class="cx">             break;
</span></span></pre></div>
<a id="trunkSourceWebCorecssWebKitCSSKeyframesRuleh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/WebKitCSSKeyframesRule.h (174252 => 174253)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/WebKitCSSKeyframesRule.h        2014-10-03 00:37:47 UTC (rev 174252)
+++ trunk/Source/WebCore/css/WebKitCSSKeyframesRule.h        2014-10-03 01:40:12 UTC (rev 174253)
</span><span class="lines">@@ -99,4 +99,6 @@
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><ins>+SPECIALIZE_TYPE_TRAITS_CSS_RULE(WebKitCSSKeyframesRule, CSSRule::WEBKIT_KEYFRAMES_RULE)
+
</ins><span class="cx"> #endif // WebKitCSSKeyframesRule_h
</span></span></pre></div>
<a id="trunkSourceWebCorecssWebKitCSSRegionRuleh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/WebKitCSSRegionRule.h (174252 => 174253)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/WebKitCSSRegionRule.h        2014-10-03 00:37:47 UTC (rev 174252)
+++ trunk/Source/WebCore/css/WebKitCSSRegionRule.h        2014-10-03 01:40:12 UTC (rev 174253)
</span><span class="lines">@@ -50,9 +50,9 @@
</span><span class="cx">     WebKitCSSRegionRule(StyleRuleRegion*, CSSStyleSheet* parent);
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-CSS_RULE_TYPE_CASTS(WebKitCSSRegionRule, CSSRule::WEBKIT_REGION_RULE)
</del><ins>+} // namespace WebCore
</ins><span class="cx"> 
</span><del>-}
</del><ins>+SPECIALIZE_TYPE_TRAITS_CSS_RULE(WebKitCSSRegionRule, CSSRule::WEBKIT_REGION_RULE)
</ins><span class="cx"> 
</span><span class="cx"> #endif // ENABLE(CSS_REGIONS)
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorCSSAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorCSSAgent.cpp (174252 => 174253)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorCSSAgent.cpp        2014-10-03 00:37:47 UTC (rev 174252)
+++ trunk/Source/WebCore/inspector/InspectorCSSAgent.cpp        2014-10-03 01:40:12 UTC (rev 174253)
</span><span class="lines">@@ -427,11 +427,11 @@
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> // static
</span><del>-CSSStyleRule* InspectorCSSAgent::asCSSStyleRule(CSSRule* rule)
</del><ins>+CSSStyleRule* InspectorCSSAgent::asCSSStyleRule(CSSRule&amp; rule)
</ins><span class="cx"> {
</span><del>-    if (rule-&gt;type() != CSSRule::STYLE_RULE)
</del><ins>+    if (!is&lt;CSSStyleRule&gt;(rule))
</ins><span class="cx">         return nullptr;
</span><del>-    return toCSSStyleRule(rule);
</del><ins>+    return downcast&lt;CSSStyleRule&gt;(&amp;rule);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> InspectorCSSAgent::InspectorCSSAgent(InstrumentingAgents* instrumentingAgents, InspectorDOMAgent* domAgent)
</span><span class="lines">@@ -918,9 +918,8 @@
</span><span class="cx">     result-&gt;addItem(inspectorStyleSheet-&gt;buildObjectForStyleSheetInfo());
</span><span class="cx">     for (unsigned i = 0, size = styleSheet-&gt;length(); i &lt; size; ++i) {
</span><span class="cx">         CSSRule* rule = styleSheet-&gt;item(i);
</span><del>-        if (rule-&gt;type() == CSSRule::IMPORT_RULE) {
-            CSSStyleSheet* importedStyleSheet = toCSSImportRule(rule)-&gt;styleSheet();
-            if (importedStyleSheet)
</del><ins>+        if (is&lt;CSSImportRule&gt;(*rule)) {
+            if (CSSStyleSheet* importedStyleSheet = downcast&lt;CSSImportRule&gt;(*rule).styleSheet())
</ins><span class="cx">                 collectStyleSheets(importedStyleSheet, result);
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="lines">@@ -1046,7 +1045,7 @@
</span><span class="cx">         return result.release();
</span><span class="cx"> 
</span><span class="cx">     for (unsigned i = 0, size = ruleList-&gt;length(); i &lt; size; ++i) {
</span><del>-        CSSStyleRule* rule = asCSSStyleRule(ruleList-&gt;item(i));
</del><ins>+        CSSStyleRule* rule = asCSSStyleRule(*ruleList-&gt;item(i));
</ins><span class="cx">         RefPtr&lt;Inspector::Protocol::CSS::CSSRule&gt; ruleObject = buildObjectForRule(rule);
</span><span class="cx">         if (!ruleObject)
</span><span class="cx">             continue;
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorCSSAgenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorCSSAgent.h (174252 => 174253)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorCSSAgent.h        2014-10-03 00:37:47 UTC (rev 174252)
+++ trunk/Source/WebCore/inspector/InspectorCSSAgent.h        2014-10-03 01:40:12 UTC (rev 174253)
</span><span class="lines">@@ -92,7 +92,7 @@
</span><span class="cx">     InspectorCSSAgent(InstrumentingAgents*, InspectorDOMAgent*);
</span><span class="cx">     ~InspectorCSSAgent();
</span><span class="cx"> 
</span><del>-    static CSSStyleRule* asCSSStyleRule(CSSRule*);
</del><ins>+    static CSSStyleRule* asCSSStyleRule(CSSRule&amp;);
</ins><span class="cx"> 
</span><span class="cx">     bool forcePseudoState(Element*, CSSSelector::PseudoClassType);
</span><span class="cx">     virtual void didCreateFrontendAndBackend(Inspector::InspectorFrontendChannel*, Inspector::InspectorBackendDispatcher*) override;
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorStyleSheetcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp (174252 => 174253)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp        2014-10-03 00:37:47 UTC (rev 174252)
+++ trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp        2014-10-03 01:40:12 UTC (rev 174253)
</span><span class="lines">@@ -214,15 +214,15 @@
</span><span class="cx">     if (!rule)
</span><span class="cx">         return nullptr;
</span><span class="cx"> 
</span><del>-    if (rule-&gt;type() == CSSRule::MEDIA_RULE)
-        return &amp;toCSSMediaRule(rule)-&gt;cssRules();
</del><ins>+    if (is&lt;CSSMediaRule&gt;(*rule))
+        return &amp;downcast&lt;CSSMediaRule&gt;(*rule).cssRules();
</ins><span class="cx"> 
</span><del>-    if (rule-&gt;type() == CSSRule::WEBKIT_KEYFRAMES_RULE)
-        return &amp;static_cast&lt;WebKitCSSKeyframesRule*&gt;(rule)-&gt;cssRules();
</del><ins>+    if (is&lt;WebKitCSSKeyframesRule&gt;(*rule))
+        return &amp;downcast&lt;WebKitCSSKeyframesRule&gt;(*rule).cssRules();
</ins><span class="cx"> 
</span><span class="cx"> #if ENABLE(CSS3_CONDITIONAL_RULES)
</span><del>-    if (rule-&gt;type() == CSSRule::SUPPORTS_RULE)
-        return &amp;toCSSSupportsRule(rule)-&gt;cssRules();
</del><ins>+    if (is&lt;CSSSupportsRule&gt;(*rule))
+        return &amp;downcast&lt;CSSSupportsRule&gt;(*rule).cssRules();
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     return nullptr;
</span><span class="lines">@@ -236,14 +236,14 @@
</span><span class="cx">     while (parentRule) {
</span><span class="cx">         CSSStyleSheet* parentStyleSheet = nullptr;
</span><span class="cx">         bool isMediaRule = true;
</span><del>-        if (parentRule-&gt;type() == CSSRule::MEDIA_RULE) {
-            CSSMediaRule* mediaRule = toCSSMediaRule(parentRule);
-            mediaList = mediaRule-&gt;media();
-            parentStyleSheet = mediaRule-&gt;parentStyleSheet();
-        } else if (parentRule-&gt;type() == CSSRule::IMPORT_RULE) {
-            CSSImportRule* importRule = toCSSImportRule(parentRule);
-            mediaList = &amp;importRule-&gt;media();
-            parentStyleSheet = importRule-&gt;parentStyleSheet();
</del><ins>+        if (is&lt;CSSMediaRule&gt;(*parentRule)) {
+            CSSMediaRule&amp; mediaRule = downcast&lt;CSSMediaRule&gt;(*parentRule);
+            mediaList = mediaRule.media();
+            parentStyleSheet = mediaRule.parentStyleSheet();
+        } else if (is&lt;CSSImportRule&gt;(*parentRule)) {
+            CSSImportRule&amp; importRule = downcast&lt;CSSImportRule&gt;(*parentRule);
+            mediaList = &amp;importRule.media();
+            parentStyleSheet = importRule.parentStyleSheet();
</ins><span class="cx">             isMediaRule = false;
</span><span class="cx">         } else
</span><span class="cx">             mediaList = nullptr;
</span><span class="lines">@@ -892,7 +892,7 @@
</span><span class="cx">     CSSRule* rule = m_pageStyleSheet-&gt;item(lastRuleIndex);
</span><span class="cx">     ASSERT(rule);
</span><span class="cx"> 
</span><del>-    CSSStyleRule* styleRule = InspectorCSSAgent::asCSSStyleRule(rule);
</del><ins>+    CSSStyleRule* styleRule = InspectorCSSAgent::asCSSStyleRule(*rule);
</ins><span class="cx">     if (!styleRule) {
</span><span class="cx">         // What we just added has to be a CSSStyleRule - we cannot handle other types of rules yet.
</span><span class="cx">         // If it is not a style rule, pretend we never touched the stylesheet.
</span><span class="lines">@@ -1421,7 +1421,7 @@
</span><span class="cx"> 
</span><span class="cx">     for (unsigned i = 0, size = ruleList-&gt;length(); i &lt; size; ++i) {
</span><span class="cx">         CSSRule* rule = ruleList-&gt;item(i);
</span><del>-        CSSStyleRule* styleRule = InspectorCSSAgent::asCSSStyleRule(rule);
</del><ins>+        CSSStyleRule* styleRule = InspectorCSSAgent::asCSSStyleRule(*rule);
</ins><span class="cx">         if (styleRule)
</span><span class="cx">             result-&gt;append(styleRule);
</span><span class="cx">         else {
</span></span></pre></div>
<a id="trunkSourceWebCorepagePageSerializercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/PageSerializer.cpp (174252 => 174253)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/PageSerializer.cpp        2014-10-03 00:37:47 UTC (rev 174252)
+++ trunk/Source/WebCore/page/PageSerializer.cpp        2014-10-03 01:40:12 UTC (rev 174253)
</span><span class="lines">@@ -31,6 +31,7 @@
</span><span class="cx"> #include &quot;config.h&quot;
</span><span class="cx"> #include &quot;PageSerializer.h&quot;
</span><span class="cx"> 
</span><ins>+#include &quot;CSSFontFaceRule.h&quot;
</ins><span class="cx"> #include &quot;CSSImageValue.h&quot;
</span><span class="cx"> #include &quot;CSSImportRule.h&quot;
</span><span class="cx"> #include &quot;CSSStyleRule.h&quot;
</span><span class="lines">@@ -265,17 +266,17 @@
</span><span class="cx">         }
</span><span class="cx">         Document* document = styleSheet-&gt;ownerDocument();
</span><span class="cx">         // Some rules have resources associated with them that we need to retrieve.
</span><del>-        if (rule-&gt;type() == CSSRule::IMPORT_RULE) {
-            CSSImportRule* importRule = toCSSImportRule(rule);
-            URL importURL = document-&gt;completeURL(importRule-&gt;href());
</del><ins>+        if (is&lt;CSSImportRule&gt;(*rule)) {
+            CSSImportRule&amp; importRule = downcast&lt;CSSImportRule&gt;(*rule);
+            URL importURL = document-&gt;completeURL(importRule.href());
</ins><span class="cx">             if (m_resourceURLs.contains(importURL))
</span><span class="cx">                 continue;
</span><del>-            serializeCSSStyleSheet(importRule-&gt;styleSheet(), importURL);
-        } else if (rule-&gt;type() == CSSRule::FONT_FACE_RULE) {
</del><ins>+            serializeCSSStyleSheet(importRule.styleSheet(), importURL);
+        } else if (is&lt;CSSFontFaceRule&gt;(*rule)) {
</ins><span class="cx">             // FIXME: Add support for font face rule. It is not clear to me at this point if the actual otf/eot file can
</span><span class="cx">             // be retrieved from the CSSFontFaceRule object.
</span><del>-        } else if (rule-&gt;type() == CSSRule::STYLE_RULE)
-            retrieveResourcesForRule(toCSSStyleRule(rule)-&gt;styleRule(), document);
</del><ins>+        } else if (is&lt;CSSStyleRule&gt;(*rule))
+            retrieveResourcesForRule(downcast&lt;CSSStyleRule&gt;(*rule).styleRule(), document);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (url.isValid() &amp;&amp; !m_resourceURLs.contains(url)) {
</span></span></pre>
</div>
</div>

</body>
</html>