Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(234)

Side by Side Diff: Source/core/page/TouchDisambiguation.cpp

Issue 138643003: Simpler return value of HashTable::add/HashMap:add and others (Closed)
Patch Set: Daily master update (now with base url?) Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/page/EventHandler.cpp ('k') | Source/core/page/scrolling/ScrollingCoordinator.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 121
122 HashMap<Node*, TouchTargetData> touchTargets; 122 HashMap<Node*, TouchTargetData> touchTargets;
123 float bestScore = 0; 123 float bestScore = 0;
124 for (ListHashSet<RefPtr<Node> >::const_iterator it = hitResults.begin(); it != hitResults.end(); ++it) { 124 for (ListHashSet<RefPtr<Node> >::const_iterator it = hitResults.begin(); it != hitResults.end(); ++it) {
125 for (Node* node = it->get(); node; node = node->parentNode()) { 125 for (Node* node = it->get(); node; node = node->parentNode()) {
126 if (blackList.contains(node)) 126 if (blackList.contains(node))
127 continue; 127 continue;
128 if (node->isDocumentNode() || node->hasTagName(HTMLNames::htmlTag) | | node->hasTagName(HTMLNames::bodyTag)) 128 if (node->isDocumentNode() || node->hasTagName(HTMLNames::htmlTag) | | node->hasTagName(HTMLNames::bodyTag))
129 break; 129 break;
130 if (node->willRespondToMouseClickEvents()) { 130 if (node->willRespondToMouseClickEvents()) {
131 TouchTargetData& targetData = touchTargets.add(node, TouchTarget Data()).iterator->value; 131 TouchTargetData& targetData = touchTargets.add(node, TouchTarget Data()).storedValue->value;
132 targetData.windowBoundingBox = boundingBoxForEventNodes(node); 132 targetData.windowBoundingBox = boundingBoxForEventNodes(node);
133 targetData.score = scoreTouchTarget(touchPoint, touchPointPaddin g, targetData.windowBoundingBox); 133 targetData.score = scoreTouchTarget(touchPoint, touchPointPaddin g, targetData.windowBoundingBox);
134 bestScore = max(bestScore, targetData.score); 134 bestScore = max(bestScore, targetData.score);
135 break; 135 break;
136 } 136 }
137 } 137 }
138 } 138 }
139 139
140 for (HashMap<Node*, TouchTargetData>::iterator it = touchTargets.begin(); it != touchTargets.end(); ++it) { 140 for (HashMap<Node*, TouchTargetData>::iterator it = touchTargets.begin(); it != touchTargets.end(); ++it) {
141 // Currently the scoring function uses the overlap area with the fat poi nt as the score. 141 // Currently the scoring function uses the overlap area with the fat poi nt as the score.
142 // 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 // 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 if (it->value.score < bestScore * 0.5) 143 if (it->value.score < bestScore * 0.5)
144 continue; 144 continue;
145 goodTargets.append(it->value.windowBoundingBox); 145 goodTargets.append(it->value.windowBoundingBox);
146 highlightNodes.append(it->key); 146 highlightNodes.append(it->key);
147 } 147 }
148 } 148 }
149 149
150 } // namespace WebCore 150 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/page/EventHandler.cpp ('k') | Source/core/page/scrolling/ScrollingCoordinator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698