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

Side by Side Diff: Source/core/svg/SVGPathElement.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/SVGPathElement.h ('k') | Source/core/svg/SVGPathElement.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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 DEFINE_ANIMATED_BOOLEAN(SVGPathElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired) 72 DEFINE_ANIMATED_BOOLEAN(SVGPathElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired)
73 73
74 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGPathElement) 74 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGPathElement)
75 REGISTER_LOCAL_ANIMATED_PROPERTY(d) 75 REGISTER_LOCAL_ANIMATED_PROPERTY(d)
76 REGISTER_LOCAL_ANIMATED_PROPERTY(pathLength) 76 REGISTER_LOCAL_ANIMATED_PROPERTY(pathLength)
77 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) 77 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)
78 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement) 78 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement)
79 END_REGISTER_ANIMATED_PROPERTIES 79 END_REGISTER_ANIMATED_PROPERTIES
80 80
81 inline SVGPathElement::SVGPathElement(const QualifiedName& tagName, Document& do cument) 81 inline SVGPathElement::SVGPathElement(const QualifiedName& tagName, Document& do cument)
82 : SVGGraphicsElement(tagName, document) 82 : SVGGeometryElement(tagName, document)
83 , m_pathByteStream(SVGPathByteStream::create()) 83 , m_pathByteStream(SVGPathByteStream::create())
84 , m_pathSegList(PathSegUnalteredRole) 84 , m_pathSegList(PathSegUnalteredRole)
85 , m_isAnimValObserved(false) 85 , m_isAnimValObserved(false)
86 { 86 {
87 ASSERT(hasTagName(SVGNames::pathTag)); 87 ASSERT(hasTagName(SVGNames::pathTag));
88 ScriptWrappable::init(this); 88 ScriptWrappable::init(this);
89 registerAnimatedPropertiesForSVGPathElement(); 89 registerAnimatedPropertiesForSVGPathElement();
90 } 90 }
91 91
92 PassRefPtr<SVGPathElement> SVGPathElement::create(const QualifiedName& tagName, Document& document) 92 PassRefPtr<SVGPathElement> SVGPathElement::create(const QualifiedName& tagName, Document& document)
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes ); 217 SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes );
218 supportedAttributes.add(SVGNames::dAttr); 218 supportedAttributes.add(SVGNames::dAttr);
219 supportedAttributes.add(SVGNames::pathLengthAttr); 219 supportedAttributes.add(SVGNames::pathLengthAttr);
220 } 220 }
221 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); 221 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName);
222 } 222 }
223 223
224 void SVGPathElement::parseAttribute(const QualifiedName& name, const AtomicStrin g& value) 224 void SVGPathElement::parseAttribute(const QualifiedName& name, const AtomicStrin g& value)
225 { 225 {
226 if (!isSupportedAttribute(name)) { 226 if (!isSupportedAttribute(name)) {
227 SVGGraphicsElement::parseAttribute(name, value); 227 SVGGeometryElement::parseAttribute(name, value);
228 return; 228 return;
229 } 229 }
230 230
231 if (name == SVGNames::dAttr) { 231 if (name == SVGNames::dAttr) {
232 if (!buildSVGPathByteStreamFromString(value, m_pathByteStream.get(), Una lteredParsing)) 232 if (!buildSVGPathByteStreamFromString(value, m_pathByteStream.get(), Una lteredParsing))
233 document().accessSVGExtensions()->reportError("Problem parsing d=\"" + value + "\""); 233 document().accessSVGExtensions()->reportError("Problem parsing d=\"" + value + "\"");
234 return; 234 return;
235 } 235 }
236 236
237 if (name == SVGNames::pathLengthAttr) { 237 if (name == SVGNames::pathLengthAttr) {
238 setPathLengthBaseValue(value.toFloat()); 238 setPathLengthBaseValue(value.toFloat());
239 if (pathLengthBaseValue() < 0) 239 if (pathLengthBaseValue() < 0)
240 document().accessSVGExtensions()->reportError("A negative value for path attribute <pathLength> is not allowed"); 240 document().accessSVGExtensions()->reportError("A negative value for path attribute <pathLength> is not allowed");
241 return; 241 return;
242 } 242 }
243 243
244 if (SVGExternalResourcesRequired::parseAttribute(name, value)) 244 if (SVGExternalResourcesRequired::parseAttribute(name, value))
245 return; 245 return;
246 246
247 ASSERT_NOT_REACHED(); 247 ASSERT_NOT_REACHED();
248 } 248 }
249 249
250 void SVGPathElement::svgAttributeChanged(const QualifiedName& attrName) 250 void SVGPathElement::svgAttributeChanged(const QualifiedName& attrName)
251 { 251 {
252 if (!isSupportedAttribute(attrName)) { 252 if (!isSupportedAttribute(attrName)) {
253 SVGGraphicsElement::svgAttributeChanged(attrName); 253 SVGGeometryElement::svgAttributeChanged(attrName);
254 return; 254 return;
255 } 255 }
256 256
257 SVGElementInstance::InvalidationGuard invalidationGuard(this); 257 SVGElementInstance::InvalidationGuard invalidationGuard(this);
258 258
259 RenderSVGPath* renderer = toRenderSVGPath(this->renderer()); 259 RenderSVGPath* renderer = toRenderSVGPath(this->renderer());
260 260
261 if (attrName == SVGNames::dAttr) { 261 if (attrName == SVGNames::dAttr) {
262 if (m_pathSegList.shouldSynchronize && !SVGAnimatedProperty::lookupWrapp er<SVGPathElement, SVGAnimatedPathSegListPropertyTearOff>(this, dPropertyInfo()) ->isAnimating()) { 262 if (m_pathSegList.shouldSynchronize && !SVGAnimatedProperty::lookupWrapp er<SVGPathElement, SVGAnimatedPathSegListPropertyTearOff>(this, dPropertyInfo()) ->isAnimating()) {
263 SVGPathSegList newList(PathSegUnalteredRole); 263 SVGPathSegList newList(PathSegUnalteredRole);
(...skipping 19 matching lines...) Expand all
283 HashSet<SVGElement*>::iterator end = dependencies->end(); 283 HashSet<SVGElement*>::iterator end = dependencies->end();
284 for (HashSet<SVGElement*>::iterator it = dependencies->begin(); it != en d; ++it) { 284 for (HashSet<SVGElement*>::iterator it = dependencies->begin(); it != en d; ++it) {
285 if ((*it)->hasTagName(SVGNames::mpathTag)) 285 if ((*it)->hasTagName(SVGNames::mpathTag))
286 toSVGMPathElement(*it)->targetPathChanged(); 286 toSVGMPathElement(*it)->targetPathChanged();
287 } 287 }
288 } 288 }
289 } 289 }
290 290
291 Node::InsertionNotificationRequest SVGPathElement::insertedInto(ContainerNode* r ootParent) 291 Node::InsertionNotificationRequest SVGPathElement::insertedInto(ContainerNode* r ootParent)
292 { 292 {
293 SVGGraphicsElement::insertedInto(rootParent); 293 SVGGeometryElement::insertedInto(rootParent);
294 invalidateMPathDependencies(); 294 invalidateMPathDependencies();
295 return InsertionDone; 295 return InsertionDone;
296 } 296 }
297 297
298 void SVGPathElement::removedFrom(ContainerNode* rootParent) 298 void SVGPathElement::removedFrom(ContainerNode* rootParent)
299 { 299 {
300 SVGGraphicsElement::removedFrom(rootParent); 300 SVGGeometryElement::removedFrom(rootParent);
301 invalidateMPathDependencies(); 301 invalidateMPathDependencies();
302 } 302 }
303 303
304 SVGPathByteStream* SVGPathElement::pathByteStream() const 304 SVGPathByteStream* SVGPathElement::pathByteStream() const
305 { 305 {
306 SVGAnimatedProperty* property = SVGAnimatedProperty::lookupWrapper<SVGPathEl ement, SVGAnimatedPathSegListPropertyTearOff>(this, dPropertyInfo()); 306 SVGAnimatedProperty* property = SVGAnimatedProperty::lookupWrapper<SVGPathEl ement, SVGAnimatedPathSegListPropertyTearOff>(this, dPropertyInfo());
307 if (!property || !property->isAnimating()) 307 if (!property || !property->isAnimating())
308 return m_pathByteStream.get(); 308 return m_pathByteStream.get();
309 return static_cast<SVGAnimatedPathSegListPropertyTearOff*>(property)->animat edPathByteStream(); 309 return static_cast<SVGAnimatedPathSegListPropertyTearOff*>(property)->animat edPathByteStream();
310 } 310 }
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 return renderer->path().boundingRect(); 400 return renderer->path().boundingRect();
401 } 401 }
402 402
403 RenderObject* SVGPathElement::createRenderer(RenderStyle*) 403 RenderObject* SVGPathElement::createRenderer(RenderStyle*)
404 { 404 {
405 // By default, any subclass is expected to do path-based drawing 405 // By default, any subclass is expected to do path-based drawing
406 return new RenderSVGPath(this); 406 return new RenderSVGPath(this);
407 } 407 }
408 408
409 } 409 }
OLDNEW
« no previous file with comments | « Source/core/svg/SVGPathElement.h ('k') | Source/core/svg/SVGPathElement.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698