Commit afdfb3ff authored by Alan Cutter's avatar Alan Cutter Committed by Commit Bot

Fix title bar drag hit testing when in RTL mode

Our hit testing for the title bar window control buttons was not taking
RTL mirroring into account. This CL fixes that.
Without this CL the user was not able to drag the window in the top
right corner when in RTL mode.

Fixed: 1008371
Change-Id: Id84d381dca00ebb70931e3692fe4982df8827471
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1943491
Commit-Queue: Alan Cutter <alancutter@chromium.org>
Auto-Submit: Alan Cutter <alancutter@chromium.org>
Reviewed-by: default avatarBret Sepulveda <bsep@chromium.org>
Cr-Commit-Position: refs/heads/master@{#720360}
parent cf5df561
...@@ -330,8 +330,8 @@ int GlassBrowserFrameView::NonClientHitTest(const gfx::Point& point) { ...@@ -330,8 +330,8 @@ int GlassBrowserFrameView::NonClientHitTest(const gfx::Point& point) {
DWMWA_CAPTION_BUTTON_BOUNDS, DWMWA_CAPTION_BUTTON_BOUNDS,
&button_bounds, &button_bounds,
sizeof(button_bounds)))) { sizeof(button_bounds)))) {
gfx::Rect buttons = gfx::ConvertRectToDIP(display::win::GetDPIScale(), gfx::Rect buttons = GetMirroredRect(gfx::ConvertRectToDIP(
gfx::Rect(button_bounds)); display::win::GetDPIScale(), gfx::Rect(button_bounds)));
// There is a small one-pixel strip right above the caption buttons in // There is a small one-pixel strip right above the caption buttons in
// which the resize border "peeks" through. // which the resize border "peeks" through.
......
...@@ -98,3 +98,17 @@ IN_PROC_BROWSER_TEST_F(WebAppGlassBrowserFrameViewTest, MaximizedLayout) { ...@@ -98,3 +98,17 @@ IN_PROC_BROWSER_TEST_F(WebAppGlassBrowserFrameViewTest, MaximizedLayout) {
DCHECK_GT(glass_frame_view_->window_title_for_testing()->x(), 0); DCHECK_GT(glass_frame_view_->window_title_for_testing()->x(), 0);
DCHECK_GT(glass_frame_view_->web_app_frame_toolbar_for_testing()->y(), 0); DCHECK_GT(glass_frame_view_->web_app_frame_toolbar_for_testing()->y(), 0);
} }
IN_PROC_BROWSER_TEST_F(WebAppGlassBrowserFrameViewTest, RTLTopRightHitTest) {
base::i18n::SetRTLForTesting(true);
if (!InstallAndLaunchWebApp())
return;
static_cast<views::View*>(glass_frame_view_)->Layout();
// Avoid the top right resize corner.
constexpr int kInset = 10;
EXPECT_EQ(glass_frame_view_->NonClientHitTest(
gfx::Point(glass_frame_view_->width() - kInset, kInset)),
HTCAPTION);
}
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