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, |
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 * Library General Public License for more details. | 13 * Library General Public License for more details. |
14 * | 14 * |
15 * You should have received a copy of the GNU Library General Public License | 15 * You should have received a copy of the GNU Library General Public License |
16 * along with this library; see the file COPYING.LIB. If not, write to | 16 * along with this library; see the file COPYING.LIB. If not, write to |
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
18 * Boston, MA 02110-1301, USA. | 18 * Boston, MA 02110-1301, USA. |
19 * | 19 * |
20 */ | 20 */ |
21 | 21 |
22 #include "config.h" | 22 #include "config.h" |
23 #include "core/rendering/HitTestResult.h" | 23 #include "core/rendering/HitTestResult.h" |
24 | 24 |
25 #include "HTMLNames.h" | 25 #include "HTMLNames.h" |
26 #include "core/dom/DocumentMarkerController.h" | 26 #include "core/dom/DocumentMarkerController.h" |
27 #include "core/dom/shadow/ShadowRoot.h" | |
27 #include "core/editing/Editor.h" | 28 #include "core/editing/Editor.h" |
28 #include "core/editing/FrameSelection.h" | 29 #include "core/editing/FrameSelection.h" |
29 #include "core/html/HTMLAnchorElement.h" | 30 #include "core/html/HTMLAnchorElement.h" |
30 #include "core/html/HTMLImageElement.h" | 31 #include "core/html/HTMLImageElement.h" |
31 #include "core/html/HTMLInputElement.h" | 32 #include "core/html/HTMLInputElement.h" |
32 #include "core/html/HTMLMediaElement.h" | 33 #include "core/html/HTMLMediaElement.h" |
33 #include "core/html/HTMLPlugInImageElement.h" | 34 #include "core/html/HTMLPlugInImageElement.h" |
34 #include "core/html/HTMLVideoElement.h" | 35 #include "core/html/HTMLVideoElement.h" |
35 #include "core/html/parser/HTMLParserIdioms.h" | 36 #include "core/html/parser/HTMLParserIdioms.h" |
36 #include "core/loader/cache/CachedImage.h" | 37 #include "core/loader/cache/CachedImage.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
105 m_innerURLElement = other.URLElement(); | 106 m_innerURLElement = other.URLElement(); |
106 m_scrollbar = other.scrollbar(); | 107 m_scrollbar = other.scrollbar(); |
107 m_isOverWidget = other.isOverWidget(); | 108 m_isOverWidget = other.isOverWidget(); |
108 | 109 |
109 // Only copy the NodeSet in case of rect hit test. | 110 // Only copy the NodeSet in case of rect hit test. |
110 m_rectBasedTestResult = adoptPtr(other.m_rectBasedTestResult ? new NodeSet(* other.m_rectBasedTestResult) : 0); | 111 m_rectBasedTestResult = adoptPtr(other.m_rectBasedTestResult ? new NodeSet(* other.m_rectBasedTestResult) : 0); |
111 | 112 |
112 return *this; | 113 return *this; |
113 } | 114 } |
114 | 115 |
115 void HitTestResult::setToNonShadowAncestor() | 116 void HitTestResult::setToNodesInDocumentTreeScope() |
dglazkov
2013/05/13 16:11:42
It's not necessarily document tree scope, right? Y
| |
116 { | 117 { |
117 Node* node = innerNode(); | 118 if (Node* node = innerNode()) { |
118 if (node) | |
119 node = node->document()->ancestorInThisScope(node); | 119 node = node->document()->ancestorInThisScope(node); |
Hajime Morrita
2013/05/14 00:13:53
This asks document()->ancestorInThisScope(), which
| |
120 setInnerNode(node); | 120 setInnerNode(node); |
121 node = innerNonSharedNode(); | 121 } |
122 if (node) | 122 |
123 if (Node* node = innerNonSharedNode()) { | |
123 node = node->document()->ancestorInThisScope(node); | 124 node = node->document()->ancestorInThisScope(node); |
124 setInnerNonSharedNode(node); | 125 setInnerNonSharedNode(node); |
126 } | |
127 } | |
128 | |
129 void HitTestResult::setToShadowHostIfInUserAgentShadowRoot() | |
130 { | |
131 if (Node* node = innerNode()) { | |
132 if (ShadowRoot* containingShadowRoot = node->containingShadowRoot()) { | |
133 if (containingShadowRoot->type() == ShadowRoot::UserAgentShadowRoot) | |
134 setInnerNode(node->shadowHost()); | |
135 } | |
136 } | |
137 | |
138 if (Node* node = innerNonSharedNode()) { | |
139 if (ShadowRoot* containingShadowRoot = node->containingShadowRoot()) { | |
140 if (containingShadowRoot->type() == ShadowRoot::UserAgentShadowRoot) | |
141 setInnerNonSharedNode(node->shadowHost()); | |
142 } | |
143 } | |
125 } | 144 } |
126 | 145 |
127 void HitTestResult::setInnerNode(Node* n) | 146 void HitTestResult::setInnerNode(Node* n) |
128 { | 147 { |
129 if (n && n->isPseudoElement()) | 148 if (n && n->isPseudoElement()) |
130 n = n->parentOrShadowHostNode(); | 149 n = n->parentOrShadowHostNode(); |
131 m_innerNode = n; | 150 m_innerNode = n; |
132 } | 151 } |
133 | 152 |
134 void HitTestResult::setInnerNonSharedNode(Node* n) | 153 void HitTestResult::setInnerNonSharedNode(Node* n) |
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
594 { | 613 { |
595 for (Node* node = m_innerNode.get(); node; node = node->parentNode()) { | 614 for (Node* node = m_innerNode.get(); node; node = node->parentNode()) { |
596 if (node->isElementNode()) | 615 if (node->isElementNode()) |
597 return toElement(node); | 616 return toElement(node); |
598 } | 617 } |
599 | 618 |
600 return 0; | 619 return 0; |
601 } | 620 } |
602 | 621 |
603 } // namespace WebCore | 622 } // namespace WebCore |
OLD | NEW |