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

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

Issue 132233010: [SVG] SVGAnimatedRect migration to new SVG property impl. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebsaed 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/SVGMarkerElement.h ('k') | Source/core/svg/SVGPathElement.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, 2007, 2008 Nikolas Zimmermann <zimmermann@kde .org> 2 * Copyright (C) 2004, 2005, 2006, 2007, 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 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 29 matching lines...) Expand all
40 orientTypeIdentifier(), 40 orientTypeIdentifier(),
41 &SVGMarkerElement::synchronizeOrien tType, 41 &SVGMarkerElement::synchronizeOrien tType,
42 &SVGMarkerElement::lookupOrCreateOr ientTypeWrapper); 42 &SVGMarkerElement::lookupOrCreateOr ientTypeWrapper);
43 } 43 }
44 return s_propertyInfo; 44 return s_propertyInfo;
45 } 45 }
46 46
47 // Animated property definitions 47 // Animated property definitions
48 DEFINE_ANIMATED_ENUMERATION(SVGMarkerElement, SVGNames::markerUnitsAttr, MarkerU nits, markerUnits, SVGMarkerUnitsType) 48 DEFINE_ANIMATED_ENUMERATION(SVGMarkerElement, SVGNames::markerUnitsAttr, MarkerU nits, markerUnits, SVGMarkerUnitsType)
49 DEFINE_ANIMATED_ANGLE_AND_ENUMERATION(SVGMarkerElement, SVGNames::orientAttr, or ientAngleIdentifier(), OrientAngle, orientAngle) 49 DEFINE_ANIMATED_ANGLE_AND_ENUMERATION(SVGMarkerElement, SVGNames::orientAttr, or ientAngleIdentifier(), OrientAngle, orientAngle)
50 DEFINE_ANIMATED_RECT(SVGMarkerElement, SVGNames::viewBoxAttr, ViewBox, viewBox)
51 DEFINE_ANIMATED_PRESERVEASPECTRATIO(SVGMarkerElement, SVGNames::preserveAspectRa tioAttr, PreserveAspectRatio, preserveAspectRatio) 50 DEFINE_ANIMATED_PRESERVEASPECTRATIO(SVGMarkerElement, SVGNames::preserveAspectRa tioAttr, PreserveAspectRatio, preserveAspectRatio)
52 51
53 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGMarkerElement) 52 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGMarkerElement)
54 REGISTER_LOCAL_ANIMATED_PROPERTY(markerUnits) 53 REGISTER_LOCAL_ANIMATED_PROPERTY(markerUnits)
55 REGISTER_LOCAL_ANIMATED_PROPERTY(orientAngle) 54 REGISTER_LOCAL_ANIMATED_PROPERTY(orientAngle)
56 REGISTER_LOCAL_ANIMATED_PROPERTY(orientType) 55 REGISTER_LOCAL_ANIMATED_PROPERTY(orientType)
57 REGISTER_LOCAL_ANIMATED_PROPERTY(viewBox)
58 REGISTER_LOCAL_ANIMATED_PROPERTY(preserveAspectRatio) 56 REGISTER_LOCAL_ANIMATED_PROPERTY(preserveAspectRatio)
59 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement) 57 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement)
60 END_REGISTER_ANIMATED_PROPERTIES 58 END_REGISTER_ANIMATED_PROPERTIES
61 59
62 inline SVGMarkerElement::SVGMarkerElement(Document& document) 60 inline SVGMarkerElement::SVGMarkerElement(Document& document)
63 : SVGElement(SVGNames::markerTag, document) 61 : SVGElement(SVGNames::markerTag, document)
64 , m_refX(SVGAnimatedLength::create(this, SVGNames::refXAttr, SVGLength::crea te(LengthModeWidth))) 62 , m_refX(SVGAnimatedLength::create(this, SVGNames::refXAttr, SVGLength::crea te(LengthModeWidth)))
65 , m_refY(SVGAnimatedLength::create(this, SVGNames::refXAttr, SVGLength::crea te(LengthModeWidth))) 63 , m_refY(SVGAnimatedLength::create(this, SVGNames::refXAttr, SVGLength::crea te(LengthModeWidth)))
66 , m_markerWidth(SVGAnimatedLength::create(this, SVGNames::markerWidthAttr, S VGLength::create(LengthModeWidth))) 64 , m_markerWidth(SVGAnimatedLength::create(this, SVGNames::markerWidthAttr, S VGLength::create(LengthModeWidth)))
67 , m_markerHeight(SVGAnimatedLength::create(this, SVGNames::markerHeightAttr, SVGLength::create(LengthModeHeight))) 65 , m_markerHeight(SVGAnimatedLength::create(this, SVGNames::markerHeightAttr, SVGLength::create(LengthModeHeight)))
66 , m_viewBox(SVGAnimatedRect::create(this, SVGNames::viewBoxAttr))
68 , m_orientType(SVGMarkerOrientAngle) 67 , m_orientType(SVGMarkerOrientAngle)
69 , m_markerUnits(SVGMarkerUnitsStrokeWidth) 68 , m_markerUnits(SVGMarkerUnitsStrokeWidth)
70 { 69 {
71 ScriptWrappable::init(this); 70 ScriptWrappable::init(this);
72 71
73 // Spec: If the markerWidth/markerHeight attribute is not specified, the eff ect is as if a value of "3" were specified. 72 // Spec: If the markerWidth/markerHeight attribute is not specified, the eff ect is as if a value of "3" were specified.
74 m_markerWidth->setDefaultValueAsString("3"); 73 m_markerWidth->setDefaultValueAsString("3");
75 m_markerHeight->setDefaultValueAsString("3"); 74 m_markerHeight->setDefaultValueAsString("3");
76 75
77 addToPropertyMap(m_refX); 76 addToPropertyMap(m_refX);
78 addToPropertyMap(m_refY); 77 addToPropertyMap(m_refY);
79 addToPropertyMap(m_markerWidth); 78 addToPropertyMap(m_markerWidth);
80 addToPropertyMap(m_markerHeight); 79 addToPropertyMap(m_markerHeight);
80 addToPropertyMap(m_viewBox);
81 81
82 registerAnimatedPropertiesForSVGMarkerElement(); 82 registerAnimatedPropertiesForSVGMarkerElement();
83 } 83 }
84 84
85 PassRefPtr<SVGMarkerElement> SVGMarkerElement::create(Document& document) 85 PassRefPtr<SVGMarkerElement> SVGMarkerElement::create(Document& document)
86 { 86 {
87 return adoptRef(new SVGMarkerElement(document)); 87 return adoptRef(new SVGMarkerElement(document));
88 } 88 }
89 89
90 const AtomicString& SVGMarkerElement::orientTypeIdentifier() 90 const AtomicString& SVGMarkerElement::orientTypeIdentifier()
91 { 91 {
92 DEFINE_STATIC_LOCAL(AtomicString, s_identifier, ("SVGOrientType", AtomicStri ng::ConstructFromLiteral)); 92 DEFINE_STATIC_LOCAL(AtomicString, s_identifier, ("SVGOrientType", AtomicStri ng::ConstructFromLiteral));
93 return s_identifier; 93 return s_identifier;
94 } 94 }
95 95
96 const AtomicString& SVGMarkerElement::orientAngleIdentifier() 96 const AtomicString& SVGMarkerElement::orientAngleIdentifier()
97 { 97 {
98 DEFINE_STATIC_LOCAL(AtomicString, s_identifier, ("SVGOrientAngle", AtomicStr ing::ConstructFromLiteral)); 98 DEFINE_STATIC_LOCAL(AtomicString, s_identifier, ("SVGOrientAngle", AtomicStr ing::ConstructFromLiteral));
99 return s_identifier; 99 return s_identifier;
100 } 100 }
101 101
102 AffineTransform SVGMarkerElement::viewBoxToViewTransform(float viewWidth, float viewHeight) const 102 AffineTransform SVGMarkerElement::viewBoxToViewTransform(float viewWidth, float viewHeight) const
103 { 103 {
104 return SVGFitToViewBox::viewBoxToViewTransform(viewBoxCurrentValue(), preser veAspectRatioCurrentValue(), viewWidth, viewHeight); 104 return SVGFitToViewBox::viewBoxToViewTransform(m_viewBox->currentValue()->va lue(), preserveAspectRatioCurrentValue(), viewWidth, viewHeight);
105 } 105 }
106 106
107 bool SVGMarkerElement::isSupportedAttribute(const QualifiedName& attrName) 107 bool SVGMarkerElement::isSupportedAttribute(const QualifiedName& attrName)
108 { 108 {
109 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); 109 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ());
110 if (supportedAttributes.isEmpty()) { 110 if (supportedAttributes.isEmpty()) {
111 SVGFitToViewBox::addSupportedAttributes(supportedAttributes); 111 SVGFitToViewBox::addSupportedAttributes(supportedAttributes);
112 supportedAttributes.add(SVGNames::markerUnitsAttr); 112 supportedAttributes.add(SVGNames::markerUnitsAttr);
113 supportedAttributes.add(SVGNames::refXAttr); 113 supportedAttributes.add(SVGNames::refXAttr);
114 supportedAttributes.add(SVGNames::refYAttr); 114 supportedAttributes.add(SVGNames::refYAttr);
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 (ownerType, orientTypePropertyInfo(), ownerType->m_orientType.value); 242 (ownerType, orientTypePropertyInfo(), ownerType->m_orientType.value);
243 } 243 }
244 244
245 PassRefPtr<SVGAnimatedEnumerationPropertyTearOff<SVGMarkerOrientType> > SVGMarke rElement::orientType() 245 PassRefPtr<SVGAnimatedEnumerationPropertyTearOff<SVGMarkerOrientType> > SVGMarke rElement::orientType()
246 { 246 {
247 m_orientType.shouldSynchronize = true; 247 m_orientType.shouldSynchronize = true;
248 return static_pointer_cast<SVGAnimatedEnumerationPropertyTearOff<SVGMarkerOr ientType> >(lookupOrCreateOrientTypeWrapper(this)); 248 return static_pointer_cast<SVGAnimatedEnumerationPropertyTearOff<SVGMarkerOr ientType> >(lookupOrCreateOrientTypeWrapper(this));
249 } 249 }
250 250
251 } 251 }
OLDNEW
« no previous file with comments | « Source/core/svg/SVGMarkerElement.h ('k') | Source/core/svg/SVGPathElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698