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 16 matching lines...) Expand all Loading... |
27 | 27 |
28 #include "core/rendering/svg/RenderSVGResourceRadialGradient.h" | 28 #include "core/rendering/svg/RenderSVGResourceRadialGradient.h" |
29 #include "core/svg/RadialGradientAttributes.h" | 29 #include "core/svg/RadialGradientAttributes.h" |
30 #include "core/svg/SVGElementInstance.h" | 30 #include "core/svg/SVGElementInstance.h" |
31 #include "core/svg/SVGTransformList.h" | 31 #include "core/svg/SVGTransformList.h" |
32 | 32 |
33 namespace WebCore { | 33 namespace WebCore { |
34 | 34 |
35 inline SVGRadialGradientElement::SVGRadialGradientElement(Document& document) | 35 inline SVGRadialGradientElement::SVGRadialGradientElement(Document& document) |
36 : SVGGradientElement(SVGNames::radialGradientTag, document) | 36 : SVGGradientElement(SVGNames::radialGradientTag, document) |
37 , m_cx(SVGAnimatedLength::create(this, SVGNames::cxAttr, SVGLength::create(L
engthModeWidth))) | 37 , m_cx(SVGAnimatedLength::create(this, SVGNames::cxAttr, SVGLength::create(L
engthModeWidth), AllowNegativeLengths)) |
38 , m_cy(SVGAnimatedLength::create(this, SVGNames::cyAttr, SVGLength::create(L
engthModeHeight))) | 38 , m_cy(SVGAnimatedLength::create(this, SVGNames::cyAttr, SVGLength::create(L
engthModeHeight), AllowNegativeLengths)) |
39 , m_r(SVGAnimatedLength::create(this, SVGNames::rAttr, SVGLength::create(Len
gthModeOther))) | 39 , m_r(SVGAnimatedLength::create(this, SVGNames::rAttr, SVGLength::create(Len
gthModeOther), ForbidNegativeLengths)) |
40 , m_fx(SVGAnimatedLength::create(this, SVGNames::fxAttr, SVGLength::create(L
engthModeWidth))) | 40 , m_fx(SVGAnimatedLength::create(this, SVGNames::fxAttr, SVGLength::create(L
engthModeWidth), AllowNegativeLengths)) |
41 , m_fy(SVGAnimatedLength::create(this, SVGNames::fyAttr, SVGLength::create(L
engthModeHeight))) | 41 , m_fy(SVGAnimatedLength::create(this, SVGNames::fyAttr, SVGLength::create(L
engthModeHeight), AllowNegativeLengths)) |
42 , m_fr(SVGAnimatedLength::create(this, SVGNames::frAttr, SVGLength::create(L
engthModeOther))) | 42 , m_fr(SVGAnimatedLength::create(this, SVGNames::frAttr, SVGLength::create(L
engthModeOther), ForbidNegativeLengths)) |
43 { | 43 { |
44 ScriptWrappable::init(this); | 44 ScriptWrappable::init(this); |
45 | 45 |
46 // Spec: If the cx/cy/r attribute is not specified, the effect is as if a va
lue of "50%" were specified. | 46 // Spec: If the cx/cy/r attribute is not specified, the effect is as if a va
lue of "50%" were specified. |
47 m_cx->setDefaultValueAsString("50%"); | 47 m_cx->setDefaultValueAsString("50%"); |
48 m_cy->setDefaultValueAsString("50%"); | 48 m_cy->setDefaultValueAsString("50%"); |
49 m_r->setDefaultValueAsString("50%"); | 49 m_r->setDefaultValueAsString("50%"); |
50 | 50 |
51 // SVG2-Draft Spec: If the fr attributed is not specified, the effect is as
if a value of "0%" were specified. | 51 // SVG2-Draft Spec: If the fr attributed is not specified, the effect is as
if a value of "0%" were specified. |
52 m_fr->setDefaultValueAsString("0%"); | 52 m_fr->setDefaultValueAsString("0%"); |
(...skipping 25 matching lines...) Expand all Loading... |
78 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | 78 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); |
79 } | 79 } |
80 | 80 |
81 void SVGRadialGradientElement::parseAttribute(const QualifiedName& name, const A
tomicString& value) | 81 void SVGRadialGradientElement::parseAttribute(const QualifiedName& name, const A
tomicString& value) |
82 { | 82 { |
83 SVGParsingError parseError = NoError; | 83 SVGParsingError parseError = NoError; |
84 | 84 |
85 if (!isSupportedAttribute(name)) | 85 if (!isSupportedAttribute(name)) |
86 SVGGradientElement::parseAttribute(name, value); | 86 SVGGradientElement::parseAttribute(name, value); |
87 else if (name == SVGNames::cxAttr) | 87 else if (name == SVGNames::cxAttr) |
88 m_cx->setBaseValueAsString(value, AllowNegativeLengths, parseError); | 88 m_cx->setBaseValueAsString(value, parseError); |
89 else if (name == SVGNames::cyAttr) | 89 else if (name == SVGNames::cyAttr) |
90 m_cy->setBaseValueAsString(value, AllowNegativeLengths, parseError); | 90 m_cy->setBaseValueAsString(value, parseError); |
91 else if (name == SVGNames::rAttr) | 91 else if (name == SVGNames::rAttr) |
92 m_r->setBaseValueAsString(value, ForbidNegativeLengths, parseError); | 92 m_r->setBaseValueAsString(value, parseError); |
93 else if (name == SVGNames::fxAttr) | 93 else if (name == SVGNames::fxAttr) |
94 m_fx->setBaseValueAsString(value, AllowNegativeLengths, parseError); | 94 m_fx->setBaseValueAsString(value, parseError); |
95 else if (name == SVGNames::fyAttr) | 95 else if (name == SVGNames::fyAttr) |
96 m_fy->setBaseValueAsString(value, AllowNegativeLengths, parseError); | 96 m_fy->setBaseValueAsString(value, parseError); |
97 else if (name == SVGNames::frAttr) | 97 else if (name == SVGNames::frAttr) |
98 m_fr->setBaseValueAsString(value, ForbidNegativeLengths, parseError); | 98 m_fr->setBaseValueAsString(value, parseError); |
99 else | 99 else |
100 ASSERT_NOT_REACHED(); | 100 ASSERT_NOT_REACHED(); |
101 | 101 |
102 reportAttributeParsingError(parseError, name, value); | 102 reportAttributeParsingError(parseError, name, value); |
103 } | 103 } |
104 | 104 |
105 void SVGRadialGradientElement::svgAttributeChanged(const QualifiedName& attrName
) | 105 void SVGRadialGradientElement::svgAttributeChanged(const QualifiedName& attrName
) |
106 { | 106 { |
107 if (!isSupportedAttribute(attrName)) { | 107 if (!isSupportedAttribute(attrName)) { |
108 SVGGradientElement::svgAttributeChanged(attrName); | 108 SVGGradientElement::svgAttributeChanged(attrName); |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 { | 211 { |
212 return m_cx->currentValue()->isRelative() | 212 return m_cx->currentValue()->isRelative() |
213 || m_cy->currentValue()->isRelative() | 213 || m_cy->currentValue()->isRelative() |
214 || m_r->currentValue()->isRelative() | 214 || m_r->currentValue()->isRelative() |
215 || m_fx->currentValue()->isRelative() | 215 || m_fx->currentValue()->isRelative() |
216 || m_fy->currentValue()->isRelative() | 216 || m_fy->currentValue()->isRelative() |
217 || m_fr->currentValue()->isRelative(); | 217 || m_fr->currentValue()->isRelative(); |
218 } | 218 } |
219 | 219 |
220 } | 220 } |
OLD | NEW |