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

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

Issue 112003003: [SVG] SVGLength{,List} migration to new SVG property impl. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: revert aggressive svgAttributeChanged, add NeedsRebaseline Created 6 years, 11 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
« no previous file with comments | « Source/core/svg/SVGTextPathElement.h ('k') | Source/core/svg/SVGTextPositioningElement.h » ('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) 2007 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2010 Rob Buis <rwlbuis@gmail.com> 3 * Copyright (C) 2010 Rob Buis <rwlbuis@gmail.com>
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 12 matching lines...) Expand all
23 #include "core/svg/SVGTextPathElement.h" 23 #include "core/svg/SVGTextPathElement.h"
24 24
25 #include "XLinkNames.h" 25 #include "XLinkNames.h"
26 #include "core/rendering/svg/RenderSVGResource.h" 26 #include "core/rendering/svg/RenderSVGResource.h"
27 #include "core/rendering/svg/RenderSVGTextPath.h" 27 #include "core/rendering/svg/RenderSVGTextPath.h"
28 #include "core/svg/SVGElementInstance.h" 28 #include "core/svg/SVGElementInstance.h"
29 29
30 namespace WebCore { 30 namespace WebCore {
31 31
32 // Animated property definitions 32 // Animated property definitions
33 DEFINE_ANIMATED_LENGTH(SVGTextPathElement, SVGNames::startOffsetAttr, StartOffse t, startOffset)
34 DEFINE_ANIMATED_ENUMERATION(SVGTextPathElement, SVGNames::methodAttr, Method, me thod, SVGTextPathMethodType) 33 DEFINE_ANIMATED_ENUMERATION(SVGTextPathElement, SVGNames::methodAttr, Method, me thod, SVGTextPathMethodType)
35 DEFINE_ANIMATED_ENUMERATION(SVGTextPathElement, SVGNames::spacingAttr, Spacing, spacing, SVGTextPathSpacingType) 34 DEFINE_ANIMATED_ENUMERATION(SVGTextPathElement, SVGNames::spacingAttr, Spacing, spacing, SVGTextPathSpacingType)
36 DEFINE_ANIMATED_STRING(SVGTextPathElement, XLinkNames::hrefAttr, Href, href) 35 DEFINE_ANIMATED_STRING(SVGTextPathElement, XLinkNames::hrefAttr, Href, href)
37 36
38 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGTextPathElement) 37 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGTextPathElement)
39 REGISTER_LOCAL_ANIMATED_PROPERTY(startOffset)
40 REGISTER_LOCAL_ANIMATED_PROPERTY(method) 38 REGISTER_LOCAL_ANIMATED_PROPERTY(method)
41 REGISTER_LOCAL_ANIMATED_PROPERTY(spacing) 39 REGISTER_LOCAL_ANIMATED_PROPERTY(spacing)
42 REGISTER_LOCAL_ANIMATED_PROPERTY(href) 40 REGISTER_LOCAL_ANIMATED_PROPERTY(href)
43 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGTextContentElement) 41 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGTextContentElement)
44 END_REGISTER_ANIMATED_PROPERTIES 42 END_REGISTER_ANIMATED_PROPERTIES
45 43
46 inline SVGTextPathElement::SVGTextPathElement(Document& document) 44 inline SVGTextPathElement::SVGTextPathElement(Document& document)
47 : SVGTextContentElement(SVGNames::textPathTag, document) 45 : SVGTextContentElement(SVGNames::textPathTag, document)
48 , m_startOffset(LengthModeOther) 46 , m_startOffset(SVGAnimatedLength::create(this, SVGNames::startOffsetAttr, S VGLength::create(LengthModeOther)))
49 , m_method(SVGTextPathMethodAlign) 47 , m_method(SVGTextPathMethodAlign)
50 , m_spacing(SVGTextPathSpacingExact) 48 , m_spacing(SVGTextPathSpacingExact)
51 { 49 {
52 ScriptWrappable::init(this); 50 ScriptWrappable::init(this);
51
52 addToPropertyMap(m_startOffset);
53 registerAnimatedPropertiesForSVGTextPathElement(); 53 registerAnimatedPropertiesForSVGTextPathElement();
54 } 54 }
55 55
56 PassRefPtr<SVGTextPathElement> SVGTextPathElement::create(Document& document) 56 PassRefPtr<SVGTextPathElement> SVGTextPathElement::create(Document& document)
57 { 57 {
58 return adoptRef(new SVGTextPathElement(document)); 58 return adoptRef(new SVGTextPathElement(document));
59 } 59 }
60 60
61 SVGTextPathElement::~SVGTextPathElement() 61 SVGTextPathElement::~SVGTextPathElement()
62 { 62 {
(...skipping 17 matching lines...) Expand all
80 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); 80 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName);
81 } 81 }
82 82
83 void SVGTextPathElement::parseAttribute(const QualifiedName& name, const AtomicS tring& value) 83 void SVGTextPathElement::parseAttribute(const QualifiedName& name, const AtomicS tring& value)
84 { 84 {
85 SVGParsingError parseError = NoError; 85 SVGParsingError parseError = NoError;
86 86
87 if (!isSupportedAttribute(name)) 87 if (!isSupportedAttribute(name))
88 SVGTextContentElement::parseAttribute(name, value); 88 SVGTextContentElement::parseAttribute(name, value);
89 else if (name == SVGNames::startOffsetAttr) 89 else if (name == SVGNames::startOffsetAttr)
90 setStartOffsetBaseValue(SVGLength::construct(LengthModeOther, value, par seError)); 90 m_startOffset->setBaseValueAsString(value, AllowNegativeLengths, parseEr ror);
91 else if (name == SVGNames::methodAttr) { 91 else if (name == SVGNames::methodAttr) {
92 SVGTextPathMethodType propertyValue = SVGPropertyTraits<SVGTextPathMetho dType>::fromString(value); 92 SVGTextPathMethodType propertyValue = SVGPropertyTraits<SVGTextPathMetho dType>::fromString(value);
93 if (propertyValue > 0) 93 if (propertyValue > 0)
94 setMethodBaseValue(propertyValue); 94 setMethodBaseValue(propertyValue);
95 } else if (name == SVGNames::spacingAttr) { 95 } else if (name == SVGNames::spacingAttr) {
96 SVGTextPathSpacingType propertyValue = SVGPropertyTraits<SVGTextPathSpac ingType>::fromString(value); 96 SVGTextPathSpacingType propertyValue = SVGPropertyTraits<SVGTextPathSpac ingType>::fromString(value);
97 if (propertyValue > 0) 97 if (propertyValue > 0)
98 setSpacingBaseValue(propertyValue); 98 setSpacingBaseValue(propertyValue);
99 } else if (SVGURIReference::parseAttribute(name, value)) { 99 } else if (SVGURIReference::parseAttribute(name, value)) {
100 } else 100 } else
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 182
183 void SVGTextPathElement::removedFrom(ContainerNode* rootParent) 183 void SVGTextPathElement::removedFrom(ContainerNode* rootParent)
184 { 184 {
185 SVGTextContentElement::removedFrom(rootParent); 185 SVGTextContentElement::removedFrom(rootParent);
186 if (rootParent->inDocument()) 186 if (rootParent->inDocument())
187 clearResourceReferences(); 187 clearResourceReferences();
188 } 188 }
189 189
190 bool SVGTextPathElement::selfHasRelativeLengths() const 190 bool SVGTextPathElement::selfHasRelativeLengths() const
191 { 191 {
192 return startOffsetCurrentValue().isRelative() 192 return m_startOffset->currentValue()->isRelative()
193 || SVGTextContentElement::selfHasRelativeLengths(); 193 || SVGTextContentElement::selfHasRelativeLengths();
194 } 194 }
195 195
196 } 196 }
OLDNEW
« no previous file with comments | « Source/core/svg/SVGTextPathElement.h ('k') | Source/core/svg/SVGTextPositioningElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698