Changeset 130780 in webkit


Ignore:
Timestamp:
Oct 9, 2012, 11:36:17 AM (13 years ago)
Author:
fmalita@chromium.org
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):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r130779 r130780  
     12012-10-09  Florin Malita  <fmalita@chromium.org>
     2
     3        SVGResources should use HashSet<AtomicString> instead of HashSet<AtomicStringImpl*>
     4        https://bugs.webkit.org/show_bug.cgi?id=98683
     5
     6        Reviewed by Darin Adler.
     7
     8        Eric's notes:
     9
     10        SVGResources should use HashSet<AtomicString> instead of HashSet<AtomicStringImpl*>
     11        They do basically the same thing, and the former is much more common (and less code). It's
     12        also safe, on the off-chance that we're using AtomicStrings which might otherwise go away.
     13
     14        No new tests, refactoring.
     15
     16        * rendering/svg/SVGResources.cpp:
     17        (WebCore::clipperFilterMaskerTags):
     18        (WebCore::markerTags):
     19        (WebCore::fillAndStrokeTags):
     20        (WebCore::chainableResourceTags):
     21        (WebCore::SVGResources::buildCachedResources):
     22
    1232012-10-09  Enrica Casucci  <enrica@apple.com>
    224
  • trunk/Source/WebCore/rendering/svg/SVGResources.cpp

    r100045 r130780  
    4545}
    4646
    47 static HashSet<AtomicStringImpl*>& clipperFilterMaskerTags()
    48 {
    49     DEFINE_STATIC_LOCAL(HashSet<AtomicStringImpl*>, s_tagList, ());
     47static HashSet<AtomicString>& clipperFilterMaskerTags()
     48{
     49    DEFINE_STATIC_LOCAL(HashSet<AtomicString>, s_tagList, ());
    5050    if (s_tagList.isEmpty()) {
    5151        // "container elements": http://www.w3.org/TR/SVG11/intro.html#TermContainerElement
    5252        // "graphics elements" : http://www.w3.org/TR/SVG11/intro.html#TermGraphicsElement
    53         s_tagList.add(SVGNames::aTag.localName().impl());
    54         s_tagList.add(SVGNames::circleTag.localName().impl());
    55         s_tagList.add(SVGNames::ellipseTag.localName().impl());
    56         s_tagList.add(SVGNames::glyphTag.localName().impl());
    57         s_tagList.add(SVGNames::gTag.localName().impl());
    58         s_tagList.add(SVGNames::imageTag.localName().impl());
    59         s_tagList.add(SVGNames::lineTag.localName().impl());
    60         s_tagList.add(SVGNames::markerTag.localName().impl());
    61         s_tagList.add(SVGNames::maskTag.localName().impl());
    62         s_tagList.add(SVGNames::missing_glyphTag.localName().impl());
    63         s_tagList.add(SVGNames::pathTag.localName().impl());
    64         s_tagList.add(SVGNames::polygonTag.localName().impl());
    65         s_tagList.add(SVGNames::polylineTag.localName().impl());
    66         s_tagList.add(SVGNames::rectTag.localName().impl());
    67         s_tagList.add(SVGNames::svgTag.localName().impl());
    68         s_tagList.add(SVGNames::textTag.localName().impl());
    69         s_tagList.add(SVGNames::useTag.localName().impl());
     53        s_tagList.add(SVGNames::aTag.localName());
     54        s_tagList.add(SVGNames::circleTag.localName());
     55        s_tagList.add(SVGNames::ellipseTag.localName());
     56        s_tagList.add(SVGNames::glyphTag.localName());
     57        s_tagList.add(SVGNames::gTag.localName());
     58        s_tagList.add(SVGNames::imageTag.localName());
     59        s_tagList.add(SVGNames::lineTag.localName());
     60        s_tagList.add(SVGNames::markerTag.localName());
     61        s_tagList.add(SVGNames::maskTag.localName());
     62        s_tagList.add(SVGNames::missing_glyphTag.localName());
     63        s_tagList.add(SVGNames::pathTag.localName());
     64        s_tagList.add(SVGNames::polygonTag.localName());
     65        s_tagList.add(SVGNames::polylineTag.localName());
     66        s_tagList.add(SVGNames::rectTag.localName());
     67        s_tagList.add(SVGNames::svgTag.localName());
     68        s_tagList.add(SVGNames::textTag.localName());
     69        s_tagList.add(SVGNames::useTag.localName());
    7070
    7171        // Not listed in the definitions is the clipPath element, the SVG spec says though:
     
    7373        // So we have to add clipPathTag here, otherwhise clip-path on clipPath will fail.
    7474        // (Already mailed SVG WG, waiting for a solution)
    75         s_tagList.add(SVGNames::clipPathTag.localName().impl());
     75        s_tagList.add(SVGNames::clipPathTag.localName());
    7676
    7777        // Not listed in the definitions are the text content elements, though filter/clipper/masker on tspan/text/.. is allowed.
    7878        // (Already mailed SVG WG, waiting for a solution)
    79         s_tagList.add(SVGNames::altGlyphTag.localName().impl());
    80         s_tagList.add(SVGNames::textPathTag.localName().impl());
    81         s_tagList.add(SVGNames::trefTag.localName().impl());
    82         s_tagList.add(SVGNames::tspanTag.localName().impl());
     79        s_tagList.add(SVGNames::altGlyphTag.localName());
     80        s_tagList.add(SVGNames::textPathTag.localName());
     81        s_tagList.add(SVGNames::trefTag.localName());
     82        s_tagList.add(SVGNames::tspanTag.localName());
    8383
    8484        // Not listed in the definitions is the foreignObject element, but clip-path
    8585        // is a supported attribute.
    86         s_tagList.add(SVGNames::foreignObjectTag.localName().impl());
     86        s_tagList.add(SVGNames::foreignObjectTag.localName());
    8787
    8888        // Elements that we ignore, as it doesn't make any sense.
     
    9494}
    9595
    96 static HashSet<AtomicStringImpl*>& markerTags()
    97 {
    98     DEFINE_STATIC_LOCAL(HashSet<AtomicStringImpl*>, s_tagList, ());
     96static HashSet<AtomicString>& markerTags()
     97{
     98    DEFINE_STATIC_LOCAL(HashSet<AtomicString>, s_tagList, ());
    9999    if (s_tagList.isEmpty()) {
    100         s_tagList.add(SVGNames::lineTag.localName().impl());
    101         s_tagList.add(SVGNames::pathTag.localName().impl());
    102         s_tagList.add(SVGNames::polygonTag.localName().impl());
    103         s_tagList.add(SVGNames::polylineTag.localName().impl());
     100        s_tagList.add(SVGNames::lineTag.localName());
     101        s_tagList.add(SVGNames::pathTag.localName());
     102        s_tagList.add(SVGNames::polygonTag.localName());
     103        s_tagList.add(SVGNames::polylineTag.localName());
    104104    }
    105105
     
    107107}
    108108
    109 static HashSet<AtomicStringImpl*>& fillAndStrokeTags()
    110 {
    111     DEFINE_STATIC_LOCAL(HashSet<AtomicStringImpl*>, s_tagList, ());
     109static HashSet<AtomicString>& fillAndStrokeTags()
     110{
     111    DEFINE_STATIC_LOCAL(HashSet<AtomicString>, s_tagList, ());
    112112    if (s_tagList.isEmpty()) {
    113         s_tagList.add(SVGNames::altGlyphTag.localName().impl());
    114         s_tagList.add(SVGNames::circleTag.localName().impl());
    115         s_tagList.add(SVGNames::ellipseTag.localName().impl());
    116         s_tagList.add(SVGNames::lineTag.localName().impl());
    117         s_tagList.add(SVGNames::pathTag.localName().impl());
    118         s_tagList.add(SVGNames::polygonTag.localName().impl());
    119         s_tagList.add(SVGNames::polylineTag.localName().impl());
    120         s_tagList.add(SVGNames::rectTag.localName().impl());
    121         s_tagList.add(SVGNames::textTag.localName().impl());
    122         s_tagList.add(SVGNames::textPathTag.localName().impl());
    123         s_tagList.add(SVGNames::trefTag.localName().impl());
    124         s_tagList.add(SVGNames::tspanTag.localName().impl());
     113        s_tagList.add(SVGNames::altGlyphTag.localName());
     114        s_tagList.add(SVGNames::circleTag.localName());
     115        s_tagList.add(SVGNames::ellipseTag.localName());
     116        s_tagList.add(SVGNames::lineTag.localName());
     117        s_tagList.add(SVGNames::pathTag.localName());
     118        s_tagList.add(SVGNames::polygonTag.localName());
     119        s_tagList.add(SVGNames::polylineTag.localName());
     120        s_tagList.add(SVGNames::rectTag.localName());
     121        s_tagList.add(SVGNames::textTag.localName());
     122        s_tagList.add(SVGNames::textPathTag.localName());
     123        s_tagList.add(SVGNames::trefTag.localName());
     124        s_tagList.add(SVGNames::tspanTag.localName());
    125125    }
    126126
     
    128128}
    129129
    130 static HashSet<AtomicStringImpl*>& chainableResourceTags()
    131 {
    132     DEFINE_STATIC_LOCAL(HashSet<AtomicStringImpl*>, s_tagList, ());
     130static HashSet<AtomicString>& chainableResourceTags()
     131{
     132    DEFINE_STATIC_LOCAL(HashSet<AtomicString>, s_tagList, ());
    133133    if (s_tagList.isEmpty()) {
    134         s_tagList.add(SVGNames::linearGradientTag.localName().impl());
    135         s_tagList.add(SVGNames::filterTag.localName().impl());
    136         s_tagList.add(SVGNames::patternTag.localName().impl());
    137         s_tagList.add(SVGNames::radialGradientTag.localName().impl());
     134        s_tagList.add(SVGNames::linearGradientTag.localName());
     135        s_tagList.add(SVGNames::filterTag.localName());
     136        s_tagList.add(SVGNames::patternTag.localName());
     137        s_tagList.add(SVGNames::radialGradientTag.localName());
    138138    }
    139139
     
    203203    ASSERT(extensions);
    204204
    205     AtomicStringImpl* tagNameImpl = element->tagQName().localName().impl();
    206     if (!tagNameImpl)
     205    const AtomicString& tagName = element->localName();
     206    if (tagName.isNull())
    207207        return false;
    208208
    209209    bool foundResources = false;
    210     if (clipperFilterMaskerTags().contains(tagNameImpl)) {
     210    if (clipperFilterMaskerTags().contains(tagName)) {
    211211        if (style->hasClipper()) {
    212212            AtomicString id(style->clipperResource());
     
    236236    }
    237237
    238     if (markerTags().contains(tagNameImpl) && style->hasMarkers()) {
     238    if (markerTags().contains(tagName) && style->hasMarkers()) {
    239239        AtomicString markerStartId(style->markerStartResource());
    240240        if (setMarkerStart(getRenderSVGResourceById<RenderSVGResourceMarker>(document, markerStartId)))
     
    256256    }
    257257
    258     if (fillAndStrokeTags().contains(tagNameImpl)) {
     258    if (fillAndStrokeTags().contains(tagName)) {
    259259        if (style->hasFill()) {
    260260            bool hasPendingResource = false;
     
    276276    }
    277277
    278     if (chainableResourceTags().contains(tagNameImpl)) {
     278    if (chainableResourceTags().contains(tagName)) {
    279279        AtomicString id(targetReferenceFromResource(element));
    280280        if (setLinkedResource(getRenderSVGResourceContainerById(document, id)))
Note: See TracChangeset for help on using the changeset viewer.