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

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

Issue 643703006: SVGElement::parseAttribute resolves property via property map (Step 2.4) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 2 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> 2 * Copyright (C) 2007 Eric Seidel <eric@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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 } 84 }
85 85
86 void SVGMPathElement::removedFrom(ContainerNode* rootParent) 86 void SVGMPathElement::removedFrom(ContainerNode* rootParent)
87 { 87 {
88 SVGElement::removedFrom(rootParent); 88 SVGElement::removedFrom(rootParent);
89 notifyParentOfPathChange(rootParent); 89 notifyParentOfPathChange(rootParent);
90 if (rootParent->inDocument()) 90 if (rootParent->inDocument())
91 clearResourceReferences(); 91 clearResourceReferences();
92 } 92 }
93 93
94 bool SVGMPathElement::isSupportedAttribute(const QualifiedName& attrName)
95 {
96 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ());
97 if (supportedAttributes.isEmpty()) {
98 SVGURIReference::addSupportedAttributes(supportedAttributes);
99 }
100 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName);
101 }
102
103 void SVGMPathElement::parseAttribute(const QualifiedName& name, const AtomicStri ng& value) 94 void SVGMPathElement::parseAttribute(const QualifiedName& name, const AtomicStri ng& value)
104 { 95 {
105 SVGParsingError parseError = NoError; 96 parseAttributeNew(name, value);
106
107 if (!isSupportedAttribute(name)) {
108 SVGElement::parseAttribute(name, value);
109 } else if (SVGURIReference::parseAttribute(name, value, parseError)) {
110 } else {
111 ASSERT_NOT_REACHED();
112 }
113
114 reportAttributeParsingError(parseError, name, value);
115 } 97 }
116 98
117 void SVGMPathElement::svgAttributeChanged(const QualifiedName& attrName) 99 void SVGMPathElement::svgAttributeChanged(const QualifiedName& attrName)
118 { 100 {
119 if (!isSupportedAttribute(attrName)) { 101 if (SVGURIReference::isKnownAttribute(attrName)) {
120 SVGElement::svgAttributeChanged(attrName); 102 SVGElement::InvalidationGuard invalidationGuard(this);
121 return; 103 buildPendingResource();
122 } 104 }
fs 2014/10/15 09:06:45 When eliding the call to the superclass it might b
kouhei (in TOK) 2014/10/15 10:02:00 Thanks for the catch. This was by accident. The m
123
124 SVGElement::InvalidationGuard invalidationGuard(this);
125
126 if (SVGURIReference::isKnownAttribute(attrName)) {
127 buildPendingResource();
128 return;
129 }
130
131 ASSERT_NOT_REACHED();
132 } 105 }
133 106
134 SVGPathElement* SVGMPathElement::pathElement() 107 SVGPathElement* SVGMPathElement::pathElement()
135 { 108 {
136 Element* target = targetElementFromIRIString(hrefString(), treeScope()); 109 Element* target = targetElementFromIRIString(hrefString(), treeScope());
137 return isSVGPathElement(target) ? toSVGPathElement(target) : 0; 110 return isSVGPathElement(target) ? toSVGPathElement(target) : 0;
138 } 111 }
139 112
140 void SVGMPathElement::targetPathChanged() 113 void SVGMPathElement::targetPathChanged()
141 { 114 {
142 notifyParentOfPathChange(parentNode()); 115 notifyParentOfPathChange(parentNode());
143 } 116 }
144 117
145 void SVGMPathElement::notifyParentOfPathChange(ContainerNode* parent) 118 void SVGMPathElement::notifyParentOfPathChange(ContainerNode* parent)
146 { 119 {
147 if (isSVGAnimateMotionElement(parent)) 120 if (isSVGAnimateMotionElement(parent))
148 toSVGAnimateMotionElement(parent)->updateAnimationPath(); 121 toSVGAnimateMotionElement(parent)->updateAnimationPath();
149 } 122 }
150 123
151 } // namespace blink 124 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698