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

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

Issue 933663002: Make use of new method for setting lengths in presentation style. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 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
« no previous file with comments | « Source/core/svg/SVGImageElement.cpp ('k') | no next file » | 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, 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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 return SVGGraphicsElement::isPresentationAttributeWithSVGDOM(attrName); 257 return SVGGraphicsElement::isPresentationAttributeWithSVGDOM(attrName);
258 } 258 }
259 259
260 void SVGSVGElement::collectStyleForPresentationAttribute(const QualifiedName& na me, const AtomicString& value, MutableStylePropertySet* style) 260 void SVGSVGElement::collectStyleForPresentationAttribute(const QualifiedName& na me, const AtomicString& value, MutableStylePropertySet* style)
261 { 261 {
262 RefPtrWillBeRawPtr<SVGAnimatedPropertyBase> property = propertyFromAttribute (name); 262 RefPtrWillBeRawPtr<SVGAnimatedPropertyBase> property = propertyFromAttribute (name);
263 if (property == m_x) { 263 if (property == m_x) {
264 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyX, *m _x->currentValue()); 264 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyX, *m _x->currentValue());
265 } else if (property == m_y) { 265 } else if (property == m_y) {
266 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyY, *m _y->currentValue()); 266 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyY, *m _y->currentValue());
267 } else if (isOutermostSVGSVGElement() && (property == m_width || property == m_height)) { 267 } else if (isOutermostSVGSVGElement() && (property == m_width || property == m_height)) {
fs 2015/02/16 17:34:32 I guess this (isOutermostSVGSVGElement predicate)
Erik Dahlström (inactive) 2015/02/17 08:06:26 Yes, but I think it's best to do that in another C
268 RefPtrWillBeRawPtr<SVGLength> length = SVGLength::create(LengthModeOther ); 268 if (property == m_width)
269 TrackExceptionState exceptionState; 269 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyW idth, *m_width->currentValue());
270 length->setValueAsString(value, exceptionState); 270 else if (property == m_height)
271 if (!exceptionState.hadException()) { 271 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyH eight, *m_height->currentValue());
272 if (property == m_width)
273 addPropertyToPresentationAttributeStyle(style, CSSPropertyWidth, value);
274 else if (property == m_height)
275 addPropertyToPresentationAttributeStyle(style, CSSPropertyHeight , value);
276 }
277 } else { 272 } else {
278 SVGGraphicsElement::collectStyleForPresentationAttribute(name, value, st yle); 273 SVGGraphicsElement::collectStyleForPresentationAttribute(name, value, st yle);
279 } 274 }
280 } 275 }
281 276
282 void SVGSVGElement::svgAttributeChanged(const QualifiedName& attrName) 277 void SVGSVGElement::svgAttributeChanged(const QualifiedName& attrName)
283 { 278 {
284 bool updateRelativeLengthsOrViewBox = false; 279 bool updateRelativeLengthsOrViewBox = false;
285 bool widthChanged = attrName == SVGNames::widthAttr; 280 bool widthChanged = attrName == SVGNames::widthAttr;
286 bool heightChanged = attrName == SVGNames::heightAttr; 281 bool heightChanged = attrName == SVGNames::heightAttr;
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 visitor->trace(m_width); 785 visitor->trace(m_width);
791 visitor->trace(m_height); 786 visitor->trace(m_height);
792 visitor->trace(m_translation); 787 visitor->trace(m_translation);
793 visitor->trace(m_timeContainer); 788 visitor->trace(m_timeContainer);
794 visitor->trace(m_viewSpec); 789 visitor->trace(m_viewSpec);
795 SVGGraphicsElement::trace(visitor); 790 SVGGraphicsElement::trace(visitor);
796 SVGFitToViewBox::trace(visitor); 791 SVGFitToViewBox::trace(visitor);
797 } 792 }
798 793
799 } // namespace blink 794 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/svg/SVGImageElement.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698