Commit 8c15a423 authored by wjmaclean's avatar wjmaclean Committed by Commit bot

Candidate fix for PointerEvent-OOPIF combination not working.

Prior to enabling PointerEvents, OOPIFs with TouchEvent handlers worked.
But with PointerEvents turned on, they fail. This happens because the
InputRouterImpl sending the touch events to the OOPIF never gets
notified of the current TouchAction, in turn because ChromeClientImpl
sends the TouchAction notification via RenderView and not the
RenderWidget serving the OOPIF.

Prior to PointerEvents this was not an issue, as the touch events
would continue to flow regardlesss. But with PointerEvents, touch
events are blocked after a TouchScrollStart is issued.

This CL plumbs a LocalFrame* parameter into ChromeClient::setTouchAction
so the notification can be sent via the correct channel.

BUG=680158

Review-Url: https://codereview.chromium.org/2626133002
Cr-Commit-Position: refs/heads/master@{#443302}
parent ac40ecf4
...@@ -341,7 +341,8 @@ void TouchEventManager::updateTargetAndRegionMapsForTouchStarts( ...@@ -341,7 +341,8 @@ void TouchEventManager::updateTargetAndRegionMapsForTouchStarts(
TouchAction effectiveTouchAction = TouchAction effectiveTouchAction =
TouchActionUtil::computeEffectiveTouchAction(*touchInfo.touchNode); TouchActionUtil::computeEffectiveTouchAction(*touchInfo.touchNode);
if (effectiveTouchAction != TouchActionAuto) { if (effectiveTouchAction != TouchActionAuto) {
m_frame->page()->chromeClient().setTouchAction(effectiveTouchAction); m_frame->page()->chromeClient().setTouchAction(m_frame,
effectiveTouchAction);
// Combine the current touch action sequence with the touch action // Combine the current touch action sequence with the touch action
// for the current finger press. // for the current finger press.
......
...@@ -208,7 +208,7 @@ class CORE_EXPORT EmptyChromeClient : public ChromeClient { ...@@ -208,7 +208,7 @@ class CORE_EXPORT EmptyChromeClient : public ChromeClient {
void setHasScrollEventHandlers(bool) override {} void setHasScrollEventHandlers(bool) override {}
bool hasScrollEventHandlers() const override { return false; } bool hasScrollEventHandlers() const override { return false; }
void setTouchAction(TouchAction) override {} void setTouchAction(LocalFrame*, TouchAction) override {}
void didAssociateFormControlsAfterLoad(LocalFrame*) override {} void didAssociateFormControlsAfterLoad(LocalFrame*) override {}
......
...@@ -265,7 +265,7 @@ class CORE_EXPORT ChromeClient : public HostWindow { ...@@ -265,7 +265,7 @@ class CORE_EXPORT ChromeClient : public HostWindow {
virtual void setHasScrollEventHandlers(bool) = 0; virtual void setHasScrollEventHandlers(bool) = 0;
virtual bool hasScrollEventHandlers() const = 0; virtual bool hasScrollEventHandlers() const = 0;
virtual void setTouchAction(TouchAction) = 0; virtual void setTouchAction(LocalFrame*, TouchAction) = 0;
// Checks if there is an opened popup, called by LayoutMenuList::showPopup(). // Checks if there is an opened popup, called by LayoutMenuList::showPopup().
virtual bool hasOpenedPopup() const = 0; virtual bool hasOpenedPopup() const = 0;
......
...@@ -973,8 +973,15 @@ bool ChromeClientImpl::hasScrollEventHandlers() const { ...@@ -973,8 +973,15 @@ bool ChromeClientImpl::hasScrollEventHandlers() const {
return false; return false;
} }
void ChromeClientImpl::setTouchAction(TouchAction touchAction) { void ChromeClientImpl::setTouchAction(LocalFrame* frame,
if (WebViewClient* client = m_webView->client()) TouchAction touchAction) {
DCHECK(frame);
WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame(frame);
WebFrameWidgetBase* widget = webFrame->localRoot()->frameWidget();
if (!widget)
return;
if (WebWidgetClient* client = widget->client())
client->setTouchAction(static_cast<WebTouchAction>(touchAction)); client->setTouchAction(static_cast<WebTouchAction>(touchAction));
} }
......
...@@ -142,7 +142,7 @@ class WEB_EXPORT ChromeClientImpl final : public ChromeClient { ...@@ -142,7 +142,7 @@ class WEB_EXPORT ChromeClientImpl final : public ChromeClient {
WebEventListenerClass) const override; WebEventListenerClass) const override;
void setHasScrollEventHandlers(bool hasEventHandlers) override; void setHasScrollEventHandlers(bool hasEventHandlers) override;
bool hasScrollEventHandlers() const override; bool hasScrollEventHandlers() const override;
void setTouchAction(TouchAction) override; void setTouchAction(LocalFrame*, TouchAction) override;
void attachRootGraphicsLayer(GraphicsLayer*, LocalFrame* localRoot) override; void attachRootGraphicsLayer(GraphicsLayer*, LocalFrame* localRoot) override;
......
...@@ -201,8 +201,14 @@ class PagePopupChromeClient final : public EmptyChromeClient { ...@@ -201,8 +201,14 @@ class PagePopupChromeClient final : public EmptyChromeClient {
return false; return false;
} }
void setTouchAction(TouchAction touchAction) override { void setTouchAction(LocalFrame* frame, TouchAction touchAction) override {
if (WebViewClient* client = m_popup->m_webView->client()) DCHECK(frame);
WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame(frame);
WebFrameWidgetBase* widget = webFrame->localRoot()->frameWidget();
if (!widget)
return;
if (WebWidgetClient* client = widget->client())
client->setTouchAction(static_cast<WebTouchAction>(touchAction)); client->setTouchAction(static_cast<WebTouchAction>(touchAction));
} }
......
...@@ -63,10 +63,10 @@ using blink::testing::runPendingTasks; ...@@ -63,10 +63,10 @@ using blink::testing::runPendingTasks;
namespace blink { namespace blink {
class TouchActionTrackingWebViewClient class TouchActionTrackingWebWidgetClient
: public FrameTestHelpers::TestWebViewClient { : public FrameTestHelpers::TestWebWidgetClient {
public: public:
TouchActionTrackingWebViewClient() TouchActionTrackingWebWidgetClient()
: m_actionSetCount(0), m_action(WebTouchActionAuto) {} : m_actionSetCount(0), m_action(WebTouchActionAuto) {}
// WebWidgetClient methods // WebWidgetClient methods
...@@ -113,17 +113,17 @@ class TouchActionTest : public ::testing::Test { ...@@ -113,17 +113,17 @@ class TouchActionTest : public ::testing::Test {
void runShadowDOMTest(std::string file); void runShadowDOMTest(std::string file);
void runIFrameTest(std::string file); void runIFrameTest(std::string file);
void sendTouchEvent(WebView*, WebInputEvent::Type, IntPoint clientPoint); void sendTouchEvent(WebView*, WebInputEvent::Type, IntPoint clientPoint);
WebView* setupTest(std::string file, TouchActionTrackingWebViewClient&); WebView* setupTest(std::string file, TouchActionTrackingWebWidgetClient&);
void runTestOnTree(ContainerNode* root, void runTestOnTree(ContainerNode* root,
WebView*, WebView*,
TouchActionTrackingWebViewClient&); TouchActionTrackingWebWidgetClient&);
std::string m_baseURL; std::string m_baseURL;
FrameTestHelpers::WebViewHelper m_webViewHelper; FrameTestHelpers::WebViewHelper m_webViewHelper;
}; };
void TouchActionTest::runTouchActionTest(std::string file) { void TouchActionTest::runTouchActionTest(std::string file) {
TouchActionTrackingWebViewClient client; TouchActionTrackingWebWidgetClient client;
// runTouchActionTest() loads a document in a frame, setting up a // runTouchActionTest() loads a document in a frame, setting up a
// nested message loop. Should any Oilpan GC happen while it is in // nested message loop. Should any Oilpan GC happen while it is in
...@@ -146,7 +146,7 @@ void TouchActionTest::runTouchActionTest(std::string file) { ...@@ -146,7 +146,7 @@ void TouchActionTest::runTouchActionTest(std::string file) {
} }
void TouchActionTest::runShadowDOMTest(std::string file) { void TouchActionTest::runShadowDOMTest(std::string file) {
TouchActionTrackingWebViewClient client; TouchActionTrackingWebWidgetClient client;
WebView* webView = setupTest(file, client); WebView* webView = setupTest(file, client);
...@@ -174,7 +174,7 @@ void TouchActionTest::runShadowDOMTest(std::string file) { ...@@ -174,7 +174,7 @@ void TouchActionTest::runShadowDOMTest(std::string file) {
} }
void TouchActionTest::runIFrameTest(std::string file) { void TouchActionTest::runIFrameTest(std::string file) {
TouchActionTrackingWebViewClient client; TouchActionTrackingWebWidgetClient client;
WebView* webView = setupTest(file, client); WebView* webView = setupTest(file, client);
WebFrame* curFrame = webView->mainFrame()->firstChild(); WebFrame* curFrame = webView->mainFrame()->firstChild();
...@@ -192,13 +192,14 @@ void TouchActionTest::runIFrameTest(std::string file) { ...@@ -192,13 +192,14 @@ void TouchActionTest::runIFrameTest(std::string file) {
m_webViewHelper.reset(); m_webViewHelper.reset();
} }
WebView* TouchActionTest::setupTest(std::string file, WebView* TouchActionTest::setupTest(
TouchActionTrackingWebViewClient& client) { std::string file,
TouchActionTrackingWebWidgetClient& client) {
URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL), URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL),
WebString::fromUTF8(file)); WebString::fromUTF8(file));
// Note that JavaScript must be enabled for shadow DOM tests. // Note that JavaScript must be enabled for shadow DOM tests.
WebView* webView = WebView* webView =
m_webViewHelper.initializeAndLoad(m_baseURL + file, true, 0, &client); m_webViewHelper.initializeAndLoad(m_baseURL + file, true, 0, 0, &client);
// Set size to enable hit testing, and avoid line wrapping for consistency // Set size to enable hit testing, and avoid line wrapping for consistency
// with browser. // with browser.
...@@ -222,9 +223,10 @@ IntRect windowClipRect(const FrameView& frameView) { ...@@ -222,9 +223,10 @@ IntRect windowClipRect(const FrameView& frameView) {
return enclosingIntRect(clipRect); return enclosingIntRect(clipRect);
} }
void TouchActionTest::runTestOnTree(ContainerNode* root, void TouchActionTest::runTestOnTree(
WebView* webView, ContainerNode* root,
TouchActionTrackingWebViewClient& client) { WebView* webView,
TouchActionTrackingWebWidgetClient& client) {
// Find all elements to test the touch-action of in the document. // Find all elements to test the touch-action of in the document.
DummyExceptionStateForTesting es; DummyExceptionStateForTesting es;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment