OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 goodTargets.clear(); | 92 goodTargets.clear(); |
93 | 93 |
94 int touchPointPadding = | 94 int touchPointPadding = |
95 ceil(std::max(touchBoxInRootFrame.width(), touchBoxInRootFrame.height()) * | 95 ceil(std::max(touchBoxInRootFrame.width(), touchBoxInRootFrame.height()) * |
96 0.5); | 96 0.5); |
97 | 97 |
98 IntPoint touchPoint = touchBoxInRootFrame.center(); | 98 IntPoint touchPoint = touchBoxInRootFrame.center(); |
99 IntPoint contentsPoint = mainFrame->view()->rootFrameToContents(touchPoint); | 99 IntPoint contentsPoint = mainFrame->view()->rootFrameToContents(touchPoint); |
100 | 100 |
101 HitTestResult result = mainFrame->eventHandler().hitTestResultAtPoint( | 101 HitTestResult result = mainFrame->eventHandler().hitTestResultAtPoint( |
102 contentsPoint, HitTestRequest::ReadOnly | HitTestRequest::Active | | 102 contentsPoint, |
103 HitTestRequest::ListBased, | 103 HitTestRequest::ReadOnly | HitTestRequest::Active | |
| 104 HitTestRequest::ListBased, |
104 LayoutSize(touchPointPadding, touchPointPadding)); | 105 LayoutSize(touchPointPadding, touchPointPadding)); |
105 const HeapListHashSet<Member<Node>>& hitResults = | 106 const HeapListHashSet<Member<Node>>& hitResults = |
106 result.listBasedTestResult(); | 107 result.listBasedTestResult(); |
107 | 108 |
108 // Blacklist nodes that are container of disambiguated nodes. | 109 // Blacklist nodes that are container of disambiguated nodes. |
109 // It is not uncommon to have a clickable <div> that contains other clickable | 110 // It is not uncommon to have a clickable <div> that contains other clickable |
110 // objects. This heuristic avoids excessive disambiguation in that case. | 111 // objects. This heuristic avoids excessive disambiguation in that case. |
111 HeapHashSet<Member<Node>> blackList; | 112 HeapHashSet<Member<Node>> blackList; |
112 for (const auto& hitResult : hitResults) { | 113 for (const auto& hitResult : hitResults) { |
113 // Ignore any Nodes that can't be clicked on. | 114 // Ignore any Nodes that can't be clicked on. |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 // (we consider not really ambiguous enough) than the best candidate to | 156 // (we consider not really ambiguous enough) than the best candidate to |
156 // avoid excessive popups. | 157 // avoid excessive popups. |
157 if (touchTarget.value.score < bestScore * 0.5) | 158 if (touchTarget.value.score < bestScore * 0.5) |
158 continue; | 159 continue; |
159 goodTargets.push_back(touchTarget.value.windowBoundingBox); | 160 goodTargets.push_back(touchTarget.value.windowBoundingBox); |
160 highlightNodes.push_back(touchTarget.key); | 161 highlightNodes.push_back(touchTarget.key); |
161 } | 162 } |
162 } | 163 } |
163 | 164 |
164 } // namespace blink | 165 } // namespace blink |
OLD | NEW |