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

Side by Side Diff: Source/core/rendering/svg/RenderSVGTransformableContainer.cpp

Issue 19539003: Introduce toSVGUseElement(), use it (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebased Created 7 years, 5 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 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
4 * Copyright (C) 2009 Google, Inc. 4 * Copyright (C) 2009 Google, Inc.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 28 matching lines...) Expand all
39 39
40 bool RenderSVGTransformableContainer::calculateLocalTransform() 40 bool RenderSVGTransformableContainer::calculateLocalTransform()
41 { 41 {
42 SVGGraphicsElement* element = toSVGGraphicsElement(node()); 42 SVGGraphicsElement* element = toSVGGraphicsElement(node());
43 43
44 // If we're either the renderer for a <use> element, or for any <g> element inside the shadow 44 // If we're either the renderer for a <use> element, or for any <g> element inside the shadow
45 // tree, that was created during the use/symbol/svg expansion in SVGUseEleme nt. These containers 45 // tree, that was created during the use/symbol/svg expansion in SVGUseEleme nt. These containers
46 // need to respect the translations induced by their corresponding use eleme nts x/y attributes. 46 // need to respect the translations induced by their corresponding use eleme nts x/y attributes.
47 SVGUseElement* useElement = 0; 47 SVGUseElement* useElement = 0;
48 if (element->hasTagName(SVGNames::useTag)) 48 if (element->hasTagName(SVGNames::useTag))
49 useElement = static_cast<SVGUseElement*>(element); 49 useElement = toSVGUseElement(element);
50 else if (element->isInShadowTree() && element->hasTagName(SVGNames::gTag)) { 50 else if (element->isInShadowTree() && element->hasTagName(SVGNames::gTag)) {
51 SVGElement* correspondingElement = element->correspondingElement(); 51 SVGElement* correspondingElement = element->correspondingElement();
52 if (correspondingElement && correspondingElement->hasTagName(SVGNames::u seTag)) 52 if (correspondingElement && correspondingElement->hasTagName(SVGNames::u seTag))
53 useElement = static_cast<SVGUseElement*>(correspondingElement); 53 useElement = toSVGUseElement(correspondingElement);
54 } 54 }
55 55
56 if (useElement) { 56 if (useElement) {
57 SVGLengthContext lengthContext(useElement); 57 SVGLengthContext lengthContext(useElement);
58 FloatSize translation(useElement->xCurrentValue().value(lengthContext), useElement->yCurrentValue().value(lengthContext)); 58 FloatSize translation(useElement->xCurrentValue().value(lengthContext), useElement->yCurrentValue().value(lengthContext));
59 if (translation != m_lastTranslation) 59 if (translation != m_lastTranslation)
60 m_needsTransformUpdate = true; 60 m_needsTransformUpdate = true;
61 m_lastTranslation = translation; 61 m_lastTranslation = translation;
62 } 62 }
63 63
64 m_didTransformToRootUpdate = m_needsTransformUpdate || SVGRenderSupport::tra nsformToRootChanged(parent()); 64 m_didTransformToRootUpdate = m_needsTransformUpdate || SVGRenderSupport::tra nsformToRootChanged(parent());
65 if (!m_needsTransformUpdate) 65 if (!m_needsTransformUpdate)
66 return false; 66 return false;
67 67
68 m_localTransform = element->animatedLocalTransform(); 68 m_localTransform = element->animatedLocalTransform();
69 m_localTransform.translate(m_lastTranslation.width(), m_lastTranslation.heig ht()); 69 m_localTransform.translate(m_lastTranslation.width(), m_lastTranslation.heig ht());
70 m_needsTransformUpdate = false; 70 m_needsTransformUpdate = false;
71 return true; 71 return true;
72 } 72 }
73 73
74 } 74 }
OLDNEW
« no previous file with comments | « Source/core/rendering/svg/RenderSVGResourceClipper.cpp ('k') | Source/core/svg/SVGStyledElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698