| 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 14 matching lines...) Expand all Loading... |
| 25 | 25 |
| 26 #include "core/svg/SVGLinearGradientElement.h" | 26 #include "core/svg/SVGLinearGradientElement.h" |
| 27 | 27 |
| 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/SVGLength.h" | 30 #include "core/svg/SVGLength.h" |
| 31 #include "core/svg/SVGTransformList.h" | 31 #include "core/svg/SVGTransformList.h" |
| 32 | 32 |
| 33 namespace WebCore { | 33 namespace WebCore { |
| 34 | 34 |
| 35 SVGLinearGradientElement::SVGLinearGradientElement(Document& document) | 35 inline SVGLinearGradientElement::SVGLinearGradientElement(Document& document) |
| 36 : SVGGradientElement(SVGNames::linearGradientTag, document) | 36 : SVGGradientElement(SVGNames::linearGradientTag, document) |
| 37 , m_x1(SVGAnimatedLength::create(this, SVGNames::x1Attr, SVGLength::create(L
engthModeWidth), AllowNegativeLengths)) | 37 , m_x1(SVGAnimatedLength::create(this, SVGNames::x1Attr, SVGLength::create(L
engthModeWidth), AllowNegativeLengths)) |
| 38 , m_y1(SVGAnimatedLength::create(this, SVGNames::y1Attr, SVGLength::create(L
engthModeHeight), AllowNegativeLengths)) | 38 , m_y1(SVGAnimatedLength::create(this, SVGNames::y1Attr, SVGLength::create(L
engthModeHeight), AllowNegativeLengths)) |
| 39 , m_x2(SVGAnimatedLength::create(this, SVGNames::x2Attr, SVGLength::create(L
engthModeWidth), AllowNegativeLengths)) | 39 , m_x2(SVGAnimatedLength::create(this, SVGNames::x2Attr, SVGLength::create(L
engthModeWidth), AllowNegativeLengths)) |
| 40 , m_y2(SVGAnimatedLength::create(this, SVGNames::y2Attr, SVGLength::create(L
engthModeHeight), AllowNegativeLengths)) | 40 , m_y2(SVGAnimatedLength::create(this, SVGNames::y2Attr, SVGLength::create(L
engthModeHeight), AllowNegativeLengths)) |
| 41 { | 41 { |
| 42 ScriptWrappable::init(this); | 42 ScriptWrappable::init(this); |
| 43 | 43 |
| 44 // Spec: If the x2 attribute is not specified, the effect is as if a value o
f "100%" were specified. | 44 // Spec: If the x2 attribute is not specified, the effect is as if a value o
f "100%" were specified. |
| 45 m_x2->setDefaultValueAsString("100%"); | 45 m_x2->setDefaultValueAsString("100%"); |
| 46 | 46 |
| 47 addToPropertyMap(m_x1); | 47 addToPropertyMap(m_x1); |
| 48 addToPropertyMap(m_y1); | 48 addToPropertyMap(m_y1); |
| 49 addToPropertyMap(m_x2); | 49 addToPropertyMap(m_x2); |
| 50 addToPropertyMap(m_y2); | 50 addToPropertyMap(m_y2); |
| 51 } | 51 } |
| 52 | 52 |
| 53 DEFINE_NODE_FACTORY(SVGLinearGradientElement) |
| 54 |
| 53 bool SVGLinearGradientElement::isSupportedAttribute(const QualifiedName& attrNam
e) | 55 bool SVGLinearGradientElement::isSupportedAttribute(const QualifiedName& attrNam
e) |
| 54 { | 56 { |
| 55 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | 57 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); |
| 56 if (supportedAttributes.isEmpty()) { | 58 if (supportedAttributes.isEmpty()) { |
| 57 supportedAttributes.add(SVGNames::x1Attr); | 59 supportedAttributes.add(SVGNames::x1Attr); |
| 58 supportedAttributes.add(SVGNames::x2Attr); | 60 supportedAttributes.add(SVGNames::x2Attr); |
| 59 supportedAttributes.add(SVGNames::y1Attr); | 61 supportedAttributes.add(SVGNames::y1Attr); |
| 60 supportedAttributes.add(SVGNames::y2Attr); | 62 supportedAttributes.add(SVGNames::y2Attr); |
| 61 } | 63 } |
| 62 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | 64 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 | 179 |
| 178 bool SVGLinearGradientElement::selfHasRelativeLengths() const | 180 bool SVGLinearGradientElement::selfHasRelativeLengths() const |
| 179 { | 181 { |
| 180 return m_x1->currentValue()->isRelative() | 182 return m_x1->currentValue()->isRelative() |
| 181 || m_y1->currentValue()->isRelative() | 183 || m_y1->currentValue()->isRelative() |
| 182 || m_x2->currentValue()->isRelative() | 184 || m_x2->currentValue()->isRelative() |
| 183 || m_y2->currentValue()->isRelative(); | 185 || m_y2->currentValue()->isRelative(); |
| 184 } | 186 } |
| 185 | 187 |
| 186 } | 188 } |
| OLD | NEW |