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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 | 56 |
57 IntRect result; | 57 IntRect result; |
58 Node* node = eventNode; | 58 Node* node = eventNode; |
59 while (node) { | 59 while (node) { |
60 // Skip the whole sub-tree if the node doesn't propagate events. | 60 // Skip the whole sub-tree if the node doesn't propagate events. |
61 if (node != eventNode && node->willRespondToMouseClickEvents()) { | 61 if (node != eventNode && node->willRespondToMouseClickEvents()) { |
62 node = NodeTraversal::nextSkippingChildren(node, eventNode); | 62 node = NodeTraversal::nextSkippingChildren(node, eventNode); |
63 continue; | 63 continue; |
64 } | 64 } |
65 result.unite(node->pixelSnappedBoundingBox()); | 65 result.unite(node->pixelSnappedBoundingBox()); |
66 node = NodeTraversal::next(node, eventNode); | 66 node = NodeTraversal::next(*node, eventNode); |
67 } | 67 } |
68 return eventNode->document().view()->contentsToWindow(result); | 68 return eventNode->document().view()->contentsToWindow(result); |
69 } | 69 } |
70 | 70 |
71 static float scoreTouchTarget(IntPoint touchPoint, int padding, IntRect bounding
Box) | 71 static float scoreTouchTarget(IntPoint touchPoint, int padding, IntRect bounding
Box) |
72 { | 72 { |
73 if (boundingBox.isEmpty()) | 73 if (boundingBox.isEmpty()) |
74 return 0; | 74 return 0; |
75 | 75 |
76 float reciprocalPadding = 1.f / padding; | 76 float reciprocalPadding = 1.f / padding; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 // Currently the scoring function uses the overlap area with the fat poi
nt as the score. | 142 // Currently the scoring function uses the overlap area with the fat poi
nt as the score. |
143 // 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. | 143 // 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. |
144 if (it->value.score < bestScore * 0.5) | 144 if (it->value.score < bestScore * 0.5) |
145 continue; | 145 continue; |
146 goodTargets.append(it->value.windowBoundingBox); | 146 goodTargets.append(it->value.windowBoundingBox); |
147 highlightNodes.append(it->key); | 147 highlightNodes.append(it->key); |
148 } | 148 } |
149 } | 149 } |
150 | 150 |
151 } // namespace WebCore | 151 } // namespace WebCore |
OLD | NEW |