Commit f770838a authored by Henrique Ferreiro's avatar Henrique Ferreiro Committed by Chromium LUCI CQ

Reland "Remove unneeded CursorLoaderWin::SetPlatformWindow calls"

This is a reland of 1208732e

Original change's description:
> Remove unneeded CursorLoaderWin::SetPlatformWindow calls
>
> SetCursorNative is only called from WindowTreeHost::SetCursor, which
> guarantees that the platform cursor has been set.
>
> Bug: 1097556
> Change-Id: I4c140a872482ba33bf957ed6817279c275bf7f36
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2417893
> Reviewed-by: Scott Violet <sky@chromium.org>
> Commit-Queue: Henrique Ferreiro <hferreiro@igalia.com>
> Cr-Commit-Position: refs/heads/master@{#810120}

Bug: 1097556
Change-Id: I89b742a80ddd9fee7a77b5af1bee07b58c18f39b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2445550Reviewed-by: default avatarScott Violet <sky@chromium.org>
Commit-Queue: Henrique Ferreiro <hferreiro@igalia.com>
Cr-Commit-Position: refs/heads/master@{#837132}
parent e871e66d
...@@ -219,6 +219,10 @@ void WindowTreeHost::ConvertPixelsToDIP(gfx::Point* point) const { ...@@ -219,6 +219,10 @@ void WindowTreeHost::ConvertPixelsToDIP(gfx::Point* point) const {
} }
void WindowTreeHost::SetCursor(gfx::NativeCursor cursor) { void WindowTreeHost::SetCursor(gfx::NativeCursor cursor) {
// Some CursorFactory implementations use nullptr to represent the hidden
// cursor (i.e. cursor type kNone).
DCHECK(cursor.type() == ui::mojom::CursorType::kNone || cursor.platform());
last_cursor_ = cursor; last_cursor_ = cursor;
// A lot of code seems to depend on NULL cursors actually showing an arrow, // A lot of code seems to depend on NULL cursors actually showing an arrow,
// so just pass everything along to the host. // so just pass everything along to the host.
......
...@@ -136,11 +136,12 @@ class AURA_EXPORT WindowTreeHost : public ui::internal::InputMethodDelegate, ...@@ -136,11 +136,12 @@ class AURA_EXPORT WindowTreeHost : public ui::internal::InputMethodDelegate,
// root window's. // root window's.
virtual void ConvertPixelsToDIP(gfx::Point* point) const; virtual void ConvertPixelsToDIP(gfx::Point* point) const;
// Cursor.
// Sets the currently-displayed cursor. If the cursor was previously hidden // Sets the currently-displayed cursor. If the cursor was previously hidden
// via ShowCursor(false), it will remain hidden until ShowCursor(true) is // via ShowCursor(false), it will remain hidden until ShowCursor(true) is
// called, at which point the cursor that was last set via SetCursor() will be // called, at which point the cursor that was last set via SetCursor() will be
// used. // used.
// `cursor` should have its platform cursor set, e.g. via
// `CursorLoader::SetPlatformCursor`.
void SetCursor(gfx::NativeCursor cursor); void SetCursor(gfx::NativeCursor cursor);
// Invoked when the cursor's visibility has changed. // Invoked when the cursor's visibility has changed.
......
...@@ -34,7 +34,6 @@ ...@@ -34,7 +34,6 @@
#endif #endif
#if defined(OS_WIN) #if defined(OS_WIN)
#include "ui/base/cursor/cursor_loader_win.h"
#include "ui/platform_window/win/win_window.h" #include "ui/platform_window/win/win_window.h"
#endif #endif
...@@ -185,11 +184,6 @@ void WindowTreeHostPlatform::SetCursorNative(gfx::NativeCursor cursor) { ...@@ -185,11 +184,6 @@ void WindowTreeHostPlatform::SetCursorNative(gfx::NativeCursor cursor) {
return; return;
current_cursor_ = cursor; current_cursor_ = cursor;
#if defined(OS_WIN)
ui::CursorLoaderWin cursor_loader;
cursor_loader.SetPlatformCursor(&cursor);
#endif
platform_window_->SetCursor(cursor.platform()); platform_window_->SetCursor(cursor.platform());
} }
......
...@@ -160,6 +160,8 @@ void CursorLoaderWin::SetPlatformCursor(gfx::NativeCursor* cursor) { ...@@ -160,6 +160,8 @@ void CursorLoaderWin::SetPlatformCursor(gfx::NativeCursor* cursor) {
GetModuleHandle(g_cursor_resource_module_name.Get().c_str()), GetModuleHandle(g_cursor_resource_module_name.Get().c_str()),
cursor_id); cursor_id);
} }
DCHECK(platform_cursor)
<< "Failed to load a cursor for type " << cursor->type();
cursor->SetPlatformCursor(platform_cursor); cursor->SetPlatformCursor(platform_cursor);
} }
} }
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
#include "ui/aura/client/focus_client.h" #include "ui/aura/client/focus_client.h"
#include "ui/aura/window_event_dispatcher.h" #include "ui/aura/window_event_dispatcher.h"
#include "ui/base/class_property.h" #include "ui/base/class_property.h"
#include "ui/base/cursor/cursor_loader_win.h"
#include "ui/base/ime/input_method.h" #include "ui/base/ime/input_method.h"
#include "ui/base/ui_base_features.h" #include "ui/base/ui_base_features.h"
#include "ui/base/win/event_creation_utils.h" #include "ui/base/win/event_creation_utils.h"
...@@ -632,9 +631,6 @@ DesktopWindowTreeHostWin::GetKeyboardLayoutMap() { ...@@ -632,9 +631,6 @@ DesktopWindowTreeHostWin::GetKeyboardLayoutMap() {
void DesktopWindowTreeHostWin::SetCursorNative(gfx::NativeCursor cursor) { void DesktopWindowTreeHostWin::SetCursorNative(gfx::NativeCursor cursor) {
TRACE_EVENT1("ui,input", "DesktopWindowTreeHostWin::SetCursorNative", TRACE_EVENT1("ui,input", "DesktopWindowTreeHostWin::SetCursorNative",
"cursor", cursor.type()); "cursor", cursor.type());
ui::CursorLoaderWin cursor_loader;
cursor_loader.SetPlatformCursor(&cursor);
message_handler_->SetCursor(cursor.platform()); message_handler_->SetCursor(cursor.platform());
} }
......
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