OLD | NEW |
1 /* | 1 /* |
2 Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kd
e.org> | 2 Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kd
e.org> |
3 2004, 2005, 2007, 2008 Rob Buis <buis@kde.org> | 3 2004, 2005, 2007, 2008 Rob Buis <buis@kde.org> |
4 | 4 |
5 This library is free software; you can redistribute it and/or | 5 This library is free software; you can redistribute it and/or |
6 modify it under the terms of the GNU Library General Public | 6 modify it under the terms of the GNU Library General Public |
7 License as published by the Free Software Foundation; either | 7 License as published by the Free Software Foundation; either |
8 version 2 of the License, or (at your option) any later version. | 8 version 2 of the License, or (at your option) any later version. |
9 | 9 |
10 This library is distributed in the hope that it will be useful, | 10 This library is distributed in the hope that it will be useful, |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 // Prevent anything other than SVG renderers from appearing in our render tr
ee | 64 // Prevent anything other than SVG renderers from appearing in our render tr
ee |
65 // Spec: SVG allows inclusion of elements from foreign namespaces anywhere | 65 // Spec: SVG allows inclusion of elements from foreign namespaces anywhere |
66 // with the SVG content. In general, the SVG user agent will include the unk
nown | 66 // with the SVG content. In general, the SVG user agent will include the unk
nown |
67 // elements in the DOM but will otherwise ignore unknown elements. | 67 // elements in the DOM but will otherwise ignore unknown elements. |
68 if (!parentNode() || parentNode()->isSVGElement()) | 68 if (!parentNode() || parentNode()->isSVGElement()) |
69 return StyledElement::rendererIsNeeded(style); | 69 return StyledElement::rendererIsNeeded(style); |
70 | 70 |
71 return false; | 71 return false; |
72 } | 72 } |
73 | 73 |
74 static void mapAttributeToCSSProperty(HashMap<AtomicStringImpl*, int>* propertyN
ameToIdMap, const QualifiedName& attrName) | 74 static void mapSvgAttributeToCSSProperty(HashMap<AtomicStringImpl*, int>* proper
tyNameToIdMap, const QualifiedName& attrName) |
75 { | 75 { |
76 int propertyId = cssPropertyID(attrName.localName()); | 76 int propertyId = cssPropertyID(attrName.localName()); |
77 ASSERT(propertyId > 0); | 77 ASSERT(propertyId > 0); |
78 propertyNameToIdMap->set(attrName.localName().impl(), propertyId); | 78 propertyNameToIdMap->set(attrName.localName().impl(), propertyId); |
79 } | 79 } |
80 | 80 |
81 int SVGStyledElement::cssPropertyIdForSVGAttributeName(const QualifiedName& attr
Name) | 81 int SVGStyledElement::cssPropertyIdForSVGAttributeName(const QualifiedName& attr
Name) |
82 { | 82 { |
83 if (!attrName.namespaceURI().isNull()) | 83 if (!attrName.namespaceURI().isNull()) |
84 return 0; | 84 return 0; |
85 | 85 |
86 static HashMap<AtomicStringImpl*, int>* propertyNameToIdMap = 0; | 86 static HashMap<AtomicStringImpl*, int>* propertyNameToIdMap = 0; |
87 if (!propertyNameToIdMap) { | 87 if (!propertyNameToIdMap) { |
88 propertyNameToIdMap = new HashMap<AtomicStringImpl*, int>; | 88 propertyNameToIdMap = new HashMap<AtomicStringImpl*, int>; |
89 // This is a list of all base CSS and SVG CSS properties which are expos
ed as SVG XML attributes | 89 // This is a list of all base CSS and SVG CSS properties which are expos
ed as SVG XML attributes |
90 mapAttributeToCSSProperty(propertyNameToIdMap, alignment_baselineAttr); | 90 mapSvgAttributeToCSSProperty(propertyNameToIdMap, alignment_baselineAttr
); |
91 mapAttributeToCSSProperty(propertyNameToIdMap, baseline_shiftAttr); | 91 mapSvgAttributeToCSSProperty(propertyNameToIdMap, baseline_shiftAttr); |
92 mapAttributeToCSSProperty(propertyNameToIdMap, clipAttr); | 92 mapSvgAttributeToCSSProperty(propertyNameToIdMap, clipAttr); |
93 mapAttributeToCSSProperty(propertyNameToIdMap, clip_pathAttr); | 93 mapSvgAttributeToCSSProperty(propertyNameToIdMap, clip_pathAttr); |
94 mapAttributeToCSSProperty(propertyNameToIdMap, clip_ruleAttr); | 94 mapSvgAttributeToCSSProperty(propertyNameToIdMap, clip_ruleAttr); |
95 mapAttributeToCSSProperty(propertyNameToIdMap, colorAttr); | 95 mapSvgAttributeToCSSProperty(propertyNameToIdMap, SVGNames::colorAttr); |
96 mapAttributeToCSSProperty(propertyNameToIdMap, color_interpolationAttr); | 96 mapSvgAttributeToCSSProperty(propertyNameToIdMap, color_interpolationAtt
r); |
97 mapAttributeToCSSProperty(propertyNameToIdMap, color_interpolation_filte
rsAttr); | 97 mapSvgAttributeToCSSProperty(propertyNameToIdMap, color_interpolation_fi
ltersAttr); |
98 mapAttributeToCSSProperty(propertyNameToIdMap, color_profileAttr); | 98 mapSvgAttributeToCSSProperty(propertyNameToIdMap, color_profileAttr); |
99 mapAttributeToCSSProperty(propertyNameToIdMap, color_renderingAttr); | 99 mapSvgAttributeToCSSProperty(propertyNameToIdMap, color_renderingAttr); |
100 mapAttributeToCSSProperty(propertyNameToIdMap, cursorAttr); | 100 mapSvgAttributeToCSSProperty(propertyNameToIdMap, cursorAttr); |
101 mapAttributeToCSSProperty(propertyNameToIdMap, directionAttr); | 101 mapSvgAttributeToCSSProperty(propertyNameToIdMap, SVGNames::directionAtt
r); |
102 mapAttributeToCSSProperty(propertyNameToIdMap, displayAttr); | 102 mapSvgAttributeToCSSProperty(propertyNameToIdMap, displayAttr); |
103 mapAttributeToCSSProperty(propertyNameToIdMap, dominant_baselineAttr); | 103 mapSvgAttributeToCSSProperty(propertyNameToIdMap, dominant_baselineAttr)
; |
104 mapAttributeToCSSProperty(propertyNameToIdMap, enable_backgroundAttr); | 104 mapSvgAttributeToCSSProperty(propertyNameToIdMap, enable_backgroundAttr)
; |
105 mapAttributeToCSSProperty(propertyNameToIdMap, fillAttr); | 105 mapSvgAttributeToCSSProperty(propertyNameToIdMap, fillAttr); |
106 mapAttributeToCSSProperty(propertyNameToIdMap, fill_opacityAttr); | 106 mapSvgAttributeToCSSProperty(propertyNameToIdMap, fill_opacityAttr); |
107 mapAttributeToCSSProperty(propertyNameToIdMap, fill_ruleAttr); | 107 mapSvgAttributeToCSSProperty(propertyNameToIdMap, fill_ruleAttr); |
108 mapAttributeToCSSProperty(propertyNameToIdMap, filterAttr); | 108 mapSvgAttributeToCSSProperty(propertyNameToIdMap, filterAttr); |
109 mapAttributeToCSSProperty(propertyNameToIdMap, flood_colorAttr); | 109 mapSvgAttributeToCSSProperty(propertyNameToIdMap, flood_colorAttr); |
110 mapAttributeToCSSProperty(propertyNameToIdMap, flood_opacityAttr); | 110 mapSvgAttributeToCSSProperty(propertyNameToIdMap, flood_opacityAttr); |
111 mapAttributeToCSSProperty(propertyNameToIdMap, font_familyAttr); | 111 mapSvgAttributeToCSSProperty(propertyNameToIdMap, font_familyAttr); |
112 mapAttributeToCSSProperty(propertyNameToIdMap, font_sizeAttr); | 112 mapSvgAttributeToCSSProperty(propertyNameToIdMap, font_sizeAttr); |
113 mapAttributeToCSSProperty(propertyNameToIdMap, font_stretchAttr); | 113 mapSvgAttributeToCSSProperty(propertyNameToIdMap, font_stretchAttr); |
114 mapAttributeToCSSProperty(propertyNameToIdMap, font_styleAttr); | 114 mapSvgAttributeToCSSProperty(propertyNameToIdMap, font_styleAttr); |
115 mapAttributeToCSSProperty(propertyNameToIdMap, font_variantAttr); | 115 mapSvgAttributeToCSSProperty(propertyNameToIdMap, font_variantAttr); |
116 mapAttributeToCSSProperty(propertyNameToIdMap, font_weightAttr); | 116 mapSvgAttributeToCSSProperty(propertyNameToIdMap, font_weightAttr); |
117 mapAttributeToCSSProperty(propertyNameToIdMap, glyph_orientation_horizon
talAttr); | 117 mapSvgAttributeToCSSProperty(propertyNameToIdMap, glyph_orientation_hori
zontalAttr); |
118 mapAttributeToCSSProperty(propertyNameToIdMap, glyph_orientation_vertica
lAttr); | 118 mapSvgAttributeToCSSProperty(propertyNameToIdMap, glyph_orientation_vert
icalAttr); |
119 mapAttributeToCSSProperty(propertyNameToIdMap, image_renderingAttr); | 119 mapSvgAttributeToCSSProperty(propertyNameToIdMap, image_renderingAttr); |
120 mapAttributeToCSSProperty(propertyNameToIdMap, kerningAttr); | 120 mapSvgAttributeToCSSProperty(propertyNameToIdMap, kerningAttr); |
121 mapAttributeToCSSProperty(propertyNameToIdMap, letter_spacingAttr); | 121 mapSvgAttributeToCSSProperty(propertyNameToIdMap, letter_spacingAttr); |
122 mapAttributeToCSSProperty(propertyNameToIdMap, lighting_colorAttr); | 122 mapSvgAttributeToCSSProperty(propertyNameToIdMap, lighting_colorAttr); |
123 mapAttributeToCSSProperty(propertyNameToIdMap, marker_endAttr); | 123 mapSvgAttributeToCSSProperty(propertyNameToIdMap, marker_endAttr); |
124 mapAttributeToCSSProperty(propertyNameToIdMap, marker_midAttr); | 124 mapSvgAttributeToCSSProperty(propertyNameToIdMap, marker_midAttr); |
125 mapAttributeToCSSProperty(propertyNameToIdMap, marker_startAttr); | 125 mapSvgAttributeToCSSProperty(propertyNameToIdMap, marker_startAttr); |
126 mapAttributeToCSSProperty(propertyNameToIdMap, maskAttr); | 126 mapSvgAttributeToCSSProperty(propertyNameToIdMap, maskAttr); |
127 mapAttributeToCSSProperty(propertyNameToIdMap, opacityAttr); | 127 mapSvgAttributeToCSSProperty(propertyNameToIdMap, opacityAttr); |
128 mapAttributeToCSSProperty(propertyNameToIdMap, overflowAttr); | 128 mapSvgAttributeToCSSProperty(propertyNameToIdMap, overflowAttr); |
129 mapAttributeToCSSProperty(propertyNameToIdMap, pointer_eventsAttr); | 129 mapSvgAttributeToCSSProperty(propertyNameToIdMap, pointer_eventsAttr); |
130 mapAttributeToCSSProperty(propertyNameToIdMap, shape_renderingAttr); | 130 mapSvgAttributeToCSSProperty(propertyNameToIdMap, shape_renderingAttr); |
131 mapAttributeToCSSProperty(propertyNameToIdMap, stop_colorAttr); | 131 mapSvgAttributeToCSSProperty(propertyNameToIdMap, stop_colorAttr); |
132 mapAttributeToCSSProperty(propertyNameToIdMap, stop_opacityAttr); | 132 mapSvgAttributeToCSSProperty(propertyNameToIdMap, stop_opacityAttr); |
133 mapAttributeToCSSProperty(propertyNameToIdMap, strokeAttr); | 133 mapSvgAttributeToCSSProperty(propertyNameToIdMap, strokeAttr); |
134 mapAttributeToCSSProperty(propertyNameToIdMap, stroke_dasharrayAttr); | 134 mapSvgAttributeToCSSProperty(propertyNameToIdMap, stroke_dasharrayAttr); |
135 mapAttributeToCSSProperty(propertyNameToIdMap, stroke_dashoffsetAttr); | 135 mapSvgAttributeToCSSProperty(propertyNameToIdMap, stroke_dashoffsetAttr)
; |
136 mapAttributeToCSSProperty(propertyNameToIdMap, stroke_linecapAttr); | 136 mapSvgAttributeToCSSProperty(propertyNameToIdMap, stroke_linecapAttr); |
137 mapAttributeToCSSProperty(propertyNameToIdMap, stroke_linejoinAttr); | 137 mapSvgAttributeToCSSProperty(propertyNameToIdMap, stroke_linejoinAttr); |
138 mapAttributeToCSSProperty(propertyNameToIdMap, stroke_miterlimitAttr); | 138 mapSvgAttributeToCSSProperty(propertyNameToIdMap, stroke_miterlimitAttr)
; |
139 mapAttributeToCSSProperty(propertyNameToIdMap, stroke_opacityAttr); | 139 mapSvgAttributeToCSSProperty(propertyNameToIdMap, stroke_opacityAttr); |
140 mapAttributeToCSSProperty(propertyNameToIdMap, stroke_widthAttr); | 140 mapSvgAttributeToCSSProperty(propertyNameToIdMap, stroke_widthAttr); |
141 mapAttributeToCSSProperty(propertyNameToIdMap, text_anchorAttr); | 141 mapSvgAttributeToCSSProperty(propertyNameToIdMap, text_anchorAttr); |
142 mapAttributeToCSSProperty(propertyNameToIdMap, text_decorationAttr); | 142 mapSvgAttributeToCSSProperty(propertyNameToIdMap, text_decorationAttr); |
143 mapAttributeToCSSProperty(propertyNameToIdMap, text_renderingAttr); | 143 mapSvgAttributeToCSSProperty(propertyNameToIdMap, text_renderingAttr); |
144 mapAttributeToCSSProperty(propertyNameToIdMap, unicode_bidiAttr); | 144 mapSvgAttributeToCSSProperty(propertyNameToIdMap, unicode_bidiAttr); |
145 mapAttributeToCSSProperty(propertyNameToIdMap, visibilityAttr); | 145 mapSvgAttributeToCSSProperty(propertyNameToIdMap, visibilityAttr); |
146 mapAttributeToCSSProperty(propertyNameToIdMap, word_spacingAttr); | 146 mapSvgAttributeToCSSProperty(propertyNameToIdMap, word_spacingAttr); |
147 mapAttributeToCSSProperty(propertyNameToIdMap, writing_modeAttr); | 147 mapSvgAttributeToCSSProperty(propertyNameToIdMap, writing_modeAttr); |
148 } | 148 } |
149 | 149 |
150 return propertyNameToIdMap->get(attrName.localName().impl()); | 150 return propertyNameToIdMap->get(attrName.localName().impl()); |
151 } | 151 } |
152 | 152 |
153 bool SVGStyledElement::mapToEntry(const QualifiedName& attrName, MappedAttribute
Entry& result) const | 153 bool SVGStyledElement::mapToEntry(const QualifiedName& attrName, MappedAttribute
Entry& result) const |
154 { | 154 { |
155 if (SVGStyledElement::cssPropertyIdForSVGAttributeName(attrName) > 0) { | 155 if (SVGStyledElement::cssPropertyIdForSVGAttributeName(attrName) > 0) { |
156 result = eSVG; | 156 result = eSVG; |
157 return false; | 157 return false; |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 } else { | 280 } else { |
281 ASSERT(gElementsWithInstanceUpdatesBlocked); | 281 ASSERT(gElementsWithInstanceUpdatesBlocked); |
282 ASSERT(gElementsWithInstanceUpdatesBlocked->contains(this)); | 282 ASSERT(gElementsWithInstanceUpdatesBlocked->contains(this)); |
283 gElementsWithInstanceUpdatesBlocked->remove(this); | 283 gElementsWithInstanceUpdatesBlocked->remove(this); |
284 } | 284 } |
285 } | 285 } |
286 | 286 |
287 } | 287 } |
288 | 288 |
289 #endif // ENABLE(SVG) | 289 #endif // ENABLE(SVG) |
OLD | NEW |