OLD | NEW |
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 20 matching lines...) Expand all Loading... |
31 #include "core/svg/SVGPaint.h" | 31 #include "core/svg/SVGPaint.h" |
32 #include "core/svg/SVGPatternElement.h" | 32 #include "core/svg/SVGPatternElement.h" |
33 #include "core/svg/SVGURIReference.h" | 33 #include "core/svg/SVGURIReference.h" |
34 | 34 |
35 #ifndef NDEBUG | 35 #ifndef NDEBUG |
36 #include <stdio.h> | 36 #include <stdio.h> |
37 #endif | 37 #endif |
38 | 38 |
39 namespace WebCore { | 39 namespace WebCore { |
40 | 40 |
| 41 using namespace SVGNames; |
| 42 |
41 SVGResources::SVGResources() | 43 SVGResources::SVGResources() |
42 : m_linkedResource(0) | 44 : m_linkedResource(0) |
43 { | 45 { |
44 } | 46 } |
45 | 47 |
46 static HashSet<AtomicString>& clipperFilterMaskerTags() | 48 static HashSet<AtomicString>& clipperFilterMaskerTags() |
47 { | 49 { |
48 DEFINE_STATIC_LOCAL(HashSet<AtomicString>, s_tagList, ()); | 50 DEFINE_STATIC_LOCAL(HashSet<AtomicString>, s_tagList, ()); |
49 if (s_tagList.isEmpty()) { | 51 if (s_tagList.isEmpty()) { |
50 // "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 |
51 // "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 |
52 s_tagList.add(SVGNames::aTag.localName()); | 54 s_tagList.add(aTag.localName()); |
53 s_tagList.add(SVGNames::circleTag.localName()); | 55 s_tagList.add(circleTag.localName()); |
54 s_tagList.add(SVGNames::ellipseTag.localName()); | 56 s_tagList.add(ellipseTag.localName()); |
55 #if ENABLE(SVG_FONTS) | 57 #if ENABLE(SVG_FONTS) |
56 s_tagList.add(SVGNames::glyphTag.localName()); | 58 s_tagList.add(glyphTag.localName()); |
57 #endif | 59 #endif |
58 s_tagList.add(SVGNames::gTag.localName()); | 60 s_tagList.add(gTag.localName()); |
59 s_tagList.add(SVGNames::imageTag.localName()); | 61 s_tagList.add(imageTag.localName()); |
60 s_tagList.add(SVGNames::lineTag.localName()); | 62 s_tagList.add(lineTag.localName()); |
61 s_tagList.add(SVGNames::markerTag.localName()); | 63 s_tagList.add(markerTag.localName()); |
62 s_tagList.add(SVGNames::maskTag.localName()); | 64 s_tagList.add(maskTag.localName()); |
63 #if ENABLE(SVG_FONTS) | 65 #if ENABLE(SVG_FONTS) |
64 s_tagList.add(SVGNames::missing_glyphTag.localName()); | 66 s_tagList.add(missing_glyphTag.localName()); |
65 #endif | 67 #endif |
66 s_tagList.add(SVGNames::pathTag.localName()); | 68 s_tagList.add(pathTag.localName()); |
67 s_tagList.add(SVGNames::polygonTag.localName()); | 69 s_tagList.add(polygonTag.localName()); |
68 s_tagList.add(SVGNames::polylineTag.localName()); | 70 s_tagList.add(polylineTag.localName()); |
69 s_tagList.add(SVGNames::rectTag.localName()); | 71 s_tagList.add(rectTag.localName()); |
70 s_tagList.add(SVGNames::svgTag.localName()); | 72 s_tagList.add(svgTag.localName()); |
71 s_tagList.add(SVGNames::textTag.localName()); | 73 s_tagList.add(textTag.localName()); |
72 s_tagList.add(SVGNames::useTag.localName()); | 74 s_tagList.add(useTag.localName()); |
73 | 75 |
74 // Not listed in the definitions is the clipPath element, the SVG spec s
ays though: | 76 // Not listed in the definitions is the clipPath element, the SVG spec s
ays though: |
75 // The "clipPath" element or any of its children can specify property "c
lip-path". | 77 // The "clipPath" element or any of its children can specify property "c
lip-path". |
76 // So we have to add clipPathTag here, otherwhise clip-path on clipPath
will fail. | 78 // So we have to add clipPathTag here, otherwhise clip-path on clipPath
will fail. |
77 // (Already mailed SVG WG, waiting for a solution) | 79 // (Already mailed SVG WG, waiting for a solution) |
78 s_tagList.add(SVGNames::clipPathTag.localName()); | 80 s_tagList.add(clipPathTag.localName()); |
79 | 81 |
80 // Not listed in the definitions are the text content elements, though f
ilter/clipper/masker on tspan/text/.. is allowed. | 82 // Not listed in the definitions are the text content elements, though f
ilter/clipper/masker on tspan/text/.. is allowed. |
81 // (Already mailed SVG WG, waiting for a solution) | 83 // (Already mailed SVG WG, waiting for a solution) |
82 #if ENABLE(SVG_FONTS) | 84 #if ENABLE(SVG_FONTS) |
83 s_tagList.add(SVGNames::altGlyphTag.localName()); | 85 s_tagList.add(altGlyphTag.localName()); |
84 #endif | 86 #endif |
85 s_tagList.add(SVGNames::textPathTag.localName()); | 87 s_tagList.add(textPathTag.localName()); |
86 s_tagList.add(SVGNames::tspanTag.localName()); | 88 s_tagList.add(tspanTag.localName()); |
87 | 89 |
88 // Not listed in the definitions is the foreignObject element, but clip-
path | 90 // Not listed in the definitions is the foreignObject element, but clip-
path |
89 // is a supported attribute. | 91 // is a supported attribute. |
90 s_tagList.add(SVGNames::foreignObjectTag.localName()); | 92 s_tagList.add(foreignObjectTag.localName()); |
91 | 93 |
92 // Elements that we ignore, as it doesn't make any sense. | 94 // Elements that we ignore, as it doesn't make any sense. |
93 // defs, pattern, switch (FIXME: Mail SVG WG about these) | 95 // defs, pattern, switch (FIXME: Mail SVG WG about these) |
94 // symbol (is converted to a svg element, when referenced by use, we can
safely ignore it.) | 96 // symbol (is converted to a svg element, when referenced by use, we can
safely ignore it.) |
95 } | 97 } |
96 | 98 |
97 return s_tagList; | 99 return s_tagList; |
98 } | 100 } |
99 | 101 |
100 bool SVGResources::supportsMarkers(const SVGElement& element) | 102 bool SVGResources::supportsMarkers(const SVGElement& element) |
101 { | 103 { |
102 DEFINE_STATIC_LOCAL(HashSet<AtomicString>, s_tagList, ()); | 104 DEFINE_STATIC_LOCAL(HashSet<AtomicString>, s_tagList, ()); |
103 if (s_tagList.isEmpty()) { | 105 if (s_tagList.isEmpty()) { |
104 s_tagList.add(SVGNames::lineTag.localName()); | 106 s_tagList.add(lineTag.localName()); |
105 s_tagList.add(SVGNames::pathTag.localName()); | 107 s_tagList.add(pathTag.localName()); |
106 s_tagList.add(SVGNames::polygonTag.localName()); | 108 s_tagList.add(polygonTag.localName()); |
107 s_tagList.add(SVGNames::polylineTag.localName()); | 109 s_tagList.add(polylineTag.localName()); |
108 } | 110 } |
109 | 111 |
110 return s_tagList.contains(element.localName()); | 112 return s_tagList.contains(element.localName()); |
111 } | 113 } |
112 | 114 |
113 static HashSet<AtomicString>& fillAndStrokeTags() | 115 static HashSet<AtomicString>& fillAndStrokeTags() |
114 { | 116 { |
115 DEFINE_STATIC_LOCAL(HashSet<AtomicString>, s_tagList, ()); | 117 DEFINE_STATIC_LOCAL(HashSet<AtomicString>, s_tagList, ()); |
116 if (s_tagList.isEmpty()) { | 118 if (s_tagList.isEmpty()) { |
117 #if ENABLE(SVG_FONTS) | 119 #if ENABLE(SVG_FONTS) |
118 s_tagList.add(SVGNames::altGlyphTag.localName()); | 120 s_tagList.add(altGlyphTag.localName()); |
119 #endif | 121 #endif |
120 s_tagList.add(SVGNames::circleTag.localName()); | 122 s_tagList.add(circleTag.localName()); |
121 s_tagList.add(SVGNames::ellipseTag.localName()); | 123 s_tagList.add(ellipseTag.localName()); |
122 s_tagList.add(SVGNames::lineTag.localName()); | 124 s_tagList.add(lineTag.localName()); |
123 s_tagList.add(SVGNames::pathTag.localName()); | 125 s_tagList.add(pathTag.localName()); |
124 s_tagList.add(SVGNames::polygonTag.localName()); | 126 s_tagList.add(polygonTag.localName()); |
125 s_tagList.add(SVGNames::polylineTag.localName()); | 127 s_tagList.add(polylineTag.localName()); |
126 s_tagList.add(SVGNames::rectTag.localName()); | 128 s_tagList.add(rectTag.localName()); |
127 s_tagList.add(SVGNames::textTag.localName()); | 129 s_tagList.add(textTag.localName()); |
128 s_tagList.add(SVGNames::textPathTag.localName()); | 130 s_tagList.add(textPathTag.localName()); |
129 s_tagList.add(SVGNames::tspanTag.localName()); | 131 s_tagList.add(tspanTag.localName()); |
130 } | 132 } |
131 | 133 |
132 return s_tagList; | 134 return s_tagList; |
133 } | 135 } |
134 | 136 |
135 static HashSet<AtomicString>& chainableResourceTags() | 137 static HashSet<AtomicString>& chainableResourceTags() |
136 { | 138 { |
137 DEFINE_STATIC_LOCAL(HashSet<AtomicString>, s_tagList, ()); | 139 DEFINE_STATIC_LOCAL(HashSet<AtomicString>, s_tagList, ()); |
138 if (s_tagList.isEmpty()) { | 140 if (s_tagList.isEmpty()) { |
139 s_tagList.add(SVGNames::linearGradientTag.localName()); | 141 s_tagList.add(linearGradientTag.localName()); |
140 s_tagList.add(SVGNames::filterTag.localName()); | 142 s_tagList.add(filterTag.localName()); |
141 s_tagList.add(SVGNames::patternTag.localName()); | 143 s_tagList.add(patternTag.localName()); |
142 s_tagList.add(SVGNames::radialGradientTag.localName()); | 144 s_tagList.add(radialGradientTag.localName()); |
143 } | 145 } |
144 | 146 |
145 return s_tagList; | 147 return s_tagList; |
146 } | 148 } |
147 | 149 |
148 static inline AtomicString targetReferenceFromResource(SVGElement& element) | 150 static inline AtomicString targetReferenceFromResource(SVGElement& element) |
149 { | 151 { |
150 String target; | 152 String target; |
151 if (isSVGPatternElement(element)) | 153 if (isSVGPatternElement(element)) |
152 target = toSVGPatternElement(element).href()->currentValue()->value(); | 154 target = toSVGPatternElement(element).href()->currentValue()->value(); |
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
707 if (RenderSVGResourceContainer* stroke = m_fillStrokeData->stroke) | 709 if (RenderSVGResourceContainer* stroke = m_fillStrokeData->stroke) |
708 fprintf(stderr, " |-> Stroke : %p (node=%p)\n", stroke, stroke->
element()); | 710 fprintf(stderr, " |-> Stroke : %p (node=%p)\n", stroke, stroke->
element()); |
709 } | 711 } |
710 | 712 |
711 if (m_linkedResource) | 713 if (m_linkedResource) |
712 fprintf(stderr, " |-> xlink:href : %p (node=%p)\n", m_linkedResource, m_
linkedResource->element()); | 714 fprintf(stderr, " |-> xlink:href : %p (node=%p)\n", m_linkedResource, m_
linkedResource->element()); |
713 } | 715 } |
714 #endif | 716 #endif |
715 | 717 |
716 } | 718 } |
OLD | NEW |