Commit f73cba2d authored by Leonard Grey's avatar Leonard Grey Committed by Commit Bot

Mac: Release capture when running a move loop

This is a speculative fix for https://crbug.com/876493

There's an implicit but unenforced assumption that a widget doesn't have
mouse capture when a move loop runs. Indeed, all implementations of RunMoveLoop
besides Mac appear to do this directly or indirectly, and we even do a DCHECK
in BridgedNativeWidget to ensure this is the case.

As it happens, in most cases on Mac, this ends up being true by accident:
When detaching a tab into a new window, we attempt to acquire capture in
TabDragController::Attach, but fail because the window of the newly created
widget is not yet showing.

However, evidence from the field in the linked bug shows that in reality,
sometimes we *do* have capture while running a move loop. So at a minimum,
let's get our RunMoveLoop semantics in line with other platforms and see
what happens, though there's a lot of other stuff wrong with this situation
IMO.

Bug: 876493
Change-Id: If4e7a260d7be4e5f9272eca4b8eec73a8b52e156
Reviewed-on: https://chromium-review.googlesource.com/c/1315170Reviewed-by: default avatarElly Fong-Jones <ellyjones@chromium.org>
Commit-Queue: Leonard Grey <lgrey@chromium.org>
Cr-Commit-Position: refs/heads/master@{#604997}
parent 26430b7d
...@@ -568,6 +568,7 @@ Widget::MoveLoopResult NativeWidgetMac::RunMoveLoop( ...@@ -568,6 +568,7 @@ Widget::MoveLoopResult NativeWidgetMac::RunMoveLoop(
if (!bridge_impl()) if (!bridge_impl())
return Widget::MOVE_LOOP_CANCELED; return Widget::MOVE_LOOP_CANCELED;
ReleaseCapture();
return bridge_impl()->RunMoveLoop(drag_offset) ? Widget::MOVE_LOOP_SUCCESSFUL return bridge_impl()->RunMoveLoop(drag_offset) ? Widget::MOVE_LOOP_SUCCESSFUL
: Widget::MOVE_LOOP_CANCELED; : Widget::MOVE_LOOP_CANCELED;
} }
......
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