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

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

Issue 448593002: Make Gesture Tap be aware of Shadow DOM. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Update LinkHighlight Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « Source/web/LinkHighlight.cpp ('k') | 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 1035 matching lines...) Expand 10 before | Expand all | Expand 10 after
1046 IntPoint point = mainFrameImpl()->frameView()->windowToContents(IntPoint(rec t.x, rect.y)); 1046 IntPoint point = mainFrameImpl()->frameView()->windowToContents(IntPoint(rec t.x, rect.y));
1047 HitTestRequest::HitTestRequestType hitType = HitTestRequest::ReadOnly | HitT estRequest::Active | (ignoreClipping ? HitTestRequest::IgnoreClipping : 0); 1047 HitTestRequest::HitTestRequestType hitType = HitTestRequest::ReadOnly | HitT estRequest::Active | (ignoreClipping ? HitTestRequest::IgnoreClipping : 0);
1048 HitTestResult result = mainFrameImpl()->frame()->eventHandler().hitTestResul tAtPoint(point, hitType, IntSize(rect.width, rect.height)); 1048 HitTestResult result = mainFrameImpl()->frame()->eventHandler().hitTestResul tAtPoint(point, hitType, IntSize(rect.width, rect.height));
1049 1049
1050 Node* node = result.innerNonSharedNode(); 1050 Node* node = result.innerNonSharedNode();
1051 if (!node) 1051 if (!node)
1052 return WebRect(); 1052 return WebRect();
1053 1053
1054 // Find the block type node based on the hit node. 1054 // Find the block type node based on the hit node.
1055 while (node && (!node->renderer() || node->renderer()->isInline())) 1055 while (node && (!node->renderer() || node->renderer()->isInline()))
1056 node = node->parentNode(); 1056 node = NodeRenderingTraversal::parent(node);
1057 1057
1058 // Return the bounding box in the window coordinate system. 1058 // Return the bounding box in the window coordinate system.
1059 if (node) { 1059 if (node) {
1060 IntRect rect = node->Node::pixelSnappedBoundingBox(); 1060 IntRect rect = node->Node::pixelSnappedBoundingBox();
1061 LocalFrame* frame = node->document().frame(); 1061 LocalFrame* frame = node->document().frame();
1062 return frame->view()->contentsToWindow(rect); 1062 return frame->view()->contentsToWindow(rect);
1063 } 1063 }
1064 return WebRect(); 1064 return WebRect();
1065 } 1065 }
1066 1066
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
1187 1187
1188 Node* bestTouchNode = 0; 1188 Node* bestTouchNode = 0;
1189 1189
1190 // FIXME: Rely on earlier hit test instead of hit testing again. 1190 // FIXME: Rely on earlier hit test instead of hit testing again.
1191 GestureEventWithHitTestResults targetedEvent = m_page->deprecatedLocalMainFr ame()->eventHandler().targetGestureEvent(tapEvent, true); 1191 GestureEventWithHitTestResults targetedEvent = m_page->deprecatedLocalMainFr ame()->eventHandler().targetGestureEvent(tapEvent, true);
1192 bestTouchNode = targetedEvent.hitTestResult().targetNode(); 1192 bestTouchNode = targetedEvent.hitTestResult().targetNode();
1193 1193
1194 // We might hit something like an image map that has no renderer on it 1194 // We might hit something like an image map that has no renderer on it
1195 // Walk up the tree until we have a node with an attached renderer 1195 // Walk up the tree until we have a node with an attached renderer
1196 while (bestTouchNode && !bestTouchNode->renderer()) 1196 while (bestTouchNode && !bestTouchNode->renderer())
1197 bestTouchNode = bestTouchNode->parentNode(); 1197 bestTouchNode = NodeRenderingTraversal::parent(bestTouchNode);
esprehn 2014/08/06 17:05:44 What is updating the distribution before you call
hayato 2014/08/07 02:44:55 I assumed distributions would be updated at the ti
1198 1198
1199 // Check if we're in the subtree of a node with a hand cursor 1199 // Check if we're in the subtree of a node with a hand cursor
1200 // this is the heuristic we use to determine if we show a highlight on tap 1200 // this is the heuristic we use to determine if we show a highlight on tap
1201 while (bestTouchNode && !invokesHandCursor(bestTouchNode, m_page->deprecated LocalMainFrame())) 1201 while (bestTouchNode && !invokesHandCursor(bestTouchNode, m_page->deprecated LocalMainFrame()))
1202 bestTouchNode = bestTouchNode->parentNode(); 1202 bestTouchNode = NodeRenderingTraversal::parent(bestTouchNode);
1203 1203
1204 if (!bestTouchNode) 1204 if (!bestTouchNode)
1205 return 0; 1205 return 0;
1206 1206
1207 // We should pick the largest enclosing node with hand cursor set. 1207 // We should pick the largest enclosing node with hand cursor set.
1208 while (bestTouchNode->parentNode() && invokesHandCursor(bestTouchNode->paren tNode(), toLocalFrame(m_page->mainFrame()))) 1208 Node* parentNode;
1209 bestTouchNode = bestTouchNode->parentNode(); 1209 while ((parentNode = NodeRenderingTraversal::parent(bestTouchNode)) && invok esHandCursor(parentNode, toLocalFrame(m_page->mainFrame())))
esprehn 2014/08/06 17:05:44 This would be nicer as a for loop and a break stat
1210 1210 bestTouchNode = parentNode;
1211 return bestTouchNode; 1211 return bestTouchNode;
1212 } 1212 }
1213 1213
1214 void WebViewImpl::enableTapHighlightAtPoint(const PlatformGestureEvent& tapEvent ) 1214 void WebViewImpl::enableTapHighlightAtPoint(const PlatformGestureEvent& tapEvent )
1215 { 1215 {
1216 Node* touchNode = bestTapNode(tapEvent); 1216 Node* touchNode = bestTapNode(tapEvent);
1217 1217
1218 WillBeHeapVector<RawPtrWillBeMember<Node> > highlightNodes; 1218 WillBeHeapVector<RawPtrWillBeMember<Node> > highlightNodes;
1219 highlightNodes.append(touchNode); 1219 highlightNodes.append(touchNode);
1220 1220
(...skipping 3040 matching lines...) Expand 10 before | Expand all | Expand 10 after
4261 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints(); 4261 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints();
4262 4262
4263 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) 4263 if (!mainFrameImpl() || !mainFrameImpl()->frameView())
4264 return false; 4264 return false;
4265 4265
4266 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width 4266 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width
4267 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); 4267 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1);
4268 } 4268 }
4269 4269
4270 } // namespace blink 4270 } // namespace blink
OLDNEW
« no previous file with comments | « Source/web/LinkHighlight.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698