Commit 84e2d334 authored by Maksim Sisov's avatar Maksim Sisov Committed by Chromium LUCI CQ

WebCursor: do not set rotation for non cros platforms.

After use_x11 && use_ozone started to be set at the same time,
non-Ozone/X11 (and it was also a bug in Ozone/Linux, actually) started
to show cursor with wrong rotation. The reason was the code for ChromeOS
that could rotate cursor as the physical and logical rotation can be
different, which is not the case for other platforms.

Bug: 1152217
Change-Id: I0f013f20c3aa2b5538cd6e37af73fd2b2d2dfae7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2563298
Auto-Submit: Maksim Sisov (GMT+2) <msisov@igalia.com>
Reviewed-by: default avatarAvi Drissman <avi@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Commit-Queue: Scott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#832398}
parent 3e5e262e
...@@ -32,10 +32,12 @@ void WebCursor::SetDisplayInfo(const display::Display& display) { ...@@ -32,10 +32,12 @@ void WebCursor::SetDisplayInfo(const display::Display& display) {
maximum_cursor_size_ == display.maximum_cursor_size()) maximum_cursor_size_ == display.maximum_cursor_size())
return; return;
device_scale_factor_ = display.device_scale_factor(); device_scale_factor_ = display.device_scale_factor();
#if defined(OS_CHROMEOS)
// The cursor should use the panel's physical rotation instead of // The cursor should use the panel's physical rotation instead of
// rotation. They can be different on ChromeOS but the same on // rotation. They can be different on ChromeOS but the same on
// other platforms. // other platforms.
rotation_ = display.panel_rotation(); rotation_ = display.panel_rotation();
#endif
maximum_cursor_size_ = display.maximum_cursor_size(); maximum_cursor_size_ = display.maximum_cursor_size();
// TODO(oshima): Identify if it's possible to remove this check here and move // TODO(oshima): Identify if it's possible to remove this check here and move
// the kDefaultMaxSize constants to a single place. crbug.com/603512 // the kDefaultMaxSize constants to a single place. crbug.com/603512
......
...@@ -62,15 +62,23 @@ TEST(WebCursorTest, WebCursorCursorConstructorCustom) { ...@@ -62,15 +62,23 @@ TEST(WebCursorTest, WebCursorCursorConstructorCustom) {
#if defined(USE_OZONE) #if defined(USE_OZONE)
// Test if the rotating custom cursor works correctly. // Test if the rotating custom cursor works correctly.
display::Display display; display::Display display;
#if defined(OS_CHROMEOS)
display.set_panel_rotation(display::Display::ROTATE_90); display.set_panel_rotation(display::Display::ROTATE_90);
#endif
webcursor.SetDisplayInfo(display); webcursor.SetDisplayInfo(display);
EXPECT_FALSE(webcursor.has_custom_cursor_for_test()); EXPECT_FALSE(webcursor.has_custom_cursor_for_test());
native_cursor = webcursor.GetNativeCursor(); native_cursor = webcursor.GetNativeCursor();
EXPECT_TRUE(webcursor.has_custom_cursor_for_test()); EXPECT_TRUE(webcursor.has_custom_cursor_for_test());
#if defined(OS_CHROMEOS)
// Hotspot should be scaled & rotated. We're using the icon created for 2.0, // Hotspot should be scaled & rotated. We're using the icon created for 2.0,
// on the display with dsf=1.0, so the host spot should be // on the display with dsf=1.0, so the host spot should be
// ((32 - 20) / 2, 10 / 2) = (6, 5). // ((32 - 20) / 2, 10 / 2) = (6, 5).
EXPECT_EQ(gfx::Point(6, 5), native_cursor.custom_hotspot()); EXPECT_EQ(gfx::Point(6, 5), native_cursor.custom_hotspot());
#else
// For non-CrOS platforms, the cursor mustn't be rotated as logical and
// physical location is the same.
EXPECT_EQ(gfx::Point(5, 10), native_cursor.custom_hotspot());
#endif
#endif #endif
#endif #endif
} }
......
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