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 19 matching lines...) Expand all Loading... |
30 inline SVGClipPathElement::SVGClipPathElement(Document& document) | 30 inline SVGClipPathElement::SVGClipPathElement(Document& document) |
31 : SVGGraphicsElement(SVGNames::clipPathTag, document) | 31 : SVGGraphicsElement(SVGNames::clipPathTag, document) |
32 , m_clipPathUnits(SVGAnimatedEnumeration<SVGUnitTypes::SVGUnitType>::create(
this, SVGNames::clipPathUnitsAttr, SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE)) | 32 , m_clipPathUnits(SVGAnimatedEnumeration<SVGUnitTypes::SVGUnitType>::create(
this, SVGNames::clipPathUnitsAttr, SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE)) |
33 { | 33 { |
34 ScriptWrappable::init(this); | 34 ScriptWrappable::init(this); |
35 addToPropertyMap(m_clipPathUnits); | 35 addToPropertyMap(m_clipPathUnits); |
36 } | 36 } |
37 | 37 |
38 DEFINE_NODE_FACTORY(SVGClipPathElement) | 38 DEFINE_NODE_FACTORY(SVGClipPathElement) |
39 | 39 |
40 bool SVGClipPathElement::isSupportedAttribute(const QualifiedName& attrName) | |
41 { | |
42 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | |
43 if (supportedAttributes.isEmpty()) | |
44 supportedAttributes.add(SVGNames::clipPathUnitsAttr); | |
45 | |
46 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | |
47 } | |
48 | |
49 void SVGClipPathElement::parseAttribute(const QualifiedName& name, const AtomicS
tring& value) | 40 void SVGClipPathElement::parseAttribute(const QualifiedName& name, const AtomicS
tring& value) |
50 { | 41 { |
51 if (!isSupportedAttribute(name)) { | 42 parseAttributeNew(name, value); |
52 SVGGraphicsElement::parseAttribute(name, value); | |
53 return; | |
54 } | |
55 | |
56 SVGParsingError parseError = NoError; | |
57 | |
58 if (name == SVGNames::clipPathUnitsAttr) | |
59 m_clipPathUnits->setBaseValueAsString(value, parseError); | |
60 else | |
61 ASSERT_NOT_REACHED(); | |
62 | |
63 reportAttributeParsingError(parseError, name, value); | |
64 } | 43 } |
65 | 44 |
66 void SVGClipPathElement::svgAttributeChanged(const QualifiedName& attrName) | 45 void SVGClipPathElement::svgAttributeChanged(const QualifiedName& attrName) |
67 { | 46 { |
68 if (!isSupportedAttribute(attrName)) { | 47 if (attrName != SVGNames::clipPathUnitsAttr) { |
69 SVGGraphicsElement::svgAttributeChanged(attrName); | 48 SVGGraphicsElement::svgAttributeChanged(attrName); |
70 return; | 49 return; |
71 } | 50 } |
72 | 51 |
73 SVGElement::InvalidationGuard invalidationGuard(this); | 52 SVGElement::InvalidationGuard invalidationGuard(this); |
74 | 53 |
75 RenderSVGResourceContainer* renderer = toRenderSVGResourceContainer(this->re
nderer()); | 54 RenderSVGResourceContainer* renderer = toRenderSVGResourceContainer(this->re
nderer()); |
76 if (renderer) | 55 if (renderer) |
77 renderer->invalidateCacheAndMarkForLayout(); | 56 renderer->invalidateCacheAndMarkForLayout(); |
78 } | 57 } |
79 | 58 |
80 void SVGClipPathElement::childrenChanged(const ChildrenChange& change) | 59 void SVGClipPathElement::childrenChanged(const ChildrenChange& change) |
81 { | 60 { |
82 SVGGraphicsElement::childrenChanged(change); | 61 SVGGraphicsElement::childrenChanged(change); |
83 | 62 |
84 if (change.byParser) | 63 if (change.byParser) |
85 return; | 64 return; |
86 | 65 |
87 if (RenderObject* object = renderer()) | 66 if (RenderObject* object = renderer()) |
88 object->setNeedsLayoutAndFullPaintInvalidation(); | 67 object->setNeedsLayoutAndFullPaintInvalidation(); |
89 } | 68 } |
90 | 69 |
91 RenderObject* SVGClipPathElement::createRenderer(RenderStyle*) | 70 RenderObject* SVGClipPathElement::createRenderer(RenderStyle*) |
92 { | 71 { |
93 return new RenderSVGResourceClipper(this); | 72 return new RenderSVGResourceClipper(this); |
94 } | 73 } |
95 | 74 |
96 } | 75 } |
OLD | NEW |