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(
TouchAction effectiveTouchAction =
TouchActionUtil::computeEffectiveTouchAction(*touchInfo.touchNode);
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
// for the current finger press.
......
......@@ -208,7 +208,7 @@ class CORE_EXPORT EmptyChromeClient : public ChromeClient {
void setHasScrollEventHandlers(bool) override {}
bool hasScrollEventHandlers() const override { return false; }
void setTouchAction(TouchAction) override {}
void setTouchAction(LocalFrame*, TouchAction) override {}
void didAssociateFormControlsAfterLoad(LocalFrame*) override {}
......
......@@ -265,7 +265,7 @@ class CORE_EXPORT ChromeClient : public HostWindow {
virtual void setHasScrollEventHandlers(bool) = 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().
virtual bool hasOpenedPopup() const = 0;
......
......@@ -973,8 +973,15 @@ bool ChromeClientImpl::hasScrollEventHandlers() const {
return false;
}
void ChromeClientImpl::setTouchAction(TouchAction touchAction) {
if (WebViewClient* client = m_webView->client())
void ChromeClientImpl::setTouchAction(LocalFrame* frame,
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));
}
......
......@@ -142,7 +142,7 @@ class WEB_EXPORT ChromeClientImpl final : public ChromeClient {
WebEventListenerClass) const override;
void setHasScrollEventHandlers(bool hasEventHandlers) override;
bool hasScrollEventHandlers() const override;
void setTouchAction(TouchAction) override;
void setTouchAction(LocalFrame*, TouchAction) override;
void attachRootGraphicsLayer(GraphicsLayer*, LocalFrame* localRoot) override;
......
......@@ -201,8 +201,14 @@ class PagePopupChromeClient final : public EmptyChromeClient {
return false;
}
void setTouchAction(TouchAction touchAction) override {
if (WebViewClient* client = m_popup->m_webView->client())
void setTouchAction(LocalFrame* frame, TouchAction touchAction) override {
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));
}
......
......@@ -63,10 +63,10 @@ using blink::testing::runPendingTasks;
namespace blink {
class TouchActionTrackingWebViewClient
: public FrameTestHelpers::TestWebViewClient {
class TouchActionTrackingWebWidgetClient
: public FrameTestHelpers::TestWebWidgetClient {
public:
TouchActionTrackingWebViewClient()
TouchActionTrackingWebWidgetClient()
: m_actionSetCount(0), m_action(WebTouchActionAuto) {}
// WebWidgetClient methods
......@@ -113,17 +113,17 @@ class TouchActionTest : public ::testing::Test {
void runShadowDOMTest(std::string file);
void runIFrameTest(std::string file);
void sendTouchEvent(WebView*, WebInputEvent::Type, IntPoint clientPoint);
WebView* setupTest(std::string file, TouchActionTrackingWebViewClient&);
WebView* setupTest(std::string file, TouchActionTrackingWebWidgetClient&);
void runTestOnTree(ContainerNode* root,
WebView*,
TouchActionTrackingWebViewClient&);
TouchActionTrackingWebWidgetClient&);
std::string m_baseURL;
FrameTestHelpers::WebViewHelper m_webViewHelper;
};
void TouchActionTest::runTouchActionTest(std::string file) {
TouchActionTrackingWebViewClient client;
TouchActionTrackingWebWidgetClient client;
// runTouchActionTest() loads a document in a frame, setting up a
// nested message loop. Should any Oilpan GC happen while it is in
......@@ -146,7 +146,7 @@ void TouchActionTest::runTouchActionTest(std::string file) {
}
void TouchActionTest::runShadowDOMTest(std::string file) {
TouchActionTrackingWebViewClient client;
TouchActionTrackingWebWidgetClient client;
WebView* webView = setupTest(file, client);
......@@ -174,7 +174,7 @@ void TouchActionTest::runShadowDOMTest(std::string file) {
}
void TouchActionTest::runIFrameTest(std::string file) {
TouchActionTrackingWebViewClient client;
TouchActionTrackingWebWidgetClient client;
WebView* webView = setupTest(file, client);
WebFrame* curFrame = webView->mainFrame()->firstChild();
......@@ -192,13 +192,14 @@ void TouchActionTest::runIFrameTest(std::string file) {
m_webViewHelper.reset();
}
WebView* TouchActionTest::setupTest(std::string file,
TouchActionTrackingWebViewClient& client) {
WebView* TouchActionTest::setupTest(
std::string file,
TouchActionTrackingWebWidgetClient& client) {
URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL),
WebString::fromUTF8(file));
// Note that JavaScript must be enabled for shadow DOM tests.
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
// with browser.
......@@ -222,9 +223,10 @@ IntRect windowClipRect(const FrameView& frameView) {
return enclosingIntRect(clipRect);
}
void TouchActionTest::runTestOnTree(ContainerNode* root,
void TouchActionTest::runTestOnTree(
ContainerNode* root,
WebView* webView,
TouchActionTrackingWebViewClient& client) {
TouchActionTrackingWebWidgetClient& client) {
// Find all elements to test the touch-action of in the document.
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