Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(911)

Unified Diff: third_party/WebKit/Source/core/layout/svg/SVGResources.cpp

Issue 2142513003: Use initializer_lists for static WTF::HashSets. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/html/RelList.cpp ('k') | third_party/WebKit/Source/core/svg/SVGElement.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/layout/svg/SVGResources.cpp
diff --git a/third_party/WebKit/Source/core/layout/svg/SVGResources.cpp b/third_party/WebKit/Source/core/layout/svg/SVGResources.cpp
index c668bdb303d1786d862fbcabd860dc5b1eda9035..1332771079edb6ec7d3f07e04c77d5efe90fdc97 100644
--- a/third_party/WebKit/Source/core/layout/svg/SVGResources.cpp
+++ b/third_party/WebKit/Source/core/layout/svg/SVGResources.cpp
@@ -48,91 +48,79 @@ SVGResources::SVGResources()
static HashSet<AtomicString>& clipperFilterMaskerTags()
{
- DEFINE_STATIC_LOCAL(HashSet<AtomicString>, s_tagList, ());
- if (s_tagList.isEmpty()) {
+ DEFINE_STATIC_LOCAL(HashSet<AtomicString>, s_tagList, ({
// "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(aTag.localName());
- s_tagList.add(circleTag.localName());
- s_tagList.add(ellipseTag.localName());
- s_tagList.add(gTag.localName());
- s_tagList.add(imageTag.localName());
- s_tagList.add(lineTag.localName());
- s_tagList.add(markerTag.localName());
- s_tagList.add(maskTag.localName());
- s_tagList.add(pathTag.localName());
- s_tagList.add(polygonTag.localName());
- s_tagList.add(polylineTag.localName());
- s_tagList.add(rectTag.localName());
- s_tagList.add(svgTag.localName());
- s_tagList.add(textTag.localName());
- s_tagList.add(useTag.localName());
-
+ aTag.localName(),
+ circleTag.localName(),
+ ellipseTag.localName(),
+ gTag.localName(),
+ imageTag.localName(),
+ lineTag.localName(),
+ markerTag.localName(),
+ maskTag.localName(),
+ pathTag.localName(),
+ polygonTag.localName(),
+ polylineTag.localName(),
+ rectTag.localName(),
+ svgTag.localName(),
+ textTag.localName(),
+ 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(clipPathTag.localName());
-
+ 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(textPathTag.localName());
- s_tagList.add(tspanTag.localName());
-
+ textPathTag.localName(),
+ tspanTag.localName(),
// Not listed in the definitions is the foreignObject element, but clip-path
// is a supported attribute.
- s_tagList.add(foreignObjectTag.localName());
-
+ foreignObjectTag.localName(),
// Elements that we ignore, as it doesn't make any sense.
// defs, pattern, switch (FIXME: Mail SVG WG about these)
// symbol (is converted to a svg element, when referenced by use, we can safely ignore it.)
- }
-
+ }));
return s_tagList;
}
bool SVGResources::supportsMarkers(const SVGElement& element)
{
- DEFINE_STATIC_LOCAL(HashSet<AtomicString>, s_tagList, ());
- if (s_tagList.isEmpty()) {
- s_tagList.add(lineTag.localName());
- s_tagList.add(pathTag.localName());
- s_tagList.add(polygonTag.localName());
- s_tagList.add(polylineTag.localName());
- }
-
+ DEFINE_STATIC_LOCAL(HashSet<AtomicString>, s_tagList, ({
+ lineTag.localName(),
+ pathTag.localName(),
+ polygonTag.localName(),
+ polylineTag.localName(),
+ }));
return s_tagList.contains(element.localName());
}
static HashSet<AtomicString>& fillAndStrokeTags()
{
- DEFINE_STATIC_LOCAL(HashSet<AtomicString>, s_tagList, ());
- if (s_tagList.isEmpty()) {
- s_tagList.add(circleTag.localName());
- s_tagList.add(ellipseTag.localName());
- s_tagList.add(lineTag.localName());
- s_tagList.add(pathTag.localName());
- s_tagList.add(polygonTag.localName());
- s_tagList.add(polylineTag.localName());
- s_tagList.add(rectTag.localName());
- s_tagList.add(textTag.localName());
- s_tagList.add(textPathTag.localName());
- s_tagList.add(tspanTag.localName());
- }
-
+ DEFINE_STATIC_LOCAL(HashSet<AtomicString>, s_tagList, ({
+ circleTag.localName(),
+ ellipseTag.localName(),
+ lineTag.localName(),
+ pathTag.localName(),
+ polygonTag.localName(),
+ polylineTag.localName(),
+ rectTag.localName(),
+ textTag.localName(),
+ textPathTag.localName(),
+ tspanTag.localName(),
+ }));
return s_tagList;
}
static HashSet<AtomicString>& chainableResourceTags()
{
- DEFINE_STATIC_LOCAL(HashSet<AtomicString>, s_tagList, ());
- if (s_tagList.isEmpty()) {
- s_tagList.add(linearGradientTag.localName());
- s_tagList.add(filterTag.localName());
- s_tagList.add(patternTag.localName());
- s_tagList.add(radialGradientTag.localName());
- }
-
+ DEFINE_STATIC_LOCAL(HashSet<AtomicString>, s_tagList, ({
+ linearGradientTag.localName(),
+ filterTag.localName(),
+ patternTag.localName(),
+ radialGradientTag.localName(),
+ }));
return s_tagList;
}
« no previous file with comments | « third_party/WebKit/Source/core/html/RelList.cpp ('k') | third_party/WebKit/Source/core/svg/SVGElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698