OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2006, 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) 2008 Eric Seidel <eric@webkit.org> | 4 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> |
5 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org> | 5 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org> |
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 17 matching lines...) Expand all Loading... |
28 #include "core/rendering/svg/RenderSVGResourceLinearGradient.h" | 28 #include "core/rendering/svg/RenderSVGResourceLinearGradient.h" |
29 #include "core/svg/LinearGradientAttributes.h" | 29 #include "core/svg/LinearGradientAttributes.h" |
30 #include "core/svg/SVGElementInstance.h" | 30 #include "core/svg/SVGElementInstance.h" |
31 #include "core/svg/SVGLength.h" | 31 #include "core/svg/SVGLength.h" |
32 #include "core/svg/SVGTransformList.h" | 32 #include "core/svg/SVGTransformList.h" |
33 | 33 |
34 namespace WebCore { | 34 namespace WebCore { |
35 | 35 |
36 inline SVGLinearGradientElement::SVGLinearGradientElement(Document& document) | 36 inline SVGLinearGradientElement::SVGLinearGradientElement(Document& document) |
37 : SVGGradientElement(SVGNames::linearGradientTag, document) | 37 : SVGGradientElement(SVGNames::linearGradientTag, document) |
38 , m_x1(SVGAnimatedLength::create(this, SVGNames::x1Attr, SVGLength::create(L
engthModeWidth))) | 38 , m_x1(SVGAnimatedLength::create(this, SVGNames::x1Attr, SVGLength::create(L
engthModeWidth), AllowNegativeLengths)) |
39 , m_y1(SVGAnimatedLength::create(this, SVGNames::y1Attr, SVGLength::create(L
engthModeHeight))) | 39 , m_y1(SVGAnimatedLength::create(this, SVGNames::y1Attr, SVGLength::create(L
engthModeHeight), AllowNegativeLengths)) |
40 , m_x2(SVGAnimatedLength::create(this, SVGNames::x2Attr, SVGLength::create(L
engthModeWidth))) | 40 , m_x2(SVGAnimatedLength::create(this, SVGNames::x2Attr, SVGLength::create(L
engthModeWidth), AllowNegativeLengths)) |
41 , m_y2(SVGAnimatedLength::create(this, SVGNames::y2Attr, SVGLength::create(L
engthModeHeight))) | 41 , m_y2(SVGAnimatedLength::create(this, SVGNames::y2Attr, SVGLength::create(L
engthModeHeight), AllowNegativeLengths)) |
42 { | 42 { |
43 ScriptWrappable::init(this); | 43 ScriptWrappable::init(this); |
44 | 44 |
45 // Spec: If the x2 attribute is not specified, the effect is as if a value o
f "100%" were specified. | 45 // Spec: If the x2 attribute is not specified, the effect is as if a value o
f "100%" were specified. |
46 m_x2->setDefaultValueAsString("100%"); | 46 m_x2->setDefaultValueAsString("100%"); |
47 | 47 |
48 addToPropertyMap(m_x1); | 48 addToPropertyMap(m_x1); |
49 addToPropertyMap(m_y1); | 49 addToPropertyMap(m_y1); |
50 addToPropertyMap(m_x2); | 50 addToPropertyMap(m_x2); |
51 addToPropertyMap(m_y2); | 51 addToPropertyMap(m_y2); |
(...skipping 16 matching lines...) Expand all Loading... |
68 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | 68 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); |
69 } | 69 } |
70 | 70 |
71 void SVGLinearGradientElement::parseAttribute(const QualifiedName& name, const A
tomicString& value) | 71 void SVGLinearGradientElement::parseAttribute(const QualifiedName& name, const A
tomicString& value) |
72 { | 72 { |
73 SVGParsingError parseError = NoError; | 73 SVGParsingError parseError = NoError; |
74 | 74 |
75 if (!isSupportedAttribute(name)) | 75 if (!isSupportedAttribute(name)) |
76 SVGGradientElement::parseAttribute(name, value); | 76 SVGGradientElement::parseAttribute(name, value); |
77 else if (name == SVGNames::x1Attr) | 77 else if (name == SVGNames::x1Attr) |
78 m_x1->setBaseValueAsString(value, AllowNegativeLengths, parseError); | 78 m_x1->setBaseValueAsString(value, parseError); |
79 else if (name == SVGNames::y1Attr) | 79 else if (name == SVGNames::y1Attr) |
80 m_y1->setBaseValueAsString(value, AllowNegativeLengths, parseError); | 80 m_y1->setBaseValueAsString(value, parseError); |
81 else if (name == SVGNames::x2Attr) | 81 else if (name == SVGNames::x2Attr) |
82 m_x2->setBaseValueAsString(value, AllowNegativeLengths, parseError); | 82 m_x2->setBaseValueAsString(value, parseError); |
83 else if (name == SVGNames::y2Attr) | 83 else if (name == SVGNames::y2Attr) |
84 m_y2->setBaseValueAsString(value, AllowNegativeLengths, parseError); | 84 m_y2->setBaseValueAsString(value, parseError); |
85 else | 85 else |
86 ASSERT_NOT_REACHED(); | 86 ASSERT_NOT_REACHED(); |
87 | 87 |
88 reportAttributeParsingError(parseError, name, value); | 88 reportAttributeParsingError(parseError, name, value); |
89 } | 89 } |
90 | 90 |
91 void SVGLinearGradientElement::svgAttributeChanged(const QualifiedName& attrName
) | 91 void SVGLinearGradientElement::svgAttributeChanged(const QualifiedName& attrName
) |
92 { | 92 { |
93 if (!isSupportedAttribute(attrName)) { | 93 if (!isSupportedAttribute(attrName)) { |
94 SVGGradientElement::svgAttributeChanged(attrName); | 94 SVGGradientElement::svgAttributeChanged(attrName); |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 | 183 |
184 bool SVGLinearGradientElement::selfHasRelativeLengths() const | 184 bool SVGLinearGradientElement::selfHasRelativeLengths() const |
185 { | 185 { |
186 return m_x1->currentValue()->isRelative() | 186 return m_x1->currentValue()->isRelative() |
187 || m_y1->currentValue()->isRelative() | 187 || m_y1->currentValue()->isRelative() |
188 || m_x2->currentValue()->isRelative() | 188 || m_x2->currentValue()->isRelative() |
189 || m_y2->currentValue()->isRelative(); | 189 || m_y2->currentValue()->isRelative(); |
190 } | 190 } |
191 | 191 |
192 } | 192 } |
OLD | NEW |