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

Side by Side Diff: Source/core/svg/SVGStyledElement.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, 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, 2007, 2008 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2007, 2008 Rob Buis <buis@kde.org>
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 return String(); 83 return String();
84 84
85 // Walk up the tree, to find out whether we're inside a <use> shadow tree, t o find the right title. 85 // Walk up the tree, to find out whether we're inside a <use> shadow tree, t o find the right title.
86 if (isInShadowTree()) { 86 if (isInShadowTree()) {
87 Element* shadowHostElement = toShadowRoot(treeScope()->rootNode())->host (); 87 Element* shadowHostElement = toShadowRoot(treeScope()->rootNode())->host ();
88 // At this time, SVG nodes are not allowed in non-<use> shadow trees, so any shadow root we do 88 // At this time, SVG nodes are not allowed in non-<use> shadow trees, so any shadow root we do
89 // have should be a use. The assert and following test is here to catch future shadow DOM changes 89 // have should be a use. The assert and following test is here to catch future shadow DOM changes
90 // that do enable SVG in a shadow tree. 90 // that do enable SVG in a shadow tree.
91 ASSERT(!shadowHostElement || shadowHostElement->hasTagName(SVGNames::use Tag)); 91 ASSERT(!shadowHostElement || shadowHostElement->hasTagName(SVGNames::use Tag));
92 if (shadowHostElement && shadowHostElement->hasTagName(SVGNames::useTag) ) { 92 if (shadowHostElement && shadowHostElement->hasTagName(SVGNames::useTag) ) {
93 SVGUseElement* useElement = static_cast<SVGUseElement*>(shadowHostEl ement); 93 SVGUseElement* useElement = toSVGUseElement(shadowHostElement);
94 94
95 // If the <use> title is not empty we found the title to use. 95 // If the <use> title is not empty we found the title to use.
96 String useTitle(useElement->title()); 96 String useTitle(useElement->title());
97 if (!useTitle.isEmpty()) 97 if (!useTitle.isEmpty())
98 return useTitle; 98 return useTitle;
99 } 99 }
100 } 100 }
101 101
102 // If we aren't an instance in a <use> or the <use> title was not found, the n find the first 102 // If we aren't an instance in a <use> or the <use> title was not found, the n find the first
103 // <title> child of this element. 103 // <title> child of this element.
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 Element* eventTarget = const_cast<SVGStyledElement *>(this); 476 Element* eventTarget = const_cast<SVGStyledElement *>(this);
477 return eventTarget->hasEventListeners(eventNames().focusinEvent) || eventTar get->hasEventListeners(eventNames().focusoutEvent); 477 return eventTarget->hasEventListeners(eventNames().focusinEvent) || eventTar get->hasEventListeners(eventNames().focusoutEvent);
478 } 478 }
479 479
480 bool SVGStyledElement::isKeyboardFocusable(KeyboardEvent*) const 480 bool SVGStyledElement::isKeyboardFocusable(KeyboardEvent*) const
481 { 481 {
482 return isMouseFocusable(); 482 return isMouseFocusable();
483 } 483 }
484 484
485 } 485 }
OLDNEW
« no previous file with comments | « Source/core/rendering/svg/RenderSVGTransformableContainer.cpp ('k') | Source/core/svg/SVGUseElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698