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

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

Issue 1127773003: This CL clean up patch in SVGElements. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 7 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/SVGURIReference.cpp ('k') | Source/core/svg/SVGViewSpec.cpp » ('j') | 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, 2007, 2008 Nikolas Zimmermann <zimmermann@kde .org> 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde .org>
3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
4 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. 4 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved.
5 * Copyright (C) 2011 Torch Mobile (Beijing) Co. Ltd. All rights reserved. 5 * Copyright (C) 2011 Torch Mobile (Beijing) Co. Ltd. All rights reserved.
6 * Copyright (C) 2012 University of Szeged 6 * Copyright (C) 2012 University of Szeged
7 * Copyright (C) 2012 Renata Hodovan <reni@webkit.org> 7 * Copyright (C) 2012 Renata Hodovan <reni@webkit.org>
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 if (!isExternalURIReference(hrefString(), document())) 124 if (!isExternalURIReference(hrefString(), document()))
125 return &treeScope(); 125 return &treeScope();
126 return externalDocument(); 126 return externalDocument();
127 } 127 }
128 128
129 Document* SVGUseElement::externalDocument() const 129 Document* SVGUseElement::externalDocument() const
130 { 130 {
131 if (m_resource && m_resource->isLoaded()) { 131 if (m_resource && m_resource->isLoaded()) {
132 // Gracefully handle error condition. 132 // Gracefully handle error condition.
133 if (m_resource->errorOccurred()) 133 if (m_resource->errorOccurred())
134 return 0; 134 return nullptr;
135 ASSERT(m_resource->document()); 135 ASSERT(m_resource->document());
136 return m_resource->document(); 136 return m_resource->document();
137 } 137 }
138 return 0; 138 return nullptr;
139 } 139 }
140 140
141 void transferUseWidthAndHeightIfNeeded(const SVGUseElement& use, SVGElement* sha dowElement, const SVGElement& originalElement) 141 void transferUseWidthAndHeightIfNeeded(const SVGUseElement& use, SVGElement* sha dowElement, const SVGElement& originalElement)
142 { 142 {
143 DEFINE_STATIC_LOCAL(const AtomicString, hundredPercentString, ("100%", Atomi cString::ConstructFromLiteral)); 143 DEFINE_STATIC_LOCAL(const AtomicString, hundredPercentString, ("100%", Atomi cString::ConstructFromLiteral));
144 ASSERT(shadowElement); 144 ASSERT(shadowElement);
145 if (isSVGSymbolElement(*shadowElement)) { 145 if (isSVGSymbolElement(*shadowElement)) {
146 // Spec (<use> on <symbol>): This generated 'svg' will always have expli cit values for attributes width and height. 146 // Spec (<use> on <symbol>): This generated 'svg' will always have expli cit values for attributes width and height.
147 // If attributes width and/or height are provided on the 'use' element, then these attributes 147 // If attributes width and/or height are provided on the 'use' element, then these attributes
148 // will be transferred to the generated 'svg'. If attributes width and/o r height are not specified, 148 // will be transferred to the generated 'svg'. If attributes width and/o r height are not specified,
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 } 458 }
459 } 459 }
460 460
461 LayoutObject* SVGUseElement::layoutObjectClipChild() const 461 LayoutObject* SVGUseElement::layoutObjectClipChild() const
462 { 462 {
463 if (Node* n = userAgentShadowRoot()->firstChild()) { 463 if (Node* n = userAgentShadowRoot()->firstChild()) {
464 if (n->isSVGElement() && isDirectReference(toSVGElement(*n))) 464 if (n->isSVGElement() && isDirectReference(toSVGElement(*n)))
465 return n->layoutObject(); 465 return n->layoutObject();
466 } 466 }
467 467
468 return 0; 468 return nullptr;
469 } 469 }
470 470
471 bool SVGUseElement::buildShadowTree(SVGElement* target, SVGElement* targetInstan ce, bool foundUse) 471 bool SVGUseElement::buildShadowTree(SVGElement* target, SVGElement* targetInstan ce, bool foundUse)
472 { 472 {
473 ASSERT(target); 473 ASSERT(target);
474 ASSERT(targetInstance); 474 ASSERT(targetInstance);
475 475
476 // Spec: If the referenced object is itself a 'use', or if there are 'use' s ubelements within the referenced 476 // Spec: If the referenced object is itself a 'use', or if there are 'use' s ubelements within the referenced
477 // object, the instance tree will contain recursive expansion of the indirec t references to form a complete tree. 477 // object, the instance tree will contain recursive expansion of the indirec t references to form a complete tree.
478 if (isSVGUseElement(*target)) { 478 if (isSVGUseElement(*target)) {
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
762 762
763 if (m_resource) 763 if (m_resource)
764 m_resource->removeClient(this); 764 m_resource->removeClient(this);
765 765
766 m_resource = resource; 766 m_resource = resource;
767 if (m_resource) 767 if (m_resource)
768 m_resource->addClient(this); 768 m_resource->addClient(this);
769 } 769 }
770 770
771 } 771 }
OLDNEW
« no previous file with comments | « Source/core/svg/SVGURIReference.cpp ('k') | Source/core/svg/SVGViewSpec.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698