Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(735)

Side by Side Diff: Source/core/svg/SVGClipPathElement.cpp

Issue 18053005: Introduce SVGGraphicsElement IDL interface (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 18 matching lines...) Expand all
29 29
30 namespace WebCore { 30 namespace WebCore {
31 31
32 // Animated property definitions 32 // Animated property definitions
33 DEFINE_ANIMATED_ENUMERATION(SVGClipPathElement, SVGNames::clipPathUnitsAttr, Cli pPathUnits, clipPathUnits, SVGUnitTypes::SVGUnitType) 33 DEFINE_ANIMATED_ENUMERATION(SVGClipPathElement, SVGNames::clipPathUnitsAttr, Cli pPathUnits, clipPathUnits, SVGUnitTypes::SVGUnitType)
34 DEFINE_ANIMATED_BOOLEAN(SVGClipPathElement, SVGNames::externalResourcesRequiredA ttr, ExternalResourcesRequired, externalResourcesRequired) 34 DEFINE_ANIMATED_BOOLEAN(SVGClipPathElement, SVGNames::externalResourcesRequiredA ttr, ExternalResourcesRequired, externalResourcesRequired)
35 35
36 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGClipPathElement) 36 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGClipPathElement)
37 REGISTER_LOCAL_ANIMATED_PROPERTY(clipPathUnits) 37 REGISTER_LOCAL_ANIMATED_PROPERTY(clipPathUnits)
38 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) 38 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)
39 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGStyledTransformableElement) 39 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement)
40 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGTests)
41 END_REGISTER_ANIMATED_PROPERTIES 40 END_REGISTER_ANIMATED_PROPERTIES
42 41
43 inline SVGClipPathElement::SVGClipPathElement(const QualifiedName& tagName, Docu ment* document) 42 inline SVGClipPathElement::SVGClipPathElement(const QualifiedName& tagName, Docu ment* document)
44 : SVGStyledTransformableElement(tagName, document) 43 : SVGGraphicsElement(tagName, document)
45 , m_clipPathUnits(SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE) 44 , m_clipPathUnits(SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE)
46 { 45 {
47 ASSERT(hasTagName(SVGNames::clipPathTag)); 46 ASSERT(hasTagName(SVGNames::clipPathTag));
48 ScriptWrappable::init(this); 47 ScriptWrappable::init(this);
49 registerAnimatedPropertiesForSVGClipPathElement(); 48 registerAnimatedPropertiesForSVGClipPathElement();
50 } 49 }
51 50
52 PassRefPtr<SVGClipPathElement> SVGClipPathElement::create(const QualifiedName& t agName, Document* document) 51 PassRefPtr<SVGClipPathElement> SVGClipPathElement::create(const QualifiedName& t agName, Document* document)
53 { 52 {
54 return adoptRef(new SVGClipPathElement(tagName, document)); 53 return adoptRef(new SVGClipPathElement(tagName, document));
55 } 54 }
56 55
57 bool SVGClipPathElement::isSupportedAttribute(const QualifiedName& attrName) 56 bool SVGClipPathElement::isSupportedAttribute(const QualifiedName& attrName)
58 { 57 {
59 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); 58 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ());
60 if (supportedAttributes.isEmpty()) { 59 if (supportedAttributes.isEmpty()) {
61 SVGTests::addSupportedAttributes(supportedAttributes); 60 SVGTests::addSupportedAttributes(supportedAttributes);
62 SVGLangSpace::addSupportedAttributes(supportedAttributes); 61 SVGLangSpace::addSupportedAttributes(supportedAttributes);
63 SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes ); 62 SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes );
64 supportedAttributes.add(SVGNames::clipPathUnitsAttr); 63 supportedAttributes.add(SVGNames::clipPathUnitsAttr);
65 } 64 }
66 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); 65 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName);
67 } 66 }
68 67
69 void SVGClipPathElement::parseAttribute(const QualifiedName& name, const AtomicS tring& value) 68 void SVGClipPathElement::parseAttribute(const QualifiedName& name, const AtomicS tring& value)
70 { 69 {
71 if (!isSupportedAttribute(name)) { 70 if (!isSupportedAttribute(name)) {
72 SVGStyledTransformableElement::parseAttribute(name, value); 71 SVGGraphicsElement::parseAttribute(name, value);
73 return; 72 return;
74 } 73 }
75 74
76 if (name == SVGNames::clipPathUnitsAttr) { 75 if (name == SVGNames::clipPathUnitsAttr) {
77 SVGUnitTypes::SVGUnitType propertyValue = SVGPropertyTraits<SVGUnitTypes ::SVGUnitType>::fromString(value); 76 SVGUnitTypes::SVGUnitType propertyValue = SVGPropertyTraits<SVGUnitTypes ::SVGUnitType>::fromString(value);
78 if (propertyValue > 0) 77 if (propertyValue > 0)
79 setClipPathUnitsBaseValue(propertyValue); 78 setClipPathUnitsBaseValue(propertyValue);
80 return; 79 return;
81 } 80 }
82 81
83 if (SVGTests::parseAttribute(name, value)) 82 if (SVGTests::parseAttribute(name, value))
84 return; 83 return;
85 if (SVGLangSpace::parseAttribute(name, value)) 84 if (SVGLangSpace::parseAttribute(name, value))
86 return; 85 return;
87 if (SVGExternalResourcesRequired::parseAttribute(name, value)) 86 if (SVGExternalResourcesRequired::parseAttribute(name, value))
88 return; 87 return;
89 88
90 ASSERT_NOT_REACHED(); 89 ASSERT_NOT_REACHED();
91 } 90 }
92 91
93 void SVGClipPathElement::svgAttributeChanged(const QualifiedName& attrName) 92 void SVGClipPathElement::svgAttributeChanged(const QualifiedName& attrName)
94 { 93 {
95 if (!isSupportedAttribute(attrName)) { 94 if (!isSupportedAttribute(attrName)) {
96 SVGStyledTransformableElement::svgAttributeChanged(attrName); 95 SVGGraphicsElement::svgAttributeChanged(attrName);
97 return; 96 return;
98 } 97 }
99 98
100 SVGElementInstance::InvalidationGuard invalidationGuard(this); 99 SVGElementInstance::InvalidationGuard invalidationGuard(this);
101 100
102 if (RenderObject* object = renderer()) 101 if (RenderObject* object = renderer())
103 object->setNeedsLayout(true); 102 object->setNeedsLayout(true);
104 } 103 }
105 104
106 void SVGClipPathElement::childrenChanged(bool changedByParser, Node* beforeChang e, Node* afterChange, int childCountDelta) 105 void SVGClipPathElement::childrenChanged(bool changedByParser, Node* beforeChang e, Node* afterChange, int childCountDelta)
107 { 106 {
108 SVGStyledTransformableElement::childrenChanged(changedByParser, beforeChange , afterChange, childCountDelta); 107 SVGGraphicsElement::childrenChanged(changedByParser, beforeChange, afterChan ge, childCountDelta);
109 108
110 if (changedByParser) 109 if (changedByParser)
111 return; 110 return;
112 111
113 if (RenderObject* object = renderer()) 112 if (RenderObject* object = renderer())
114 object->setNeedsLayout(true); 113 object->setNeedsLayout(true);
115 } 114 }
116 115
117 RenderObject* SVGClipPathElement::createRenderer(RenderStyle*) 116 RenderObject* SVGClipPathElement::createRenderer(RenderStyle*)
118 { 117 {
119 return new (document()->renderArena()) RenderSVGResourceClipper(this); 118 return new (document()->renderArena()) RenderSVGResourceClipper(this);
120 } 119 }
121 120
122 } 121 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698