2015-11-17 19:20:13 +01:00
|
|
|
// Copyright 2015 The Chromium Embedded Framework Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
2024-04-30 17:45:07 +02:00
|
|
|
#include "cef/libcef/browser/osr/browser_platform_delegate_osr.h"
|
2015-11-17 19:20:13 +01:00
|
|
|
|
2016-01-06 20:20:54 +01:00
|
|
|
#include <utility>
|
|
|
|
|
2020-08-29 00:39:23 +02:00
|
|
|
#include "base/task/current_thread.h"
|
2024-04-30 17:45:07 +02:00
|
|
|
#include "cef/libcef/browser/image_impl.h"
|
|
|
|
#include "cef/libcef/browser/osr/osr_accessibility_util.h"
|
|
|
|
#include "cef/libcef/browser/osr/render_widget_host_view_osr.h"
|
|
|
|
#include "cef/libcef/browser/osr/touch_selection_controller_client_osr.h"
|
|
|
|
#include "cef/libcef/browser/osr/web_contents_view_osr.h"
|
|
|
|
#include "cef/libcef/browser/views/view_util.h"
|
|
|
|
#include "cef/libcef/common/drag_data_impl.h"
|
2024-07-29 19:09:20 +02:00
|
|
|
#include "components/input/render_widget_host_input_event_router.h"
|
2016-11-23 21:54:29 +01:00
|
|
|
#include "content/browser/web_contents/web_contents_impl.h"
|
2015-11-17 19:20:13 +01:00
|
|
|
#include "content/public/browser/render_view_host.h"
|
2022-05-13 13:38:41 +02:00
|
|
|
#include "ui/display/screen.h"
|
2019-02-25 22:17:28 +01:00
|
|
|
#include "ui/events/base_event_utils.h"
|
2015-11-17 19:20:13 +01:00
|
|
|
|
|
|
|
CefBrowserPlatformDelegateOsr::CefBrowserPlatformDelegateOsr(
|
2020-07-04 20:21:34 +02:00
|
|
|
std::unique_ptr<CefBrowserPlatformDelegateNative> native_delegate,
|
|
|
|
bool use_shared_texture,
|
|
|
|
bool use_external_begin_frame)
|
|
|
|
: native_delegate_(std::move(native_delegate)),
|
|
|
|
use_shared_texture_(use_shared_texture),
|
|
|
|
use_external_begin_frame_(use_external_begin_frame) {
|
2015-11-17 19:20:13 +01:00
|
|
|
native_delegate_->set_windowless_handler(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CefBrowserPlatformDelegateOsr::CreateViewForWebContents(
|
2024-06-21 17:26:59 +02:00
|
|
|
raw_ptr<content::WebContentsView>* view,
|
|
|
|
raw_ptr<content::RenderViewHostDelegateView>* delegate_view) {
|
2015-11-17 19:20:13 +01:00
|
|
|
DCHECK(!view_osr_);
|
|
|
|
|
|
|
|
// Use the OSR view instead of the default platform view.
|
2018-07-03 02:46:03 +02:00
|
|
|
view_osr_ = new CefWebContentsViewOSR(
|
2020-07-04 20:21:34 +02:00
|
|
|
GetBackgroundColor(), use_shared_texture_, use_external_begin_frame_);
|
2015-11-17 19:20:13 +01:00
|
|
|
*view = view_osr_;
|
|
|
|
*delegate_view = view_osr_;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CefBrowserPlatformDelegateOsr::WebContentsCreated(
|
2020-07-03 22:13:27 +02:00
|
|
|
content::WebContents* web_contents,
|
|
|
|
bool owned) {
|
2020-07-04 20:21:34 +02:00
|
|
|
CefBrowserPlatformDelegateAlloy::WebContentsCreated(web_contents, owned);
|
2019-07-17 20:47:27 +02:00
|
|
|
|
2015-11-17 19:20:13 +01:00
|
|
|
DCHECK(view_osr_);
|
|
|
|
DCHECK(!view_osr_->web_contents());
|
|
|
|
|
|
|
|
// Associate the WebContents with the OSR view.
|
2017-02-15 22:03:00 +01:00
|
|
|
view_osr_->WebContentsCreated(web_contents);
|
2015-11-17 19:20:13 +01:00
|
|
|
}
|
|
|
|
|
2024-04-17 18:01:26 +02:00
|
|
|
void CefBrowserPlatformDelegateOsr::WebContentsDestroyed(
|
|
|
|
content::WebContents* web_contents) {
|
|
|
|
DCHECK_EQ(web_contents, web_contents_);
|
|
|
|
if (auto* view = GetOSRHostView()) {
|
|
|
|
view->ReleaseCompositor();
|
|
|
|
}
|
|
|
|
|
|
|
|
CefBrowserPlatformDelegateAlloy::WebContentsDestroyed(web_contents);
|
|
|
|
}
|
|
|
|
|
2020-07-28 05:38:48 +02:00
|
|
|
void CefBrowserPlatformDelegateOsr::RenderViewCreated(
|
|
|
|
content::RenderViewHost* render_view_host) {
|
2023-01-02 23:59:03 +01:00
|
|
|
if (view_osr_) {
|
2020-07-28 05:38:48 +02:00
|
|
|
view_osr_->RenderViewCreated();
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2020-07-28 05:38:48 +02:00
|
|
|
}
|
|
|
|
|
2015-11-17 19:20:13 +01:00
|
|
|
void CefBrowserPlatformDelegateOsr::BrowserCreated(
|
2020-09-25 03:40:47 +02:00
|
|
|
CefBrowserHostBase* browser) {
|
2020-07-04 20:21:34 +02:00
|
|
|
CefBrowserPlatformDelegateAlloy::BrowserCreated(browser);
|
2015-11-17 19:20:13 +01:00
|
|
|
|
|
|
|
if (browser->IsPopup()) {
|
|
|
|
// Associate the RenderWidget host view with the browser now because the
|
|
|
|
// browser wasn't known at the time that the host view was created.
|
|
|
|
// |view| will be null if the popup is a DevTools window.
|
2024-04-17 18:01:26 +02:00
|
|
|
if (auto* view = GetOSRHostView()) {
|
|
|
|
view->set_browser_impl(AlloyBrowserHostImpl::FromBaseChecked(browser));
|
2020-07-20 20:24:16 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-11-17 19:20:13 +01:00
|
|
|
void CefBrowserPlatformDelegateOsr::BrowserDestroyed(
|
2020-09-25 03:40:47 +02:00
|
|
|
CefBrowserHostBase* browser) {
|
2015-11-17 19:20:13 +01:00
|
|
|
view_osr_ = nullptr;
|
2024-05-13 23:36:09 +02:00
|
|
|
current_rvh_for_drag_ = nullptr;
|
|
|
|
CefBrowserPlatformDelegateAlloy::BrowserDestroyed(browser);
|
2015-11-17 19:20:13 +01:00
|
|
|
}
|
|
|
|
|
2017-04-20 21:28:17 +02:00
|
|
|
SkColor CefBrowserPlatformDelegateOsr::GetBackgroundColor() const {
|
|
|
|
return native_delegate_->GetBackgroundColor();
|
|
|
|
}
|
|
|
|
|
2020-01-31 23:54:26 +01:00
|
|
|
void CefBrowserPlatformDelegateOsr::WasResized() {
|
2015-11-17 19:20:13 +01:00
|
|
|
CefRenderWidgetHostViewOSR* view = GetOSRHostView();
|
2023-01-02 23:59:03 +01:00
|
|
|
if (view) {
|
2020-01-31 23:54:26 +01:00
|
|
|
view->WasResized();
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2015-11-17 19:20:13 +01:00
|
|
|
}
|
|
|
|
|
2020-01-23 22:58:01 +01:00
|
|
|
void CefBrowserPlatformDelegateOsr::SendKeyEvent(const CefKeyEvent& event) {
|
2015-11-17 19:20:13 +01:00
|
|
|
CefRenderWidgetHostViewOSR* view = GetOSRHostView();
|
2023-01-02 23:59:03 +01:00
|
|
|
if (!view) {
|
2020-01-23 22:58:01 +01:00
|
|
|
return;
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2020-01-23 22:58:01 +01:00
|
|
|
|
2024-06-14 19:01:45 +02:00
|
|
|
input::NativeWebKeyboardEvent web_event =
|
2020-01-23 22:58:01 +01:00
|
|
|
native_delegate_->TranslateWebKeyEvent(event);
|
|
|
|
view->SendKeyEvent(web_event);
|
2015-11-17 19:20:13 +01:00
|
|
|
}
|
|
|
|
|
2020-01-23 22:58:01 +01:00
|
|
|
void CefBrowserPlatformDelegateOsr::SendMouseClickEvent(
|
|
|
|
const CefMouseEvent& event,
|
|
|
|
CefBrowserHost::MouseButtonType type,
|
|
|
|
bool mouseUp,
|
|
|
|
int clickCount) {
|
2015-11-17 19:20:13 +01:00
|
|
|
CefRenderWidgetHostViewOSR* view = GetOSRHostView();
|
2023-01-02 23:59:03 +01:00
|
|
|
if (!view) {
|
2020-01-23 22:58:01 +01:00
|
|
|
return;
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2020-01-23 22:58:01 +01:00
|
|
|
|
|
|
|
blink::WebMouseEvent web_event = native_delegate_->TranslateWebClickEvent(
|
|
|
|
event, type, mouseUp, clickCount);
|
|
|
|
view->SendMouseEvent(web_event);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CefBrowserPlatformDelegateOsr::SendMouseMoveEvent(
|
|
|
|
const CefMouseEvent& event,
|
|
|
|
bool mouseLeave) {
|
|
|
|
CefRenderWidgetHostViewOSR* view = GetOSRHostView();
|
2023-01-02 23:59:03 +01:00
|
|
|
if (!view) {
|
2020-01-23 22:58:01 +01:00
|
|
|
return;
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2020-01-23 22:58:01 +01:00
|
|
|
|
|
|
|
blink::WebMouseEvent web_event =
|
|
|
|
native_delegate_->TranslateWebMoveEvent(event, mouseLeave);
|
|
|
|
view->SendMouseEvent(web_event);
|
2015-11-17 19:20:13 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void CefBrowserPlatformDelegateOsr::SendMouseWheelEvent(
|
2020-01-23 22:58:01 +01:00
|
|
|
const CefMouseEvent& event,
|
|
|
|
int deltaX,
|
|
|
|
int deltaY) {
|
2015-11-17 19:20:13 +01:00
|
|
|
CefRenderWidgetHostViewOSR* view = GetOSRHostView();
|
2023-01-02 23:59:03 +01:00
|
|
|
if (!view) {
|
2020-01-23 22:58:01 +01:00
|
|
|
return;
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2020-01-23 22:58:01 +01:00
|
|
|
|
|
|
|
blink::WebMouseWheelEvent web_event =
|
|
|
|
native_delegate_->TranslateWebWheelEvent(event, deltaX, deltaY);
|
|
|
|
view->SendMouseWheelEvent(web_event);
|
2015-11-17 19:20:13 +01:00
|
|
|
}
|
|
|
|
|
2019-02-25 22:17:28 +01:00
|
|
|
void CefBrowserPlatformDelegateOsr::SendTouchEvent(const CefTouchEvent& event) {
|
|
|
|
CefRenderWidgetHostViewOSR* view = GetOSRHostView();
|
2023-01-02 23:59:03 +01:00
|
|
|
if (view) {
|
2019-02-25 22:17:28 +01:00
|
|
|
view->SendTouchEvent(event);
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2019-02-25 22:17:28 +01:00
|
|
|
}
|
|
|
|
|
2021-09-27 09:50:07 +02:00
|
|
|
void CefBrowserPlatformDelegateOsr::SetFocus(bool setFocus) {
|
2015-11-17 19:20:13 +01:00
|
|
|
CefRenderWidgetHostViewOSR* view = GetOSRHostView();
|
2023-01-02 23:59:03 +01:00
|
|
|
if (view) {
|
2021-09-27 09:50:07 +02:00
|
|
|
view->SetFocus(setFocus);
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2015-11-17 19:20:13 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
gfx::Point CefBrowserPlatformDelegateOsr::GetScreenPoint(
|
2022-05-13 13:38:41 +02:00
|
|
|
const gfx::Point& view,
|
|
|
|
bool want_dip_coords) const {
|
2015-11-17 19:20:13 +01:00
|
|
|
CefRefPtr<CefRenderHandler> handler = browser_->client()->GetRenderHandler();
|
|
|
|
if (handler.get()) {
|
|
|
|
int screenX = 0, screenY = 0;
|
2024-05-11 17:48:38 +02:00
|
|
|
if (handler->GetScreenPoint(browser_.get(), view.x(), view.y(), screenX,
|
2017-05-17 11:29:28 +02:00
|
|
|
screenY)) {
|
2022-05-13 13:38:41 +02:00
|
|
|
gfx::Point screen_point(screenX, screenY);
|
|
|
|
#if !BUILDFLAG(IS_MAC)
|
|
|
|
// Mac always operates in DIP coordinates so |want_dip_coords| is ignored.
|
|
|
|
if (want_dip_coords) {
|
|
|
|
// Convert to DIP coordinates.
|
|
|
|
const auto& display = view_util::GetDisplayNearestPoint(
|
|
|
|
screen_point, /*input_pixel_coords=*/true);
|
|
|
|
view_util::ConvertPointFromPixels(&screen_point,
|
|
|
|
display.device_scale_factor());
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
return screen_point;
|
2015-11-17 19:20:13 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return view;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CefBrowserPlatformDelegateOsr::ViewText(const std::string& text) {
|
|
|
|
native_delegate_->ViewText(text);
|
|
|
|
}
|
|
|
|
|
2018-11-03 02:15:09 +01:00
|
|
|
bool CefBrowserPlatformDelegateOsr::HandleKeyboardEvent(
|
2024-06-14 19:01:45 +02:00
|
|
|
const input::NativeWebKeyboardEvent& event) {
|
2018-11-03 02:15:09 +01:00
|
|
|
return native_delegate_->HandleKeyboardEvent(event);
|
2015-11-17 19:20:13 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
CefEventHandle CefBrowserPlatformDelegateOsr::GetEventHandle(
|
2024-06-14 19:01:45 +02:00
|
|
|
const input::NativeWebKeyboardEvent& event) const {
|
2015-11-17 19:20:13 +01:00
|
|
|
return native_delegate_->GetEventHandle(event);
|
|
|
|
}
|
|
|
|
|
2016-04-27 22:38:52 +02:00
|
|
|
std::unique_ptr<CefJavaScriptDialogRunner>
|
2017-05-17 11:29:28 +02:00
|
|
|
CefBrowserPlatformDelegateOsr::CreateJavaScriptDialogRunner() {
|
2015-11-17 19:20:13 +01:00
|
|
|
return native_delegate_->CreateJavaScriptDialogRunner();
|
|
|
|
}
|
|
|
|
|
2017-03-03 23:37:23 +01:00
|
|
|
std::unique_ptr<CefMenuRunner>
|
|
|
|
CefBrowserPlatformDelegateOsr::CreateMenuRunner() {
|
2015-11-17 19:20:13 +01:00
|
|
|
return native_delegate_->CreateMenuRunner();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool CefBrowserPlatformDelegateOsr::IsWindowless() const {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CefBrowserPlatformDelegateOsr::WasHidden(bool hidden) {
|
2018-07-31 21:21:39 +02:00
|
|
|
// The WebContentsImpl will notify the OSR view.
|
2017-07-05 20:51:46 +02:00
|
|
|
content::WebContentsImpl* web_contents =
|
2020-09-25 03:40:47 +02:00
|
|
|
static_cast<content::WebContentsImpl*>(web_contents_);
|
2017-07-05 20:51:46 +02:00
|
|
|
if (web_contents) {
|
2023-01-02 23:59:03 +01:00
|
|
|
if (hidden) {
|
2017-07-05 20:51:46 +02:00
|
|
|
web_contents->WasHidden();
|
2023-01-02 23:59:03 +01:00
|
|
|
} else {
|
2017-07-05 20:51:46 +02:00
|
|
|
web_contents->WasShown();
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2017-07-05 20:51:46 +02:00
|
|
|
}
|
2015-11-17 19:20:13 +01:00
|
|
|
}
|
|
|
|
|
2022-06-02 11:49:50 +02:00
|
|
|
bool CefBrowserPlatformDelegateOsr::IsHidden() const {
|
|
|
|
CefRenderWidgetHostViewOSR* view = GetOSRHostView();
|
2023-01-02 23:59:03 +01:00
|
|
|
if (view) {
|
2022-06-02 11:49:50 +02:00
|
|
|
return view->is_hidden();
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2022-06-02 11:49:50 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-11-17 19:20:13 +01:00
|
|
|
void CefBrowserPlatformDelegateOsr::NotifyScreenInfoChanged() {
|
|
|
|
CefRenderWidgetHostViewOSR* view = GetOSRHostView();
|
2023-01-02 23:59:03 +01:00
|
|
|
if (view) {
|
2015-11-17 19:20:13 +01:00
|
|
|
view->OnScreenInfoChanged();
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2015-11-17 19:20:13 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void CefBrowserPlatformDelegateOsr::Invalidate(cef_paint_element_type_t type) {
|
|
|
|
CefRenderWidgetHostViewOSR* view = GetOSRHostView();
|
2023-01-02 23:59:03 +01:00
|
|
|
if (view) {
|
2015-11-17 19:20:13 +01:00
|
|
|
view->Invalidate(type);
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2015-11-17 19:20:13 +01:00
|
|
|
}
|
|
|
|
|
2018-07-03 02:46:03 +02:00
|
|
|
void CefBrowserPlatformDelegateOsr::SendExternalBeginFrame() {
|
|
|
|
CefRenderWidgetHostViewOSR* view = GetOSRHostView();
|
2023-01-02 23:59:03 +01:00
|
|
|
if (view) {
|
2018-07-03 02:46:03 +02:00
|
|
|
view->SendExternalBeginFrame();
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2018-07-03 02:46:03 +02:00
|
|
|
}
|
|
|
|
|
2015-11-17 19:20:13 +01:00
|
|
|
void CefBrowserPlatformDelegateOsr::SetWindowlessFrameRate(int frame_rate) {
|
|
|
|
CefRenderWidgetHostViewOSR* view = GetOSRHostView();
|
2023-01-02 23:59:03 +01:00
|
|
|
if (view) {
|
2015-11-17 19:20:13 +01:00
|
|
|
view->UpdateFrameRate();
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2015-11-17 19:20:13 +01:00
|
|
|
}
|
|
|
|
|
2016-10-28 18:11:24 +02:00
|
|
|
void CefBrowserPlatformDelegateOsr::ImeSetComposition(
|
|
|
|
const CefString& text,
|
|
|
|
const std::vector<CefCompositionUnderline>& underlines,
|
|
|
|
const CefRange& replacement_range,
|
|
|
|
const CefRange& selection_range) {
|
|
|
|
CefRenderWidgetHostViewOSR* view = GetOSRHostView();
|
|
|
|
if (view) {
|
2017-05-17 11:29:28 +02:00
|
|
|
view->ImeSetComposition(text, underlines, replacement_range,
|
|
|
|
selection_range);
|
2016-10-28 18:11:24 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CefBrowserPlatformDelegateOsr::ImeCommitText(
|
|
|
|
const CefString& text,
|
|
|
|
const CefRange& replacement_range,
|
|
|
|
int relative_cursor_pos) {
|
|
|
|
CefRenderWidgetHostViewOSR* view = GetOSRHostView();
|
2023-01-02 23:59:03 +01:00
|
|
|
if (view) {
|
2016-10-28 18:11:24 +02:00
|
|
|
view->ImeCommitText(text, replacement_range, relative_cursor_pos);
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2016-10-28 18:11:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void CefBrowserPlatformDelegateOsr::ImeFinishComposingText(
|
|
|
|
bool keep_selection) {
|
|
|
|
CefRenderWidgetHostViewOSR* view = GetOSRHostView();
|
2023-01-02 23:59:03 +01:00
|
|
|
if (view) {
|
2016-10-28 18:11:24 +02:00
|
|
|
view->ImeFinishComposingText(keep_selection);
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2016-10-28 18:11:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void CefBrowserPlatformDelegateOsr::ImeCancelComposition() {
|
|
|
|
CefRenderWidgetHostViewOSR* view = GetOSRHostView();
|
2023-01-02 23:59:03 +01:00
|
|
|
if (view) {
|
2016-10-28 18:11:24 +02:00
|
|
|
view->ImeCancelComposition();
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2016-10-28 18:11:24 +02:00
|
|
|
}
|
|
|
|
|
2015-11-17 19:20:13 +01:00
|
|
|
void CefBrowserPlatformDelegateOsr::DragTargetDragEnter(
|
|
|
|
CefRefPtr<CefDragData> drag_data,
|
|
|
|
const CefMouseEvent& event,
|
|
|
|
cef_drag_operations_mask_t allowed_ops) {
|
2016-11-23 21:54:29 +01:00
|
|
|
content::WebContentsImpl* web_contents =
|
2020-09-25 03:40:47 +02:00
|
|
|
static_cast<content::WebContentsImpl*>(web_contents_);
|
2023-01-02 23:59:03 +01:00
|
|
|
if (!web_contents) {
|
2015-11-17 19:20:13 +01:00
|
|
|
return;
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2015-11-17 19:20:13 +01:00
|
|
|
|
2023-01-02 23:59:03 +01:00
|
|
|
if (current_rvh_for_drag_) {
|
2016-11-23 21:54:29 +01:00
|
|
|
DragTargetDragLeave();
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2016-11-23 21:54:29 +01:00
|
|
|
|
|
|
|
const gfx::Point client_pt(event.x, event.y);
|
2017-12-07 22:44:24 +01:00
|
|
|
gfx::PointF transformed_pt;
|
2024-01-05 21:20:37 +01:00
|
|
|
|
|
|
|
// Some random crashes occured when GetWeakPtr is called on a null pointer
|
2024-04-23 22:06:00 +02:00
|
|
|
// that is the return of GetRenderWidgetHostViewInputAtPoint. As the root
|
|
|
|
// cause is not yet understood (no reproducible scenario yet), the current fix
|
|
|
|
// is only a protection against null pointer dereferencing.
|
|
|
|
auto* view =
|
|
|
|
web_contents->GetInputEventRouter()->GetRenderWidgetHostViewInputAtPoint(
|
2024-01-05 21:20:37 +01:00
|
|
|
web_contents->GetRenderViewHost()->GetWidget()->GetView(),
|
|
|
|
gfx::PointF(client_pt), &transformed_pt);
|
2024-04-23 22:06:00 +02:00
|
|
|
if (!view) {
|
2024-01-05 21:20:37 +01:00
|
|
|
return;
|
|
|
|
}
|
2024-04-23 22:06:00 +02:00
|
|
|
auto* target_rwh = content::RenderWidgetHostImpl::From(
|
|
|
|
static_cast<content::RenderWidgetHostViewBase*>(view)
|
|
|
|
->GetRenderWidgetHost());
|
|
|
|
|
|
|
|
current_rwh_for_drag_ = target_rwh->GetWeakPtr();
|
2024-01-05 21:20:37 +01:00
|
|
|
|
2016-11-23 21:54:29 +01:00
|
|
|
current_rvh_for_drag_ = web_contents->GetRenderViewHost();
|
|
|
|
|
2016-06-21 00:59:23 +02:00
|
|
|
drag_data_ = drag_data;
|
2016-11-23 21:54:29 +01:00
|
|
|
drag_allowed_ops_ = allowed_ops;
|
2016-06-21 00:59:23 +02:00
|
|
|
|
2015-11-17 19:20:13 +01:00
|
|
|
CefDragDataImpl* data_impl = static_cast<CefDragDataImpl*>(drag_data.get());
|
|
|
|
base::AutoLock lock_scope(data_impl->lock());
|
2016-06-21 00:59:23 +02:00
|
|
|
content::DropData* drop_data = data_impl->drop_data();
|
2023-10-19 20:08:48 +02:00
|
|
|
drop_data->document_is_handling_drag = document_is_handling_drag_;
|
2022-05-13 13:38:41 +02:00
|
|
|
const gfx::Point& screen_pt =
|
|
|
|
GetScreenPoint(client_pt, /*want_dip_coords=*/false);
|
2020-10-08 21:54:42 +02:00
|
|
|
blink::DragOperationsMask ops =
|
|
|
|
static_cast<blink::DragOperationsMask>(allowed_ops);
|
2020-01-23 22:58:01 +01:00
|
|
|
int modifiers = TranslateWebEventModifiers(event.modifiers);
|
2015-11-17 19:20:13 +01:00
|
|
|
|
2016-11-23 21:54:29 +01:00
|
|
|
current_rwh_for_drag_->FilterDropData(drop_data);
|
|
|
|
|
|
|
|
// Give the delegate an opportunity to cancel the drag.
|
2017-05-17 11:29:28 +02:00
|
|
|
if (web_contents->GetDelegate() && !web_contents->GetDelegate()->CanDragEnter(
|
|
|
|
web_contents, *drop_data, ops)) {
|
2016-11-23 21:54:29 +01:00
|
|
|
drag_data_ = nullptr;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-04-21 00:52:34 +02:00
|
|
|
current_rwh_for_drag_->DragTargetDragEnter(*drop_data, transformed_pt,
|
|
|
|
gfx::PointF(screen_pt), ops,
|
|
|
|
modifiers, base::DoNothing());
|
2015-11-17 19:20:13 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void CefBrowserPlatformDelegateOsr::DragTargetDragOver(
|
|
|
|
const CefMouseEvent& event,
|
|
|
|
cef_drag_operations_mask_t allowed_ops) {
|
2023-01-02 23:59:03 +01:00
|
|
|
if (!drag_data_) {
|
2016-11-23 21:54:29 +01:00
|
|
|
return;
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2016-11-23 21:54:29 +01:00
|
|
|
|
|
|
|
content::WebContentsImpl* web_contents =
|
2020-09-25 03:40:47 +02:00
|
|
|
static_cast<content::WebContentsImpl*>(web_contents_);
|
2023-01-02 23:59:03 +01:00
|
|
|
if (!web_contents) {
|
2015-11-17 19:20:13 +01:00
|
|
|
return;
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2015-11-17 19:20:13 +01:00
|
|
|
|
|
|
|
const gfx::Point client_pt(event.x, event.y);
|
2022-05-13 13:38:41 +02:00
|
|
|
const gfx::Point& screen_pt =
|
|
|
|
GetScreenPoint(client_pt, /*want_dip_coords=*/false);
|
2017-03-03 23:37:23 +01:00
|
|
|
|
2017-12-07 22:44:24 +01:00
|
|
|
gfx::PointF transformed_pt;
|
2024-04-23 22:06:00 +02:00
|
|
|
auto* view =
|
|
|
|
web_contents->GetInputEventRouter()->GetRenderWidgetHostViewInputAtPoint(
|
2017-12-07 22:44:24 +01:00
|
|
|
web_contents->GetRenderViewHost()->GetWidget()->GetView(),
|
|
|
|
gfx::PointF(client_pt), &transformed_pt);
|
2024-04-23 22:06:00 +02:00
|
|
|
auto* target_rwh = content::RenderWidgetHostImpl::From(
|
|
|
|
static_cast<content::RenderWidgetHostViewBase*>(view)
|
|
|
|
->GetRenderWidgetHost());
|
2016-11-23 21:54:29 +01:00
|
|
|
|
|
|
|
if (target_rwh != current_rwh_for_drag_.get()) {
|
2017-03-03 23:37:23 +01:00
|
|
|
if (current_rwh_for_drag_) {
|
2017-12-07 22:44:24 +01:00
|
|
|
gfx::PointF transformed_leave_point(client_pt);
|
|
|
|
gfx::PointF transformed_screen_point(screen_pt);
|
2017-03-03 23:37:23 +01:00
|
|
|
static_cast<content::RenderWidgetHostViewBase*>(
|
|
|
|
web_contents->GetRenderWidgetHostView())
|
|
|
|
->TransformPointToCoordSpaceForView(
|
2017-12-07 22:44:24 +01:00
|
|
|
gfx::PointF(client_pt),
|
2017-03-03 23:37:23 +01:00
|
|
|
static_cast<content::RenderWidgetHostViewBase*>(
|
|
|
|
current_rwh_for_drag_->GetView()),
|
|
|
|
&transformed_leave_point);
|
|
|
|
static_cast<content::RenderWidgetHostViewBase*>(
|
|
|
|
web_contents->GetRenderWidgetHostView())
|
|
|
|
->TransformPointToCoordSpaceForView(
|
2017-12-07 22:44:24 +01:00
|
|
|
gfx::PointF(screen_pt),
|
2017-03-03 23:37:23 +01:00
|
|
|
static_cast<content::RenderWidgetHostViewBase*>(
|
|
|
|
current_rwh_for_drag_->GetView()),
|
|
|
|
&transformed_screen_point);
|
|
|
|
current_rwh_for_drag_->DragTargetDragLeave(transformed_leave_point,
|
|
|
|
transformed_screen_point);
|
|
|
|
}
|
2016-11-23 21:54:29 +01:00
|
|
|
DragTargetDragEnter(drag_data_, event, drag_allowed_ops_);
|
|
|
|
}
|
|
|
|
|
2023-01-02 23:59:03 +01:00
|
|
|
if (!drag_data_) {
|
2016-11-23 21:54:29 +01:00
|
|
|
return;
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2016-11-23 21:54:29 +01:00
|
|
|
|
2020-10-08 21:54:42 +02:00
|
|
|
blink::DragOperationsMask ops =
|
|
|
|
static_cast<blink::DragOperationsMask>(allowed_ops);
|
2020-01-23 22:58:01 +01:00
|
|
|
int modifiers = TranslateWebEventModifiers(event.modifiers);
|
2015-11-17 19:20:13 +01:00
|
|
|
|
2017-12-07 22:44:24 +01:00
|
|
|
target_rwh->DragTargetDragOver(transformed_pt, gfx::PointF(screen_pt), ops,
|
2021-04-21 00:52:34 +02:00
|
|
|
modifiers, base::DoNothing());
|
2015-11-17 19:20:13 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void CefBrowserPlatformDelegateOsr::DragTargetDragLeave() {
|
2020-09-25 03:40:47 +02:00
|
|
|
if (current_rvh_for_drag_ != web_contents_->GetRenderViewHost() ||
|
2016-11-23 21:54:29 +01:00
|
|
|
!drag_data_) {
|
2015-11-17 19:20:13 +01:00
|
|
|
return;
|
2016-11-23 21:54:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (current_rwh_for_drag_) {
|
2017-12-07 22:44:24 +01:00
|
|
|
current_rwh_for_drag_->DragTargetDragLeave(gfx::PointF(), gfx::PointF());
|
2016-11-23 21:54:29 +01:00
|
|
|
current_rwh_for_drag_.reset();
|
|
|
|
}
|
2015-11-17 19:20:13 +01:00
|
|
|
|
2016-11-23 21:54:29 +01:00
|
|
|
drag_data_ = nullptr;
|
2015-11-17 19:20:13 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void CefBrowserPlatformDelegateOsr::DragTargetDrop(const CefMouseEvent& event) {
|
2023-01-02 23:59:03 +01:00
|
|
|
if (!drag_data_) {
|
2016-11-23 21:54:29 +01:00
|
|
|
return;
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2016-11-23 21:54:29 +01:00
|
|
|
|
|
|
|
content::WebContentsImpl* web_contents =
|
2020-09-25 03:40:47 +02:00
|
|
|
static_cast<content::WebContentsImpl*>(web_contents_);
|
2023-01-02 23:59:03 +01:00
|
|
|
if (!web_contents) {
|
2016-11-23 21:54:29 +01:00
|
|
|
return;
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2016-11-23 21:54:29 +01:00
|
|
|
|
|
|
|
gfx::Point client_pt(event.x, event.y);
|
2022-05-13 13:38:41 +02:00
|
|
|
const gfx::Point& screen_pt =
|
|
|
|
GetScreenPoint(client_pt, /*want_dip_coords=*/false);
|
2017-03-03 23:37:23 +01:00
|
|
|
|
2017-12-07 22:44:24 +01:00
|
|
|
gfx::PointF transformed_pt;
|
2024-04-23 22:06:00 +02:00
|
|
|
auto* view =
|
|
|
|
web_contents->GetInputEventRouter()->GetRenderWidgetHostViewInputAtPoint(
|
2017-12-07 22:44:24 +01:00
|
|
|
web_contents->GetRenderViewHost()->GetWidget()->GetView(),
|
|
|
|
gfx::PointF(client_pt), &transformed_pt);
|
2024-04-23 22:06:00 +02:00
|
|
|
auto* target_rwh = content::RenderWidgetHostImpl::From(
|
|
|
|
static_cast<content::RenderWidgetHostViewBase*>(view)
|
|
|
|
->GetRenderWidgetHost());
|
2016-11-23 21:54:29 +01:00
|
|
|
|
|
|
|
if (target_rwh != current_rwh_for_drag_.get()) {
|
2017-03-03 23:37:23 +01:00
|
|
|
if (current_rwh_for_drag_) {
|
2017-12-07 22:44:24 +01:00
|
|
|
gfx::PointF transformed_leave_point(client_pt);
|
|
|
|
gfx::PointF transformed_screen_point(screen_pt);
|
2017-03-03 23:37:23 +01:00
|
|
|
static_cast<content::RenderWidgetHostViewBase*>(
|
|
|
|
web_contents->GetRenderWidgetHostView())
|
|
|
|
->TransformPointToCoordSpaceForView(
|
2017-12-07 22:44:24 +01:00
|
|
|
gfx::PointF(client_pt),
|
2017-03-03 23:37:23 +01:00
|
|
|
static_cast<content::RenderWidgetHostViewBase*>(
|
|
|
|
current_rwh_for_drag_->GetView()),
|
|
|
|
&transformed_leave_point);
|
|
|
|
static_cast<content::RenderWidgetHostViewBase*>(
|
|
|
|
web_contents->GetRenderWidgetHostView())
|
|
|
|
->TransformPointToCoordSpaceForView(
|
2017-12-07 22:44:24 +01:00
|
|
|
gfx::PointF(screen_pt),
|
2017-03-03 23:37:23 +01:00
|
|
|
static_cast<content::RenderWidgetHostViewBase*>(
|
|
|
|
current_rwh_for_drag_->GetView()),
|
|
|
|
&transformed_screen_point);
|
|
|
|
current_rwh_for_drag_->DragTargetDragLeave(transformed_leave_point,
|
|
|
|
transformed_screen_point);
|
|
|
|
}
|
2016-11-23 21:54:29 +01:00
|
|
|
DragTargetDragEnter(drag_data_, event, drag_allowed_ops_);
|
|
|
|
}
|
|
|
|
|
2023-01-02 23:59:03 +01:00
|
|
|
if (!drag_data_) {
|
2015-11-17 19:20:13 +01:00
|
|
|
return;
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2015-11-17 19:20:13 +01:00
|
|
|
|
2016-06-21 00:59:23 +02:00
|
|
|
{
|
|
|
|
CefDragDataImpl* data_impl =
|
|
|
|
static_cast<CefDragDataImpl*>(drag_data_.get());
|
|
|
|
base::AutoLock lock_scope(data_impl->lock());
|
|
|
|
content::DropData* drop_data = data_impl->drop_data();
|
2023-10-19 20:08:48 +02:00
|
|
|
drop_data->document_is_handling_drag = document_is_handling_drag_;
|
2020-01-23 22:58:01 +01:00
|
|
|
int modifiers = TranslateWebEventModifiers(event.modifiers);
|
2016-06-21 00:59:23 +02:00
|
|
|
|
2017-12-07 22:44:24 +01:00
|
|
|
target_rwh->DragTargetDrop(*drop_data, transformed_pt,
|
2021-04-21 00:52:34 +02:00
|
|
|
gfx::PointF(screen_pt), modifiers,
|
|
|
|
base::DoNothing());
|
2016-06-21 00:59:23 +02:00
|
|
|
}
|
2015-11-17 19:20:13 +01:00
|
|
|
|
2016-06-21 00:59:23 +02:00
|
|
|
drag_data_ = nullptr;
|
2015-11-17 19:20:13 +01:00
|
|
|
}
|
|
|
|
|
2016-11-23 21:54:29 +01:00
|
|
|
void CefBrowserPlatformDelegateOsr::StartDragging(
|
|
|
|
const content::DropData& drop_data,
|
2020-10-08 21:54:42 +02:00
|
|
|
blink::DragOperationsMask allowed_ops,
|
2016-11-23 21:54:29 +01:00
|
|
|
const gfx::ImageSkia& image,
|
|
|
|
const gfx::Vector2d& image_offset,
|
2020-10-08 21:54:42 +02:00
|
|
|
const blink::mojom::DragEventSourceInfo& event_info,
|
2016-11-23 21:54:29 +01:00
|
|
|
content::RenderWidgetHostImpl* source_rwh) {
|
|
|
|
drag_start_rwh_ = source_rwh->GetWeakPtr();
|
|
|
|
|
|
|
|
bool handled = false;
|
|
|
|
|
|
|
|
CefRefPtr<CefRenderHandler> handler =
|
|
|
|
browser_->GetClient()->GetRenderHandler();
|
|
|
|
if (handler.get()) {
|
2017-05-11 20:22:21 +02:00
|
|
|
CefRefPtr<CefImage> cef_image(new CefImageImpl(image));
|
|
|
|
CefPoint cef_image_pos(image_offset.x(), image_offset.y());
|
2017-05-17 11:29:28 +02:00
|
|
|
CefRefPtr<CefDragDataImpl> drag_data(
|
|
|
|
new CefDragDataImpl(drop_data, cef_image, cef_image_pos));
|
2016-11-23 21:54:29 +01:00
|
|
|
drag_data->SetReadOnly(true);
|
2023-01-03 00:34:43 +01:00
|
|
|
base::CurrentThread::ScopedAllowApplicationTasksInNativeNestedLoop allow;
|
2016-11-23 21:54:29 +01:00
|
|
|
handled = handler->StartDragging(
|
2024-05-11 17:48:38 +02:00
|
|
|
browser_.get(), drag_data.get(),
|
2016-11-23 21:54:29 +01:00
|
|
|
static_cast<CefRenderHandler::DragOperationsMask>(allowed_ops),
|
2020-10-08 21:54:42 +02:00
|
|
|
event_info.location.x(), event_info.location.y());
|
2016-11-23 21:54:29 +01:00
|
|
|
}
|
|
|
|
|
2023-01-02 23:59:03 +01:00
|
|
|
if (!handled) {
|
2016-11-23 21:54:29 +01:00
|
|
|
DragSourceSystemDragEnded();
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2016-11-23 21:54:29 +01:00
|
|
|
}
|
|
|
|
|
2023-10-19 20:08:48 +02:00
|
|
|
void CefBrowserPlatformDelegateOsr::UpdateDragOperation(
|
|
|
|
ui::mojom::DragOperation operation,
|
|
|
|
bool document_is_handling_drag) {
|
|
|
|
document_is_handling_drag_ = document_is_handling_drag;
|
|
|
|
|
2016-11-23 21:54:29 +01:00
|
|
|
CefRefPtr<CefRenderHandler> handler =
|
|
|
|
browser_->GetClient()->GetRenderHandler();
|
|
|
|
if (handler.get()) {
|
|
|
|
handler->UpdateDragCursor(
|
2024-05-11 17:48:38 +02:00
|
|
|
browser_.get(),
|
|
|
|
static_cast<CefRenderHandler::DragOperation>(operation));
|
2016-11-23 21:54:29 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-11-17 19:20:13 +01:00
|
|
|
void CefBrowserPlatformDelegateOsr::DragSourceEndedAt(
|
2017-05-17 11:29:28 +02:00
|
|
|
int x,
|
|
|
|
int y,
|
2015-11-17 19:20:13 +01:00
|
|
|
cef_drag_operations_mask_t op) {
|
2023-01-02 23:59:03 +01:00
|
|
|
if (!drag_start_rwh_) {
|
2016-11-23 21:54:29 +01:00
|
|
|
return;
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2016-11-23 21:54:29 +01:00
|
|
|
|
|
|
|
content::WebContentsImpl* web_contents =
|
2020-09-25 03:40:47 +02:00
|
|
|
static_cast<content::WebContentsImpl*>(web_contents_);
|
2023-01-02 23:59:03 +01:00
|
|
|
if (!web_contents) {
|
2015-11-17 19:20:13 +01:00
|
|
|
return;
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2015-11-17 19:20:13 +01:00
|
|
|
|
2017-03-03 23:37:23 +01:00
|
|
|
content::RenderWidgetHostImpl* source_rwh = drag_start_rwh_.get();
|
|
|
|
const gfx::Point client_loc(gfx::Point(x, y));
|
2022-05-13 13:38:41 +02:00
|
|
|
const gfx::Point& screen_loc =
|
|
|
|
GetScreenPoint(client_loc, /*want_dip_coords=*/false);
|
2021-01-28 00:13:12 +01:00
|
|
|
ui::mojom::DragOperation drag_op = static_cast<ui::mojom::DragOperation>(op);
|
2015-11-17 19:20:13 +01:00
|
|
|
|
2017-03-03 23:37:23 +01:00
|
|
|
// |client_loc| and |screen_loc| are in the root coordinate space, for
|
|
|
|
// non-root RenderWidgetHosts they need to be transformed.
|
2017-12-07 22:44:24 +01:00
|
|
|
gfx::PointF transformed_point(client_loc);
|
|
|
|
gfx::PointF transformed_screen_point(screen_loc);
|
2017-03-03 23:37:23 +01:00
|
|
|
if (source_rwh && web_contents->GetRenderWidgetHostView()) {
|
|
|
|
static_cast<content::RenderWidgetHostViewBase*>(
|
|
|
|
web_contents->GetRenderWidgetHostView())
|
|
|
|
->TransformPointToCoordSpaceForView(
|
2017-12-07 22:44:24 +01:00
|
|
|
gfx::PointF(client_loc),
|
2017-03-03 23:37:23 +01:00
|
|
|
static_cast<content::RenderWidgetHostViewBase*>(
|
|
|
|
source_rwh->GetView()),
|
|
|
|
&transformed_point);
|
|
|
|
static_cast<content::RenderWidgetHostViewBase*>(
|
|
|
|
web_contents->GetRenderWidgetHostView())
|
|
|
|
->TransformPointToCoordSpaceForView(
|
2017-12-07 22:44:24 +01:00
|
|
|
gfx::PointF(screen_loc),
|
2017-03-03 23:37:23 +01:00
|
|
|
static_cast<content::RenderWidgetHostViewBase*>(
|
|
|
|
source_rwh->GetView()),
|
|
|
|
&transformed_screen_point);
|
|
|
|
}
|
|
|
|
|
|
|
|
web_contents->DragSourceEndedAt(transformed_point.x(), transformed_point.y(),
|
|
|
|
transformed_screen_point.x(),
|
|
|
|
transformed_screen_point.y(), drag_op,
|
|
|
|
source_rwh);
|
2015-11-17 19:20:13 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void CefBrowserPlatformDelegateOsr::DragSourceSystemDragEnded() {
|
2023-01-02 23:59:03 +01:00
|
|
|
if (!drag_start_rwh_) {
|
2015-11-17 19:20:13 +01:00
|
|
|
return;
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2015-11-17 19:20:13 +01:00
|
|
|
|
2020-07-08 19:23:29 +02:00
|
|
|
content::WebContentsImpl* web_contents =
|
2020-09-25 03:40:47 +02:00
|
|
|
static_cast<content::WebContentsImpl*>(web_contents_);
|
2023-01-02 23:59:03 +01:00
|
|
|
if (!web_contents) {
|
2016-11-23 21:54:29 +01:00
|
|
|
return;
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2016-11-23 21:54:29 +01:00
|
|
|
|
|
|
|
web_contents->SystemDragEnded(drag_start_rwh_.get());
|
|
|
|
|
|
|
|
drag_start_rwh_ = nullptr;
|
2015-11-17 19:20:13 +01:00
|
|
|
}
|
|
|
|
|
2017-05-12 20:28:25 +02:00
|
|
|
void CefBrowserPlatformDelegateOsr::AccessibilityEventReceived(
|
2024-05-23 03:52:35 +02:00
|
|
|
const ui::AXUpdatesAndEvents& details) {
|
2017-05-12 20:28:25 +02:00
|
|
|
CefRefPtr<CefRenderHandler> handler = browser_->client()->GetRenderHandler();
|
|
|
|
if (handler.get()) {
|
|
|
|
CefRefPtr<CefAccessibilityHandler> acchandler =
|
|
|
|
handler->GetAccessibilityHandler();
|
|
|
|
|
|
|
|
if (acchandler.get()) {
|
|
|
|
acchandler->OnAccessibilityTreeChange(
|
2024-05-23 03:52:35 +02:00
|
|
|
osr_accessibility_util::ParseAccessibilityEventData(details));
|
2017-05-12 20:28:25 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CefBrowserPlatformDelegateOsr::AccessibilityLocationChangesReceived(
|
2024-05-23 03:52:35 +02:00
|
|
|
const std::vector<ui::AXLocationChanges>& details) {
|
2017-05-12 20:28:25 +02:00
|
|
|
CefRefPtr<CefRenderHandler> handler = browser_->client()->GetRenderHandler();
|
|
|
|
if (handler.get()) {
|
|
|
|
CefRefPtr<CefAccessibilityHandler> acchandler =
|
|
|
|
handler->GetAccessibilityHandler();
|
|
|
|
|
|
|
|
if (acchandler.get()) {
|
|
|
|
acchandler->OnAccessibilityLocationChange(
|
2024-05-23 03:52:35 +02:00
|
|
|
osr_accessibility_util::ParseAccessibilityLocationData(details));
|
2017-05-12 20:28:25 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-11-17 19:20:13 +01:00
|
|
|
CefWindowHandle CefBrowserPlatformDelegateOsr::GetParentWindowHandle() const {
|
|
|
|
return GetHostWindowHandle();
|
|
|
|
}
|
|
|
|
|
|
|
|
gfx::Point CefBrowserPlatformDelegateOsr::GetParentScreenPoint(
|
2022-05-13 13:38:41 +02:00
|
|
|
const gfx::Point& view,
|
|
|
|
bool want_dip_coords) const {
|
|
|
|
return GetScreenPoint(view, want_dip_coords);
|
2015-11-17 19:20:13 +01:00
|
|
|
}
|
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
CefRenderWidgetHostViewOSR* CefBrowserPlatformDelegateOsr::GetOSRHostView()
|
|
|
|
const {
|
2024-04-17 18:01:26 +02:00
|
|
|
if (!web_contents_) {
|
|
|
|
return nullptr;
|
|
|
|
}
|
2020-09-25 03:40:47 +02:00
|
|
|
content::RenderViewHost* host = web_contents_->GetRenderViewHost();
|
2015-11-17 19:20:13 +01:00
|
|
|
if (host) {
|
|
|
|
return static_cast<CefRenderWidgetHostViewOSR*>(
|
|
|
|
host->GetWidget()->GetView());
|
|
|
|
}
|
|
|
|
|
|
|
|
return nullptr;
|
|
|
|
}
|