Title: [100251] trunk
Revision
100251
Author
apav...@chromium.org
Date
2011-11-15 01:32:16 -0800 (Tue, 15 Nov 2011)

Log Message

Web Inspector: [Crash] Crash when inspecting namespaced SVG styled via element names
https://bugs.webkit.org/show_bug.cgi?id=72261

Reviewed by Pavel Feldman.

Source/WebCore:

Test: inspector/styles/svg-style.xhtml

* inspector/InspectorStyleSheet.cpp:
(WebCore::InspectorStyleSheet::inlineStyleSheetText):

LayoutTests:

* inspector/styles/svg-style-expected.txt: Added.
* inspector/styles/svg-style.xhtml: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (100250 => 100251)


--- trunk/LayoutTests/ChangeLog	2011-11-15 09:24:01 UTC (rev 100250)
+++ trunk/LayoutTests/ChangeLog	2011-11-15 09:32:16 UTC (rev 100251)
@@ -1,3 +1,13 @@
+2011-11-14  Alexander Pavlov  <apav...@chromium.org>
+
+        Web Inspector: [Crash] Crash when inspecting namespaced SVG styled via element names
+        https://bugs.webkit.org/show_bug.cgi?id=72261
+
+        Reviewed by Pavel Feldman.
+
+        * inspector/styles/svg-style-expected.txt: Added.
+        * inspector/styles/svg-style.xhtml: Added.
+
 2011-11-15  Czene Tamás  <tcz...@inf.u-szeged.hu>
 
         [Qt] Platform-specific result for r100157.

Added: trunk/LayoutTests/inspector/styles/svg-style-expected.txt (0 => 100251)


--- trunk/LayoutTests/inspector/styles/svg-style-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/inspector/styles/svg-style-expected.txt	2011-11-15 09:32:16 UTC (rev 100251)
@@ -0,0 +1,14 @@
+Tests that svg:style does not crash when the related element is inspected.
+
+ Main style:
+[expanded] 
+element.style  { ()
+
+======== Matched CSS Rules ========
+[expanded] 
+media="all" (svg-style.xhtml)
+rect  { (svg-style.xhtml:30)
+fill: red;
+
+
+
Property changes on: trunk/LayoutTests/inspector/styles/svg-style-expected.txt
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/inspector/styles/svg-style.xhtml (0 => 100251)


--- trunk/LayoutTests/inspector/styles/svg-style.xhtml	                        (rev 0)
+++ trunk/LayoutTests/inspector/styles/svg-style.xhtml	2011-11-15 09:32:16 UTC (rev 100251)
@@ -0,0 +1,36 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+
+<script src=""
+<script src=""
+<script>
+
+function test()
+{
+    InspectorTest.selectNodeAndWaitForStyles("main", step1);
+
+    function step1()
+    {
+        InspectorTest.addResult("Main style:");
+        InspectorTest.dumpSelectedElementStyles(true, false, true);
+        InspectorTest.completeTest();
+    }
+}
+</script>
+</head>
+
+<body _onload_="runTest()">
+<p>
+Tests that svg:style does not crash when the related element is inspected.
+</p>
+
+<svg:svg xmlns:svg="http://www.w3.org/2000/svg" version="1.1">
+   <svg:defs>
+      <svg:style type="text/css">
+         rect {fill: red}
+      </svg:style>
+   </svg:defs>
+   <svg:rect id="main" width="100" height="100"/>
+</svg:svg>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (100250 => 100251)


--- trunk/Source/WebCore/ChangeLog	2011-11-15 09:24:01 UTC (rev 100250)
+++ trunk/Source/WebCore/ChangeLog	2011-11-15 09:32:16 UTC (rev 100251)
@@ -1,3 +1,15 @@
+2011-11-14  Alexander Pavlov  <apav...@chromium.org>
+
+        Web Inspector: [Crash] Crash when inspecting namespaced SVG styled via element names
+        https://bugs.webkit.org/show_bug.cgi?id=72261
+
+        Reviewed by Pavel Feldman.
+
+        Test: inspector/styles/svg-style.xhtml
+
+        * inspector/InspectorStyleSheet.cpp:
+        (WebCore::InspectorStyleSheet::inlineStyleSheetText):
+
 2011-11-15  Kent Tamura  <tk...@chromium.org>
 
         [V8] Fix incorrect handling of _javascript_ properties in DOMStringMap

Modified: trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp (100250 => 100251)


--- trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp	2011-11-15 09:24:01 UTC (rev 100250)
+++ trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp	2011-11-15 09:32:16 UTC (rev 100251)
@@ -39,11 +39,13 @@
 #include "Document.h"
 #include "Element.h"
 #include "HTMLHeadElement.h"
+#include "HTMLNames.h"
 #include "HTMLParserIdioms.h"
 #include "InspectorCSSAgent.h"
 #include "InspectorPageAgent.h"
 #include "InspectorValues.h"
 #include "Node.h"
+#include "SVGNames.h"
 #include "StyleSheetList.h"
 #include "WebKitCSSKeyframesRule.h"
 
@@ -1102,7 +1104,12 @@
     if (!ownerNode || ownerNode->nodeType() != Node::ELEMENT_NODE)
         return false;
     Element* ownerElement = static_cast<Element*>(ownerNode);
-    if (ownerElement->tagName().lower() != "style")
+
+    if (!ownerElement->hasTagName(HTMLNames::styleTag)
+#if ENABLE(SVG)
+        && !ownerElement->hasTagName(SVGNames::styleTag)
+#endif
+    )
         return false;
     *result = ownerElement->innerText();
     return true;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to