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

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

Issue 1601093007: Simplify SVGSVGElement::collectStyleForPresentationAttribute (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
« no previous file with comments | « no previous file | 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 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 else if (property == m_height) 256 else if (property == m_height)
257 addPropertyToPresentationAttributeStyle(style, CSSPropertyHeight, m_ height->currentValue()->asCSSPrimitiveValue()); 257 addPropertyToPresentationAttributeStyle(style, CSSPropertyHeight, m_ height->currentValue()->asCSSPrimitiveValue());
258 } else { 258 } else {
259 SVGGraphicsElement::collectStyleForPresentationAttribute(name, value, st yle); 259 SVGGraphicsElement::collectStyleForPresentationAttribute(name, value, st yle);
260 } 260 }
261 } 261 }
262 262
263 void SVGSVGElement::svgAttributeChanged(const QualifiedName& attrName) 263 void SVGSVGElement::svgAttributeChanged(const QualifiedName& attrName)
264 { 264 {
265 bool updateRelativeLengthsOrViewBox = false; 265 bool updateRelativeLengthsOrViewBox = false;
266 bool widthChanged = attrName == SVGNames::widthAttr; 266 bool widthOrHeightChanged = attrName == SVGNames::widthAttr || attrName == S VGNames::heightAttr;
267 bool heightChanged = attrName == SVGNames::heightAttr; 267 if (widthOrHeightChanged
268 if (widthChanged || heightChanged
269 || attrName == SVGNames::xAttr 268 || attrName == SVGNames::xAttr
270 || attrName == SVGNames::yAttr) { 269 || attrName == SVGNames::yAttr) {
271 updateRelativeLengthsOrViewBox = true; 270 updateRelativeLengthsOrViewBox = true;
272 updateRelativeLengthsInformation(); 271 updateRelativeLengthsInformation();
273 invalidateRelativeLengthClients(); 272 invalidateRelativeLengthClients();
274 273
275 // At the SVG/HTML boundary (aka LayoutSVGRoot), the width and 274 // At the SVG/HTML boundary (aka LayoutSVGRoot), the width and
276 // height attributes can affect the replaced size so we need 275 // height attributes can affect the replaced size so we need
277 // to mark it for updating. 276 // to mark it for updating.
278 // 277 //
279 // FIXME: For width/height animated as XML attributes on SVG 278 // FIXME: For width/height animated as XML attributes on SVG
280 // roots, there is an attribute synchronization missing. See 279 // roots, there is an attribute synchronization missing. See
281 // http://crbug.com/364807 280 // http://crbug.com/364807
282 if (widthChanged || heightChanged) { 281 if (widthOrHeightChanged) {
283 LayoutObject* layoutObject = this->layoutObject(); 282 LayoutObject* layoutObject = this->layoutObject();
284 if (layoutObject && layoutObject->isSVGRoot()) { 283 if (layoutObject && layoutObject->isSVGRoot()) {
285 invalidateSVGPresentationAttributeStyle(); 284 invalidateSVGPresentationAttributeStyle();
286 setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracin g::create(StyleChangeReason::SVGContainerSizeChange)); 285 setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracin g::create(StyleChangeReason::SVGContainerSizeChange));
287 } 286 }
288 } else { 287 } else {
289 invalidateSVGPresentationAttributeStyle(); 288 invalidateSVGPresentationAttributeStyle();
290 setNeedsStyleRecalc(LocalStyleChange, 289 setNeedsStyleRecalc(LocalStyleChange,
291 StyleChangeReasonForTracing::fromAttribute(attrName)); 290 StyleChangeReasonForTracing::fromAttribute(attrName));
292 } 291 }
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 visitor->trace(m_width); 763 visitor->trace(m_width);
765 visitor->trace(m_height); 764 visitor->trace(m_height);
766 visitor->trace(m_translation); 765 visitor->trace(m_translation);
767 visitor->trace(m_timeContainer); 766 visitor->trace(m_timeContainer);
768 visitor->trace(m_viewSpec); 767 visitor->trace(m_viewSpec);
769 SVGGraphicsElement::trace(visitor); 768 SVGGraphicsElement::trace(visitor);
770 SVGFitToViewBox::trace(visitor); 769 SVGFitToViewBox::trace(visitor);
771 } 770 }
772 771
773 } // namespace blink 772 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698