<!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<>() / downcast<>() for CSSRule subclasses
https://bugs.webkit.org/show_bug.cgi?id=137364
Reviewed by Benjamin Poulain.
Use is<>() / downcast<>() 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 <cdumez@apple.com>
+
+ Use is<>() / downcast<>() for CSSRule subclasses
+ https://bugs.webkit.org/show_bug.cgi?id=137364
+
+ Reviewed by Benjamin Poulain.
+
+ Use is<>() / downcast<>() 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 <mitz@apple.com>
</span><span class="cx">
</span><span class="cx"> <rdar://problem/18531395> 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<CSSStyleSheet> 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<MediaList> 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 <wtf/RefCounted.h>
</span><ins>+#include <wtf/TypeCasts.h>
</ins><span class="cx"> #include <wtf/text/WTFString.h>
</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->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& 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<StyleRuleCSSStyleDeclaration> 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->item(i);
</span><span class="cx"> switch (cssRule->type()) {
</span><span class="cx"> case CSSRule::IMPORT_RULE:
</span><del>- collect(toCSSImportRule(cssRule)->styleSheet());
</del><ins>+ collect(downcast<CSSImportRule>(*cssRule).styleSheet());
</ins><span class="cx"> break;
</span><span class="cx"> case CSSRule::MEDIA_RULE:
</span><del>- collect(toCSSMediaRule(cssRule));
</del><ins>+ collect(downcast<CSSMediaRule>(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<CSSSupportsRule>(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<WebKitCSSRegionRule>(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)->styleRule(), toCSSStyleRule(cssRule));
</del><ins>+ m_styleRuleToCSSOMWrapperMap.add(downcast<CSSStyleRule>(*cssRule).styleRule(), downcast<CSSStyleRule>(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& rule)
</ins><span class="cx"> {
</span><del>- if (rule->type() != CSSRule::STYLE_RULE)
</del><ins>+ if (!is<CSSStyleRule>(rule))
</ins><span class="cx"> return nullptr;
</span><del>- return toCSSStyleRule(rule);
</del><ins>+ return downcast<CSSStyleRule>(&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->addItem(inspectorStyleSheet->buildObjectForStyleSheetInfo());
</span><span class="cx"> for (unsigned i = 0, size = styleSheet->length(); i < size; ++i) {
</span><span class="cx"> CSSRule* rule = styleSheet->item(i);
</span><del>- if (rule->type() == CSSRule::IMPORT_RULE) {
- CSSStyleSheet* importedStyleSheet = toCSSImportRule(rule)->styleSheet();
- if (importedStyleSheet)
</del><ins>+ if (is<CSSImportRule>(*rule)) {
+ if (CSSStyleSheet* importedStyleSheet = downcast<CSSImportRule>(*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->length(); i < size; ++i) {
</span><del>- CSSStyleRule* rule = asCSSStyleRule(ruleList->item(i));
</del><ins>+ CSSStyleRule* rule = asCSSStyleRule(*ruleList->item(i));
</ins><span class="cx"> RefPtr<Inspector::Protocol::CSS::CSSRule> 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&);
</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->type() == CSSRule::MEDIA_RULE)
- return &toCSSMediaRule(rule)->cssRules();
</del><ins>+ if (is<CSSMediaRule>(*rule))
+ return &downcast<CSSMediaRule>(*rule).cssRules();
</ins><span class="cx">
</span><del>- if (rule->type() == CSSRule::WEBKIT_KEYFRAMES_RULE)
- return &static_cast<WebKitCSSKeyframesRule*>(rule)->cssRules();
</del><ins>+ if (is<WebKitCSSKeyframesRule>(*rule))
+ return &downcast<WebKitCSSKeyframesRule>(*rule).cssRules();
</ins><span class="cx">
</span><span class="cx"> #if ENABLE(CSS3_CONDITIONAL_RULES)
</span><del>- if (rule->type() == CSSRule::SUPPORTS_RULE)
- return &toCSSSupportsRule(rule)->cssRules();
</del><ins>+ if (is<CSSSupportsRule>(*rule))
+ return &downcast<CSSSupportsRule>(*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->type() == CSSRule::MEDIA_RULE) {
- CSSMediaRule* mediaRule = toCSSMediaRule(parentRule);
- mediaList = mediaRule->media();
- parentStyleSheet = mediaRule->parentStyleSheet();
- } else if (parentRule->type() == CSSRule::IMPORT_RULE) {
- CSSImportRule* importRule = toCSSImportRule(parentRule);
- mediaList = &importRule->media();
- parentStyleSheet = importRule->parentStyleSheet();
</del><ins>+ if (is<CSSMediaRule>(*parentRule)) {
+ CSSMediaRule& mediaRule = downcast<CSSMediaRule>(*parentRule);
+ mediaList = mediaRule.media();
+ parentStyleSheet = mediaRule.parentStyleSheet();
+ } else if (is<CSSImportRule>(*parentRule)) {
+ CSSImportRule& importRule = downcast<CSSImportRule>(*parentRule);
+ mediaList = &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->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->length(); i < size; ++i) {
</span><span class="cx"> CSSRule* rule = ruleList->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->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 "config.h"
</span><span class="cx"> #include "PageSerializer.h"
</span><span class="cx">
</span><ins>+#include "CSSFontFaceRule.h"
</ins><span class="cx"> #include "CSSImageValue.h"
</span><span class="cx"> #include "CSSImportRule.h"
</span><span class="cx"> #include "CSSStyleRule.h"
</span><span class="lines">@@ -265,17 +266,17 @@
</span><span class="cx"> }
</span><span class="cx"> Document* document = styleSheet->ownerDocument();
</span><span class="cx"> // Some rules have resources associated with them that we need to retrieve.
</span><del>- if (rule->type() == CSSRule::IMPORT_RULE) {
- CSSImportRule* importRule = toCSSImportRule(rule);
- URL importURL = document->completeURL(importRule->href());
</del><ins>+ if (is<CSSImportRule>(*rule)) {
+ CSSImportRule& importRule = downcast<CSSImportRule>(*rule);
+ URL importURL = document->completeURL(importRule.href());
</ins><span class="cx"> if (m_resourceURLs.contains(importURL))
</span><span class="cx"> continue;
</span><del>- serializeCSSStyleSheet(importRule->styleSheet(), importURL);
- } else if (rule->type() == CSSRule::FONT_FACE_RULE) {
</del><ins>+ serializeCSSStyleSheet(importRule.styleSheet(), importURL);
+ } else if (is<CSSFontFaceRule>(*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->type() == CSSRule::STYLE_RULE)
- retrieveResourcesForRule(toCSSStyleRule(rule)->styleRule(), document);
</del><ins>+ } else if (is<CSSStyleRule>(*rule))
+ retrieveResourcesForRule(downcast<CSSStyleRule>(*rule).styleRule(), document);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (url.isValid() && !m_resourceURLs.contains(url)) {
</span></span></pre>
</div>
</div>
</body>
</html>