| 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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 if (!hitResult) | 132 if (!hitResult) |
| 133 continue; | 133 continue; |
| 134 for (Node& node : NodeTraversal::inclusiveAncestorsOf(*hitResult)) { | 134 for (Node& node : NodeTraversal::inclusiveAncestorsOf(*hitResult)) { |
| 135 if (blackList.contains(&node)) | 135 if (blackList.contains(&node)) |
| 136 continue; | 136 continue; |
| 137 if (node.isDocumentNode() || isHTMLHtmlElement(node) || | 137 if (node.isDocumentNode() || isHTMLHtmlElement(node) || |
| 138 isHTMLBodyElement(node)) | 138 isHTMLBodyElement(node)) |
| 139 break; | 139 break; |
| 140 if (node.willRespondToMouseClickEvents()) { | 140 if (node.willRespondToMouseClickEvents()) { |
| 141 TouchTargetData& targetData = | 141 TouchTargetData& targetData = |
| 142 touchTargets.add(&node, TouchTargetData()).storedValue->value; | 142 touchTargets.insert(&node, TouchTargetData()).storedValue->value; |
| 143 targetData.windowBoundingBox = boundingBoxForEventNodes(&node); | 143 targetData.windowBoundingBox = boundingBoxForEventNodes(&node); |
| 144 targetData.score = scoreTouchTarget(touchPoint, touchPointPadding, | 144 targetData.score = scoreTouchTarget(touchPoint, touchPointPadding, |
| 145 targetData.windowBoundingBox); | 145 targetData.windowBoundingBox); |
| 146 bestScore = std::max(bestScore, targetData.score); | 146 bestScore = std::max(bestScore, targetData.score); |
| 147 break; | 147 break; |
| 148 } | 148 } |
| 149 } | 149 } |
| 150 } | 150 } |
| 151 | 151 |
| 152 for (const auto& touchTarget : touchTargets) { | 152 for (const auto& touchTarget : touchTargets) { |
| 153 // Currently the scoring function uses the overlap area with the fat point | 153 // Currently the scoring function uses the overlap area with the fat point |
| 154 // as the score. We ignore the candidates that has less than 1/2 overlap | 154 // as the score. We ignore the candidates that has less than 1/2 overlap |
| 155 // (we consider not really ambiguous enough) than the best candidate to | 155 // (we consider not really ambiguous enough) than the best candidate to |
| 156 // avoid excessive popups. | 156 // avoid excessive popups. |
| 157 if (touchTarget.value.score < bestScore * 0.5) | 157 if (touchTarget.value.score < bestScore * 0.5) |
| 158 continue; | 158 continue; |
| 159 goodTargets.push_back(touchTarget.value.windowBoundingBox); | 159 goodTargets.push_back(touchTarget.value.windowBoundingBox); |
| 160 highlightNodes.push_back(touchTarget.key); | 160 highlightNodes.push_back(touchTarget.key); |
| 161 } | 161 } |
| 162 } | 162 } |
| 163 | 163 |
| 164 } // namespace blink | 164 } // namespace blink |
| OLD | NEW |