OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |