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

Side by Side Diff: third_party/WebKit/Source/core/layout/HitTestResult.cpp

Issue 2752763002: Change the type of a SVG <use> element's shadow tree from "user agent" to "closed" (Closed)
Patch Set: Rebased and resolve a conflict in HitTestResult 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2008, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2008, 2011 Apple Inc. All rights reserved.
3 * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies)
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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 m_innerPossiblyPseudoNode->getPseudoId() == PseudoIdBefore) 162 m_innerPossiblyPseudoNode->getPseudoId() == PseudoIdBefore)
163 return mostForwardCaretPosition( 163 return mostForwardCaretPosition(
164 Position(m_innerNode, PositionAnchorType::BeforeChildren)); 164 Position(m_innerNode, PositionAnchorType::BeforeChildren));
165 return layoutObject->positionForPoint(localPoint()); 165 return layoutObject->positionForPoint(localPoint());
166 } 166 }
167 167
168 LayoutObject* HitTestResult::layoutObject() const { 168 LayoutObject* HitTestResult::layoutObject() const {
169 return m_innerNode ? m_innerNode->layoutObject() : 0; 169 return m_innerNode ? m_innerNode->layoutObject() : 0;
170 } 170 }
171 171
172 void HitTestResult::setToShadowHostIfInUserAgentShadowRoot() { 172 void HitTestResult::setToShadowHostIfInRestrictedShadowRoot() {
173 Node* node = innerNode(); 173 Node* node = innerNode();
174 if (!node) 174 if (!node)
175 return; 175 return;
176 176
177 ShadowRoot* containingShadowRoot = node->containingShadowRoot(); 177 ShadowRoot* containingShadowRoot = node->containingShadowRoot();
178 Element* shadowHost = nullptr; 178 Element* shadowHost = nullptr;
179 179
180 // Consider a closed shadow tree of SVG's <use> element as a special
181 // case so that a toolip title in the shadow tree works.
180 while (containingShadowRoot && 182 while (containingShadowRoot &&
181 containingShadowRoot->type() == ShadowRootType::UserAgent) { 183 (containingShadowRoot->type() == ShadowRootType::UserAgent ||
184 isSVGUseElement(containingShadowRoot->host()))) {
182 shadowHost = &containingShadowRoot->host(); 185 shadowHost = &containingShadowRoot->host();
183 containingShadowRoot = shadowHost->containingShadowRoot(); 186 containingShadowRoot = shadowHost->containingShadowRoot();
187 setInnerNode(node->ownerShadowHost());
184 } 188 }
185 189
186 if (shadowHost) 190 if (shadowHost)
187 setInnerNode(shadowHost); 191 setInnerNode(shadowHost);
188 } 192 }
189 193
190 HTMLAreaElement* HitTestResult::imageAreaForImage() const { 194 HTMLAreaElement* HitTestResult::imageAreaForImage() const {
191 ASSERT(m_innerNode); 195 ASSERT(m_innerNode);
192 HTMLImageElement* imageElement = nullptr; 196 HTMLImageElement* imageElement = nullptr;
193 if (isHTMLImageElement(m_innerNode)) { 197 if (isHTMLImageElement(m_innerNode)) {
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 else if (isHTMLMapElement(m_innerNode)) 516 else if (isHTMLMapElement(m_innerNode))
513 imageMapImageElement = toHTMLMapElement(m_innerNode)->imageElement(); 517 imageMapImageElement = toHTMLMapElement(m_innerNode)->imageElement();
514 518
515 if (!imageMapImageElement) 519 if (!imageMapImageElement)
516 return m_innerNode.get(); 520 return m_innerNode.get();
517 521
518 return imageMapImageElement; 522 return imageMapImageElement;
519 } 523 }
520 524
521 } // namespace blink 525 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/HitTestResult.h ('k') | third_party/WebKit/Source/core/svg/SVGElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698