Title: [146760] trunk/Source/WebCore
Revision
146760
Author
apav...@chromium.org
Date
2013-03-25 05:55:30 -0700 (Mon, 25 Mar 2013)

Log Message

Web Inspector: Properly handle the rule addition to an XML or SVG document.
https://bugs.webkit.org/show_bug.cgi?id=113185

Reviewed by Pavel Feldman.

* inspector/InspectorCSSAgent.cpp:
(WebCore::InspectorCSSAgent::viaInspectorStyleSheet):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (146759 => 146760)


--- trunk/Source/WebCore/ChangeLog	2013-03-25 12:38:46 UTC (rev 146759)
+++ trunk/Source/WebCore/ChangeLog	2013-03-25 12:55:30 UTC (rev 146760)
@@ -1,3 +1,13 @@
+2013-03-25  Alexander Pavlov  <apav...@chromium.org>
+
+        Web Inspector: Properly handle the rule addition to an XML or SVG document.
+        https://bugs.webkit.org/show_bug.cgi?id=113185
+
+        Reviewed by Pavel Feldman.
+
+        * inspector/InspectorCSSAgent.cpp:
+        (WebCore::InspectorCSSAgent::viaInspectorStyleSheet):
+
 2013-03-25  Peter Rybin  <pry...@chromium.org>
 
         Web Inspector: support changing local variables in frontend

Modified: trunk/Source/WebCore/inspector/InspectorCSSAgent.cpp (146759 => 146760)


--- trunk/Source/WebCore/inspector/InspectorCSSAgent.cpp	2013-03-25 12:38:46 UTC (rev 146759)
+++ trunk/Source/WebCore/inspector/InspectorCSSAgent.cpp	2013-03-25 12:55:30 UTC (rev 146760)
@@ -51,6 +51,7 @@
 #include "Node.h"
 #include "NodeList.h"
 #include "RenderRegion.h"
+#include "SVGStyleElement.h"
 #include "StylePropertySet.h"
 #include "StylePropertyShorthand.h"
 #include "StyleResolver.h"
@@ -1058,6 +1059,9 @@
         return 0;
     }
 
+    if (!document->isHTMLDocument() && !document->isSVGDocument())
+        return 0;
+
     RefPtr<InspectorStyleSheet> inspectorStyleSheet = m_documentToInspectorStyleSheet.get(document);
     if (inspectorStyleSheet || !createIfAbsent)
         return inspectorStyleSheet.get();
@@ -1082,12 +1086,12 @@
     if (ec)
         return 0;
 
-    HTMLElement* htmlElement = toHTMLElement(styleElement.get());
-    if (!htmlElement || !htmlElement->hasTagName(HTMLNames::styleTag))
-        return 0;
+    CSSStyleSheet* cssStyleSheet = 0;
+    if (styleElement->isHTMLElement())
+        cssStyleSheet = static_cast<HTMLStyleElement*>(styleElement.get())->sheet();
+    else if (styleElement->isSVGElement())
+        cssStyleSheet = static_cast<SVGStyleElement*>(styleElement.get())->sheet();
 
-    HTMLStyleElement* htmlStyleElement = static_cast<HTMLStyleElement*>(htmlElement);
-    CSSStyleSheet* cssStyleSheet = htmlStyleElement->sheet();
     if (!cssStyleSheet)
         return 0;
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to