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

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

Issue 148173018: [SVG] SVGAnimatedString{,List} migration to new SVG property impl. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: remove debug print 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/SVGViewElement.h ('k') | Source/core/svg/properties/NewSVGAnimatedProperty.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, 2008 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2007 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 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,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details. 13 * Library General Public License for more details.
14 * 14 *
15 * You should have received a copy of the GNU Library General Public License 15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to 16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA. 18 * Boston, MA 02110-1301, USA.
19 */ 19 */
20 20
21 #include "config.h" 21 #include "config.h"
22 22
23 #include "core/svg/SVGViewElement.h" 23 #include "core/svg/SVGViewElement.h"
24 24
25
26 namespace WebCore { 25 namespace WebCore {
27 26
28 // Animated property definitions 27 // Animated property definitions
29 28
30 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGViewElement) 29 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGViewElement)
31 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement) 30 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement)
32 END_REGISTER_ANIMATED_PROPERTIES 31 END_REGISTER_ANIMATED_PROPERTIES
33 32
34 inline SVGViewElement::SVGViewElement(Document& document) 33 inline SVGViewElement::SVGViewElement(Document& document)
35 : SVGElement(SVGNames::viewTag, document) 34 : SVGElement(SVGNames::viewTag, document)
36 , m_viewBox(SVGAnimatedRect::create(this, SVGNames::viewBoxAttr)) 35 , m_viewBox(SVGAnimatedRect::create(this, SVGNames::viewBoxAttr))
37 , m_preserveAspectRatio(SVGAnimatedPreserveAspectRatio::create(this, SVGName s::preserveAspectRatioAttr, SVGPreserveAspectRatio::create())) 36 , m_preserveAspectRatio(SVGAnimatedPreserveAspectRatio::create(this, SVGName s::preserveAspectRatioAttr, SVGPreserveAspectRatio::create()))
37 , m_viewTarget(SVGStaticStringList::create(this, SVGNames::viewTargetAttr))
38 , m_zoomAndPan(SVGZoomAndPanMagnify) 38 , m_zoomAndPan(SVGZoomAndPanMagnify)
39 , m_viewTarget(SVGNames::viewTargetAttr)
40 { 39 {
41 ScriptWrappable::init(this); 40 ScriptWrappable::init(this);
42 41
43 addToPropertyMap(m_viewBox); 42 addToPropertyMap(m_viewBox);
44 addToPropertyMap(m_preserveAspectRatio); 43 addToPropertyMap(m_preserveAspectRatio);
44 addToPropertyMap(m_viewTarget);
45 registerAnimatedPropertiesForSVGViewElement(); 45 registerAnimatedPropertiesForSVGViewElement();
46 } 46 }
47 47
48 PassRefPtr<SVGViewElement> SVGViewElement::create(Document& document) 48 PassRefPtr<SVGViewElement> SVGViewElement::create(Document& document)
49 { 49 {
50 return adoptRef(new SVGViewElement(document)); 50 return adoptRef(new SVGViewElement(document));
51 } 51 }
52 52
53 bool SVGViewElement::isSupportedAttribute(const QualifiedName& attrName) 53 bool SVGViewElement::isSupportedAttribute(const QualifiedName& attrName)
54 { 54 {
55 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); 55 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ());
56 if (supportedAttributes.isEmpty()) { 56 if (supportedAttributes.isEmpty()) {
57 SVGFitToViewBox::addSupportedAttributes(supportedAttributes); 57 SVGFitToViewBox::addSupportedAttributes(supportedAttributes);
58 SVGZoomAndPan::addSupportedAttributes(supportedAttributes); 58 SVGZoomAndPan::addSupportedAttributes(supportedAttributes);
59 supportedAttributes.add(SVGNames::viewTargetAttr); 59 supportedAttributes.add(SVGNames::viewTargetAttr);
60 } 60 }
61 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); 61 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName);
62 } 62 }
63 63
64 void SVGViewElement::parseAttribute(const QualifiedName& name, const AtomicStrin g& value) 64 void SVGViewElement::parseAttribute(const QualifiedName& name, const AtomicStrin g& value)
65 { 65 {
66 if (!isSupportedAttribute(name)) { 66 if (!isSupportedAttribute(name)) {
67 SVGElement::parseAttribute(name, value); 67 SVGElement::parseAttribute(name, value);
68 return; 68 return;
69 } 69 }
70 70
71 if (name == SVGNames::viewTargetAttr) {
72 viewTarget().reset(value);
73 return;
74 }
75
76 if (SVGFitToViewBox::parseAttribute(this, name, value)) 71 if (SVGFitToViewBox::parseAttribute(this, name, value))
77 return; 72 return;
78 if (SVGZoomAndPan::parseAttribute(this, name, value)) 73 if (SVGZoomAndPan::parseAttribute(this, name, value))
79 return; 74 return;
80 75
81 ASSERT_NOT_REACHED(); 76 SVGParsingError parseError = NoError;
77
78 if (name == SVGNames::viewTargetAttr)
79 m_viewTarget->setBaseValueAsString(value, parseError);
80 else
81 ASSERT_NOT_REACHED();
82
83 reportAttributeParsingError(parseError, name, value);
82 } 84 }
83 85
84 } 86 }
OLDNEW
« no previous file with comments | « Source/core/svg/SVGViewElement.h ('k') | Source/core/svg/properties/NewSVGAnimatedProperty.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698