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 | |
60 bool SVGPatternElement::isSupportedAttribute(const QualifiedName& attrName) | 75 bool SVGPatternElement::isSupportedAttribute(const QualifiedName& attrName) |
61 { | 76 { |
62 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | 77 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); |
63 if (supportedAttributes.isEmpty()) { | 78 if (supportedAttributes.isEmpty()) { |
64 SVGURIReference::addSupportedAttributes(supportedAttributes); | 79 SVGURIReference::addSupportedAttributes(supportedAttributes); |
65 SVGTests::addSupportedAttributes(supportedAttributes); | 80 SVGTests::addSupportedAttributes(supportedAttributes); |
66 SVGFitToViewBox::addSupportedAttributes(supportedAttributes); | 81 SVGFitToViewBox::addSupportedAttributes(supportedAttributes); |
67 supportedAttributes.add(SVGNames::patternUnitsAttr); | 82 supportedAttributes.add(SVGNames::patternUnitsAttr); |
68 supportedAttributes.add(SVGNames::patternContentUnitsAttr); | 83 supportedAttributes.add(SVGNames::patternContentUnitsAttr); |
69 supportedAttributes.add(SVGNames::patternTransformAttr); | 84 supportedAttributes.add(SVGNames::patternTransformAttr); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
105 reportAttributeParsingError(parseError, name, value); | 120 reportAttributeParsingError(parseError, name, value); |
106 } | 121 } |
107 | 122 |
108 void SVGPatternElement::svgAttributeChanged(const QualifiedName& attrName) | 123 void SVGPatternElement::svgAttributeChanged(const QualifiedName& attrName) |
109 { | 124 { |
110 if (!isSupportedAttribute(attrName)) { | 125 if (!isSupportedAttribute(attrName)) { |
111 SVGElement::svgAttributeChanged(attrName); | 126 SVGElement::svgAttributeChanged(attrName); |
112 return; | 127 return; |
113 } | 128 } |
114 | 129 |
130 if (attrName == SVGNames::patternTransformAttr) { | |
131 invalidateSVGPresentationAttributeStyle(); | |
132 setNeedsStyleRecalc(LocalStyleChange); | |
pdr.
2014/08/04 16:11:17
Could a pattern's children depend on the transform
| |
133 } | |
134 | |
115 SVGElement::InvalidationGuard invalidationGuard(this); | 135 SVGElement::InvalidationGuard invalidationGuard(this); |
116 | 136 |
117 if (attrName == SVGNames::xAttr | 137 if (attrName == SVGNames::xAttr |
118 || attrName == SVGNames::yAttr | 138 || attrName == SVGNames::yAttr |
119 || attrName == SVGNames::widthAttr | 139 || attrName == SVGNames::widthAttr |
120 || attrName == SVGNames::heightAttr) | 140 || attrName == SVGNames::heightAttr) |
121 updateRelativeLengthsInformation(); | 141 updateRelativeLengthsInformation(); |
122 | 142 |
123 RenderSVGResourceContainer* renderer = toRenderSVGResourceContainer(this->re nderer()); | 143 RenderSVGResourceContainer* renderer = toRenderSVGResourceContainer(this->re nderer()); |
124 if (renderer) | 144 if (renderer) |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
160 | 180 |
161 if (!attributes.hasPreserveAspectRatio() && element->preserveAspectRatio()-> isSpecified()) | 181 if (!attributes.hasPreserveAspectRatio() && element->preserveAspectRatio()-> isSpecified()) |
162 attributes.setPreserveAspectRatio(element->preserveAspectRatio()->curren tValue()); | 182 attributes.setPreserveAspectRatio(element->preserveAspectRatio()->curren tValue()); |
163 | 183 |
164 if (!attributes.hasPatternUnits() && element->patternUnits()->isSpecified()) | 184 if (!attributes.hasPatternUnits() && element->patternUnits()->isSpecified()) |
165 attributes.setPatternUnits(element->patternUnits()->currentValue()->enum Value()); | 185 attributes.setPatternUnits(element->patternUnits()->currentValue()->enum Value()); |
166 | 186 |
167 if (!attributes.hasPatternContentUnits() && element->patternContentUnits()-> isSpecified()) | 187 if (!attributes.hasPatternContentUnits() && element->patternContentUnits()-> isSpecified()) |
168 attributes.setPatternContentUnits(element->patternContentUnits()->curren tValue()->enumValue()); | 188 attributes.setPatternContentUnits(element->patternContentUnits()->curren tValue()->enumValue()); |
169 | 189 |
170 if (!attributes.hasPatternTransform() && element->patternTransform()->isSpec ified()) { | 190 if (!attributes.hasPatternTransform()) { |
171 AffineTransform transform; | 191 AffineTransform transform; |
172 element->patternTransform()->currentValue()->concatenate(transform); | 192 bool hasTransform = element->getStyleTransform(transform); |
173 attributes.setPatternTransform(transform); | 193 |
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); | |
174 } | 202 } |
175 | 203 |
176 if (!attributes.hasPatternContentElement() && ElementTraversal::firstWithin( *element)) | 204 if (!attributes.hasPatternContentElement() && ElementTraversal::firstWithin( *element)) |
177 attributes.setPatternContentElement(element); | 205 attributes.setPatternContentElement(element); |
178 } | 206 } |
179 | 207 |
180 void SVGPatternElement::collectPatternAttributes(PatternAttributes& attributes) const | 208 void SVGPatternElement::collectPatternAttributes(PatternAttributes& attributes) const |
181 { | 209 { |
182 WillBeHeapHashSet<RawPtrWillBeMember<const SVGPatternElement> > processedPat terns; | 210 WillBeHeapHashSet<RawPtrWillBeMember<const SVGPatternElement> > processedPat terns; |
183 const SVGPatternElement* current = this; | 211 const SVGPatternElement* current = this; |
(...skipping 27 matching lines...) Expand all Loading... | |
211 | 239 |
212 bool SVGPatternElement::selfHasRelativeLengths() const | 240 bool SVGPatternElement::selfHasRelativeLengths() const |
213 { | 241 { |
214 return m_x->currentValue()->isRelative() | 242 return m_x->currentValue()->isRelative() |
215 || m_y->currentValue()->isRelative() | 243 || m_y->currentValue()->isRelative() |
216 || m_width->currentValue()->isRelative() | 244 || m_width->currentValue()->isRelative() |
217 || m_height->currentValue()->isRelative(); | 245 || m_height->currentValue()->isRelative(); |
218 } | 246 } |
219 | 247 |
220 } | 248 } |
OLD | NEW |