mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Update to Chromium version 82.0.4085.0 (#749737)
- Building on macOS now requires the 10.15 SDK. Xcode 11.3 is recommended as Xcode 11.4 is not currently supported (see https://crbug.com/1065146). - Jumbo build configuration is no longer supported. Chromium is skipping the M82 release and consequently no CEF 4085 branch will be created. For details on the Chromium decision see https://groups.google.com/a/chromium.org/d/msg/chromium-dev/Vn7uzglqLz0/JItlSrZxBAAJ
This commit is contained in:
@@ -258,10 +258,10 @@ void CefBrowserPlatformDelegate::HandleExternalProtocol(const GURL& url) {}
|
||||
|
||||
CefEventHandle CefBrowserPlatformDelegateNativeLinux::GetEventHandle(
|
||||
const content::NativeWebKeyboardEvent& event) const {
|
||||
if (!event.os_event)
|
||||
return nullptr;
|
||||
return const_cast<CefEventHandle>(
|
||||
static_cast<CefEventHandle>(event.os_event->native_event()));
|
||||
// TODO(cef): We need to return an XEvent* from this method, but
|
||||
// |event.os_event->native_event()| now returns a ui::Event* instead.
|
||||
// See https://crbug.com/965991.
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::unique_ptr<CefMenuRunner>
|
||||
|
@@ -526,8 +526,7 @@ CefBrowserPlatformDelegateNativeMac::TranslateWebWheelEvent(
|
||||
result.delta_y = deltaY;
|
||||
result.wheel_ticks_x = deltaX / scrollbarPixelsPerCocoaTick;
|
||||
result.wheel_ticks_y = deltaY / scrollbarPixelsPerCocoaTick;
|
||||
result.delta_units =
|
||||
ui::input_types::ScrollGranularity::kScrollByPrecisePixel;
|
||||
result.delta_units = ui::ScrollGranularity::kScrollByPrecisePixel;
|
||||
|
||||
if (mouse_event.modifiers & EVENTFLAG_LEFT_MOUSE_BUTTON)
|
||||
result.button = blink::WebMouseEvent::Button::kLeft;
|
||||
|
@@ -8,6 +8,7 @@
|
||||
|
||||
#include "ui/base/x/x11_util.h"
|
||||
#include "ui/events/platform/platform_event_source.h"
|
||||
#include "ui/events/x/x11_event_translation.h"
|
||||
#include "ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h"
|
||||
#include "ui/views/widget/desktop_aura/x11_topmost_window_finder.h"
|
||||
|
||||
@@ -28,13 +29,6 @@ const char kNetWMState[] = "_NET_WM_STATE";
|
||||
const char kXdndProxy[] = "XdndProxy";
|
||||
const char kUTF8String[] = "UTF8_STRING";
|
||||
|
||||
::Window FindEventTarget(const ui::PlatformEvent& xev) {
|
||||
::Window target = xev->xany.window;
|
||||
if (xev->type == GenericEvent)
|
||||
target = static_cast<XIDeviceEvent*>(xev->xcookie.data)->event;
|
||||
return target;
|
||||
}
|
||||
|
||||
::Window FindChild(::Display* display, ::Window window) {
|
||||
::Window root;
|
||||
::Window parent;
|
||||
@@ -109,8 +103,8 @@ CefWindowX11::CefWindowX11(CefRefPtr<CefBrowserHostImpl> browser,
|
||||
CWBackPixmap | CWOverrideRedirect, &swa);
|
||||
CHECK(xwindow_);
|
||||
|
||||
if (ui::PlatformEventSource::GetInstance())
|
||||
ui::PlatformEventSource::GetInstance()->AddPlatformEventDispatcher(this);
|
||||
DCHECK(ui::X11EventSource::HasInstance());
|
||||
ui::X11EventSource::GetInstance()->AddXEventDispatcher(this);
|
||||
|
||||
long event_mask = FocusChangeMask | StructureNotifyMask | PropertyChangeMask;
|
||||
XSelectInput(xdisplay_, xwindow_, event_mask);
|
||||
@@ -148,8 +142,8 @@ CefWindowX11::CefWindowX11(CefRefPtr<CefBrowserHostImpl> browser,
|
||||
|
||||
CefWindowX11::~CefWindowX11() {
|
||||
DCHECK(!xwindow_);
|
||||
if (ui::PlatformEventSource::GetInstance())
|
||||
ui::PlatformEventSource::GetInstance()->RemovePlatformEventDispatcher(this);
|
||||
DCHECK(ui::X11EventSource::HasInstance());
|
||||
ui::X11EventSource::GetInstance()->RemoveXEventDispatcher(this);
|
||||
}
|
||||
|
||||
void CefWindowX11::Close() {
|
||||
@@ -288,12 +282,88 @@ views::DesktopWindowTreeHostX11* CefWindowX11::GetHost() {
|
||||
}
|
||||
|
||||
bool CefWindowX11::CanDispatchEvent(const ui::PlatformEvent& event) {
|
||||
::Window target = FindEventTarget(event);
|
||||
return target == xwindow_;
|
||||
DCHECK_NE(xwindow_, x11::None);
|
||||
return !!current_xevent_;
|
||||
}
|
||||
|
||||
uint32_t CefWindowX11::DispatchEvent(const ui::PlatformEvent& event) {
|
||||
XEvent* xev = event;
|
||||
DCHECK_NE(xwindow_, x11::None);
|
||||
DCHECK(event);
|
||||
DCHECK(current_xevent_);
|
||||
|
||||
ProcessXEvent(current_xevent_);
|
||||
return ui::POST_DISPATCH_STOP_PROPAGATION;
|
||||
}
|
||||
|
||||
// Called by X11EventSourceLibevent to determine whether this XEventDispatcher
|
||||
// implementation is able to process the next translated event sent by it.
|
||||
void CefWindowX11::CheckCanDispatchNextPlatformEvent(XEvent* xev) {
|
||||
current_xevent_ = IsTargetedBy(*xev) ? xev : nullptr;
|
||||
}
|
||||
|
||||
void CefWindowX11::PlatformEventDispatchFinished() {
|
||||
current_xevent_ = nullptr;
|
||||
}
|
||||
|
||||
ui::PlatformEventDispatcher* CefWindowX11::GetPlatformEventDispatcher() {
|
||||
return this;
|
||||
}
|
||||
|
||||
bool CefWindowX11::DispatchXEvent(XEvent* xev) {
|
||||
if (!IsTargetedBy(*xev))
|
||||
return false;
|
||||
ProcessXEvent(xev);
|
||||
return true;
|
||||
}
|
||||
|
||||
void CefWindowX11::ContinueFocus() {
|
||||
if (!focus_pending_)
|
||||
return;
|
||||
if (browser_.get())
|
||||
browser_->SetFocus(true);
|
||||
focus_pending_ = false;
|
||||
}
|
||||
|
||||
bool CefWindowX11::TopLevelAlwaysOnTop() const {
|
||||
::Window toplevel_window = FindToplevelParent(xdisplay_, xwindow_);
|
||||
|
||||
Atom state_atom = gfx::GetAtom("_NET_WM_STATE");
|
||||
Atom state_keep_above = gfx::GetAtom("_NET_WM_STATE_KEEP_ABOVE");
|
||||
Atom* states;
|
||||
|
||||
Atom actual_type;
|
||||
int actual_format;
|
||||
unsigned long num_items;
|
||||
unsigned long bytes_after;
|
||||
|
||||
XGetWindowProperty(xdisplay_, toplevel_window, state_atom, 0, 1024,
|
||||
x11::False, XA_ATOM, &actual_type, &actual_format,
|
||||
&num_items, &bytes_after,
|
||||
reinterpret_cast<unsigned char**>(&states));
|
||||
|
||||
bool always_on_top = false;
|
||||
|
||||
for (unsigned long i = 0; i < num_items; ++i) {
|
||||
if (states[i] == state_keep_above) {
|
||||
always_on_top = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
XFree(states);
|
||||
|
||||
return always_on_top;
|
||||
}
|
||||
|
||||
bool CefWindowX11::IsTargetedBy(const XEvent& xev) const {
|
||||
::Window target_window =
|
||||
(xev.type == GenericEvent)
|
||||
? static_cast<XIDeviceEvent*>(xev.xcookie.data)->event
|
||||
: xev.xany.window;
|
||||
return target_window == xwindow_;
|
||||
}
|
||||
|
||||
void CefWindowX11::ProcessXEvent(XEvent* xev) {
|
||||
switch (xev->type) {
|
||||
case ConfigureNotify: {
|
||||
DCHECK_EQ(xwindow_, xev->xconfigure.event);
|
||||
@@ -402,45 +472,4 @@ uint32_t CefWindowX11::DispatchEvent(const ui::PlatformEvent& event) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return ui::POST_DISPATCH_STOP_PROPAGATION;
|
||||
}
|
||||
|
||||
void CefWindowX11::ContinueFocus() {
|
||||
if (!focus_pending_)
|
||||
return;
|
||||
if (browser_.get())
|
||||
browser_->SetFocus(true);
|
||||
focus_pending_ = false;
|
||||
}
|
||||
|
||||
bool CefWindowX11::TopLevelAlwaysOnTop() const {
|
||||
::Window toplevel_window = FindToplevelParent(xdisplay_, xwindow_);
|
||||
|
||||
Atom state_atom = gfx::GetAtom("_NET_WM_STATE");
|
||||
Atom state_keep_above = gfx::GetAtom("_NET_WM_STATE_KEEP_ABOVE");
|
||||
Atom* states;
|
||||
|
||||
Atom actual_type;
|
||||
int actual_format;
|
||||
unsigned long num_items;
|
||||
unsigned long bytes_after;
|
||||
|
||||
XGetWindowProperty(xdisplay_, toplevel_window, state_atom, 0, 1024,
|
||||
x11::False, XA_ATOM, &actual_type, &actual_format,
|
||||
&num_items, &bytes_after,
|
||||
reinterpret_cast<unsigned char**>(&states));
|
||||
|
||||
bool always_on_top = false;
|
||||
|
||||
for (unsigned long i = 0; i < num_items; ++i) {
|
||||
if (states[i] == state_keep_above) {
|
||||
always_on_top = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
XFree(states);
|
||||
|
||||
return always_on_top;
|
||||
}
|
||||
|
@@ -16,6 +16,7 @@ typedef struct _XDisplay Display;
|
||||
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "ui/events/platform/platform_event_dispatcher.h"
|
||||
#include "ui/events/platform/x11/x11_event_source.h"
|
||||
#include "ui/gfx/geometry/rect.h"
|
||||
#include "ui/gfx/x/x11_atom_cache.h"
|
||||
|
||||
@@ -25,7 +26,8 @@ class DesktopWindowTreeHostX11;
|
||||
|
||||
// Object wrapper for an X11 Window.
|
||||
// Based on WindowTreeHostX11 and DesktopWindowTreeHostX11.
|
||||
class CefWindowX11 : public ui::PlatformEventDispatcher {
|
||||
class CefWindowX11 : public ui::PlatformEventDispatcher,
|
||||
public ui::XEventDispatcher {
|
||||
public:
|
||||
CefWindowX11(CefRefPtr<CefBrowserHostImpl> browser,
|
||||
::Window parent_xwindow,
|
||||
@@ -50,6 +52,12 @@ class CefWindowX11 : public ui::PlatformEventDispatcher {
|
||||
bool CanDispatchEvent(const ui::PlatformEvent& event) override;
|
||||
uint32_t DispatchEvent(const ui::PlatformEvent& event) override;
|
||||
|
||||
// ui::XEventDispatcher methods:
|
||||
void CheckCanDispatchNextPlatformEvent(XEvent* xev) override;
|
||||
void PlatformEventDispatchFinished() override;
|
||||
ui::PlatformEventDispatcher* GetPlatformEventDispatcher() override;
|
||||
bool DispatchXEvent(XEvent* event) override;
|
||||
|
||||
::Window xwindow() const { return xwindow_; }
|
||||
gfx::Rect bounds() const { return bounds_; }
|
||||
|
||||
@@ -58,6 +66,9 @@ class CefWindowX11 : public ui::PlatformEventDispatcher {
|
||||
private:
|
||||
void ContinueFocus();
|
||||
|
||||
bool IsTargetedBy(const XEvent& xev) const;
|
||||
void ProcessXEvent(XEvent* xev);
|
||||
|
||||
CefRefPtr<CefBrowserHostImpl> browser_;
|
||||
|
||||
// The display and the native X window hosting the root window.
|
||||
@@ -73,6 +84,11 @@ class CefWindowX11 : public ui::PlatformEventDispatcher {
|
||||
|
||||
bool focus_pending_;
|
||||
|
||||
// Tells if this dispatcher can process next translated event based on a
|
||||
// previous check in ::CheckCanDispatchNextPlatformEvent based on a XID
|
||||
// target.
|
||||
XEvent* current_xevent_ = nullptr;
|
||||
|
||||
// Must always be the last member.
|
||||
base::WeakPtrFactory<CefWindowX11> weak_ptr_factory_;
|
||||
|
||||
|
Reference in New Issue
Block a user