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

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

Issue 62943002: Implement SVGGeometryElement (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add SVGGeometryElement in expected results Created 7 years, 1 month 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
« no previous file with comments | « Source/core/svg/SVGPolyElement.h ('k') | Source/core/svg/SVGPolygonElement.idl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 // Animated property definitions 60 // Animated property definitions
61 DEFINE_ANIMATED_BOOLEAN(SVGPolyElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired) 61 DEFINE_ANIMATED_BOOLEAN(SVGPolyElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired)
62 62
63 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGPolyElement) 63 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGPolyElement)
64 REGISTER_LOCAL_ANIMATED_PROPERTY(points) 64 REGISTER_LOCAL_ANIMATED_PROPERTY(points)
65 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) 65 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)
66 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement) 66 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement)
67 END_REGISTER_ANIMATED_PROPERTIES 67 END_REGISTER_ANIMATED_PROPERTIES
68 68
69 SVGPolyElement::SVGPolyElement(const QualifiedName& tagName, Document& document) 69 SVGPolyElement::SVGPolyElement(const QualifiedName& tagName, Document& document)
70 : SVGGraphicsElement(tagName, document) 70 : SVGGeometryElement(tagName, document)
71 { 71 {
72 registerAnimatedPropertiesForSVGPolyElement(); 72 registerAnimatedPropertiesForSVGPolyElement();
73 } 73 }
74 74
75 bool SVGPolyElement::isSupportedAttribute(const QualifiedName& attrName) 75 bool SVGPolyElement::isSupportedAttribute(const QualifiedName& attrName)
76 { 76 {
77 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); 77 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ());
78 if (supportedAttributes.isEmpty()) { 78 if (supportedAttributes.isEmpty()) {
79 SVGLangSpace::addSupportedAttributes(supportedAttributes); 79 SVGLangSpace::addSupportedAttributes(supportedAttributes);
80 SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes ); 80 SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes );
81 supportedAttributes.add(SVGNames::pointsAttr); 81 supportedAttributes.add(SVGNames::pointsAttr);
82 } 82 }
83 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); 83 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName);
84 } 84 }
85 85
86 void SVGPolyElement::parseAttribute(const QualifiedName& name, const AtomicStrin g& value) 86 void SVGPolyElement::parseAttribute(const QualifiedName& name, const AtomicStrin g& value)
87 { 87 {
88 if (!isSupportedAttribute(name)) { 88 if (!isSupportedAttribute(name)) {
89 SVGGraphicsElement::parseAttribute(name, value); 89 SVGGeometryElement::parseAttribute(name, value);
90 return; 90 return;
91 } 91 }
92 92
93 if (name == SVGNames::pointsAttr) { 93 if (name == SVGNames::pointsAttr) {
94 SVGPointList newList; 94 SVGPointList newList;
95 if (!pointsListFromSVGData(newList, value)) 95 if (!pointsListFromSVGData(newList, value))
96 document().accessSVGExtensions()->reportError("Problem parsing point s=\"" + value + "\""); 96 document().accessSVGExtensions()->reportError("Problem parsing point s=\"" + value + "\"");
97 97
98 if (SVGAnimatedProperty* wrapper = SVGAnimatedProperty::lookupWrapper<SV GPolyElement, SVGAnimatedPointList>(this, pointsPropertyInfo())) 98 if (SVGAnimatedProperty* wrapper = SVGAnimatedProperty::lookupWrapper<SV GPolyElement, SVGAnimatedPointList>(this, pointsPropertyInfo()))
99 static_cast<SVGAnimatedPointList*>(wrapper)->detachListWrappers(newL ist.size()); 99 static_cast<SVGAnimatedPointList*>(wrapper)->detachListWrappers(newL ist.size());
100 100
101 m_points.value = newList; 101 m_points.value = newList;
102 return; 102 return;
103 } 103 }
104 104
105 if (SVGLangSpace::parseAttribute(name, value)) 105 if (SVGLangSpace::parseAttribute(name, value))
106 return; 106 return;
107 if (SVGExternalResourcesRequired::parseAttribute(name, value)) 107 if (SVGExternalResourcesRequired::parseAttribute(name, value))
108 return; 108 return;
109 109
110 ASSERT_NOT_REACHED(); 110 ASSERT_NOT_REACHED();
111 } 111 }
112 112
113 void SVGPolyElement::svgAttributeChanged(const QualifiedName& attrName) 113 void SVGPolyElement::svgAttributeChanged(const QualifiedName& attrName)
114 { 114 {
115 if (!isSupportedAttribute(attrName)) { 115 if (!isSupportedAttribute(attrName)) {
116 SVGGraphicsElement::svgAttributeChanged(attrName); 116 SVGGeometryElement::svgAttributeChanged(attrName);
117 return; 117 return;
118 } 118 }
119 119
120 SVGElementInstance::InvalidationGuard invalidationGuard(this); 120 SVGElementInstance::InvalidationGuard invalidationGuard(this);
121 121
122 RenderSVGShape* renderer = toRenderSVGShape(this->renderer()); 122 RenderSVGShape* renderer = toRenderSVGShape(this->renderer());
123 if (!renderer) 123 if (!renderer)
124 return; 124 return;
125 125
126 if (attrName == SVGNames::pointsAttr) { 126 if (attrName == SVGNames::pointsAttr) {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 return static_cast<SVGListPropertyTearOff<SVGPointList>*>(static_pointer_cas t<SVGAnimatedPointList>(lookupOrCreatePointsWrapper(this))->baseVal()); 160 return static_cast<SVGListPropertyTearOff<SVGPointList>*>(static_pointer_cas t<SVGAnimatedPointList>(lookupOrCreatePointsWrapper(this))->baseVal());
161 } 161 }
162 162
163 SVGListPropertyTearOff<SVGPointList>* SVGPolyElement::animatedPoints() 163 SVGListPropertyTearOff<SVGPointList>* SVGPolyElement::animatedPoints()
164 { 164 {
165 m_points.shouldSynchronize = true; 165 m_points.shouldSynchronize = true;
166 return static_cast<SVGListPropertyTearOff<SVGPointList>*>(static_pointer_cas t<SVGAnimatedPointList>(lookupOrCreatePointsWrapper(this))->animVal()); 166 return static_cast<SVGListPropertyTearOff<SVGPointList>*>(static_pointer_cas t<SVGAnimatedPointList>(lookupOrCreatePointsWrapper(this))->animVal());
167 } 167 }
168 168
169 } 169 }
OLDNEW
« no previous file with comments | « Source/core/svg/SVGPolyElement.h ('k') | Source/core/svg/SVGPolygonElement.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698