OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde
.org> | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde
.org> |
3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> |
4 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 4 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 addToPropertyMap(m_y); | 50 addToPropertyMap(m_y); |
51 addToPropertyMap(m_width); | 51 addToPropertyMap(m_width); |
52 addToPropertyMap(m_height); | 52 addToPropertyMap(m_height); |
53 addToPropertyMap(m_patternTransform); | 53 addToPropertyMap(m_patternTransform); |
54 addToPropertyMap(m_patternUnits); | 54 addToPropertyMap(m_patternUnits); |
55 addToPropertyMap(m_patternContentUnits); | 55 addToPropertyMap(m_patternContentUnits); |
56 } | 56 } |
57 | 57 |
58 DEFINE_NODE_FACTORY(SVGPatternElement) | 58 DEFINE_NODE_FACTORY(SVGPatternElement) |
59 | 59 |
60 bool SVGPatternElement::isPresentationAttribute(const QualifiedName& name) const | |
61 { | |
62 if (name == SVGNames::patternTransformAttr) | |
63 return true; | |
64 return SVGElement::isPresentationAttribute(name); | |
65 } | |
66 | |
67 void SVGPatternElement::collectStyleForPresentationAttribute(const QualifiedName
& name, const AtomicString& value, MutableStylePropertySet* style) | |
68 { | |
69 if (name == SVGNames::patternTransformAttr) | |
70 addPropertyToPresentationAttributeStyle(style, CSSPropertyTransform, val
ue); | |
71 else | |
72 SVGElement::collectStyleForPresentationAttribute(name, value, style); | |
73 } | |
74 | |
75 bool SVGPatternElement::isSupportedAttribute(const QualifiedName& attrName) | 60 bool SVGPatternElement::isSupportedAttribute(const QualifiedName& attrName) |
76 { | 61 { |
77 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | 62 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); |
78 if (supportedAttributes.isEmpty()) { | 63 if (supportedAttributes.isEmpty()) { |
79 SVGURIReference::addSupportedAttributes(supportedAttributes); | 64 SVGURIReference::addSupportedAttributes(supportedAttributes); |
80 SVGTests::addSupportedAttributes(supportedAttributes); | 65 SVGTests::addSupportedAttributes(supportedAttributes); |
81 SVGFitToViewBox::addSupportedAttributes(supportedAttributes); | 66 SVGFitToViewBox::addSupportedAttributes(supportedAttributes); |
82 supportedAttributes.add(SVGNames::patternUnitsAttr); | 67 supportedAttributes.add(SVGNames::patternUnitsAttr); |
83 supportedAttributes.add(SVGNames::patternContentUnitsAttr); | 68 supportedAttributes.add(SVGNames::patternContentUnitsAttr); |
84 supportedAttributes.add(SVGNames::patternTransformAttr); | 69 supportedAttributes.add(SVGNames::patternTransformAttr); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 reportAttributeParsingError(parseError, name, value); | 105 reportAttributeParsingError(parseError, name, value); |
121 } | 106 } |
122 | 107 |
123 void SVGPatternElement::svgAttributeChanged(const QualifiedName& attrName) | 108 void SVGPatternElement::svgAttributeChanged(const QualifiedName& attrName) |
124 { | 109 { |
125 if (!isSupportedAttribute(attrName)) { | 110 if (!isSupportedAttribute(attrName)) { |
126 SVGElement::svgAttributeChanged(attrName); | 111 SVGElement::svgAttributeChanged(attrName); |
127 return; | 112 return; |
128 } | 113 } |
129 | 114 |
130 if (attrName == SVGNames::patternTransformAttr) { | |
131 invalidateSVGPresentationAttributeStyle(); | |
132 setNeedsStyleRecalc(LocalStyleChange); | |
133 } | |
134 | |
135 SVGElement::InvalidationGuard invalidationGuard(this); | 115 SVGElement::InvalidationGuard invalidationGuard(this); |
136 | 116 |
137 if (attrName == SVGNames::xAttr | 117 if (attrName == SVGNames::xAttr |
138 || attrName == SVGNames::yAttr | 118 || attrName == SVGNames::yAttr |
139 || attrName == SVGNames::widthAttr | 119 || attrName == SVGNames::widthAttr |
140 || attrName == SVGNames::heightAttr) | 120 || attrName == SVGNames::heightAttr) |
141 updateRelativeLengthsInformation(); | 121 updateRelativeLengthsInformation(); |
142 | 122 |
143 RenderSVGResourceContainer* renderer = toRenderSVGResourceContainer(this->re
nderer()); | 123 RenderSVGResourceContainer* renderer = toRenderSVGResourceContainer(this->re
nderer()); |
144 if (renderer) | 124 if (renderer) |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 | 160 |
181 if (!attributes.hasPreserveAspectRatio() && element->preserveAspectRatio()->
isSpecified()) | 161 if (!attributes.hasPreserveAspectRatio() && element->preserveAspectRatio()->
isSpecified()) |
182 attributes.setPreserveAspectRatio(element->preserveAspectRatio()->curren
tValue()); | 162 attributes.setPreserveAspectRatio(element->preserveAspectRatio()->curren
tValue()); |
183 | 163 |
184 if (!attributes.hasPatternUnits() && element->patternUnits()->isSpecified()) | 164 if (!attributes.hasPatternUnits() && element->patternUnits()->isSpecified()) |
185 attributes.setPatternUnits(element->patternUnits()->currentValue()->enum
Value()); | 165 attributes.setPatternUnits(element->patternUnits()->currentValue()->enum
Value()); |
186 | 166 |
187 if (!attributes.hasPatternContentUnits() && element->patternContentUnits()->
isSpecified()) | 167 if (!attributes.hasPatternContentUnits() && element->patternContentUnits()->
isSpecified()) |
188 attributes.setPatternContentUnits(element->patternContentUnits()->curren
tValue()->enumValue()); | 168 attributes.setPatternContentUnits(element->patternContentUnits()->curren
tValue()->enumValue()); |
189 | 169 |
190 if (!attributes.hasPatternTransform()) { | 170 if (!attributes.hasPatternTransform() && element->patternTransform()->isSpec
ified()) { |
191 AffineTransform transform; | 171 AffineTransform transform; |
192 bool hasTransform = element->getStyleTransform(transform); | 172 element->patternTransform()->currentValue()->concatenate(transform); |
193 | 173 attributes.setPatternTransform(transform); |
194 // If CSS property was set, use that, otherwise fallback to attribute (i
f set). | |
195 if (!hasTransform && element->patternTransform()->isSpecified()) { | |
196 element->patternTransform()->currentValue()->concatenate(transform); | |
197 hasTransform = true; | |
198 } | |
199 | |
200 if (hasTransform) | |
201 attributes.setPatternTransform(transform); | |
202 } | 174 } |
203 | 175 |
204 if (!attributes.hasPatternContentElement() && ElementTraversal::firstWithin(
*element)) | 176 if (!attributes.hasPatternContentElement() && ElementTraversal::firstWithin(
*element)) |
205 attributes.setPatternContentElement(element); | 177 attributes.setPatternContentElement(element); |
206 } | 178 } |
207 | 179 |
208 void SVGPatternElement::collectPatternAttributes(PatternAttributes& attributes)
const | 180 void SVGPatternElement::collectPatternAttributes(PatternAttributes& attributes)
const |
209 { | 181 { |
210 WillBeHeapHashSet<RawPtrWillBeMember<const SVGPatternElement> > processedPat
terns; | 182 WillBeHeapHashSet<RawPtrWillBeMember<const SVGPatternElement> > processedPat
terns; |
211 const SVGPatternElement* current = this; | 183 const SVGPatternElement* current = this; |
(...skipping 27 matching lines...) Expand all Loading... |
239 | 211 |
240 bool SVGPatternElement::selfHasRelativeLengths() const | 212 bool SVGPatternElement::selfHasRelativeLengths() const |
241 { | 213 { |
242 return m_x->currentValue()->isRelative() | 214 return m_x->currentValue()->isRelative() |
243 || m_y->currentValue()->isRelative() | 215 || m_y->currentValue()->isRelative() |
244 || m_width->currentValue()->isRelative() | 216 || m_width->currentValue()->isRelative() |
245 || m_height->currentValue()->isRelative(); | 217 || m_height->currentValue()->isRelative(); |
246 } | 218 } |
247 | 219 |
248 } | 220 } |
OLD | NEW |