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

Side by Side Diff: Source/web/WebViewImpl.cpp

Issue 402603005: Disable touch highlight when the touched node has no hand-cursor. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 5 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 | « no previous file | no next file » | 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) 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2011, 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 1176 matching lines...) Expand 10 before | Expand all | Expand 10 after
1187 1187
1188 // FIXME: Rely on earlier hit test instead of hit testing again. 1188 // FIXME: Rely on earlier hit test instead of hit testing again.
1189 GestureEventWithHitTestResults targetedEvent = m_page->deprecatedLocalMainFr ame()->eventHandler().targetGestureEvent(tapEvent, true); 1189 GestureEventWithHitTestResults targetedEvent = m_page->deprecatedLocalMainFr ame()->eventHandler().targetGestureEvent(tapEvent, true);
1190 bestTouchNode = targetedEvent.hitTestResult().targetNode(); 1190 bestTouchNode = targetedEvent.hitTestResult().targetNode();
1191 1191
1192 // We might hit something like an image map that has no renderer on it 1192 // We might hit something like an image map that has no renderer on it
1193 // Walk up the tree until we have a node with an attached renderer 1193 // Walk up the tree until we have a node with an attached renderer
1194 while (bestTouchNode && !bestTouchNode->renderer()) 1194 while (bestTouchNode && !bestTouchNode->renderer())
1195 bestTouchNode = bestTouchNode->parentNode(); 1195 bestTouchNode = bestTouchNode->parentNode();
1196 1196
1197 // Check if we're in the subtree of a node with a hand cursor 1197 // The heuristic we use is: show a highlight on tap only when we are at a no de with a hand cursor
Rick Byers 2014/07/17 21:19:03 I don't think this is quite what we want. If the
1198 // this is the heuristic we use to determine if we show a highlight on tap 1198 if (!bestTouchNode || !invokesHandCursor(bestTouchNode, m_page->deprecatedLo calMainFrame()))
1199 while (bestTouchNode && !invokesHandCursor(bestTouchNode, m_page->deprecated LocalMainFrame()))
1200 bestTouchNode = bestTouchNode->parentNode();
1201
1202 if (!bestTouchNode)
1203 return 0; 1199 return 0;
1204 1200
1205 // We should pick the largest enclosing node with hand cursor set. 1201 // We should pick the largest enclosing node with hand cursor set.
1206 while (bestTouchNode->parentNode() && invokesHandCursor(bestTouchNode->paren tNode(), toLocalFrame(m_page->mainFrame()))) 1202 while (bestTouchNode->parentNode() && invokesHandCursor(bestTouchNode->paren tNode(), toLocalFrame(m_page->mainFrame())))
1207 bestTouchNode = bestTouchNode->parentNode(); 1203 bestTouchNode = bestTouchNode->parentNode();
1208 1204
1209 return bestTouchNode; 1205 return bestTouchNode;
1210 } 1206 }
1211 1207
1212 void WebViewImpl::enableTapHighlightAtPoint(const PlatformGestureEvent& tapEvent ) 1208 void WebViewImpl::enableTapHighlightAtPoint(const PlatformGestureEvent& tapEvent )
(...skipping 3026 matching lines...) Expand 10 before | Expand all | Expand 10 after
4239 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints(); 4235 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints();
4240 4236
4241 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) 4237 if (!mainFrameImpl() || !mainFrameImpl()->frameView())
4242 return false; 4238 return false;
4243 4239
4244 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width 4240 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width
4245 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); 4241 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1);
4246 } 4242 }
4247 4243
4248 } // namespace blink 4244 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698