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

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

Issue 153883003: [SVG] SVGAnimatedTransform{,List} migration to new SVG property impl. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: remove m_zoomAndPan Created 6 years, 10 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/SVGGradientElement.h ('k') | Source/core/svg/SVGGraphicsElement.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) 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 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 4 * Copyright (C) Research In Motion Limited 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 30 matching lines...) Expand all
41 if (entries.isEmpty()) { 41 if (entries.isEmpty()) {
42 entries.append(std::make_pair(SVGSpreadMethodUnknown, emptyString())); 42 entries.append(std::make_pair(SVGSpreadMethodUnknown, emptyString()));
43 entries.append(std::make_pair(SVGSpreadMethodPad, "pad")); 43 entries.append(std::make_pair(SVGSpreadMethodPad, "pad"));
44 entries.append(std::make_pair(SVGSpreadMethodReflect, "reflect")); 44 entries.append(std::make_pair(SVGSpreadMethodReflect, "reflect"));
45 entries.append(std::make_pair(SVGSpreadMethodRepeat, "repeat")); 45 entries.append(std::make_pair(SVGSpreadMethodRepeat, "repeat"));
46 } 46 }
47 return entries; 47 return entries;
48 } 48 }
49 49
50 // Animated property definitions 50 // Animated property definitions
51 DEFINE_ANIMATED_TRANSFORM_LIST(SVGGradientElement, SVGNames::gradientTransformAt tr, GradientTransform, gradientTransform)
52
53 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGGradientElement) 51 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGGradientElement)
54 REGISTER_LOCAL_ANIMATED_PROPERTY(gradientTransform)
55 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement) 52 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement)
56 END_REGISTER_ANIMATED_PROPERTIES 53 END_REGISTER_ANIMATED_PROPERTIES
57 54
58 SVGGradientElement::SVGGradientElement(const QualifiedName& tagName, Document& d ocument) 55 SVGGradientElement::SVGGradientElement(const QualifiedName& tagName, Document& d ocument)
59 : SVGElement(tagName, document) 56 : SVGElement(tagName, document)
60 , SVGURIReference(this) 57 , SVGURIReference(this)
58 , m_gradientTransform(SVGAnimatedTransformList::create(this, SVGNames::gradi entTransformAttr, SVGTransformList::create()))
61 , m_spreadMethod(SVGAnimatedEnumeration<SVGSpreadMethodType>::create(this, S VGNames::spreadMethodAttr, SVGSpreadMethodPad)) 59 , m_spreadMethod(SVGAnimatedEnumeration<SVGSpreadMethodType>::create(this, S VGNames::spreadMethodAttr, SVGSpreadMethodPad))
62 , m_gradientUnits(SVGAnimatedEnumeration<SVGUnitTypes::SVGUnitType>::create( this, SVGNames::gradientUnitsAttr, SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX )) 60 , m_gradientUnits(SVGAnimatedEnumeration<SVGUnitTypes::SVGUnitType>::create( this, SVGNames::gradientUnitsAttr, SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX ))
63 { 61 {
64 ScriptWrappable::init(this); 62 ScriptWrappable::init(this);
63 addToPropertyMap(m_gradientTransform);
65 addToPropertyMap(m_spreadMethod); 64 addToPropertyMap(m_spreadMethod);
66 addToPropertyMap(m_gradientUnits); 65 addToPropertyMap(m_gradientUnits);
67 registerAnimatedPropertiesForSVGGradientElement(); 66 registerAnimatedPropertiesForSVGGradientElement();
68 } 67 }
69 68
70 bool SVGGradientElement::isSupportedAttribute(const QualifiedName& attrName) 69 bool SVGGradientElement::isSupportedAttribute(const QualifiedName& attrName)
71 { 70 {
72 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); 71 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ());
73 if (supportedAttributes.isEmpty()) { 72 if (supportedAttributes.isEmpty()) {
74 SVGURIReference::addSupportedAttributes(supportedAttributes); 73 SVGURIReference::addSupportedAttributes(supportedAttributes);
75 supportedAttributes.add(SVGNames::gradientUnitsAttr); 74 supportedAttributes.add(SVGNames::gradientUnitsAttr);
76 supportedAttributes.add(SVGNames::gradientTransformAttr); 75 supportedAttributes.add(SVGNames::gradientTransformAttr);
77 supportedAttributes.add(SVGNames::spreadMethodAttr); 76 supportedAttributes.add(SVGNames::spreadMethodAttr);
78 } 77 }
79 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); 78 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName);
80 } 79 }
81 80
82 void SVGGradientElement::parseAttribute(const QualifiedName& name, const AtomicS tring& value) 81 void SVGGradientElement::parseAttribute(const QualifiedName& name, const AtomicS tring& value)
83 { 82 {
84 if (!isSupportedAttribute(name)) { 83 if (!isSupportedAttribute(name)) {
85 SVGElement::parseAttribute(name, value); 84 SVGElement::parseAttribute(name, value);
86 return; 85 return;
87 } 86 }
88 87
89 if (name == SVGNames::gradientTransformAttr) {
90 SVGTransformList newList;
91 newList.parse(value);
92 detachAnimatedGradientTransformListWrappers(newList.size());
93 setGradientTransformBaseValue(newList);
94 return;
95 }
96
97 SVGParsingError parseError = NoError; 88 SVGParsingError parseError = NoError;
98 89
99 if (name == SVGNames::gradientUnitsAttr) 90 if (name == SVGNames::gradientTransformAttr)
91 m_gradientTransform->setBaseValueAsString(value, parseError);
92 else if (name == SVGNames::gradientUnitsAttr)
100 m_gradientUnits->setBaseValueAsString(value, parseError); 93 m_gradientUnits->setBaseValueAsString(value, parseError);
101 else if (name == SVGNames::spreadMethodAttr) 94 else if (name == SVGNames::spreadMethodAttr)
102 m_spreadMethod->setBaseValueAsString(value, parseError); 95 m_spreadMethod->setBaseValueAsString(value, parseError);
103 else if (SVGURIReference::parseAttribute(name, value, parseError)) { 96 else if (SVGURIReference::parseAttribute(name, value, parseError)) {
104 } else 97 } else
105 ASSERT_NOT_REACHED(); 98 ASSERT_NOT_REACHED();
106 99
107 reportAttributeParsingError(parseError, name, value); 100 reportAttributeParsingError(parseError, name, value);
108 } 101 }
109 102
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 float r, g, b, a; 148 float r, g, b, a;
156 color.getRGBA(r, g, b, a); 149 color.getRGBA(r, g, b, a);
157 150
158 stops.append(Gradient::ColorStop(offset, r, g, b, a)); 151 stops.append(Gradient::ColorStop(offset, r, g, b, a));
159 } 152 }
160 153
161 return stops; 154 return stops;
162 } 155 }
163 156
164 } 157 }
OLDNEW
« no previous file with comments | « Source/core/svg/SVGGradientElement.h ('k') | Source/core/svg/SVGGraphicsElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698