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

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

Issue 470833002: Add WebKit API for doing a hit-test that mimics GestureTap (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: tapCount Created 6 years, 1 month 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/web/WebViewImpl.h ('k') | Source/web/tests/WebViewTest.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) 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 4048 matching lines...) Expand 10 before | Expand all | Expand 10 after
4059 HitTestResult WebViewImpl::hitTestResultForWindowPos(const IntPoint& pos) 4059 HitTestResult WebViewImpl::hitTestResultForWindowPos(const IntPoint& pos)
4060 { 4060 {
4061 if (!m_page->mainFrame()->isLocalFrame()) 4061 if (!m_page->mainFrame()->isLocalFrame())
4062 return HitTestResult(); 4062 return HitTestResult();
4063 IntPoint docPoint(m_page->deprecatedLocalMainFrame()->view()->windowToConten ts(pos)); 4063 IntPoint docPoint(m_page->deprecatedLocalMainFrame()->view()->windowToConten ts(pos));
4064 HitTestResult result = m_page->deprecatedLocalMainFrame()->eventHandler().hi tTestResultAtPoint(docPoint, HitTestRequest::ReadOnly | HitTestRequest::Active); 4064 HitTestResult result = m_page->deprecatedLocalMainFrame()->eventHandler().hi tTestResultAtPoint(docPoint, HitTestRequest::ReadOnly | HitTestRequest::Active);
4065 result.setToShadowHostIfInUserAgentShadowRoot(); 4065 result.setToShadowHostIfInUserAgentShadowRoot();
4066 return result; 4066 return result;
4067 } 4067 }
4068 4068
4069 WebHitTestResult WebViewImpl::hitTestResultForTap(const WebPoint& tapPointWindow Pos, const WebSize& tapArea)
4070 {
4071 if (!m_page->mainFrame()->isLocalFrame())
4072 return HitTestResult();
4073
4074 WebGestureEvent tapEvent;
4075 tapEvent.x = tapPointWindowPos.x;
4076 tapEvent.y = tapPointWindowPos.y;
4077 tapEvent.type = WebInputEvent::GestureTap;
4078 tapEvent.data.tap.tapCount = 1;
4079 tapEvent.data.tap.width = tapArea.width;
4080 tapEvent.data.tap.height = tapArea.height;
4081
4082 PlatformGestureEventBuilder platformEvent(mainFrameImpl()->frameView(), tapE vent);
4083
4084 HitTestResult result = m_page->deprecatedLocalMainFrame()->eventHandler().hi tTestResultForGestureEvent(platformEvent, HitTestRequest::ReadOnly | HitTestRequ est::Active).hitTestResult();
4085
4086 result.setToShadowHostIfInUserAgentShadowRoot();
4087 return result;
4088 }
4089
4069 void WebViewImpl::setTabsToLinks(bool enable) 4090 void WebViewImpl::setTabsToLinks(bool enable)
4070 { 4091 {
4071 m_tabsToLinks = enable; 4092 m_tabsToLinks = enable;
4072 } 4093 }
4073 4094
4074 bool WebViewImpl::tabsToLinks() const 4095 bool WebViewImpl::tabsToLinks() const
4075 { 4096 {
4076 return m_tabsToLinks; 4097 return m_tabsToLinks;
4077 } 4098 }
4078 4099
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
4473 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints(); 4494 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints();
4474 4495
4475 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) 4496 if (!mainFrameImpl() || !mainFrameImpl()->frameView())
4476 return false; 4497 return false;
4477 4498
4478 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width 4499 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width
4479 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); 4500 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1);
4480 } 4501 }
4481 4502
4482 } // namespace blink 4503 } // namespace blink
OLDNEW
« no previous file with comments | « Source/web/WebViewImpl.h ('k') | Source/web/tests/WebViewTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698