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 30 matching lines...) Expand all Loading... |
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 , SVGURIReference(this) | 49 , SVGURIReference(this) |
50 , SVGTests(this) | 50 , SVGTests(this) |
| 51 , SVGFitToViewBox(this) |
51 , m_x(SVGAnimatedLength::create(this, SVGNames::xAttr, SVGLength::create(Len
gthModeWidth))) | 52 , m_x(SVGAnimatedLength::create(this, SVGNames::xAttr, SVGLength::create(Len
gthModeWidth))) |
52 , m_y(SVGAnimatedLength::create(this, SVGNames::yAttr, SVGLength::create(Len
gthModeHeight))) | 53 , m_y(SVGAnimatedLength::create(this, SVGNames::yAttr, SVGLength::create(Len
gthModeHeight))) |
53 , m_width(SVGAnimatedLength::create(this, SVGNames::widthAttr, SVGLength::cr
eate(LengthModeWidth))) | 54 , m_width(SVGAnimatedLength::create(this, SVGNames::widthAttr, SVGLength::cr
eate(LengthModeWidth))) |
54 , m_height(SVGAnimatedLength::create(this, SVGNames::heightAttr, SVGLength::
create(LengthModeHeight))) | 55 , m_height(SVGAnimatedLength::create(this, SVGNames::heightAttr, SVGLength::
create(LengthModeHeight))) |
55 , m_viewBox(SVGAnimatedRect::create(this, SVGNames::viewBoxAttr)) | |
56 , m_preserveAspectRatio(SVGAnimatedPreserveAspectRatio::create(this, SVGName
s::preserveAspectRatioAttr, SVGPreserveAspectRatio::create())) | |
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 registerAnimatedPropertiesForSVGPatternElement(); | 65 registerAnimatedPropertiesForSVGPatternElement(); |
69 } | 66 } |
70 | 67 |
71 PassRefPtr<SVGPatternElement> SVGPatternElement::create(Document& document) | 68 PassRefPtr<SVGPatternElement> SVGPatternElement::create(Document& document) |
72 { | 69 { |
73 return adoptRef(new SVGPatternElement(document)); | 70 return adoptRef(new SVGPatternElement(document)); |
74 } | 71 } |
75 | 72 |
76 bool SVGPatternElement::isSupportedAttribute(const QualifiedName& attrName) | 73 bool SVGPatternElement::isSupportedAttribute(const QualifiedName& attrName) |
77 { | 74 { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 } else if (name == SVGNames::xAttr) { | 113 } else if (name == SVGNames::xAttr) { |
117 m_x->setBaseValueAsString(value, AllowNegativeLengths, parseError); | 114 m_x->setBaseValueAsString(value, AllowNegativeLengths, parseError); |
118 } else if (name == SVGNames::yAttr) { | 115 } else if (name == SVGNames::yAttr) { |
119 m_y->setBaseValueAsString(value, AllowNegativeLengths, parseError); | 116 m_y->setBaseValueAsString(value, AllowNegativeLengths, parseError); |
120 } else if (name == SVGNames::widthAttr) { | 117 } else if (name == SVGNames::widthAttr) { |
121 m_width->setBaseValueAsString(value, ForbidNegativeLengths, parseError); | 118 m_width->setBaseValueAsString(value, ForbidNegativeLengths, parseError); |
122 } else if (name == SVGNames::heightAttr) { | 119 } else if (name == SVGNames::heightAttr) { |
123 m_height->setBaseValueAsString(value, ForbidNegativeLengths, parseError)
; | 120 m_height->setBaseValueAsString(value, ForbidNegativeLengths, parseError)
; |
124 } else if (SVGURIReference::parseAttribute(name, value, parseError)) { | 121 } else if (SVGURIReference::parseAttribute(name, value, parseError)) { |
125 } else if (SVGTests::parseAttribute(name, value)) { | 122 } else if (SVGTests::parseAttribute(name, value)) { |
126 } else if (SVGFitToViewBox::parseAttribute(this, name, value)) { | 123 } else if (SVGFitToViewBox::parseAttribute(name, value, document(), parseErr
or)) { |
127 } else { | 124 } else { |
128 ASSERT_NOT_REACHED(); | 125 ASSERT_NOT_REACHED(); |
129 } | 126 } |
130 | 127 |
131 reportAttributeParsingError(parseError, name, value); | 128 reportAttributeParsingError(parseError, name, value); |
132 } | 129 } |
133 | 130 |
134 void SVGPatternElement::svgAttributeChanged(const QualifiedName& attrName) | 131 void SVGPatternElement::svgAttributeChanged(const QualifiedName& attrName) |
135 { | 132 { |
136 if (!isSupportedAttribute(attrName)) { | 133 if (!isSupportedAttribute(attrName)) { |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 | 234 |
238 bool SVGPatternElement::selfHasRelativeLengths() const | 235 bool SVGPatternElement::selfHasRelativeLengths() const |
239 { | 236 { |
240 return m_x->currentValue()->isRelative() | 237 return m_x->currentValue()->isRelative() |
241 || m_y->currentValue()->isRelative() | 238 || m_y->currentValue()->isRelative() |
242 || m_width->currentValue()->isRelative() | 239 || m_width->currentValue()->isRelative() |
243 || m_height->currentValue()->isRelative(); | 240 || m_height->currentValue()->isRelative(); |
244 } | 241 } |
245 | 242 |
246 } | 243 } |
OLD | NEW |