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

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

Issue 148173018: [SVG] SVGAnimatedString{,List} migration to new SVG property impl. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: remove if 0 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006 Apple Inc. All rights reserved. 2 * Copyright (C) 2006 Apple Inc. All rights reserved.
3 * Copyright (C) 2008 Nikolas Zimmermann <zimmermann@kde.org> 3 * Copyright (C) 2008 Nikolas Zimmermann <zimmermann@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,
(...skipping 13 matching lines...) Expand all
24 #include "XLinkNames.h" 24 #include "XLinkNames.h"
25 #include "core/rendering/svg/RenderSVGForeignObject.h" 25 #include "core/rendering/svg/RenderSVGForeignObject.h"
26 #include "core/rendering/svg/RenderSVGResource.h" 26 #include "core/rendering/svg/RenderSVGResource.h"
27 #include "core/svg/SVGElementInstance.h" 27 #include "core/svg/SVGElementInstance.h"
28 #include "core/svg/SVGLength.h" 28 #include "core/svg/SVGLength.h"
29 #include "wtf/Assertions.h" 29 #include "wtf/Assertions.h"
30 30
31 namespace WebCore { 31 namespace WebCore {
32 32
33 // Animated property definitions 33 // Animated property definitions
34 DEFINE_ANIMATED_STRING(SVGForeignObjectElement, XLinkNames::hrefAttr, Href, href )
35 34
36 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGForeignObjectElement) 35 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGForeignObjectElement)
37 REGISTER_LOCAL_ANIMATED_PROPERTY(href)
38 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement) 36 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement)
39 END_REGISTER_ANIMATED_PROPERTIES 37 END_REGISTER_ANIMATED_PROPERTIES
40 38
41 inline SVGForeignObjectElement::SVGForeignObjectElement(Document& document) 39 inline SVGForeignObjectElement::SVGForeignObjectElement(Document& document)
42 : SVGGraphicsElement(SVGNames::foreignObjectTag, document) 40 : SVGGraphicsElement(SVGNames::foreignObjectTag, document)
43 , m_x(SVGAnimatedLength::create(this, SVGNames::xAttr, SVGLength::create(Len gthModeWidth))) 41 , m_x(SVGAnimatedLength::create(this, SVGNames::xAttr, SVGLength::create(Len gthModeWidth)))
44 , m_y(SVGAnimatedLength::create(this, SVGNames::yAttr, SVGLength::create(Len gthModeHeight))) 42 , m_y(SVGAnimatedLength::create(this, SVGNames::yAttr, SVGLength::create(Len gthModeHeight)))
45 , m_width(SVGAnimatedLength::create(this, SVGNames::widthAttr, SVGLength::cr eate(LengthModeWidth))) 43 , m_width(SVGAnimatedLength::create(this, SVGNames::widthAttr, SVGLength::cr eate(LengthModeWidth)))
46 , m_height(SVGAnimatedLength::create(this, SVGNames::heightAttr, SVGLength:: create(LengthModeHeight))) 44 , m_height(SVGAnimatedLength::create(this, SVGNames::heightAttr, SVGLength:: create(LengthModeHeight)))
45 , m_href(SVGAnimatedString::create(this, XLinkNames::hrefAttr, SVGString::cr eate()))
47 { 46 {
48 ScriptWrappable::init(this); 47 ScriptWrappable::init(this);
49 48
50 addToPropertyMap(m_x); 49 addToPropertyMap(m_x);
51 addToPropertyMap(m_y); 50 addToPropertyMap(m_y);
52 addToPropertyMap(m_width); 51 addToPropertyMap(m_width);
53 addToPropertyMap(m_height); 52 addToPropertyMap(m_height);
54 53
54 addToPropertyMap(m_href);
55 registerAnimatedPropertiesForSVGForeignObjectElement(); 55 registerAnimatedPropertiesForSVGForeignObjectElement();
56 } 56 }
57 57
58 PassRefPtr<SVGForeignObjectElement> SVGForeignObjectElement::create(Document& do cument) 58 PassRefPtr<SVGForeignObjectElement> SVGForeignObjectElement::create(Document& do cument)
59 { 59 {
60 return adoptRef(new SVGForeignObjectElement(document)); 60 return adoptRef(new SVGForeignObjectElement(document));
61 } 61 }
62 62
63 bool SVGForeignObjectElement::isSupportedAttribute(const QualifiedName& attrName ) 63 bool SVGForeignObjectElement::isSupportedAttribute(const QualifiedName& attrName )
64 { 64 {
(...skipping 14 matching lines...) Expand all
79 if (!isSupportedAttribute(name)) 79 if (!isSupportedAttribute(name))
80 SVGGraphicsElement::parseAttribute(name, value); 80 SVGGraphicsElement::parseAttribute(name, value);
81 else if (name == SVGNames::xAttr) 81 else if (name == SVGNames::xAttr)
82 m_x->setBaseValueAsString(value, AllowNegativeLengths, parseError); 82 m_x->setBaseValueAsString(value, AllowNegativeLengths, parseError);
83 else if (name == SVGNames::yAttr) 83 else if (name == SVGNames::yAttr)
84 m_y->setBaseValueAsString(value, AllowNegativeLengths, parseError); 84 m_y->setBaseValueAsString(value, AllowNegativeLengths, parseError);
85 else if (name == SVGNames::widthAttr) 85 else if (name == SVGNames::widthAttr)
86 m_width->setBaseValueAsString(value, ForbidNegativeLengths, parseError); 86 m_width->setBaseValueAsString(value, ForbidNegativeLengths, parseError);
87 else if (name == SVGNames::heightAttr) 87 else if (name == SVGNames::heightAttr)
88 m_height->setBaseValueAsString(value, ForbidNegativeLengths, parseError) ; 88 m_height->setBaseValueAsString(value, ForbidNegativeLengths, parseError) ;
89 else 89 else
haraken 2014/01/29 05:18:00 You need to add a check for name.matches(SVGLinks:
kouhei (in TOK) 2014/01/30 08:18:56 Actually, it seems like its a bug that SVGForeignO
fs 2014/01/30 12:22:33 Probably a benign such if so - there doesn't appea
90 ASSERT_NOT_REACHED(); 90 ASSERT_NOT_REACHED();
91 91
92 reportAttributeParsingError(parseError, name, value); 92 reportAttributeParsingError(parseError, name, value);
93 } 93 }
94 94
95 void SVGForeignObjectElement::svgAttributeChanged(const QualifiedName& attrName) 95 void SVGForeignObjectElement::svgAttributeChanged(const QualifiedName& attrName)
96 { 96 {
97 if (!isSupportedAttribute(attrName)) { 97 if (!isSupportedAttribute(attrName)) {
98 SVGGraphicsElement::svgAttributeChanged(attrName); 98 SVGGraphicsElement::svgAttributeChanged(attrName);
99 return; 99 return;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 138
139 bool SVGForeignObjectElement::selfHasRelativeLengths() const 139 bool SVGForeignObjectElement::selfHasRelativeLengths() const
140 { 140 {
141 return m_x->currentValue()->isRelative() 141 return m_x->currentValue()->isRelative()
142 || m_y->currentValue()->isRelative() 142 || m_y->currentValue()->isRelative()
143 || m_width->currentValue()->isRelative() 143 || m_width->currentValue()->isRelative()
144 || m_height->currentValue()->isRelative(); 144 || m_height->currentValue()->isRelative();
145 } 145 }
146 146
147 } 147 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698