Source/WebCore/ChangeLog

 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 Arpita Bahuguna <arpitabahuguna@gmail.com>
224
325 Text decorations specified on the containing block are not properly applied when ::first-line is present.

Source/WebCore/rendering/svg/SVGResources.cpp

@@SVGResources::SVGResources()
4444{
4545}
4646
47 static HashSet<AtomicStringImpl*>& clipperFilterMaskerTags()
 47static HashSet<AtomicString>& clipperFilterMaskerTags()
4848{
49  DEFINE_STATIC_LOCAL(HashSet<AtomicStringImpl*>, s_tagList, ());
 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:
7272 // The "clipPath" element or any of its children can specify property "clip-path".
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.
8989 // defs, pattern, switch (FIXME: Mail SVG WG about these)

@@static HashSet<AtomicStringImpl*>& clipperFilterMaskerTags()
9393 return s_tagList;
9494}
9595
96 static HashSet<AtomicStringImpl*>& markerTags()
 96static HashSet<AtomicString>& markerTags()
9797{
98  DEFINE_STATIC_LOCAL(HashSet<AtomicStringImpl*>, s_tagList, ());
 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
106106 return s_tagList;
107107}
108108
109 static HashSet<AtomicStringImpl*>& fillAndStrokeTags()
 109static HashSet<AtomicString>& fillAndStrokeTags()
110110{
111  DEFINE_STATIC_LOCAL(HashSet<AtomicStringImpl*>, s_tagList, ());
 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
127127 return s_tagList;
128128}
129129
130 static HashSet<AtomicStringImpl*>& chainableResourceTags()
 130static HashSet<AtomicString>& chainableResourceTags()
131131{
132  DEFINE_STATIC_LOCAL(HashSet<AtomicStringImpl*>, s_tagList, ());
 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
140140 return s_tagList;

@@bool SVGResources::buildCachedResources(const RenderObject* object, const SVGRen
202202 SVGDocumentExtensions* extensions = document->accessSVGExtensions();
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());
213213 if (setClipper(getRenderSVGResourceById<RenderSVGResourceClipper>(document, id)))

@@bool SVGResources::buildCachedResources(const RenderObject* object, const SVGRen
235235 }
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)))
241241 foundResources = true;

@@bool SVGResources::buildCachedResources(const RenderObject* object, const SVGRen
255255 registerPendingResource(extensions, markerEndId, element);
256256 }
257257
258  if (fillAndStrokeTags().contains(tagNameImpl)) {
 258 if (fillAndStrokeTags().contains(tagName)) {
259259 if (style->hasFill()) {
260260 bool hasPendingResource = false;
261261 AtomicString id;

@@bool SVGResources::buildCachedResources(const RenderObject* object, const SVGRen
275275 }
276276 }
277277
278  if (chainableResourceTags().contains(tagNameImpl)) {
 278 if (chainableResourceTags().contains(tagName)) {
279279 AtomicString id(targetReferenceFromResource(element));
280280 if (setLinkedResource(getRenderSVGResourceContainerById(document, id)))
281281 foundResources = true;