Title: [130780] trunk/Source/WebCore
Revision
130780
Author
fmal...@chromium.org
Date
2012-10-09 11:36:17 -0700 (Tue, 09 Oct 2012)

Log Message

SVGResources should use HashSet<AtomicString> instead of HashSet<AtomicStringImpl*>
https://bugs.webkit.org/show_bug.cgi?id=98683

Reviewed by Darin Adler.

Eric's notes:

SVGResources should use HashSet<AtomicString> instead of HashSet<AtomicStringImpl*>
They do basically the same thing, and the former is much more common (and less code). It's
also safe, on the off-chance that we're using AtomicStrings which might otherwise go away.

No new tests, refactoring.

* rendering/svg/SVGResources.cpp:
(WebCore::clipperFilterMaskerTags):
(WebCore::markerTags):
(WebCore::fillAndStrokeTags):
(WebCore::chainableResourceTags):
(WebCore::SVGResources::buildCachedResources):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (130779 => 130780)


--- trunk/Source/WebCore/ChangeLog	2012-10-09 18:09:28 UTC (rev 130779)
+++ trunk/Source/WebCore/ChangeLog	2012-10-09 18:36:17 UTC (rev 130780)
@@ -1,3 +1,25 @@
+2012-10-09  Florin Malita  <fmal...@chromium.org>
+
+        SVGResources should use HashSet<AtomicString> instead of HashSet<AtomicStringImpl*>
+        https://bugs.webkit.org/show_bug.cgi?id=98683
+
+        Reviewed by Darin Adler.
+
+        Eric's notes:
+
+        SVGResources should use HashSet<AtomicString> instead of HashSet<AtomicStringImpl*>
+        They do basically the same thing, and the former is much more common (and less code). It's
+        also safe, on the off-chance that we're using AtomicStrings which might otherwise go away.
+
+        No new tests, refactoring. 
+
+        * rendering/svg/SVGResources.cpp:
+        (WebCore::clipperFilterMaskerTags):
+        (WebCore::markerTags):
+        (WebCore::fillAndStrokeTags):
+        (WebCore::chainableResourceTags):
+        (WebCore::SVGResources::buildCachedResources):
+
 2012-10-09  Enrica Casucci  <enr...@apple.com>
 
         [chromium] fast/text/international/text-spliced-font.html and fast/writing-mode/Kusa-Makura-background-canvas.html

Modified: trunk/Source/WebCore/rendering/svg/SVGResources.cpp (130779 => 130780)


--- trunk/Source/WebCore/rendering/svg/SVGResources.cpp	2012-10-09 18:09:28 UTC (rev 130779)
+++ trunk/Source/WebCore/rendering/svg/SVGResources.cpp	2012-10-09 18:36:17 UTC (rev 130780)
@@ -44,46 +44,46 @@
 {
 }
 
-static HashSet<AtomicStringImpl*>& clipperFilterMaskerTags()
+static HashSet<AtomicString>& clipperFilterMaskerTags()
 {
-    DEFINE_STATIC_LOCAL(HashSet<AtomicStringImpl*>, s_tagList, ());
+    DEFINE_STATIC_LOCAL(HashSet<AtomicString>, s_tagList, ());
     if (s_tagList.isEmpty()) {
         // "container elements": http://www.w3.org/TR/SVG11/intro.html#TermContainerElement
         // "graphics elements" : http://www.w3.org/TR/SVG11/intro.html#TermGraphicsElement
-        s_tagList.add(SVGNames::aTag.localName().impl());
-        s_tagList.add(SVGNames::circleTag.localName().impl());
-        s_tagList.add(SVGNames::ellipseTag.localName().impl());
-        s_tagList.add(SVGNames::glyphTag.localName().impl());
-        s_tagList.add(SVGNames::gTag.localName().impl());
-        s_tagList.add(SVGNames::imageTag.localName().impl());
-        s_tagList.add(SVGNames::lineTag.localName().impl());
-        s_tagList.add(SVGNames::markerTag.localName().impl());
-        s_tagList.add(SVGNames::maskTag.localName().impl());
-        s_tagList.add(SVGNames::missing_glyphTag.localName().impl());
-        s_tagList.add(SVGNames::pathTag.localName().impl());
-        s_tagList.add(SVGNames::polygonTag.localName().impl());
-        s_tagList.add(SVGNames::polylineTag.localName().impl());
-        s_tagList.add(SVGNames::rectTag.localName().impl());
-        s_tagList.add(SVGNames::svgTag.localName().impl());
-        s_tagList.add(SVGNames::textTag.localName().impl());
-        s_tagList.add(SVGNames::useTag.localName().impl());
+        s_tagList.add(SVGNames::aTag.localName());
+        s_tagList.add(SVGNames::circleTag.localName());
+        s_tagList.add(SVGNames::ellipseTag.localName());
+        s_tagList.add(SVGNames::glyphTag.localName());
+        s_tagList.add(SVGNames::gTag.localName());
+        s_tagList.add(SVGNames::imageTag.localName());
+        s_tagList.add(SVGNames::lineTag.localName());
+        s_tagList.add(SVGNames::markerTag.localName());
+        s_tagList.add(SVGNames::maskTag.localName());
+        s_tagList.add(SVGNames::missing_glyphTag.localName());
+        s_tagList.add(SVGNames::pathTag.localName());
+        s_tagList.add(SVGNames::polygonTag.localName());
+        s_tagList.add(SVGNames::polylineTag.localName());
+        s_tagList.add(SVGNames::rectTag.localName());
+        s_tagList.add(SVGNames::svgTag.localName());
+        s_tagList.add(SVGNames::textTag.localName());
+        s_tagList.add(SVGNames::useTag.localName());
 
         // Not listed in the definitions is the clipPath element, the SVG spec says though:
         // The "clipPath" element or any of its children can specify property "clip-path".
         // So we have to add clipPathTag here, otherwhise clip-path on clipPath will fail.
         // (Already mailed SVG WG, waiting for a solution)
-        s_tagList.add(SVGNames::clipPathTag.localName().impl());
+        s_tagList.add(SVGNames::clipPathTag.localName());
 
         // Not listed in the definitions are the text content elements, though filter/clipper/masker on tspan/text/.. is allowed.
         // (Already mailed SVG WG, waiting for a solution)
-        s_tagList.add(SVGNames::altGlyphTag.localName().impl());
-        s_tagList.add(SVGNames::textPathTag.localName().impl());
-        s_tagList.add(SVGNames::trefTag.localName().impl());
-        s_tagList.add(SVGNames::tspanTag.localName().impl());
+        s_tagList.add(SVGNames::altGlyphTag.localName());
+        s_tagList.add(SVGNames::textPathTag.localName());
+        s_tagList.add(SVGNames::trefTag.localName());
+        s_tagList.add(SVGNames::tspanTag.localName());
 
         // Not listed in the definitions is the foreignObject element, but clip-path
         // is a supported attribute.
-        s_tagList.add(SVGNames::foreignObjectTag.localName().impl());
+        s_tagList.add(SVGNames::foreignObjectTag.localName());
 
         // Elements that we ignore, as it doesn't make any sense.
         // defs, pattern, switch (FIXME: Mail SVG WG about these)
@@ -93,48 +93,48 @@
     return s_tagList;
 }
 
-static HashSet<AtomicStringImpl*>& markerTags()
+static HashSet<AtomicString>& markerTags()
 {
-    DEFINE_STATIC_LOCAL(HashSet<AtomicStringImpl*>, s_tagList, ());
+    DEFINE_STATIC_LOCAL(HashSet<AtomicString>, s_tagList, ());
     if (s_tagList.isEmpty()) {
-        s_tagList.add(SVGNames::lineTag.localName().impl());
-        s_tagList.add(SVGNames::pathTag.localName().impl());
-        s_tagList.add(SVGNames::polygonTag.localName().impl());
-        s_tagList.add(SVGNames::polylineTag.localName().impl());
+        s_tagList.add(SVGNames::lineTag.localName());
+        s_tagList.add(SVGNames::pathTag.localName());
+        s_tagList.add(SVGNames::polygonTag.localName());
+        s_tagList.add(SVGNames::polylineTag.localName());
     }
 
     return s_tagList;
 }
 
-static HashSet<AtomicStringImpl*>& fillAndStrokeTags()
+static HashSet<AtomicString>& fillAndStrokeTags()
 {
-    DEFINE_STATIC_LOCAL(HashSet<AtomicStringImpl*>, s_tagList, ());
+    DEFINE_STATIC_LOCAL(HashSet<AtomicString>, s_tagList, ());
     if (s_tagList.isEmpty()) {
-        s_tagList.add(SVGNames::altGlyphTag.localName().impl());
-        s_tagList.add(SVGNames::circleTag.localName().impl());
-        s_tagList.add(SVGNames::ellipseTag.localName().impl());
-        s_tagList.add(SVGNames::lineTag.localName().impl());
-        s_tagList.add(SVGNames::pathTag.localName().impl());
-        s_tagList.add(SVGNames::polygonTag.localName().impl());
-        s_tagList.add(SVGNames::polylineTag.localName().impl());
-        s_tagList.add(SVGNames::rectTag.localName().impl());
-        s_tagList.add(SVGNames::textTag.localName().impl());
-        s_tagList.add(SVGNames::textPathTag.localName().impl());
-        s_tagList.add(SVGNames::trefTag.localName().impl());
-        s_tagList.add(SVGNames::tspanTag.localName().impl());
+        s_tagList.add(SVGNames::altGlyphTag.localName());
+        s_tagList.add(SVGNames::circleTag.localName());
+        s_tagList.add(SVGNames::ellipseTag.localName());
+        s_tagList.add(SVGNames::lineTag.localName());
+        s_tagList.add(SVGNames::pathTag.localName());
+        s_tagList.add(SVGNames::polygonTag.localName());
+        s_tagList.add(SVGNames::polylineTag.localName());
+        s_tagList.add(SVGNames::rectTag.localName());
+        s_tagList.add(SVGNames::textTag.localName());
+        s_tagList.add(SVGNames::textPathTag.localName());
+        s_tagList.add(SVGNames::trefTag.localName());
+        s_tagList.add(SVGNames::tspanTag.localName());
     }
 
     return s_tagList;
 }
 
-static HashSet<AtomicStringImpl*>& chainableResourceTags()
+static HashSet<AtomicString>& chainableResourceTags()
 {
-    DEFINE_STATIC_LOCAL(HashSet<AtomicStringImpl*>, s_tagList, ());
+    DEFINE_STATIC_LOCAL(HashSet<AtomicString>, s_tagList, ());
     if (s_tagList.isEmpty()) {
-        s_tagList.add(SVGNames::linearGradientTag.localName().impl());
-        s_tagList.add(SVGNames::filterTag.localName().impl());
-        s_tagList.add(SVGNames::patternTag.localName().impl());
-        s_tagList.add(SVGNames::radialGradientTag.localName().impl());
+        s_tagList.add(SVGNames::linearGradientTag.localName());
+        s_tagList.add(SVGNames::filterTag.localName());
+        s_tagList.add(SVGNames::patternTag.localName());
+        s_tagList.add(SVGNames::radialGradientTag.localName());
     }
 
     return s_tagList;
@@ -202,12 +202,12 @@
     SVGDocumentExtensions* extensions = document->accessSVGExtensions();
     ASSERT(extensions);
 
-    AtomicStringImpl* tagNameImpl = element->tagQName().localName().impl();
-    if (!tagNameImpl)
+    const AtomicString& tagName = element->localName();
+    if (tagName.isNull())
         return false;
 
     bool foundResources = false;
-    if (clipperFilterMaskerTags().contains(tagNameImpl)) {
+    if (clipperFilterMaskerTags().contains(tagName)) {
         if (style->hasClipper()) {
             AtomicString id(style->clipperResource());
             if (setClipper(getRenderSVGResourceById<RenderSVGResourceClipper>(document, id)))
@@ -235,7 +235,7 @@
         }
     }
 
-    if (markerTags().contains(tagNameImpl) && style->hasMarkers()) {
+    if (markerTags().contains(tagName) && style->hasMarkers()) {
         AtomicString markerStartId(style->markerStartResource());
         if (setMarkerStart(getRenderSVGResourceById<RenderSVGResourceMarker>(document, markerStartId)))
             foundResources = true;
@@ -255,7 +255,7 @@
             registerPendingResource(extensions, markerEndId, element);
     }
 
-    if (fillAndStrokeTags().contains(tagNameImpl)) {
+    if (fillAndStrokeTags().contains(tagName)) {
         if (style->hasFill()) {
             bool hasPendingResource = false;
             AtomicString id;
@@ -275,7 +275,7 @@
         }
     }
 
-    if (chainableResourceTags().contains(tagNameImpl)) {
+    if (chainableResourceTags().contains(tagName)) {
         AtomicString id(targetReferenceFromResource(element));
         if (setLinkedResource(getRenderSVGResourceContainerById(document, id)))
             foundResources = true;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to