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

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

Issue 169103002: Drop [LegacyImplementedInBaseClass] from SVGURIReference IDL interface (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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) 2011 Leo Yang <leoyang@webkit.org> 2 * Copyright (C) 2011 Leo Yang <leoyang@webkit.org>
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 18 matching lines...) Expand all
29 namespace WebCore { 29 namespace WebCore {
30 30
31 // Animated property definitions 31 // Animated property definitions
32 32
33 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGGlyphRefElement) 33 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGGlyphRefElement)
34 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement) 34 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement)
35 END_REGISTER_ANIMATED_PROPERTIES 35 END_REGISTER_ANIMATED_PROPERTIES
36 36
37 inline SVGGlyphRefElement::SVGGlyphRefElement(Document& document) 37 inline SVGGlyphRefElement::SVGGlyphRefElement(Document& document)
38 : SVGElement(SVGNames::glyphRefTag, document) 38 : SVGElement(SVGNames::glyphRefTag, document)
39 , m_href(SVGAnimatedString::create(this, XLinkNames::hrefAttr, SVGString::cr eate())) 39 , SVGURIReference(this)
40 , m_x(0) 40 , m_x(0)
41 , m_y(0) 41 , m_y(0)
42 , m_dx(0) 42 , m_dx(0)
43 , m_dy(0) 43 , m_dy(0)
44 { 44 {
45 ScriptWrappable::init(this); 45 ScriptWrappable::init(this);
46 addToPropertyMap(m_href);
47 registerAnimatedPropertiesForSVGGlyphRefElement(); 46 registerAnimatedPropertiesForSVGGlyphRefElement();
48 } 47 }
49 48
50 PassRefPtr<SVGGlyphRefElement> SVGGlyphRefElement::create(Document& document) 49 PassRefPtr<SVGGlyphRefElement> SVGGlyphRefElement::create(Document& document)
51 { 50 {
52 return adoptRef(new SVGGlyphRefElement(document)); 51 return adoptRef(new SVGGlyphRefElement(document));
53 } 52 }
54 53
55 bool SVGGlyphRefElement::hasValidGlyphElement(AtomicString& glyphName) const 54 bool SVGGlyphRefElement::hasValidGlyphElement(AtomicString& glyphName) const
56 { 55 {
57 // FIXME: We only support xlink:href so far. 56 // FIXME: We only support xlink:href so far.
58 // https://bugs.webkit.org/show_bug.cgi?id=64787 57 // https://bugs.webkit.org/show_bug.cgi?id=64787
59 Element* element = targetElementFromIRIString(getAttribute(XLinkNames::hrefA ttr), document(), &glyphName); 58 Element* element = targetElementFromIRIString(getAttribute(XLinkNames::hrefA ttr), document(), &glyphName);
60 if (!element || !element->hasTagName(SVGNames::glyphTag)) 59 if (!element || !element->hasTagName(SVGNames::glyphTag))
61 return false; 60 return false;
62 return true; 61 return true;
63 } 62 }
64 63
65 template<typename CharType> 64 template<typename CharType>
66 void SVGGlyphRefElement::parseAttributeInternal(const QualifiedName& name, const AtomicString& value) 65 void SVGGlyphRefElement::parseAttributeInternal(const QualifiedName& name, const AtomicString& value)
67 { 66 {
68 const CharType* ptr = value.isEmpty() ? 0 : value.string().getCharacters<Cha rType>(); 67 const CharType* ptr = value.isEmpty() ? 0 : value.string().getCharacters<Cha rType>();
69 const CharType* end = ptr + value.length(); 68 const CharType* end = ptr + value.length();
70 69
71 // FIXME: We need some error handling here. 70 // FIXME: We need some error handling here.
71 SVGParsingError parseError = NoError;
72 if (name == SVGNames::xAttr) { 72 if (name == SVGNames::xAttr) {
73 parseNumber(ptr, end, m_x); 73 parseNumber(ptr, end, m_x);
74 } else if (name == SVGNames::yAttr) { 74 } else if (name == SVGNames::yAttr) {
75 parseNumber(ptr, end, m_y); 75 parseNumber(ptr, end, m_y);
76 } else if (name == SVGNames::dxAttr) { 76 } else if (name == SVGNames::dxAttr) {
77 parseNumber(ptr, end, m_dx); 77 parseNumber(ptr, end, m_dx);
78 } else if (name == SVGNames::dyAttr) { 78 } else if (name == SVGNames::dyAttr) {
79 parseNumber(ptr, end, m_dy); 79 parseNumber(ptr, end, m_dy);
80 } else if (name.matches(XLinkNames::hrefAttr)) { 80 } else if (SVGURIReference::parseAttribute(name, value, parseError)) {
81 SVGParsingError parseError = NoError;
82 m_href->setBaseValueAsString(value, parseError);
83 reportAttributeParsingError(parseError, name, value);
84 } else { 81 } else {
85 SVGElement::parseAttribute(name, value); 82 SVGElement::parseAttribute(name, value);
86 } 83 }
84 reportAttributeParsingError(parseError, name, value);
87 } 85 }
88 86
89 void SVGGlyphRefElement::parseAttribute(const QualifiedName& name, const AtomicS tring& value) 87 void SVGGlyphRefElement::parseAttribute(const QualifiedName& name, const AtomicS tring& value)
90 { 88 {
91 if (value.isEmpty() || value.is8Bit()) 89 if (value.isEmpty() || value.is8Bit())
92 parseAttributeInternal<LChar>(name, value); 90 parseAttributeInternal<LChar>(name, value);
93 else 91 else
94 parseAttributeInternal<UChar>(name, value); 92 parseAttributeInternal<UChar>(name, value);
95 } 93 }
96 94
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 void SVGGlyphRefElement::setDy(float dy) 127 void SVGGlyphRefElement::setDy(float dy)
130 { 128 {
131 // FIXME: Honor attribute change. 129 // FIXME: Honor attribute change.
132 // https://bugs.webkit.org/show_bug.cgi?id=64787 130 // https://bugs.webkit.org/show_bug.cgi?id=64787
133 m_dy = dy; 131 m_dy = dy;
134 } 132 }
135 133
136 } 134 }
137 135
138 #endif 136 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698