OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> |
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Rob Buis <buis@kde.org> |
4 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. | 4 * Copyright (C) Research In Motion Limited 2009-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 12 matching lines...) Expand all Loading... |
23 | 23 |
24 #include "core/svg/SVGClipPathElement.h" | 24 #include "core/svg/SVGClipPathElement.h" |
25 | 25 |
26 #include "core/rendering/svg/RenderSVGResourceClipper.h" | 26 #include "core/rendering/svg/RenderSVGResourceClipper.h" |
27 #include "core/svg/SVGElementInstance.h" | 27 #include "core/svg/SVGElementInstance.h" |
28 | 28 |
29 namespace WebCore { | 29 namespace WebCore { |
30 | 30 |
31 // Animated property definitions | 31 // Animated property definitions |
32 DEFINE_ANIMATED_ENUMERATION(SVGClipPathElement, SVGNames::clipPathUnitsAttr, Cli
pPathUnits, clipPathUnits, SVGUnitTypes::SVGUnitType) | 32 DEFINE_ANIMATED_ENUMERATION(SVGClipPathElement, SVGNames::clipPathUnitsAttr, Cli
pPathUnits, clipPathUnits, SVGUnitTypes::SVGUnitType) |
33 DEFINE_ANIMATED_BOOLEAN(SVGClipPathElement, SVGNames::externalResourcesRequiredA
ttr, ExternalResourcesRequired, externalResourcesRequired) | |
34 | 33 |
35 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGClipPathElement) | 34 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGClipPathElement) |
36 REGISTER_LOCAL_ANIMATED_PROPERTY(clipPathUnits) | 35 REGISTER_LOCAL_ANIMATED_PROPERTY(clipPathUnits) |
37 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) | |
38 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement) | 36 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement) |
39 END_REGISTER_ANIMATED_PROPERTIES | 37 END_REGISTER_ANIMATED_PROPERTIES |
40 | 38 |
41 inline SVGClipPathElement::SVGClipPathElement(Document& document) | 39 inline SVGClipPathElement::SVGClipPathElement(Document& document) |
42 : SVGGraphicsElement(SVGNames::clipPathTag, document) | 40 : SVGGraphicsElement(SVGNames::clipPathTag, document) |
43 , m_clipPathUnits(SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE) | 41 , m_clipPathUnits(SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE) |
44 { | 42 { |
45 ScriptWrappable::init(this); | 43 ScriptWrappable::init(this); |
46 registerAnimatedPropertiesForSVGClipPathElement(); | 44 registerAnimatedPropertiesForSVGClipPathElement(); |
47 } | 45 } |
48 | 46 |
49 PassRefPtr<SVGClipPathElement> SVGClipPathElement::create(Document& document) | 47 PassRefPtr<SVGClipPathElement> SVGClipPathElement::create(Document& document) |
50 { | 48 { |
51 return adoptRef(new SVGClipPathElement(document)); | 49 return adoptRef(new SVGClipPathElement(document)); |
52 } | 50 } |
53 | 51 |
54 bool SVGClipPathElement::isSupportedAttribute(const QualifiedName& attrName) | 52 bool SVGClipPathElement::isSupportedAttribute(const QualifiedName& attrName) |
55 { | 53 { |
56 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | 54 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); |
57 if (supportedAttributes.isEmpty()) { | 55 if (supportedAttributes.isEmpty()) |
58 SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes
); | |
59 supportedAttributes.add(SVGNames::clipPathUnitsAttr); | 56 supportedAttributes.add(SVGNames::clipPathUnitsAttr); |
60 } | 57 |
61 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | 58 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); |
62 } | 59 } |
63 | 60 |
64 void SVGClipPathElement::parseAttribute(const QualifiedName& name, const AtomicS
tring& value) | 61 void SVGClipPathElement::parseAttribute(const QualifiedName& name, const AtomicS
tring& value) |
65 { | 62 { |
66 if (!isSupportedAttribute(name)) { | 63 if (!isSupportedAttribute(name)) { |
67 SVGGraphicsElement::parseAttribute(name, value); | 64 SVGGraphicsElement::parseAttribute(name, value); |
68 return; | 65 return; |
69 } | 66 } |
70 | 67 |
71 if (name == SVGNames::clipPathUnitsAttr) { | 68 if (name == SVGNames::clipPathUnitsAttr) { |
72 SVGUnitTypes::SVGUnitType propertyValue = SVGPropertyTraits<SVGUnitTypes
::SVGUnitType>::fromString(value); | 69 SVGUnitTypes::SVGUnitType propertyValue = SVGPropertyTraits<SVGUnitTypes
::SVGUnitType>::fromString(value); |
73 if (propertyValue > 0) | 70 if (propertyValue > 0) |
74 setClipPathUnitsBaseValue(propertyValue); | 71 setClipPathUnitsBaseValue(propertyValue); |
75 return; | 72 return; |
76 } | 73 } |
77 | 74 |
78 if (SVGExternalResourcesRequired::parseAttribute(name, value)) | |
79 return; | |
80 | |
81 ASSERT_NOT_REACHED(); | 75 ASSERT_NOT_REACHED(); |
82 } | 76 } |
83 | 77 |
84 void SVGClipPathElement::svgAttributeChanged(const QualifiedName& attrName) | 78 void SVGClipPathElement::svgAttributeChanged(const QualifiedName& attrName) |
85 { | 79 { |
86 if (!isSupportedAttribute(attrName)) { | 80 if (!isSupportedAttribute(attrName)) { |
87 SVGGraphicsElement::svgAttributeChanged(attrName); | 81 SVGGraphicsElement::svgAttributeChanged(attrName); |
88 return; | 82 return; |
89 } | 83 } |
90 | 84 |
(...skipping 14 matching lines...) Expand all Loading... |
105 if (RenderObject* object = renderer()) | 99 if (RenderObject* object = renderer()) |
106 object->setNeedsLayout(); | 100 object->setNeedsLayout(); |
107 } | 101 } |
108 | 102 |
109 RenderObject* SVGClipPathElement::createRenderer(RenderStyle*) | 103 RenderObject* SVGClipPathElement::createRenderer(RenderStyle*) |
110 { | 104 { |
111 return new RenderSVGResourceClipper(this); | 105 return new RenderSVGResourceClipper(this); |
112 } | 106 } |
113 | 107 |
114 } | 108 } |
OLD | NEW |