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

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

Issue 169033002: Drop [LegacyImplementedInBaseClass] from SVGFitToViewBox IDL interface (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase 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/SVGMarkerElement.h ('k') | Source/core/svg/SVGPatternElement.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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 50
51 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGMarkerElement) 51 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGMarkerElement)
52 REGISTER_LOCAL_ANIMATED_PROPERTY(markerUnits) 52 REGISTER_LOCAL_ANIMATED_PROPERTY(markerUnits)
53 REGISTER_LOCAL_ANIMATED_PROPERTY(orientAngle) 53 REGISTER_LOCAL_ANIMATED_PROPERTY(orientAngle)
54 REGISTER_LOCAL_ANIMATED_PROPERTY(orientType) 54 REGISTER_LOCAL_ANIMATED_PROPERTY(orientType)
55 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement) 55 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement)
56 END_REGISTER_ANIMATED_PROPERTIES 56 END_REGISTER_ANIMATED_PROPERTIES
57 57
58 inline SVGMarkerElement::SVGMarkerElement(Document& document) 58 inline SVGMarkerElement::SVGMarkerElement(Document& document)
59 : SVGElement(SVGNames::markerTag, document) 59 : SVGElement(SVGNames::markerTag, document)
60 , SVGFitToViewBox(this)
60 , m_refX(SVGAnimatedLength::create(this, SVGNames::refXAttr, SVGLength::crea te(LengthModeWidth))) 61 , m_refX(SVGAnimatedLength::create(this, SVGNames::refXAttr, SVGLength::crea te(LengthModeWidth)))
61 , m_refY(SVGAnimatedLength::create(this, SVGNames::refXAttr, SVGLength::crea te(LengthModeWidth))) 62 , m_refY(SVGAnimatedLength::create(this, SVGNames::refXAttr, SVGLength::crea te(LengthModeWidth)))
62 , m_markerWidth(SVGAnimatedLength::create(this, SVGNames::markerWidthAttr, S VGLength::create(LengthModeWidth))) 63 , m_markerWidth(SVGAnimatedLength::create(this, SVGNames::markerWidthAttr, S VGLength::create(LengthModeWidth)))
63 , m_markerHeight(SVGAnimatedLength::create(this, SVGNames::markerHeightAttr, SVGLength::create(LengthModeHeight))) 64 , m_markerHeight(SVGAnimatedLength::create(this, SVGNames::markerHeightAttr, SVGLength::create(LengthModeHeight)))
64 , m_viewBox(SVGAnimatedRect::create(this, SVGNames::viewBoxAttr))
65 , m_preserveAspectRatio(SVGAnimatedPreserveAspectRatio::create(this, SVGName s::preserveAspectRatioAttr, SVGPreserveAspectRatio::create()))
66 , m_orientType(SVGMarkerOrientAngle) 65 , m_orientType(SVGMarkerOrientAngle)
67 , m_markerUnits(SVGMarkerUnitsStrokeWidth) 66 , m_markerUnits(SVGMarkerUnitsStrokeWidth)
68 { 67 {
69 ScriptWrappable::init(this); 68 ScriptWrappable::init(this);
70 69
71 // Spec: If the markerWidth/markerHeight attribute is not specified, the eff ect is as if a value of "3" were specified. 70 // Spec: If the markerWidth/markerHeight attribute is not specified, the eff ect is as if a value of "3" were specified.
72 m_markerWidth->setDefaultValueAsString("3"); 71 m_markerWidth->setDefaultValueAsString("3");
73 m_markerHeight->setDefaultValueAsString("3"); 72 m_markerHeight->setDefaultValueAsString("3");
74 73
75 addToPropertyMap(m_refX); 74 addToPropertyMap(m_refX);
76 addToPropertyMap(m_refY); 75 addToPropertyMap(m_refY);
77 addToPropertyMap(m_markerWidth); 76 addToPropertyMap(m_markerWidth);
78 addToPropertyMap(m_markerHeight); 77 addToPropertyMap(m_markerHeight);
79 addToPropertyMap(m_viewBox);
80 78
81 addToPropertyMap(m_preserveAspectRatio);
82 registerAnimatedPropertiesForSVGMarkerElement(); 79 registerAnimatedPropertiesForSVGMarkerElement();
83 } 80 }
84 81
85 PassRefPtr<SVGMarkerElement> SVGMarkerElement::create(Document& document) 82 PassRefPtr<SVGMarkerElement> SVGMarkerElement::create(Document& document)
86 { 83 {
87 return adoptRef(new SVGMarkerElement(document)); 84 return adoptRef(new SVGMarkerElement(document));
88 } 85 }
89 86
90 const AtomicString& SVGMarkerElement::orientTypeIdentifier() 87 const AtomicString& SVGMarkerElement::orientTypeIdentifier()
91 { 88 {
92 DEFINE_STATIC_LOCAL(AtomicString, s_identifier, ("SVGOrientType", AtomicStri ng::ConstructFromLiteral)); 89 DEFINE_STATIC_LOCAL(AtomicString, s_identifier, ("SVGOrientType", AtomicStri ng::ConstructFromLiteral));
93 return s_identifier; 90 return s_identifier;
94 } 91 }
95 92
96 const AtomicString& SVGMarkerElement::orientAngleIdentifier() 93 const AtomicString& SVGMarkerElement::orientAngleIdentifier()
97 { 94 {
98 DEFINE_STATIC_LOCAL(AtomicString, s_identifier, ("SVGOrientAngle", AtomicStr ing::ConstructFromLiteral)); 95 DEFINE_STATIC_LOCAL(AtomicString, s_identifier, ("SVGOrientAngle", AtomicStr ing::ConstructFromLiteral));
99 return s_identifier; 96 return s_identifier;
100 } 97 }
101 98
102 AffineTransform SVGMarkerElement::viewBoxToViewTransform(float viewWidth, float viewHeight) const 99 AffineTransform SVGMarkerElement::viewBoxToViewTransform(float viewWidth, float viewHeight) const
103 { 100 {
104 return SVGFitToViewBox::viewBoxToViewTransform(m_viewBox->currentValue()->va lue(), m_preserveAspectRatio->currentValue(), viewWidth, viewHeight); 101 return SVGFitToViewBox::viewBoxToViewTransform(viewBox()->currentValue()->va lue(), preserveAspectRatio()->currentValue(), viewWidth, viewHeight);
105 } 102 }
106 103
107 bool SVGMarkerElement::isSupportedAttribute(const QualifiedName& attrName) 104 bool SVGMarkerElement::isSupportedAttribute(const QualifiedName& attrName)
108 { 105 {
109 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); 106 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ());
110 if (supportedAttributes.isEmpty()) { 107 if (supportedAttributes.isEmpty()) {
111 SVGFitToViewBox::addSupportedAttributes(supportedAttributes); 108 SVGFitToViewBox::addSupportedAttributes(supportedAttributes);
112 supportedAttributes.add(SVGNames::markerUnitsAttr); 109 supportedAttributes.add(SVGNames::markerUnitsAttr);
113 supportedAttributes.add(SVGNames::refXAttr); 110 supportedAttributes.add(SVGNames::refXAttr);
114 supportedAttributes.add(SVGNames::refYAttr); 111 supportedAttributes.add(SVGNames::refYAttr);
(...skipping 22 matching lines...) Expand all
137 m_markerWidth->setBaseValueAsString(value, ForbidNegativeLengths, parseE rror); 134 m_markerWidth->setBaseValueAsString(value, ForbidNegativeLengths, parseE rror);
138 else if (name == SVGNames::markerHeightAttr) 135 else if (name == SVGNames::markerHeightAttr)
139 m_markerHeight->setBaseValueAsString(value, ForbidNegativeLengths, parse Error); 136 m_markerHeight->setBaseValueAsString(value, ForbidNegativeLengths, parse Error);
140 else if (name == SVGNames::orientAttr) { 137 else if (name == SVGNames::orientAttr) {
141 SVGAngle angle; 138 SVGAngle angle;
142 SVGMarkerOrientType orientType = SVGPropertyTraits<SVGMarkerOrientType>: :fromString(value, angle); 139 SVGMarkerOrientType orientType = SVGPropertyTraits<SVGMarkerOrientType>: :fromString(value, angle);
143 if (orientType > 0) 140 if (orientType > 0)
144 setOrientTypeBaseValue(orientType); 141 setOrientTypeBaseValue(orientType);
145 if (orientType == SVGMarkerOrientAngle) 142 if (orientType == SVGMarkerOrientAngle)
146 setOrientAngleBaseValue(angle); 143 setOrientAngleBaseValue(angle);
147 } else if (SVGFitToViewBox::parseAttribute(this, name, value)) { 144 } else if (SVGFitToViewBox::parseAttribute(name, value, document(), parseErr or)) {
148 } else 145 } else {
149 ASSERT_NOT_REACHED(); 146 ASSERT_NOT_REACHED();
147 }
150 148
151 reportAttributeParsingError(parseError, name, value); 149 reportAttributeParsingError(parseError, name, value);
152 } 150 }
153 151
154 void SVGMarkerElement::svgAttributeChanged(const QualifiedName& attrName) 152 void SVGMarkerElement::svgAttributeChanged(const QualifiedName& attrName)
155 { 153 {
156 if (!isSupportedAttribute(attrName)) { 154 if (!isSupportedAttribute(attrName)) {
157 SVGElement::svgAttributeChanged(attrName); 155 SVGElement::svgAttributeChanged(attrName);
158 return; 156 return;
159 } 157 }
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 (ownerType, orientTypePropertyInfo(), ownerType->m_orientType.value); 240 (ownerType, orientTypePropertyInfo(), ownerType->m_orientType.value);
243 } 241 }
244 242
245 PassRefPtr<SVGAnimatedEnumerationPropertyTearOff<SVGMarkerOrientType> > SVGMarke rElement::orientType() 243 PassRefPtr<SVGAnimatedEnumerationPropertyTearOff<SVGMarkerOrientType> > SVGMarke rElement::orientType()
246 { 244 {
247 m_orientType.shouldSynchronize = true; 245 m_orientType.shouldSynchronize = true;
248 return static_pointer_cast<SVGAnimatedEnumerationPropertyTearOff<SVGMarkerOr ientType> >(lookupOrCreateOrientTypeWrapper(this)); 246 return static_pointer_cast<SVGAnimatedEnumerationPropertyTearOff<SVGMarkerOr ientType> >(lookupOrCreateOrientTypeWrapper(this));
249 } 247 }
250 248
251 } 249 }
OLDNEW
« no previous file with comments | « Source/core/svg/SVGMarkerElement.h ('k') | Source/core/svg/SVGPatternElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698