Title: [109333] trunk/Source/WebCore
Revision
109333
Author
[email protected]
Date
2012-03-01 04:21:26 -0800 (Thu, 01 Mar 2012)

Log Message

SVG <use> element allows invalid contents
https://bugs.webkit.org/show_bug.cgi?id=77764

Reviewed by Zoltan Herczeg.

Unbreak the world after r109299 - dozens of SVGUseElement tests fail in trunk because:
- text nodes weren't allowed in SVG shadow subtrees
- tagName matching ignores any prefixes, thus svg:circle fails to identify as SVGCircleElement

* svg/SVGUseElement.cpp:
(WebCore::isDisallowedElement):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (109332 => 109333)


--- trunk/Source/WebCore/ChangeLog	2012-03-01 11:43:41 UTC (rev 109332)
+++ trunk/Source/WebCore/ChangeLog	2012-03-01 12:21:26 UTC (rev 109333)
@@ -1,3 +1,17 @@
+2012-03-01  Nikolas Zimmermann  <[email protected]>
+
+        SVG <use> element allows invalid contents
+        https://bugs.webkit.org/show_bug.cgi?id=77764
+
+        Reviewed by Zoltan Herczeg.
+
+        Unbreak the world after r109299 - dozens of SVGUseElement tests fail in trunk because:
+        - text nodes weren't allowed in SVG shadow subtrees
+        - tagName matching ignores any prefixes, thus svg:circle fails to identify as SVGCircleElement
+
+        * svg/SVGUseElement.cpp:
+        (WebCore::isDisallowedElement):
+
 2012-03-01  Luke Macpherson   <[email protected]>
 
         Handle CSSPropertyWebkitHyphens in CSSStyleApplyProperty.

Modified: trunk/Source/WebCore/svg/SVGUseElement.cpp (109332 => 109333)


--- trunk/Source/WebCore/svg/SVGUseElement.cpp	2012-03-01 11:43:41 UTC (rev 109332)
+++ trunk/Source/WebCore/svg/SVGUseElement.cpp	2012-03-01 12:21:26 UTC (rev 109333)
@@ -282,7 +282,7 @@
     // "Graphics Element" is defined as 'circle', 'ellipse', 'image', 'line', 'path', 'polygon', 'polyline', 'rect', 'text'
     // Excluded are anything that is used by reference or that only make sense to appear once in a document.
     // We must also allow the shadow roots of other use elements.
-    if (node->isShadowRoot())
+    if (node->isShadowRoot() || node->isTextNode())
         return false;
 
     if (!node->isSVGElement())
@@ -290,31 +290,31 @@
 
     Element* element = static_cast<Element*>(node);
 
-    DEFINE_STATIC_LOCAL(HashSet<String>, allowedElementTags, ());
+    DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, allowedElementTags, ());
     if (allowedElementTags.isEmpty()) {
-        allowedElementTags.add(SVGNames::aTag.toString());
-        allowedElementTags.add(SVGNames::circleTag.toString());
-        allowedElementTags.add(SVGNames::descTag.toString());
-        allowedElementTags.add(SVGNames::ellipseTag.toString());
-        allowedElementTags.add(SVGNames::gTag.toString());
-        allowedElementTags.add(SVGNames::imageTag.toString());
-        allowedElementTags.add(SVGNames::lineTag.toString());
-        allowedElementTags.add(SVGNames::metadataTag.toString());
-        allowedElementTags.add(SVGNames::pathTag.toString());
-        allowedElementTags.add(SVGNames::polygonTag.toString());
-        allowedElementTags.add(SVGNames::polylineTag.toString());
-        allowedElementTags.add(SVGNames::rectTag.toString());
-        allowedElementTags.add(SVGNames::svgTag.toString());
-        allowedElementTags.add(SVGNames::switchTag.toString());
-        allowedElementTags.add(SVGNames::symbolTag.toString());
-        allowedElementTags.add(SVGNames::textTag.toString());
-        allowedElementTags.add(SVGNames::textPathTag.toString());
-        allowedElementTags.add(SVGNames::titleTag.toString());
-        allowedElementTags.add(SVGNames::trefTag.toString());
-        allowedElementTags.add(SVGNames::tspanTag.toString());
-        allowedElementTags.add(SVGNames::useTag.toString());
+        allowedElementTags.add(SVGNames::aTag);
+        allowedElementTags.add(SVGNames::circleTag);
+        allowedElementTags.add(SVGNames::descTag);
+        allowedElementTags.add(SVGNames::ellipseTag);
+        allowedElementTags.add(SVGNames::gTag);
+        allowedElementTags.add(SVGNames::imageTag);
+        allowedElementTags.add(SVGNames::lineTag);
+        allowedElementTags.add(SVGNames::metadataTag);
+        allowedElementTags.add(SVGNames::pathTag);
+        allowedElementTags.add(SVGNames::polygonTag);
+        allowedElementTags.add(SVGNames::polylineTag);
+        allowedElementTags.add(SVGNames::rectTag);
+        allowedElementTags.add(SVGNames::svgTag);
+        allowedElementTags.add(SVGNames::switchTag);
+        allowedElementTags.add(SVGNames::symbolTag);
+        allowedElementTags.add(SVGNames::textTag);
+        allowedElementTags.add(SVGNames::textPathTag);
+        allowedElementTags.add(SVGNames::titleTag);
+        allowedElementTags.add(SVGNames::trefTag);
+        allowedElementTags.add(SVGNames::tspanTag);
+        allowedElementTags.add(SVGNames::useTag);
     }
-    return !allowedElementTags.contains(element->tagName());
+    return !allowedElementTags.contains<QualifiedName, SVGAttributeHashTranslator>(element->tagQName());
 }
 
 static bool subtreeContainsDisallowedElement(Node* start)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to