Title: [97508] trunk/Source/WebCore
- Revision
- 97508
- Author
- [email protected]
- Date
- 2011-10-14 14:33:49 -0700 (Fri, 14 Oct 2011)
Log Message
Inspector: Remove StyleBase usage.
https://bugs.webkit.org/show_bug.cgi?id=70138
Reviewed by Antti Koivisto.
Be fully specific about whether we're operating on a CSSRule or
a CSSStyleSheet.
No behavior change expected, this merely is a cleanup.
* inspector/InspectorCSSAgent.cpp:
(WebCore::InspectorCSSAgent::parentStyleSheet):
(WebCore::InspectorCSSAgent::asCSSStyleRule):
* inspector/InspectorCSSAgent.h:
* inspector/InspectorStyleSheet.cpp:
(WebCore::asCSSRuleList):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (97507 => 97508)
--- trunk/Source/WebCore/ChangeLog 2011-10-14 21:25:11 UTC (rev 97507)
+++ trunk/Source/WebCore/ChangeLog 2011-10-14 21:33:49 UTC (rev 97508)
@@ -1,3 +1,22 @@
+2011-10-14 Andreas Kling <[email protected]>
+
+ Inspector: Remove StyleBase usage.
+ https://bugs.webkit.org/show_bug.cgi?id=70138
+
+ Reviewed by Antti Koivisto.
+
+ Be fully specific about whether we're operating on a CSSRule or
+ a CSSStyleSheet.
+
+ No behavior change expected, this merely is a cleanup.
+
+ * inspector/InspectorCSSAgent.cpp:
+ (WebCore::InspectorCSSAgent::parentStyleSheet):
+ (WebCore::InspectorCSSAgent::asCSSStyleRule):
+ * inspector/InspectorCSSAgent.h:
+ * inspector/InspectorStyleSheet.cpp:
+ (WebCore::asCSSRuleList):
+
2011-10-14 Mark Hahnenberg <[email protected]>
Rename virtual deleteProperty to deletePropertyVirtual
Modified: trunk/Source/WebCore/inspector/InspectorCSSAgent.cpp (97507 => 97508)
--- trunk/Source/WebCore/inspector/InspectorCSSAgent.cpp 2011-10-14 21:25:11 UTC (rev 97507)
+++ trunk/Source/WebCore/inspector/InspectorCSSAgent.cpp 2011-10-14 21:33:49 UTC (rev 97508)
@@ -168,12 +168,12 @@
}
// static
-CSSStyleSheet* InspectorCSSAgent::parentStyleSheet(StyleBase* styleBase)
+CSSStyleSheet* InspectorCSSAgent::parentStyleSheet(CSSRule* rule)
{
- if (!styleBase)
+ if (!rule)
return 0;
- StyleSheet* styleSheet = styleBase->stylesheet();
+ StyleSheet* styleSheet = rule->stylesheet();
if (styleSheet && styleSheet->isCSSStyleSheet())
return static_cast<CSSStyleSheet*>(styleSheet);
@@ -181,11 +181,9 @@
}
// static
-CSSStyleRule* InspectorCSSAgent::asCSSStyleRule(StyleBase* styleBase)
+CSSStyleRule* InspectorCSSAgent::asCSSStyleRule(CSSRule* rule)
{
- if (!styleBase->isStyleRule())
- return 0;
- CSSRule* rule = static_cast<CSSRule*>(styleBase);
+ // NOTE: CSSPageRule inherits from CSSStyleRule, so isStyleRule() is not enough.
if (rule->type() != CSSRule::STYLE_RULE)
return 0;
return static_cast<CSSStyleRule*>(rule);
Modified: trunk/Source/WebCore/inspector/InspectorCSSAgent.h (97507 => 97508)
--- trunk/Source/WebCore/inspector/InspectorCSSAgent.h 2011-10-14 21:25:11 UTC (rev 97507)
+++ trunk/Source/WebCore/inspector/InspectorCSSAgent.h 2011-10-14 21:33:49 UTC (rev 97508)
@@ -48,15 +48,14 @@
class InstrumentingAgents;
class NameNodeMap;
class Node;
-class StyleBase;
#if ENABLE(INSPECTOR)
class InspectorCSSAgent : public InspectorDOMAgent::DOMListener {
WTF_MAKE_NONCOPYABLE(InspectorCSSAgent);
public:
- static CSSStyleSheet* parentStyleSheet(StyleBase*);
- static CSSStyleRule* asCSSStyleRule(StyleBase*);
+ static CSSStyleSheet* parentStyleSheet(CSSRule*);
+ static CSSStyleRule* asCSSStyleRule(CSSRule*);
InspectorCSSAgent(InstrumentingAgents*, InspectorDOMAgent*);
~InspectorCSSAgent();
Modified: trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp (97507 => 97508)
--- trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp 2011-10-14 21:25:11 UTC (rev 97507)
+++ trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp 2011-10-14 21:33:49 UTC (rev 97508)
@@ -110,32 +110,25 @@
return result.release();
}
-static PassRefPtr<CSSRuleList> asCSSRuleList(StyleBase* styleBase)
+static PassRefPtr<CSSRuleList> asCSSRuleList(CSSStyleSheet* styleSheet)
{
- if (!styleBase)
+ if (!styleSheet)
return 0;
- if (styleBase->isCSSStyleSheet())
- return CSSRuleList::create(static_cast<CSSStyleSheet*>(styleBase), true);
- if (styleBase->isRule()) {
- unsigned ruleType = static_cast<CSSRule*>(styleBase)->type();
- RefPtr<CSSRuleList> result = 0;
+ return CSSRuleList::create(styleSheet, true);
+}
- switch (ruleType) {
- case CSSRule::MEDIA_RULE:
- result = static_cast<CSSMediaRule*>(styleBase)->cssRules();
- break;
- case CSSRule::WEBKIT_KEYFRAMES_RULE:
- result = static_cast<WebKitCSSKeyframesRule*>(styleBase)->cssRules();
- break;
- case CSSRule::IMPORT_RULE:
- case CSSRule::PAGE_RULE:
- default:
- return 0;
- }
+static PassRefPtr<CSSRuleList> asCSSRuleList(CSSRule* rule)
+{
+ if (!rule)
+ return 0;
- return result.release();
- }
+ if (rule->isMediaRule())
+ return static_cast<CSSMediaRule*>(rule)->cssRules();
+
+ if (rule->isKeyframesRule())
+ return static_cast<WebKitCSSKeyframesRule*>(rule)->cssRules();
+
return 0;
}
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes