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

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

Issue 470803002: WebViewImpl's hit tests should use setToShadowHostIfInUserAgentShadowRoot. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase. Created 6 years, 3 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 | « 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 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 493
494 m_lastMouseDownPoint = WebPoint(event.x, event.y); 494 m_lastMouseDownPoint = WebPoint(event.x, event.y);
495 495
496 // Take capture on a mouse down on a plugin so we can send it mouse events. 496 // Take capture on a mouse down on a plugin so we can send it mouse events.
497 // If the hit node is a plugin but a scrollbar is over it don't start mouse 497 // If the hit node is a plugin but a scrollbar is over it don't start mouse
498 // capture because it will interfere with the scrollbar receiving events. 498 // capture because it will interfere with the scrollbar receiving events.
499 IntPoint point(event.x, event.y); 499 IntPoint point(event.x, event.y);
500 if (event.button == WebMouseEvent::ButtonLeft && m_page->mainFrame()->isLoca lFrame() && !m_page->deprecatedLocalMainFrame()->view()->scrollbarAtPoint(point) ) { 500 if (event.button == WebMouseEvent::ButtonLeft && m_page->mainFrame()->isLoca lFrame() && !m_page->deprecatedLocalMainFrame()->view()->scrollbarAtPoint(point) ) {
501 point = m_page->deprecatedLocalMainFrame()->view()->windowToContents(poi nt); 501 point = m_page->deprecatedLocalMainFrame()->view()->windowToContents(poi nt);
502 HitTestResult result(m_page->deprecatedLocalMainFrame()->eventHandler(). hitTestResultAtPoint(point)); 502 HitTestResult result(m_page->deprecatedLocalMainFrame()->eventHandler(). hitTestResultAtPoint(point));
503 result.setToShadowHostIfInUserAgentShadowRoot();
503 Node* hitNode = result.innerNonSharedNode(); 504 Node* hitNode = result.innerNonSharedNode();
504 505
505 if (!result.scrollbar() && hitNode && hitNode->renderer() && hitNode->re nderer()->isEmbeddedObject()) { 506 if (!result.scrollbar() && hitNode && hitNode->renderer() && hitNode->re nderer()->isEmbeddedObject()) {
506 m_mouseCaptureNode = hitNode; 507 m_mouseCaptureNode = hitNode;
507 TRACE_EVENT_ASYNC_BEGIN0("input", "capturing mouse", this); 508 TRACE_EVENT_ASYNC_BEGIN0("input", "capturing mouse", this);
508 } 509 }
509 } 510 }
510 511
511 PageWidgetEventHandler::handleMouseDown(mainFrame, event); 512 PageWidgetEventHandler::handleMouseDown(mainFrame, event);
512 513
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after
1043 1044
1044 WebRect WebViewImpl::computeBlockBounds(const WebRect& rect, bool ignoreClipping ) 1045 WebRect WebViewImpl::computeBlockBounds(const WebRect& rect, bool ignoreClipping )
1045 { 1046 {
1046 if (!mainFrameImpl()) 1047 if (!mainFrameImpl())
1047 return WebRect(); 1048 return WebRect();
1048 1049
1049 // Use the rect-based hit test to find the node. 1050 // Use the rect-based hit test to find the node.
1050 IntPoint point = mainFrameImpl()->frameView()->windowToContents(IntPoint(rec t.x, rect.y)); 1051 IntPoint point = mainFrameImpl()->frameView()->windowToContents(IntPoint(rec t.x, rect.y));
1051 HitTestRequest::HitTestRequestType hitType = HitTestRequest::ReadOnly | HitT estRequest::Active | (ignoreClipping ? HitTestRequest::IgnoreClipping : 0); 1052 HitTestRequest::HitTestRequestType hitType = HitTestRequest::ReadOnly | HitT estRequest::Active | (ignoreClipping ? HitTestRequest::IgnoreClipping : 0);
1052 HitTestResult result = mainFrameImpl()->frame()->eventHandler().hitTestResul tAtPoint(point, hitType, IntSize(rect.width, rect.height)); 1053 HitTestResult result = mainFrameImpl()->frame()->eventHandler().hitTestResul tAtPoint(point, hitType, IntSize(rect.width, rect.height));
1054 result.setToShadowHostIfInUserAgentShadowRoot();
1053 1055
1054 Node* node = result.innerNonSharedNode(); 1056 Node* node = result.innerNonSharedNode();
1055 if (!node) 1057 if (!node)
1056 return WebRect(); 1058 return WebRect();
1057 1059
1058 // Find the block type node based on the hit node. 1060 // Find the block type node based on the hit node.
1061 // FIXME: This wants to walk composed tree with NodeRenderingTraversal::pare nt().
1059 while (node && (!node->renderer() || node->renderer()->isInline())) 1062 while (node && (!node->renderer() || node->renderer()->isInline()))
1060 node = NodeRenderingTraversal::parent(node); 1063 node = NodeRenderingTraversal::parent(node);
1061 1064
1062 // Return the bounding box in the window coordinate system. 1065 // Return the bounding box in the window coordinate system.
1063 if (node) { 1066 if (node) {
1064 IntRect rect = node->Node::pixelSnappedBoundingBox(); 1067 IntRect rect = node->Node::pixelSnappedBoundingBox();
1065 LocalFrame* frame = node->document().frame(); 1068 LocalFrame* frame = node->document().frame();
1066 return frame->view()->contentsToWindow(rect); 1069 return frame->view()->contentsToWindow(rect);
1067 } 1070 }
1068 return WebRect(); 1071 return WebRect();
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
1204 if (!m_page || !m_page->mainFrame()) 1207 if (!m_page || !m_page->mainFrame())
1205 return 0; 1208 return 0;
1206 1209
1207 // FIXME: Rely on earlier hit test instead of hit testing again. 1210 // FIXME: Rely on earlier hit test instead of hit testing again.
1208 GestureEventWithHitTestResults targetedEvent = 1211 GestureEventWithHitTestResults targetedEvent =
1209 m_page->deprecatedLocalMainFrame()->eventHandler().targetGestureEvent(ta pEvent, true); 1212 m_page->deprecatedLocalMainFrame()->eventHandler().targetGestureEvent(ta pEvent, true);
1210 Node* bestTouchNode = targetedEvent.hitTestResult().targetNode(); 1213 Node* bestTouchNode = targetedEvent.hitTestResult().targetNode();
1211 1214
1212 // We might hit something like an image map that has no renderer on it 1215 // We might hit something like an image map that has no renderer on it
1213 // Walk up the tree until we have a node with an attached renderer 1216 // Walk up the tree until we have a node with an attached renderer
1217 // FIXME: This wants to walk composed tree with NodeRenderingTraversal::pare nt().
1214 while (bestTouchNode && !bestTouchNode->renderer()) 1218 while (bestTouchNode && !bestTouchNode->renderer())
1215 bestTouchNode = NodeRenderingTraversal::parent(bestTouchNode); 1219 bestTouchNode = NodeRenderingTraversal::parent(bestTouchNode);
1216 1220
1217 Node* cursorDefiningAncestor = 1221 Node* cursorDefiningAncestor =
1218 findCursorDefiningAncestor(bestTouchNode, m_page->deprecatedLocalMainFra me()); 1222 findCursorDefiningAncestor(bestTouchNode, m_page->deprecatedLocalMainFra me());
1219 // We show a highlight on tap only when the current node shows a hand cursor 1223 // We show a highlight on tap only when the current node shows a hand cursor
1220 if (!cursorDefiningAncestor || !showsHandCursor(cursorDefiningAncestor, m_pa ge->deprecatedLocalMainFrame())) { 1224 if (!cursorDefiningAncestor || !showsHandCursor(cursorDefiningAncestor, m_pa ge->deprecatedLocalMainFrame())) {
1221 return 0; 1225 return 0;
1222 } 1226 }
1223 1227
(...skipping 2650 matching lines...) Expand 10 before | Expand all | Expand 10 after
3874 return 0; 3878 return 0;
3875 3879
3876 return document->focusedElement(); 3880 return document->focusedElement();
3877 } 3881 }
3878 3882
3879 HitTestResult WebViewImpl::hitTestResultForWindowPos(const IntPoint& pos) 3883 HitTestResult WebViewImpl::hitTestResultForWindowPos(const IntPoint& pos)
3880 { 3884 {
3881 if (!m_page->mainFrame()->isLocalFrame()) 3885 if (!m_page->mainFrame()->isLocalFrame())
3882 return HitTestResult(); 3886 return HitTestResult();
3883 IntPoint docPoint(m_page->deprecatedLocalMainFrame()->view()->windowToConten ts(pos)); 3887 IntPoint docPoint(m_page->deprecatedLocalMainFrame()->view()->windowToConten ts(pos));
3884 return m_page->deprecatedLocalMainFrame()->eventHandler().hitTestResultAtPoi nt(docPoint, HitTestRequest::ReadOnly | HitTestRequest::Active); 3888 HitTestResult result = m_page->deprecatedLocalMainFrame()->eventHandler().hi tTestResultAtPoint(docPoint, HitTestRequest::ReadOnly | HitTestRequest::Active);
3889 result.setToShadowHostIfInUserAgentShadowRoot();
3890 return result;
3885 } 3891 }
3886 3892
3887 void WebViewImpl::setTabsToLinks(bool enable) 3893 void WebViewImpl::setTabsToLinks(bool enable)
3888 { 3894 {
3889 m_tabsToLinks = enable; 3895 m_tabsToLinks = enable;
3890 } 3896 }
3891 3897
3892 bool WebViewImpl::tabsToLinks() const 3898 bool WebViewImpl::tabsToLinks() const
3893 { 3899 {
3894 return m_tabsToLinks; 3900 return m_tabsToLinks;
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
4268 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints(); 4274 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints();
4269 4275
4270 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) 4276 if (!mainFrameImpl() || !mainFrameImpl()->frameView())
4271 return false; 4277 return false;
4272 4278
4273 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width 4279 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width
4274 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); 4280 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1);
4275 } 4281 }
4276 4282
4277 } // namespace blink 4283 } // 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