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

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

Issue 2706583002: Fix the way <title> is read under <use> shadow tree (Closed)
Patch Set: Add title() handler to SVGUseElement and remove code from SVGElement Created 3 years, 9 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 | « third_party/WebKit/Source/core/svg/SVGUseElement.h ('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, 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, 2007 Rob Buis <buis@kde.org> 4 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
5 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. 5 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved.
6 * Copyright (C) 2011 Torch Mobile (Beijing) Co. Ltd. All rights reserved. 6 * Copyright (C) 2011 Torch Mobile (Beijing) Co. Ltd. All rights reserved.
7 * Copyright (C) 2012 University of Szeged 7 * Copyright (C) 2012 University of Szeged
8 * Copyright (C) 2012 Renata Hodovan <reni@webkit.org> 8 * Copyright (C) 2012 Renata Hodovan <reni@webkit.org>
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 22 matching lines...) Expand all
33 #include "core/dom/StyleChangeReason.h" 33 #include "core/dom/StyleChangeReason.h"
34 #include "core/dom/TaskRunnerHelper.h" 34 #include "core/dom/TaskRunnerHelper.h"
35 #include "core/dom/shadow/ElementShadow.h" 35 #include "core/dom/shadow/ElementShadow.h"
36 #include "core/dom/shadow/ShadowRoot.h" 36 #include "core/dom/shadow/ShadowRoot.h"
37 #include "core/events/Event.h" 37 #include "core/events/Event.h"
38 #include "core/layout/svg/LayoutSVGTransformableContainer.h" 38 #include "core/layout/svg/LayoutSVGTransformableContainer.h"
39 #include "core/svg/SVGGElement.h" 39 #include "core/svg/SVGGElement.h"
40 #include "core/svg/SVGLengthContext.h" 40 #include "core/svg/SVGLengthContext.h"
41 #include "core/svg/SVGSVGElement.h" 41 #include "core/svg/SVGSVGElement.h"
42 #include "core/svg/SVGSymbolElement.h" 42 #include "core/svg/SVGSymbolElement.h"
43 #include "core/svg/SVGTitleElement.h"
43 #include "core/svg/SVGTreeScopeResources.h" 44 #include "core/svg/SVGTreeScopeResources.h"
44 #include "core/xml/parser/XMLDocumentParser.h" 45 #include "core/xml/parser/XMLDocumentParser.h"
45 #include "platform/loader/fetch/FetchRequest.h" 46 #include "platform/loader/fetch/FetchRequest.h"
46 #include "platform/loader/fetch/ResourceFetcher.h" 47 #include "platform/loader/fetch/ResourceFetcher.h"
47 #include "wtf/Vector.h" 48 #include "wtf/Vector.h"
48 49
49 namespace blink { 50 namespace blink {
50 51
51 inline SVGUseElement::SVGUseElement(Document& document) 52 inline SVGUseElement::SVGUseElement(Document& document)
52 : SVGGraphicsElement(SVGNames::useTag, document), 53 : SVGGraphicsElement(SVGNames::useTag, document),
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 return; 333 return;
333 Element* target = resolveTargetElement(); 334 Element* target = resolveTargetElement();
334 if (target && target->isSVGElement()) { 335 if (target && target->isSVGElement()) {
335 buildShadowAndInstanceTree(toSVGElement(*target)); 336 buildShadowAndInstanceTree(toSVGElement(*target));
336 invalidateDependentShadowTrees(); 337 invalidateDependentShadowTrees();
337 } 338 }
338 339
339 ASSERT(!m_needsShadowTreeRecreation); 340 ASSERT(!m_needsShadowTreeRecreation);
340 } 341 }
341 342
343 String SVGUseElement::title() const {
344 // Find the first <title> child in <use> which doesn't cover shadow tree.
345 if (Element* titleElement = Traversal<SVGTitleElement>::firstChild(*this))
346 return titleElement->innerText();
347
348 // If there is no <title> child in <use>, we lookup first <title> child in
349 // shadow tree.
350 if (Element* titleElement =
351 Traversal<SVGTitleElement>::firstChild(*m_targetElementInstance))
352 return titleElement->innerText();
353
354 // Otherwise return a null/empty string.
fs 2017/02/28 09:07:15 null/empty -> null (String() is a null string, fo
355 return String();
356 }
357
342 static void associateCorrespondingElements(SVGElement& targetRoot, 358 static void associateCorrespondingElements(SVGElement& targetRoot,
343 SVGElement& instanceRoot) { 359 SVGElement& instanceRoot) {
344 auto targetRange = Traversal<SVGElement>::inclusiveDescendantsOf(targetRoot); 360 auto targetRange = Traversal<SVGElement>::inclusiveDescendantsOf(targetRoot);
345 auto targetIterator = targetRange.begin(); 361 auto targetIterator = targetRange.begin();
346 for (SVGElement& instance : 362 for (SVGElement& instance :
347 Traversal<SVGElement>::inclusiveDescendantsOf(instanceRoot)) { 363 Traversal<SVGElement>::inclusiveDescendantsOf(instanceRoot)) {
348 ASSERT(!instance.correspondingElement()); 364 ASSERT(!instance.correspondingElement());
349 instance.setCorrespondingElement(&*targetIterator); 365 instance.setCorrespondingElement(&*targetIterator);
350 ++targetIterator; 366 ++targetIterator;
351 } 367 }
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
724 740
725 if (m_resource) 741 if (m_resource)
726 m_resource->removeClient(this); 742 m_resource->removeClient(this);
727 743
728 m_resource = resource; 744 m_resource = resource;
729 if (m_resource) 745 if (m_resource)
730 m_resource->addClient(this); 746 m_resource->addClient(this);
731 } 747 }
732 748
733 } // namespace blink 749 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGUseElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698