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

Side by Side Diff: third_party/WebKit/Source/core/svg/SVGSVGElement.cpp

Issue 2623513005: Introduce Element::AttributeModificationParams (Closed)
Patch Set: Created 3 years, 11 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) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Rob Buis <buis@kde.org>
4 * Copyright (C) 2007 Apple Inc. All rights reserved. 4 * Copyright (C) 2007 Apple Inc. All rights reserved.
5 * Copyright (C) 2014 Google, Inc. 5 * Copyright (C) 2014 Google, Inc.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 LayoutInvalidationReason::Unknown); 148 LayoutInvalidationReason::Unknown);
149 } 149 }
150 150
151 bool SVGSVGElement::zoomAndPanEnabled() const { 151 bool SVGSVGElement::zoomAndPanEnabled() const {
152 SVGZoomAndPanType zoomAndPan = this->zoomAndPan(); 152 SVGZoomAndPanType zoomAndPan = this->zoomAndPan();
153 if (m_viewSpec) 153 if (m_viewSpec)
154 zoomAndPan = m_viewSpec->zoomAndPan(); 154 zoomAndPan = m_viewSpec->zoomAndPan();
155 return zoomAndPan == SVGZoomAndPanMagnify; 155 return zoomAndPan == SVGZoomAndPanMagnify;
156 } 156 }
157 157
158 void SVGSVGElement::parseAttribute(const QualifiedName& name, 158 void SVGSVGElement::parseAttribute(const AttributeModificationParams& params) {
159 const AtomicString& oldValue, 159 const QualifiedName& name = params.name;
160 const AtomicString& value) { 160 const AtomicString& value = params.newValue;
161 if (!nearestViewportElement()) { 161 if (!nearestViewportElement()) {
162 bool setListener = true; 162 bool setListener = true;
163 163
164 // Only handle events if we're the outermost <svg> element 164 // Only handle events if we're the outermost <svg> element
165 if (name == HTMLNames::onunloadAttr) { 165 if (name == HTMLNames::onunloadAttr) {
166 document().setWindowAttributeEventListener( 166 document().setWindowAttributeEventListener(
167 EventTypeNames::unload, 167 EventTypeNames::unload,
168 createAttributeEventListener(document().frame(), name, value, 168 createAttributeEventListener(document().frame(), name, value,
169 eventParameterName())); 169 eventParameterName()));
170 } else if (name == HTMLNames::onresizeAttr) { 170 } else if (name == HTMLNames::onresizeAttr) {
(...skipping 28 matching lines...) Expand all
199 } else if (name == SVGNames::widthAttr || name == SVGNames::heightAttr) { 199 } else if (name == SVGNames::widthAttr || name == SVGNames::heightAttr) {
200 SVGAnimatedLength* property = 200 SVGAnimatedLength* property =
201 name == SVGNames::widthAttr ? m_width : m_height; 201 name == SVGNames::widthAttr ? m_width : m_height;
202 SVGParsingError parseError; 202 SVGParsingError parseError;
203 if (!value.isNull()) 203 if (!value.isNull())
204 parseError = property->setBaseValueAsString(value); 204 parseError = property->setBaseValueAsString(value);
205 if (parseError != SVGParseStatus::NoError || value.isNull()) 205 if (parseError != SVGParseStatus::NoError || value.isNull())
206 property->setDefaultValueAsString("100%"); 206 property->setDefaultValueAsString("100%");
207 reportAttributeParsingError(parseError, name, value); 207 reportAttributeParsingError(parseError, name, value);
208 } else { 208 } else {
209 SVGElement::parseAttribute(name, oldValue, value); 209 SVGElement::parseAttribute(params);
210 } 210 }
211 } 211 }
212 212
213 bool SVGSVGElement::isPresentationAttribute(const QualifiedName& name) const { 213 bool SVGSVGElement::isPresentationAttribute(const QualifiedName& name) const {
214 if ((name == SVGNames::widthAttr || name == SVGNames::heightAttr) && 214 if ((name == SVGNames::widthAttr || name == SVGNames::heightAttr) &&
215 !isOutermostSVGSVGElement()) 215 !isOutermostSVGSVGElement())
216 return false; 216 return false;
217 return SVGGraphicsElement::isPresentationAttribute(name); 217 return SVGGraphicsElement::isPresentationAttribute(name);
218 } 218 }
219 219
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after
760 visitor->trace(m_width); 760 visitor->trace(m_width);
761 visitor->trace(m_height); 761 visitor->trace(m_height);
762 visitor->trace(m_translation); 762 visitor->trace(m_translation);
763 visitor->trace(m_timeContainer); 763 visitor->trace(m_timeContainer);
764 visitor->trace(m_viewSpec); 764 visitor->trace(m_viewSpec);
765 SVGGraphicsElement::trace(visitor); 765 SVGGraphicsElement::trace(visitor);
766 SVGFitToViewBox::trace(visitor); 766 SVGFitToViewBox::trace(visitor);
767 } 767 }
768 768
769 } // namespace blink 769 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGSVGElement.h ('k') | third_party/WebKit/Source/core/svg/SVGScriptElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698