[Chromecast] Send tap event for mouse left button click
When text field is focused and received double tap, touch exploration controller send out ax gesture click which triggers this stubbed out function. The function needs to rewrite a tap gesture for touch explored components. Bug: b/195347732 Test: test on device on webview with text field. Change-Id: I3bdec5ceba4f1387a7aa1ca0476be4bf2de3ef2c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3098047 Reviewed-by: Randy Rossi <rmrossi@chromium.org> Reviewed-by: Daniel Nicoara <dnicoara@chromium.org> Commit-Queue: Yuanyao Zhong <yyzhong@google.com> Cr-Commit-Position: refs/heads/master@{#912688}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
338fc031ac
commit
327787d892
@ -12,6 +12,13 @@
|
||||
#include "content/public/browser/render_frame_host.h"
|
||||
#include "extensions/common/image_util.h"
|
||||
#include "services/service_manager/public/cpp/interface_provider.h"
|
||||
#include "ui/aura/window.h"
|
||||
#include "ui/aura/window_tree_host.h"
|
||||
#include "ui/display/display.h"
|
||||
#include "ui/display/screen.h"
|
||||
#include "ui/events/base_event_utils.h"
|
||||
#include "ui/events/event.h"
|
||||
#include "ui/events/event_constants.h"
|
||||
|
||||
namespace {
|
||||
|
||||
@ -130,8 +137,51 @@ AccessibilityPrivateSendSyntheticKeyEventFunction::Run() {
|
||||
|
||||
ExtensionFunction::ResponseAction
|
||||
AccessibilityPrivateSendSyntheticMouseEventFunction::Run() {
|
||||
// Chromecast's touch exploration controller still generates synthetic
|
||||
// mouse events on its own. Do nothing.
|
||||
std::unique_ptr<accessibility_private::SendSyntheticMouseEvent::Params>
|
||||
params = accessibility_private::SendSyntheticMouseEvent::Params::Create(
|
||||
*args_);
|
||||
EXTENSION_FUNCTION_VALIDATE(params);
|
||||
accessibility_private::SyntheticMouseEvent* mouse_data = ¶ms->mouse_event;
|
||||
|
||||
if (mouse_data->type ==
|
||||
accessibility_private::SYNTHETIC_MOUSE_EVENT_TYPE_RELEASE &&
|
||||
mouse_data->mouse_button ==
|
||||
accessibility_private::SYNTHETIC_MOUSE_EVENT_BUTTON_LEFT) {
|
||||
// ui::ET_TOUCH_PRESSED and ui::ET_TOUCH_RELEASED is sent for synthetic
|
||||
// mouse event left button click.
|
||||
ui::PointerDetails pointer_details;
|
||||
pointer_details.pointer_type = ui::EventPointerType::kTouch;
|
||||
|
||||
gfx::Point location(mouse_data->x, mouse_data->y);
|
||||
|
||||
auto* host = chromecast::shell::CastBrowserProcess::GetInstance()
|
||||
->accessibility_manager()
|
||||
->window_tree_host();
|
||||
DCHECK(host);
|
||||
|
||||
std::unique_ptr<ui::TouchEvent> touch_press =
|
||||
std::make_unique<ui::TouchEvent>(ui::ET_TOUCH_PRESSED, gfx::Point(),
|
||||
ui::EventTimeForNow(),
|
||||
pointer_details);
|
||||
touch_press->set_location(location);
|
||||
touch_press->set_root_location(location);
|
||||
touch_press->UpdateForRootTransform(
|
||||
host->GetRootTransform(),
|
||||
host->GetRootTransformForLocalEventCoordinates());
|
||||
host->DeliverEventToSink(touch_press.get());
|
||||
|
||||
std::unique_ptr<ui::TouchEvent> touch_release =
|
||||
std::make_unique<ui::TouchEvent>(ui::ET_TOUCH_RELEASED, gfx::Point(),
|
||||
ui::EventTimeForNow(),
|
||||
pointer_details);
|
||||
touch_release->set_location(location);
|
||||
touch_release->set_root_location(location);
|
||||
touch_release->UpdateForRootTransform(
|
||||
host->GetRootTransform(),
|
||||
host->GetRootTransformForLocalEventCoordinates());
|
||||
host->DeliverEventToSink(touch_release.get());
|
||||
}
|
||||
|
||||
return RespondNow(NoArguments());
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user