Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(110)

Issue 1747803003: MacViews: Implement Tab Dragging (Closed)

Created:
4 years, 9 months ago by themblsha
Modified:
4 years, 6 months ago
Reviewers:
tapted, sky
CC:
chromium-reviews, tfarina, dcheng, tdresser+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

MacViews: Implement Tab Dragging BridgedNativeWidget::RunMoveLoop() drags the window by manually processing mouse move events. Most of the tests in tab_drag_controller_interactive_uitest.cc pass, and I've added several Mac-specific ones to test for the edge cases. BUG=594079 COLLABORATOR=tapted@chromium.org Also reviewed in http://crrev.com/1259913003/ Committed: https://crrev.com/6984eac05884a72bc81697589817df83bcde0551 Cr-Commit-Position: refs/heads/master@{#400463}

Patch Set 1 #

Total comments: 23

Patch Set 2 : Removed debug logging, use CGEvents for drag-n-drop. #

Total comments: 6

Patch Set 3 : Wait for CocoaWindowMoveLoop to finish, fix PressEscapeWhileDetached test. #

Patch Set 4 : Extract DragsWindowUsingCocoaMoveLoop test, cleanup code. #

Total comments: 54

Patch Set 5 : Extract CocoaWindowMoveLoop, fix review issues. #

Total comments: 21

Patch Set 6 : Add CocoaShakeDetach test. #

Patch Set 7 : Fix dragging edge conditions, add tests for them (incomplete, sorry). #

Patch Set 8 : Fix dragging edge conditions, add tests for them. #

Patch Set 9 : Fix review issues. #

Total comments: 6

Patch Set 10 : Fix tests and review issues (incomplete, sorry). #

Patch Set 11 : Fix tests and review issues. #

Total comments: 70

Patch Set 12 : Fix review issues. #

Patch Set 13 : Replace GCD with DelegateSimpleThread, remove ConstrainToEnclosingRect function, cleanup code. #

Total comments: 4

Patch Set 14 : Replace MacDetachesWindowOnTopOfMacMenuBar with MacDetachesWindowAtTopOfScreen, rename kCocoaWindow… #

Patch Set 15 : Removed click simulation, reimplemented CocoaWindowMoveLoop without relying on the WindowServer. #

Total comments: 60

Patch Set 16 : Removed the traces of old code that relied on moving the window using WindowServer. #

Patch Set 17 : Remove CGEvent-generating code from ui_controls_mac.mm #

Total comments: 39

Patch Set 18 : Fix review issues. #

Total comments: 12

Patch Set 19 : Fix review issues. #

Total comments: 4

Patch Set 20 : Fix review issues. #

Total comments: 1

Patch Set 21 : Don't set the window position inside the RunMoveLoop call. #

Total comments: 2

Patch Set 22 : Remove crbug.com/518740-fixing code, remove DragAndDrop helpers that are no longer required without… #

Total comments: 2

Patch Set 23 : FIXME --> TODO #

Patch Set 24 : git cl upload --target_branch=master #

Patch Set 25 : Rebased on top of master. #

Patch Set 26 : Fix include. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+394 lines, -37 lines) Patch
M chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 12 chunks +37 lines, -12 lines 0 comments Download
M chrome/browser/ui/views/tabs/window_finder_mac.mm View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 chunk +25 lines, -2 lines 0 comments Download
M chrome/chrome_tests.gypi View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 1 chunk +0 lines, -1 line 0 comments Download
M chrome/test/BUILD.gn View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 1 chunk +1 line, -4 lines 0 comments Download
M ui/base/test/ui_controls_mac.mm View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 7 chunks +86 lines, -15 lines 0 comments Download
M ui/views/cocoa/bridged_native_widget.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 4 chunks +12 lines, -0 lines 0 comments Download
M ui/views/cocoa/bridged_native_widget.mm View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 3 chunks +38 lines, -0 lines 0 comments Download
A ui/views/cocoa/cocoa_window_move_loop.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1 chunk +53 lines, -0 lines 0 comments Download
A ui/views/cocoa/cocoa_window_move_loop.mm View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 1 chunk +127 lines, -0 lines 0 comments Download
M ui/views/cocoa/views_nswindow_delegate.mm View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1 chunk +7 lines, -0 lines 0 comments Download
M ui/views/views.gyp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 1 chunk +2 lines, -0 lines 0 comments Download
M ui/views/widget/native_widget_mac.mm View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 1 chunk +6 lines, -3 lines 0 comments Download

Messages

Total messages: 77 (15 generated)
themblsha
I've added one test for dragging. What do you think of this approach? I could ...
4 years, 9 months ago (2016-02-29 14:58:20 UTC) #1
tapted
On 2016/02/29 14:58:20, themblsha wrote: > I've added one test for dragging. What do you ...
4 years, 9 months ago (2016-03-01 08:11:58 UTC) #2
tapted
https://codereview.chromium.org/1747803003/diff/1/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc File chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc (right): https://codereview.chromium.org/1747803003/diff/1/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc#newcode2377 chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc:2377: #elif defined(USE_ASH) oh, and this [not stuff you added ...
4 years, 9 months ago (2016-03-01 08:30:10 UTC) #3
themblsha
https://codereview.chromium.org/1747803003/diff/1/ui/base/test/ui_controls_mac.mm File ui/base/test/ui_controls_mac.mm (right): https://codereview.chromium.org/1747803003/diff/1/ui/base/test/ui_controls_mac.mm#newcode186 ui/base/test/ui_controls_mac.mm:186: @interface EventDeletedTaskRunner : NSObject { On 2016/03/01 08:11:58, tapted ...
4 years, 9 months ago (2016-03-01 18:41:53 UTC) #4
themblsha
So I'm currently fixing the CocoaWindowMoveLoop not really working in the test.
4 years, 9 months ago (2016-03-01 18:42:45 UTC) #5
tapted
On 2016/03/01 18:42:45, themblsha wrote: > So I'm currently fixing the CocoaWindowMoveLoop not really working ...
4 years, 9 months ago (2016-03-01 22:38:00 UTC) #6
themblsha
Turns out the cocoa window moving works even when the application is completely frozen, so ...
4 years, 9 months ago (2016-03-02 17:34:29 UTC) #7
tapted
On 2016/03/02 17:34:29, themblsha wrote: > Turns out the cocoa window moving works even when ...
4 years, 9 months ago (2016-03-03 08:12:48 UTC) #8
themblsha
What do you think of this approach? Should I continue with fixing the remaining issues? ...
4 years, 9 months ago (2016-03-03 17:56:51 UTC) #9
tapted
Yeah - the g_use_cgevents approach looks like a good way to me. https://codereview.chromium.org/1747803003/diff/20001/chrome/test/base/interactive_test_utils_mac.mm File chrome/test/base/interactive_test_utils_mac.mm ...
4 years, 9 months ago (2016-03-04 06:33:08 UTC) #10
themblsha
Turns out that simply waiting for window_move_loop_ to become NULL is not enough, as there'll ...
4 years, 9 months ago (2016-03-04 17:47:03 UTC) #11
themblsha
Phew. Fixed all review issues. Some tests fail/timeout due to gray bar that appears on ...
4 years, 9 months ago (2016-03-09 17:40:22 UTC) #12
tapted
It'll need a proper CL description (the one on my earlier experiment is a bit ...
4 years, 9 months ago (2016-03-10 11:51:20 UTC) #13
themblsha
Didn't have the time yet to address bridged_content_view.{h,mm} issues yet, will do it tomorrow. Also ...
4 years, 9 months ago (2016-03-10 17:18:59 UTC) #14
tapted
I uploaded a couple of tricky test cases to a bug I created for this ...
4 years, 9 months ago (2016-03-11 09:38:28 UTC) #15
themblsha
On 2016/03/11 09:38:28, tapted wrote: > It would be nice to have a test that ...
4 years, 9 months ago (2016-03-11 10:33:20 UTC) #16
themblsha
Spent the day writing tests today, and only CocoaShakeDetach is somewhat usable: https://bugs.chromium.org/p/chromium/issues/detail?id=594079#c3
4 years, 9 months ago (2016-03-11 17:40:28 UTC) #17
themblsha
Hmm, botched the previous 'git cl upload' somehow, sorry for extra patchset :-/ Fixed most ...
4 years, 9 months ago (2016-03-25 17:22:54 UTC) #19
themblsha
DetachToBrowserTabDragControllerTest.CancelOnNewTabWhenDragging fails with a weird reason I wasn't yet able to fix: ending RunMoveLoop() somehow ...
4 years, 8 months ago (2016-04-05 17:20:43 UTC) #20
tapted
I'll do a more thorough review tomorrow, but it's a super complex CL. Just addressing ...
4 years, 8 months ago (2016-04-06 09:38:51 UTC) #21
themblsha
I'm working from home today and for some reason was unable to get 'git cl ...
4 years, 8 months ago (2016-04-06 17:54:11 UTC) #22
themblsha
Uploaded yesterdays fixes.
4 years, 8 months ago (2016-04-07 10:30:02 UTC) #23
tapted
On 2016/04/07 10:30:02, themblsha wrote: > Uploaded yesterdays fixes. There's still an issue with dragging ...
4 years, 8 months ago (2016-04-11 08:15:09 UTC) #24
tapted
OK this is enough to go on. Some (but not all) of the review recommendations ...
4 years, 8 months ago (2016-04-13 08:28:13 UTC) #25
themblsha
Guess I now have to clean up ui/gfx/geometry/rect* after your simplification of menu bar frame ...
4 years, 8 months ago (2016-04-18 09:30:02 UTC) #26
themblsha
I tried replacing GCD with base::Thread but it resulted in base::RunLoop never quitting, probably as ...
4 years, 8 months ago (2016-04-18 17:02:31 UTC) #27
tapted
Another pass - I'll try to absorb all the ui::DragAndDrop stuff this week and do ...
4 years, 8 months ago (2016-04-20 07:30:23 UTC) #28
themblsha
https://codereview.chromium.org/1747803003/diff/200001/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc File chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc (right): https://codereview.chromium.org/1747803003/diff/200001/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc#newcode1344 chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc:1344: ui_test_utils::DragAndDrop(tab_0_center, on_top_of_menu_bar); On 2016/04/20 07:30:22, tapted wrote: > On ...
4 years, 8 months ago (2016-04-20 13:38:40 UTC) #29
tapted
https://codereview.chromium.org/1747803003/diff/200001/ui/views/cocoa/cocoa_window_move_loop.mm File ui/views/cocoa/cocoa_window_move_loop.mm (right): https://codereview.chromium.org/1747803003/diff/200001/ui/views/cocoa/cocoa_window_move_loop.mm#newcode17 ui/views/cocoa/cocoa_window_move_loop.mm:17: @interface WeakCocoaWindowMoveLoop : NSObject { On 2016/04/20 13:38:40, themblsha ...
4 years, 7 months ago (2016-04-27 07:43:00 UTC) #30
themblsha
https://codereview.chromium.org/1747803003/diff/200001/ui/views/cocoa/cocoa_window_move_loop.mm File ui/views/cocoa/cocoa_window_move_loop.mm (right): https://codereview.chromium.org/1747803003/diff/200001/ui/views/cocoa/cocoa_window_move_loop.mm#newcode17 ui/views/cocoa/cocoa_window_move_loop.mm:17: @interface WeakCocoaWindowMoveLoop : NSObject { Turns out I had ...
4 years, 7 months ago (2016-04-28 17:39:29 UTC) #31
themblsha
https://codereview.chromium.org/1747803003/diff/200001/ui/views/cocoa/cocoa_window_move_loop.mm File ui/views/cocoa/cocoa_window_move_loop.mm (right): https://codereview.chromium.org/1747803003/diff/200001/ui/views/cocoa/cocoa_window_move_loop.mm#newcode17 ui/views/cocoa/cocoa_window_move_loop.mm:17: @interface WeakCocoaWindowMoveLoop : NSObject { Ah, I went on ...
4 years, 7 months ago (2016-04-28 18:01:51 UTC) #32
themblsha
Tried tracing malloc/free for the CGEvent using malloc_history, and it was a temporary object: stack[0]: ...
4 years, 7 months ago (2016-04-29 17:25:08 UTC) #33
themblsha
Did a bit more research on the issue. ### Reverse-engineering update: Turns out there are ...
4 years, 7 months ago (2016-05-17 14:43:33 UTC) #34
tapted
On 2016/05/17 14:43:33, themblsha wrote: > Did a bit more research on the issue. > ...
4 years, 7 months ago (2016-05-19 11:58:48 UTC) #35
themblsha
I reimplemented CocoaWindowMoveLoop without relying on the WindowServer. Should be more robust, but no more ...
4 years, 7 months ago (2016-05-20 17:36:00 UTC) #36
tapted
I haven't reviewed ui_controls_mac.mm thoroughly yet. And, conceptually, I'm OK with keeping the CGEvent stuff ...
4 years, 7 months ago (2016-05-23 07:29:29 UTC) #37
tapted
And do a pass yourself for other ways to simplify. E.g. SetMousePositionOverride and related methods ...
4 years, 7 months ago (2016-05-23 07:39:19 UTC) #38
themblsha
Phew, I think this is it. Cleaned up the comments and some other stuff as ...
4 years, 7 months ago (2016-05-26 15:13:26 UTC) #39
themblsha
Removed all the CGEvent-related code from this CL. Should be bare-bones now.
4 years, 6 months ago (2016-05-30 14:19:21 UTC) #40
tapted
On 2016/05/30 14:19:21, themblsha wrote: > Removed all the CGEvent-related code from this CL. Should ...
4 years, 6 months ago (2016-05-31 12:39:46 UTC) #41
tapted
OK - I think things are in pretty good shape. I should be able to ...
4 years, 6 months ago (2016-06-01 11:29:56 UTC) #42
themblsha
https://codereview.chromium.org/1747803003/diff/320001/chrome/test/base/interactive_test_utils.h File chrome/test/base/interactive_test_utils.h (right): https://codereview.chromium.org/1747803003/diff/320001/chrome/test/base/interactive_test_utils.h#newcode26 chrome/test/base/interactive_test_utils.h:26: void DragAndDrop(const gfx::Point& from, const gfx::Point& to, int steps ...
4 years, 6 months ago (2016-06-03 17:42:08 UTC) #44
tapted
https://codereview.chromium.org/1747803003/diff/320001/chrome/test/base/interactive_test_utils_mac.mm File chrome/test/base/interactive_test_utils_mac.mm (right): https://codereview.chromium.org/1747803003/diff/320001/chrome/test/base/interactive_test_utils_mac.mm#newcode108 chrome/test/base/interactive_test_utils_mac.mm:108: void DragAndDropSequence(const std::list<DragAndDropOperation>& operations) { On 2016/06/03 17:42:08, themblsha ...
4 years, 6 months ago (2016-06-06 07:12:36 UTC) #45
themblsha
https://codereview.chromium.org/1747803003/diff/320001/ui/base/test/ui_controls_mac.mm File ui/base/test/ui_controls_mac.mm (right): https://codereview.chromium.org/1747803003/diff/320001/ui/base/test/ui_controls_mac.mm#newcode213 ui/base/test/ui_controls_mac.mm:213: - (NSPoint)mouseLocationOutsideOfEventStream { On 2016/06/06 07:12:36, tapted wrote: > ...
4 years, 6 months ago (2016-06-06 17:20:27 UTC) #46
tapted
lgtm - just some final stuff since `MockNSEventClassMethods` is now staying in the .mm file. ...
4 years, 6 months ago (2016-06-07 00:49:14 UTC) #47
themblsha
+sky Please review these files: chrome/browser/ui/views/tabs/tab_drag_controller.cc chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc chrome/browser/ui/views/tabs/window_finder_mac.mm chrome/test/base/interactive_test_utils.h chrome/test/base/interactive_test_utils_mac.mm ui/views/views.gyp chrome/browser/ui/views/tabs/tab_drag_controller.cc: The offset in ...
4 years, 6 months ago (2016-06-07 12:11:11 UTC) #49
sky
https://codereview.chromium.org/1747803003/diff/380001/chrome/browser/ui/views/tabs/tab_drag_controller.cc File chrome/browser/ui/views/tabs/tab_drag_controller.cc (right): https://codereview.chromium.org/1747803003/diff/380001/chrome/browser/ui/views/tabs/tab_drag_controller.cc#newcode396 chrome/browser/ui/views/tabs/tab_drag_controller.cc:396: RunMoveLoop(GetWindowOffset(start_point_in_screen_)); I think the right thing here is to ...
4 years, 6 months ago (2016-06-07 15:57:55 UTC) #50
themblsha
On 2016/06/07 15:57:55, sky wrote: > https://codereview.chromium.org/1747803003/diff/380001/chrome/browser/ui/views/tabs/tab_drag_controller.cc > File chrome/browser/ui/views/tabs/tab_drag_controller.cc (right): > > https://codereview.chromium.org/1747803003/diff/380001/chrome/browser/ui/views/tabs/tab_drag_controller.cc#newcode396 > ...
4 years, 6 months ago (2016-06-08 17:17:48 UTC) #51
sky
On Wed, Jun 8, 2016 at 10:17 AM, <mblsha@yandex-team.ru> wrote: > On 2016/06/07 15:57:55, sky ...
4 years, 6 months ago (2016-06-08 20:07:43 UTC) #52
themblsha
Sorry, didn't notice your reply last week :-( I think I found the solution that ...
4 years, 6 months ago (2016-06-14 18:06:04 UTC) #53
sky
https://codereview.chromium.org/1747803003/diff/400001/chrome/browser/ui/views/tabs/tab_drag_controller.cc File chrome/browser/ui/views/tabs/tab_drag_controller.cc (right): https://codereview.chromium.org/1747803003/diff/400001/chrome/browser/ui/views/tabs/tab_drag_controller.cc#newcode394 chrome/browser/ui/views/tabs/tab_drag_controller.cc:394: views::Widget* widget = GetAttachedBrowserWidget(); As this part is really ...
4 years, 6 months ago (2016-06-16 15:56:12 UTC) #54
themblsha
If you're ok with this CL, I can start fixing crbug.com/518740 after this one lands. ...
4 years, 6 months ago (2016-06-17 14:58:07 UTC) #55
sky
LGTM https://codereview.chromium.org/1747803003/diff/420001/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc File chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc (right): https://codereview.chromium.org/1747803003/diff/420001/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc#newcode1328 chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc:1328: // FIXME(mblsha): Fails on MacViews because of crbug.com/518740 ...
4 years, 6 months ago (2016-06-17 15:15:18 UTC) #56
themblsha
https://codereview.chromium.org/1747803003/diff/420001/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc File chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc (right): https://codereview.chromium.org/1747803003/diff/420001/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc#newcode1328 chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc:1328: // FIXME(mblsha): Fails on MacViews because of crbug.com/518740 On ...
4 years, 6 months ago (2016-06-17 15:26:39 UTC) #57
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1747803003/440001
4 years, 6 months ago (2016-06-17 15:27:00 UTC) #60
commit-bot: I haz the power
CLs for remote refs other than refs/pending/heads/master must contain NOTRY=true and NOPRESUBMIT=true in order for ...
4 years, 6 months ago (2016-06-17 15:27:04 UTC) #62
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1747803003/460001
4 years, 6 months ago (2016-06-17 15:37:07 UTC) #65
commit-bot: I haz the power
Try jobs failed on following builders: ios-simulator on tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/ios-simulator/builds/22752) ios-simulator-gn on tryserver.chromium.mac (JOB_FAILED, ...
4 years, 6 months ago (2016-06-17 15:38:46 UTC) #67
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1747803003/480001
4 years, 6 months ago (2016-06-17 17:18:05 UTC) #70
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1747803003/500001
4 years, 6 months ago (2016-06-17 17:41:17 UTC) #73
commit-bot: I haz the power
Committed patchset #26 (id:500001)
4 years, 6 months ago (2016-06-17 18:38:41 UTC) #75
commit-bot: I haz the power
4 years, 6 months ago (2016-06-17 18:39:46 UTC) #77
Message was sent while issue was closed.
Patchset 26 (id:??) landed as
https://crrev.com/6984eac05884a72bc81697589817df83bcde0551
Cr-Commit-Position: refs/heads/master@{#400463}

Powered by Google App Engine
This is Rietveld 408576698