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 29 matching lines...) Expand all Loading... |
40 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGPatternElement) | 40 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGPatternElement) |
41 REGISTER_LOCAL_ANIMATED_PROPERTY(patternUnits) | 41 REGISTER_LOCAL_ANIMATED_PROPERTY(patternUnits) |
42 REGISTER_LOCAL_ANIMATED_PROPERTY(patternContentUnits) | 42 REGISTER_LOCAL_ANIMATED_PROPERTY(patternContentUnits) |
43 REGISTER_LOCAL_ANIMATED_PROPERTY(patternTransform) | 43 REGISTER_LOCAL_ANIMATED_PROPERTY(patternTransform) |
44 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement) | 44 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement) |
45 END_REGISTER_ANIMATED_PROPERTIES | 45 END_REGISTER_ANIMATED_PROPERTIES |
46 | 46 |
47 inline SVGPatternElement::SVGPatternElement(Document& document) | 47 inline SVGPatternElement::SVGPatternElement(Document& document) |
48 : SVGElement(SVGNames::patternTag, document) | 48 : SVGElement(SVGNames::patternTag, document) |
49 , SVGTests(this) | 49 , SVGTests(this) |
| 50 , SVGFitToViewBox(this) |
50 , m_x(SVGAnimatedLength::create(this, SVGNames::xAttr, SVGLength::create(Len
gthModeWidth))) | 51 , m_x(SVGAnimatedLength::create(this, SVGNames::xAttr, SVGLength::create(Len
gthModeWidth))) |
51 , m_y(SVGAnimatedLength::create(this, SVGNames::yAttr, SVGLength::create(Len
gthModeHeight))) | 52 , m_y(SVGAnimatedLength::create(this, SVGNames::yAttr, SVGLength::create(Len
gthModeHeight))) |
52 , m_width(SVGAnimatedLength::create(this, SVGNames::widthAttr, SVGLength::cr
eate(LengthModeWidth))) | 53 , m_width(SVGAnimatedLength::create(this, SVGNames::widthAttr, SVGLength::cr
eate(LengthModeWidth))) |
53 , m_height(SVGAnimatedLength::create(this, SVGNames::heightAttr, SVGLength::
create(LengthModeHeight))) | 54 , m_height(SVGAnimatedLength::create(this, SVGNames::heightAttr, SVGLength::
create(LengthModeHeight))) |
54 , m_viewBox(SVGAnimatedRect::create(this, SVGNames::viewBoxAttr)) | |
55 , m_preserveAspectRatio(SVGAnimatedPreserveAspectRatio::create(this, SVGName
s::preserveAspectRatioAttr, SVGPreserveAspectRatio::create())) | |
56 , m_href(SVGAnimatedString::create(this, XLinkNames::hrefAttr, SVGString::cr
eate())) | 55 , m_href(SVGAnimatedString::create(this, XLinkNames::hrefAttr, SVGString::cr
eate())) |
57 , m_patternUnits(SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) | 56 , m_patternUnits(SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) |
58 , m_patternContentUnits(SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE) | 57 , m_patternContentUnits(SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE) |
59 { | 58 { |
60 ScriptWrappable::init(this); | 59 ScriptWrappable::init(this); |
61 | 60 |
62 addToPropertyMap(m_x); | 61 addToPropertyMap(m_x); |
63 addToPropertyMap(m_y); | 62 addToPropertyMap(m_y); |
64 addToPropertyMap(m_width); | 63 addToPropertyMap(m_width); |
65 addToPropertyMap(m_height); | 64 addToPropertyMap(m_height); |
66 addToPropertyMap(m_viewBox); | |
67 addToPropertyMap(m_preserveAspectRatio); | |
68 addToPropertyMap(m_href); | 65 addToPropertyMap(m_href); |
69 registerAnimatedPropertiesForSVGPatternElement(); | 66 registerAnimatedPropertiesForSVGPatternElement(); |
70 } | 67 } |
71 | 68 |
72 PassRefPtr<SVGPatternElement> SVGPatternElement::create(Document& document) | 69 PassRefPtr<SVGPatternElement> SVGPatternElement::create(Document& document) |
73 { | 70 { |
74 return adoptRef(new SVGPatternElement(document)); | 71 return adoptRef(new SVGPatternElement(document)); |
75 } | 72 } |
76 | 73 |
77 bool SVGPatternElement::isSupportedAttribute(const QualifiedName& attrName) | 74 bool SVGPatternElement::isSupportedAttribute(const QualifiedName& attrName) |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 } else if (name == SVGNames::xAttr) | 114 } else if (name == SVGNames::xAttr) |
118 m_x->setBaseValueAsString(value, AllowNegativeLengths, parseError); | 115 m_x->setBaseValueAsString(value, AllowNegativeLengths, parseError); |
119 else if (name == SVGNames::yAttr) | 116 else if (name == SVGNames::yAttr) |
120 m_y->setBaseValueAsString(value, AllowNegativeLengths, parseError); | 117 m_y->setBaseValueAsString(value, AllowNegativeLengths, parseError); |
121 else if (name == SVGNames::widthAttr) | 118 else if (name == SVGNames::widthAttr) |
122 m_width->setBaseValueAsString(value, ForbidNegativeLengths, parseError); | 119 m_width->setBaseValueAsString(value, ForbidNegativeLengths, parseError); |
123 else if (name == SVGNames::heightAttr) | 120 else if (name == SVGNames::heightAttr) |
124 m_height->setBaseValueAsString(value, ForbidNegativeLengths, parseError)
; | 121 m_height->setBaseValueAsString(value, ForbidNegativeLengths, parseError)
; |
125 else if (name.matches(XLinkNames::hrefAttr)) | 122 else if (name.matches(XLinkNames::hrefAttr)) |
126 m_href->setBaseValueAsString(value, parseError); | 123 m_href->setBaseValueAsString(value, parseError); |
127 else if (SVGTests::parseAttribute(name, value) | 124 else if (SVGTests::parseAttribute(name, value) || SVGFitToViewBox::parseAttr
ibute(name, value, document(), parseError)) { |
128 || SVGFitToViewBox::parseAttribute(this, name, value)) { | |
129 } else | 125 } else |
130 ASSERT_NOT_REACHED(); | 126 ASSERT_NOT_REACHED(); |
131 | 127 |
132 reportAttributeParsingError(parseError, name, value); | 128 reportAttributeParsingError(parseError, name, value); |
133 } | 129 } |
134 | 130 |
135 void SVGPatternElement::svgAttributeChanged(const QualifiedName& attrName) | 131 void SVGPatternElement::svgAttributeChanged(const QualifiedName& attrName) |
136 { | 132 { |
137 if (!isSupportedAttribute(attrName)) { | 133 if (!isSupportedAttribute(attrName)) { |
138 SVGElement::svgAttributeChanged(attrName); | 134 SVGElement::svgAttributeChanged(attrName); |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 | 234 |
239 bool SVGPatternElement::selfHasRelativeLengths() const | 235 bool SVGPatternElement::selfHasRelativeLengths() const |
240 { | 236 { |
241 return m_x->currentValue()->isRelative() | 237 return m_x->currentValue()->isRelative() |
242 || m_y->currentValue()->isRelative() | 238 || m_y->currentValue()->isRelative() |
243 || m_width->currentValue()->isRelative() | 239 || m_width->currentValue()->isRelative() |
244 || m_height->currentValue()->isRelative(); | 240 || m_height->currentValue()->isRelative(); |
245 } | 241 } |
246 | 242 |
247 } | 243 } |
OLD | NEW |