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) 2005 Alexander Kellett <lypanov@kde.org> | 4 * Copyright (C) 2005 Alexander Kellett <lypanov@kde.org> |
5 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> | 5 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> |
6 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. | 6 * Copyright (C) Research In Motion Limited 2009-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 11 matching lines...) Expand all Loading... |
22 */ | 22 */ |
23 | 23 |
24 #include "config.h" | 24 #include "config.h" |
25 | 25 |
26 #include "core/svg/SVGMaskElement.h" | 26 #include "core/svg/SVGMaskElement.h" |
27 | 27 |
28 #include "core/rendering/svg/RenderSVGResourceMasker.h" | 28 #include "core/rendering/svg/RenderSVGResourceMasker.h" |
29 | 29 |
30 namespace WebCore { | 30 namespace WebCore { |
31 | 31 |
32 SVGMaskElement::SVGMaskElement(Document& document) | 32 inline SVGMaskElement::SVGMaskElement(Document& document) |
33 : SVGElement(SVGNames::maskTag, document) | 33 : SVGElement(SVGNames::maskTag, document) |
34 , SVGTests(this) | 34 , SVGTests(this) |
35 , m_x(SVGAnimatedLength::create(this, SVGNames::xAttr, SVGLength::create(Len
gthModeWidth), AllowNegativeLengths)) | 35 , m_x(SVGAnimatedLength::create(this, SVGNames::xAttr, SVGLength::create(Len
gthModeWidth), AllowNegativeLengths)) |
36 , m_y(SVGAnimatedLength::create(this, SVGNames::yAttr, SVGLength::create(Len
gthModeHeight), AllowNegativeLengths)) | 36 , m_y(SVGAnimatedLength::create(this, SVGNames::yAttr, SVGLength::create(Len
gthModeHeight), AllowNegativeLengths)) |
37 , m_width(SVGAnimatedLength::create(this, SVGNames::widthAttr, SVGLength::cr
eate(LengthModeWidth), ForbidNegativeLengths)) | 37 , m_width(SVGAnimatedLength::create(this, SVGNames::widthAttr, SVGLength::cr
eate(LengthModeWidth), ForbidNegativeLengths)) |
38 , m_height(SVGAnimatedLength::create(this, SVGNames::heightAttr, SVGLength::
create(LengthModeHeight), ForbidNegativeLengths)) | 38 , m_height(SVGAnimatedLength::create(this, SVGNames::heightAttr, SVGLength::
create(LengthModeHeight), ForbidNegativeLengths)) |
39 , m_maskUnits(SVGAnimatedEnumeration<SVGUnitTypes::SVGUnitType>::create(this
, SVGNames::maskUnitsAttr, SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX)) | 39 , m_maskUnits(SVGAnimatedEnumeration<SVGUnitTypes::SVGUnitType>::create(this
, SVGNames::maskUnitsAttr, SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX)) |
40 , m_maskContentUnits(SVGAnimatedEnumeration<SVGUnitTypes::SVGUnitType>::crea
te(this, SVGNames::maskContentUnitsAttr, SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEON
USE)) | 40 , m_maskContentUnits(SVGAnimatedEnumeration<SVGUnitTypes::SVGUnitType>::crea
te(this, SVGNames::maskContentUnitsAttr, SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEON
USE)) |
41 { | 41 { |
42 ScriptWrappable::init(this); | 42 ScriptWrappable::init(this); |
43 | 43 |
44 // Spec: If the x/y attribute is not specified, the effect is as if a value
of "-10%" were specified. | 44 // Spec: If the x/y attribute is not specified, the effect is as if a value
of "-10%" were specified. |
45 m_x->setDefaultValueAsString("-10%"); | 45 m_x->setDefaultValueAsString("-10%"); |
46 m_y->setDefaultValueAsString("-10%"); | 46 m_y->setDefaultValueAsString("-10%"); |
47 | 47 |
48 // Spec: If the width/height attribute is not specified, the effect is as if
a value of "120%" were specified. | 48 // Spec: If the width/height attribute is not specified, the effect is as if
a value of "120%" were specified. |
49 m_width->setDefaultValueAsString("120%"); | 49 m_width->setDefaultValueAsString("120%"); |
50 m_height->setDefaultValueAsString("120%"); | 50 m_height->setDefaultValueAsString("120%"); |
51 | 51 |
52 addToPropertyMap(m_x); | 52 addToPropertyMap(m_x); |
53 addToPropertyMap(m_y); | 53 addToPropertyMap(m_y); |
54 addToPropertyMap(m_width); | 54 addToPropertyMap(m_width); |
55 addToPropertyMap(m_height); | 55 addToPropertyMap(m_height); |
56 addToPropertyMap(m_maskUnits); | 56 addToPropertyMap(m_maskUnits); |
57 addToPropertyMap(m_maskContentUnits); | 57 addToPropertyMap(m_maskContentUnits); |
58 } | 58 } |
59 | 59 |
| 60 DEFINE_NODE_FACTORY(SVGMaskElement) |
| 61 |
60 bool SVGMaskElement::isSupportedAttribute(const QualifiedName& attrName) | 62 bool SVGMaskElement::isSupportedAttribute(const QualifiedName& attrName) |
61 { | 63 { |
62 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | 64 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); |
63 if (supportedAttributes.isEmpty()) { | 65 if (supportedAttributes.isEmpty()) { |
64 SVGTests::addSupportedAttributes(supportedAttributes); | 66 SVGTests::addSupportedAttributes(supportedAttributes); |
65 supportedAttributes.add(SVGNames::maskUnitsAttr); | 67 supportedAttributes.add(SVGNames::maskUnitsAttr); |
66 supportedAttributes.add(SVGNames::maskContentUnitsAttr); | 68 supportedAttributes.add(SVGNames::maskContentUnitsAttr); |
67 supportedAttributes.add(SVGNames::xAttr); | 69 supportedAttributes.add(SVGNames::xAttr); |
68 supportedAttributes.add(SVGNames::yAttr); | 70 supportedAttributes.add(SVGNames::yAttr); |
69 supportedAttributes.add(SVGNames::widthAttr); | 71 supportedAttributes.add(SVGNames::widthAttr); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 | 137 |
136 bool SVGMaskElement::selfHasRelativeLengths() const | 138 bool SVGMaskElement::selfHasRelativeLengths() const |
137 { | 139 { |
138 return m_x->currentValue()->isRelative() | 140 return m_x->currentValue()->isRelative() |
139 || m_y->currentValue()->isRelative() | 141 || m_y->currentValue()->isRelative() |
140 || m_width->currentValue()->isRelative() | 142 || m_width->currentValue()->isRelative() |
141 || m_height->currentValue()->isRelative(); | 143 || m_height->currentValue()->isRelative(); |
142 } | 144 } |
143 | 145 |
144 } | 146 } |
OLD | NEW |