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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 | 97 |
98 HitTestResult result = mainFrame->eventHandler().hitTestResultAtPoint(conten
tsPoint, HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::Lis
tBased, LayoutSize(touchPointPadding, touchPointPadding)); | 98 HitTestResult result = mainFrame->eventHandler().hitTestResultAtPoint(conten
tsPoint, HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::Lis
tBased, LayoutSize(touchPointPadding, touchPointPadding)); |
99 const WillBeHeapListHashSet<RefPtrWillBeMember<Node>>& hitResults = result.l
istBasedTestResult(); | 99 const WillBeHeapListHashSet<RefPtrWillBeMember<Node>>& hitResults = result.l
istBasedTestResult(); |
100 | 100 |
101 // Blacklist nodes that are container of disambiguated nodes. | 101 // Blacklist nodes that are container of disambiguated nodes. |
102 // It is not uncommon to have a clickable <div> that contains other clickabl
e objects. | 102 // It is not uncommon to have a clickable <div> that contains other clickabl
e objects. |
103 // This heuristic avoids excessive disambiguation in that case. | 103 // This heuristic avoids excessive disambiguation in that case. |
104 WillBeHeapHashSet<RawPtrWillBeMember<Node>> blackList; | 104 WillBeHeapHashSet<RawPtrWillBeMember<Node>> blackList; |
105 for (const auto& hitResult : hitResults) { | 105 for (const auto& hitResult : hitResults) { |
106 // Ignore any Nodes that can't be clicked on. | 106 // Ignore any Nodes that can't be clicked on. |
107 LayoutObject* renderer = hitResult.get()->renderer(); | 107 LayoutObject* renderer = hitResult.get()->layoutObject(); |
108 if (!renderer || !hitResult.get()->willRespondToMouseClickEvents()) | 108 if (!renderer || !hitResult.get()->willRespondToMouseClickEvents()) |
109 continue; | 109 continue; |
110 | 110 |
111 // Blacklist all of the Node's containers. | 111 // Blacklist all of the Node's containers. |
112 for (LayoutBlock* container = renderer->containingBlock(); container; co
ntainer = container->containingBlock()) { | 112 for (LayoutBlock* container = renderer->containingBlock(); container; co
ntainer = container->containingBlock()) { |
113 Node* containerNode = container->node(); | 113 Node* containerNode = container->node(); |
114 if (!containerNode) | 114 if (!containerNode) |
115 continue; | 115 continue; |
116 if (!blackList.add(containerNode).isNewEntry) | 116 if (!blackList.add(containerNode).isNewEntry) |
117 break; | 117 break; |
(...skipping 22 matching lines...) Expand all Loading... |
140 // Currently the scoring function uses the overlap area with the fat poi
nt as the score. | 140 // Currently the scoring function uses the overlap area with the fat poi
nt as the score. |
141 // We ignore the candidates that has less than 1/2 overlap (we consider
not really ambiguous enough) than the best candidate to avoid excessive popups. | 141 // We ignore the candidates that has less than 1/2 overlap (we consider
not really ambiguous enough) than the best candidate to avoid excessive popups. |
142 if (touchTarget.value.score < bestScore * 0.5) | 142 if (touchTarget.value.score < bestScore * 0.5) |
143 continue; | 143 continue; |
144 goodTargets.append(touchTarget.value.windowBoundingBox); | 144 goodTargets.append(touchTarget.value.windowBoundingBox); |
145 highlightNodes.append(touchTarget.key); | 145 highlightNodes.append(touchTarget.key); |
146 } | 146 } |
147 } | 147 } |
148 | 148 |
149 } // namespace blink | 149 } // namespace blink |
OLD | NEW |