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

Side by Side 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 2 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 30 matching lines...) Expand all
41 41
42 using namespace SVGNames; 42 using namespace SVGNames;
43 43
44 SVGResources::SVGResources() 44 SVGResources::SVGResources()
45 : m_linkedResource(nullptr) 45 : m_linkedResource(nullptr)
46 { 46 {
47 } 47 }
48 48
49 static HashSet<AtomicString>& clipperFilterMaskerTags() 49 static HashSet<AtomicString>& clipperFilterMaskerTags()
50 { 50 {
51 DEFINE_STATIC_LOCAL(HashSet<AtomicString>, s_tagList, ()); 51 DEFINE_STATIC_LOCAL(HashSet<AtomicString>, s_tagList, ({
52 if (s_tagList.isEmpty()) {
53 // "container elements": http://www.w3.org/TR/SVG11/intro.html#TermConta inerElement 52 // "container elements": http://www.w3.org/TR/SVG11/intro.html#TermConta inerElement
54 // "graphics elements" : http://www.w3.org/TR/SVG11/intro.html#TermGraph icsElement 53 // "graphics elements" : http://www.w3.org/TR/SVG11/intro.html#TermGraph icsElement
55 s_tagList.add(aTag.localName()); 54 aTag.localName(),
56 s_tagList.add(circleTag.localName()); 55 circleTag.localName(),
57 s_tagList.add(ellipseTag.localName()); 56 ellipseTag.localName(),
58 s_tagList.add(gTag.localName()); 57 gTag.localName(),
59 s_tagList.add(imageTag.localName()); 58 imageTag.localName(),
60 s_tagList.add(lineTag.localName()); 59 lineTag.localName(),
61 s_tagList.add(markerTag.localName()); 60 markerTag.localName(),
62 s_tagList.add(maskTag.localName()); 61 maskTag.localName(),
63 s_tagList.add(pathTag.localName()); 62 pathTag.localName(),
64 s_tagList.add(polygonTag.localName()); 63 polygonTag.localName(),
65 s_tagList.add(polylineTag.localName()); 64 polylineTag.localName(),
66 s_tagList.add(rectTag.localName()); 65 rectTag.localName(),
67 s_tagList.add(svgTag.localName()); 66 svgTag.localName(),
68 s_tagList.add(textTag.localName()); 67 textTag.localName(),
69 s_tagList.add(useTag.localName()); 68 useTag.localName(),
70
71 // Not listed in the definitions is the clipPath element, the SVG spec s ays though: 69 // Not listed in the definitions is the clipPath element, the SVG spec s ays though:
72 // The "clipPath" element or any of its children can specify property "c lip-path". 70 // The "clipPath" element or any of its children can specify property "c lip-path".
73 // So we have to add clipPathTag here, otherwhise clip-path on clipPath will fail. 71 // So we have to add clipPathTag here, otherwhise clip-path on clipPath will fail.
74 // (Already mailed SVG WG, waiting for a solution) 72 // (Already mailed SVG WG, waiting for a solution)
75 s_tagList.add(clipPathTag.localName()); 73 clipPathTag.localName(),
76
77 // Not listed in the definitions are the text content elements, though f ilter/clipper/masker on tspan/text/.. is allowed. 74 // Not listed in the definitions are the text content elements, though f ilter/clipper/masker on tspan/text/.. is allowed.
78 // (Already mailed SVG WG, waiting for a solution) 75 // (Already mailed SVG WG, waiting for a solution)
79 s_tagList.add(textPathTag.localName()); 76 textPathTag.localName(),
80 s_tagList.add(tspanTag.localName()); 77 tspanTag.localName(),
81
82 // Not listed in the definitions is the foreignObject element, but clip- path 78 // Not listed in the definitions is the foreignObject element, but clip- path
83 // is a supported attribute. 79 // is a supported attribute.
84 s_tagList.add(foreignObjectTag.localName()); 80 foreignObjectTag.localName(),
85
86 // Elements that we ignore, as it doesn't make any sense. 81 // Elements that we ignore, as it doesn't make any sense.
87 // defs, pattern, switch (FIXME: Mail SVG WG about these) 82 // defs, pattern, switch (FIXME: Mail SVG WG about these)
88 // symbol (is converted to a svg element, when referenced by use, we can safely ignore it.) 83 // symbol (is converted to a svg element, when referenced by use, we can safely ignore it.)
89 } 84 }));
90
91 return s_tagList; 85 return s_tagList;
92 } 86 }
93 87
94 bool SVGResources::supportsMarkers(const SVGElement& element) 88 bool SVGResources::supportsMarkers(const SVGElement& element)
95 { 89 {
96 DEFINE_STATIC_LOCAL(HashSet<AtomicString>, s_tagList, ()); 90 DEFINE_STATIC_LOCAL(HashSet<AtomicString>, s_tagList, ({
97 if (s_tagList.isEmpty()) { 91 lineTag.localName(),
98 s_tagList.add(lineTag.localName()); 92 pathTag.localName(),
99 s_tagList.add(pathTag.localName()); 93 polygonTag.localName(),
100 s_tagList.add(polygonTag.localName()); 94 polylineTag.localName(),
101 s_tagList.add(polylineTag.localName()); 95 }));
102 }
103
104 return s_tagList.contains(element.localName()); 96 return s_tagList.contains(element.localName());
105 } 97 }
106 98
107 static HashSet<AtomicString>& fillAndStrokeTags() 99 static HashSet<AtomicString>& fillAndStrokeTags()
108 { 100 {
109 DEFINE_STATIC_LOCAL(HashSet<AtomicString>, s_tagList, ()); 101 DEFINE_STATIC_LOCAL(HashSet<AtomicString>, s_tagList, ({
110 if (s_tagList.isEmpty()) { 102 circleTag.localName(),
111 s_tagList.add(circleTag.localName()); 103 ellipseTag.localName(),
112 s_tagList.add(ellipseTag.localName()); 104 lineTag.localName(),
113 s_tagList.add(lineTag.localName()); 105 pathTag.localName(),
114 s_tagList.add(pathTag.localName()); 106 polygonTag.localName(),
115 s_tagList.add(polygonTag.localName()); 107 polylineTag.localName(),
116 s_tagList.add(polylineTag.localName()); 108 rectTag.localName(),
117 s_tagList.add(rectTag.localName()); 109 textTag.localName(),
118 s_tagList.add(textTag.localName()); 110 textPathTag.localName(),
119 s_tagList.add(textPathTag.localName()); 111 tspanTag.localName(),
120 s_tagList.add(tspanTag.localName()); 112 }));
121 }
122
123 return s_tagList; 113 return s_tagList;
124 } 114 }
125 115
126 static HashSet<AtomicString>& chainableResourceTags() 116 static HashSet<AtomicString>& chainableResourceTags()
127 { 117 {
128 DEFINE_STATIC_LOCAL(HashSet<AtomicString>, s_tagList, ()); 118 DEFINE_STATIC_LOCAL(HashSet<AtomicString>, s_tagList, ({
129 if (s_tagList.isEmpty()) { 119 linearGradientTag.localName(),
130 s_tagList.add(linearGradientTag.localName()); 120 filterTag.localName(),
131 s_tagList.add(filterTag.localName()); 121 patternTag.localName(),
132 s_tagList.add(patternTag.localName()); 122 radialGradientTag.localName(),
133 s_tagList.add(radialGradientTag.localName()); 123 }));
134 }
135
136 return s_tagList; 124 return s_tagList;
137 } 125 }
138 126
139 static inline AtomicString targetReferenceFromResource(SVGElement& element) 127 static inline AtomicString targetReferenceFromResource(SVGElement& element)
140 { 128 {
141 String target; 129 String target;
142 if (isSVGPatternElement(element)) 130 if (isSVGPatternElement(element))
143 target = toSVGPatternElement(element).href()->currentValue()->value(); 131 target = toSVGPatternElement(element).href()->currentValue()->value();
144 else if (isSVGGradientElement(element)) 132 else if (isSVGGradientElement(element))
145 target = toSVGGradientElement(element).href()->currentValue()->value(); 133 target = toSVGGradientElement(element).href()->currentValue()->value();
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 if (LayoutSVGResourcePaintServer* stroke = m_fillStrokeData->stroke) 663 if (LayoutSVGResourcePaintServer* stroke = m_fillStrokeData->stroke)
676 fprintf(stderr, " |-> Stroke : %p (node=%p)\n", stroke, stroke-> element()); 664 fprintf(stderr, " |-> Stroke : %p (node=%p)\n", stroke, stroke-> element());
677 } 665 }
678 666
679 if (m_linkedResource) 667 if (m_linkedResource)
680 fprintf(stderr, " |-> xlink:href : %p (node=%p)\n", m_linkedResource, m_ linkedResource->element()); 668 fprintf(stderr, " |-> xlink:href : %p (node=%p)\n", m_linkedResource, m_ linkedResource->element());
681 } 669 }
682 #endif 670 #endif
683 671
684 } // namespace blink 672 } // namespace blink
OLDNEW
« 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