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

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

Issue 2706583002: Fix the way <title> is read under <use> shadow tree (Closed)
Patch Set: Created 3 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 | « 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, 2007, 2008 Nikolas Zimmermann 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann
3 * <zimmermann@kde.org> 3 * <zimmermann@kde.org>
4 * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org> 4 * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
5 * Copyright (C) 2008 Apple Inc. All rights reserved. 5 * Copyright (C) 2008 Apple Inc. All rights reserved.
6 * Copyright (C) 2008 Alp Toker <alp@atoker.com> 6 * Copyright (C) 2008 Alp Toker <alp@atoker.com>
7 * Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> 7 * Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au>
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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 if (isOutermostSVGSVGElement()) 196 if (isOutermostSVGSVGElement())
197 return String(); 197 return String();
198 198
199 if (inUseShadowTree()) { 199 if (inUseShadowTree()) {
200 String useTitle(ownerShadowHost()->title()); 200 String useTitle(ownerShadowHost()->title());
201 if (!useTitle.isEmpty()) 201 if (!useTitle.isEmpty())
202 return useTitle; 202 return useTitle;
203 } 203 }
204 204
205 // If we aren't an instance in a <use> or the <use> title was not found, then 205 // If we aren't an instance in a <use> or the <use> title was not found, then
206 // find the first <title> child of this element. 206 // find the first <title> child of this element and return it's text contents.
fs 2017/02/24 09:06:18 Nit: its
207 // If a title child was found, return the text contents.
208 if (Element* titleElement = Traversal<SVGTitleElement>::firstChild(*this)) 207 if (Element* titleElement = Traversal<SVGTitleElement>::firstChild(*this))
209 return titleElement->innerText(); 208 return titleElement->innerText();
210 209 // Else we traverse potential <use> shadow tree to see if it has any <title>
210 // descendants using FlatTreeTraversal.
fs 2017/02/24 09:06:18 I don't think we want to look at _all_ descendants
mrunal 2017/02/25 00:31:18 The example in the bug uses <title> which is neste
fs 2017/02/27 08:57:08 Yes, per the referenced document [1].
211 Node* node = FlatTreeTraversal::firstChild(*this);
212 while (node) {
213 if (isSVGTitleElement(node)) {
214 return toElement(node)->innerText();
215 }
216 node = FlatTreeTraversal::next(*node, this);
217 }
211 // Otherwise return a null/empty string. 218 // Otherwise return a null/empty string.
212 return String(); 219 return String();
213 } 220 }
214 221
215 bool SVGElement::instanceUpdatesBlocked() const { 222 bool SVGElement::instanceUpdatesBlocked() const {
216 return hasSVGRareData() && svgRareData()->instanceUpdatesBlocked(); 223 return hasSVGRareData() && svgRareData()->instanceUpdatesBlocked();
217 } 224 }
218 225
219 void SVGElement::setInstanceUpdatesBlocked(bool value) { 226 void SVGElement::setInstanceUpdatesBlocked(bool value) {
220 if (hasSVGRareData()) 227 if (hasSVGRareData())
(...skipping 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after
1289 visitor->trace(m_className); 1296 visitor->trace(m_className);
1290 Element::trace(visitor); 1297 Element::trace(visitor);
1291 } 1298 }
1292 1299
1293 const AtomicString& SVGElement::eventParameterName() { 1300 const AtomicString& SVGElement::eventParameterName() {
1294 DEFINE_STATIC_LOCAL(const AtomicString, evtString, ("evt")); 1301 DEFINE_STATIC_LOCAL(const AtomicString, evtString, ("evt"));
1295 return evtString; 1302 return evtString;
1296 } 1303 }
1297 1304
1298 } // namespace blink 1305 } // 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