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

Issue 2549543002: Clamp dialog bounds to be fully visible on the nearest display (Closed)

Created:
4 years ago by kylix_rd
Modified:
4 years ago
Reviewers:
msw, Daniel Erat
CC:
chromium-reviews, blundell+watchlist_chromium.org, sdefresne+watchlist_chromium.org, droger+watchlist_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Clamp dialog bounds to be fully visible on the nearest display If a displayed modal dialog is partially or entirely off-screen, the user may be unable to interact with it or even be aware of its presence. This change ensures that the dialog is moved to the nearest display so that it is fully visible to the user. BUG=668734 Committed: https://crrev.com/51116b9a03e97df9962af7b22e0f3661dbd6efb3 Cr-Commit-Position: refs/heads/master@{#439127}

Patch Set 1 #

Total comments: 18

Patch Set 2 : Fixed a nit #

Patch Set 3 : Moved MoveScreenRectToNearestDisplay() back to constrained window #

Patch Set 4 : Addressed all the feedback #

Total comments: 4

Patch Set 5 : Moved code inline and incorporated suggestions #

Patch Set 6 : Added unittest for clamping dialog #

Total comments: 4

Patch Set 7 : Better unit test #

Total comments: 4

Patch Set 8 : Make the dialog smaller than the display #

Unified diffs Side-by-side diffs Delta from patch set Stats (+54 lines, -1 line) Patch
M components/constrained_window/BUILD.gn View 1 chunk +1 line, -0 lines 0 comments Download
M components/constrained_window/DEPS View 1 chunk +1 line, -0 lines 0 comments Download
M components/constrained_window/constrained_window_views.cc View 1 2 3 4 2 chunks +15 lines, -1 line 0 comments Download
M components/constrained_window/constrained_window_views_unittest.cc View 1 2 3 4 5 6 7 2 chunks +37 lines, -0 lines 0 comments Download

Messages

Total messages: 48 (20 generated)
kylix_rd
4 years ago (2016-12-01 16:28:30 UTC) #5
kylix_rd
marcheu@ - please review/verify new display::Screen::MoveScreenRectToNearestDisplay() method msw@ - please validate use of the aforementioned ...
4 years ago (2016-12-12 22:20:44 UTC) #7
msw
https://codereview.chromium.org/2549543002/diff/1/ui/display/screen.cc File ui/display/screen.cc (right): https://codereview.chromium.org/2549543002/diff/1/ui/display/screen.cc#newcode38 ui/display/screen.cc:38: //static nit: space after slashes https://codereview.chromium.org/2549543002/diff/1/ui/display/screen.cc#newcode39 ui/display/screen.cc:39: gfx::Rect Screen::MoveScreenRectToNearestDisplay( ...
4 years ago (2016-12-12 23:04:35 UTC) #8
kylix_rd
https://codereview.chromium.org/2549543002/diff/1/ui/display/screen.cc File ui/display/screen.cc (right): https://codereview.chromium.org/2549543002/diff/1/ui/display/screen.cc#newcode39 ui/display/screen.cc:39: gfx::Rect Screen::MoveScreenRectToNearestDisplay( On 2016/12/12 23:04:35, msw wrote: > Will ...
4 years ago (2016-12-13 14:17:44 UTC) #9
msw
Can you add some tests (for constrained windows)? https://codereview.chromium.org/2549543002/diff/1/ui/display/screen.cc File ui/display/screen.cc (right): https://codereview.chromium.org/2549543002/diff/1/ui/display/screen.cc#newcode38 ui/display/screen.cc:38: //static ...
4 years ago (2016-12-13 22:52:44 UTC) #10
kylix_rd
Tests will be forthcoming. https://codereview.chromium.org/2549543002/diff/1/ui/display/screen.cc File ui/display/screen.cc (right): https://codereview.chromium.org/2549543002/diff/1/ui/display/screen.cc#newcode38 ui/display/screen.cc:38: //static On 2016/12/13 22:52:43, msw ...
4 years ago (2016-12-14 17:35:10 UTC) #11
msw
https://codereview.chromium.org/2549543002/diff/1/ui/display/screen.cc File ui/display/screen.cc (right): https://codereview.chromium.org/2549543002/diff/1/ui/display/screen.cc#newcode39 ui/display/screen.cc:39: gfx::Rect Screen::MoveScreenRectToNearestDisplay( On 2016/12/14 17:35:10, kylix_rd wrote: > On ...
4 years ago (2016-12-14 18:22:06 UTC) #12
msw
Apparently Chrome OS already clamps dialogs onscreen, where's that code? https://codereview.chromium.org/2549543002/diff/1/ui/display/screen.cc File ui/display/screen.cc (right): https://codereview.chromium.org/2549543002/diff/1/ui/display/screen.cc#newcode44 ...
4 years ago (2016-12-14 18:45:12 UTC) #13
kylix_rd
On 2016/12/14 18:45:12, msw wrote: > Apparently Chrome OS already clamps dialogs onscreen, where's that ...
4 years ago (2016-12-14 18:54:00 UTC) #14
kylix_rd
4 years ago (2016-12-14 20:19:30 UTC) #17
msw
Please address my comments regarding using the parent's bounds, using Rect::AdjustToFit, and please consider changing ...
4 years ago (2016-12-14 20:29:38 UTC) #18
kylix_rd
This should, hopefully, address your concerns. It's using the host widget's center point to determine ...
4 years ago (2016-12-14 22:15:32 UTC) #19
msw
This seems much better; thanks. https://codereview.chromium.org/2549543002/diff/80001/components/constrained_window/constrained_window_views.cc File components/constrained_window/constrained_window_views.cc (right): https://codereview.chromium.org/2549543002/diff/80001/components/constrained_window/constrained_window_views.cc#newcode86 components/constrained_window/constrained_window_views.cc:86: gfx::Point MoveRectToNearestHostDisplay(const gfx::Rect& screen_rect, ...
4 years ago (2016-12-14 22:37:08 UTC) #20
kylix_rd
msw@ review incorporated suggestions derat@ please verify addition of +ui/display to DEPS
4 years ago (2016-12-15 15:15:08 UTC) #23
Daniel Erat
DEPS lgtm. can you add tests for this to the _unittest.cc file?
4 years ago (2016-12-15 15:19:12 UTC) #26
msw
The code lgtm, I can take another pass for unit tests.
4 years ago (2016-12-15 16:15:13 UTC) #27
kylix_rd
Unit test added.
4 years ago (2016-12-15 19:43:54 UTC) #30
msw
https://codereview.chromium.org/2549543002/diff/140001/components/constrained_window/constrained_window_views_unittest.cc File components/constrained_window/constrained_window_views_unittest.cc (right): https://codereview.chromium.org/2549543002/diff/140001/components/constrained_window/constrained_window_views_unittest.cc#newcode245 components/constrained_window/constrained_window_views_unittest.cc:245: const gfx::Rect bounds = display.bounds(); use Rect::Union (or skip ...
4 years ago (2016-12-15 20:46:09 UTC) #33
kylix_rd
Update test based on feedback. It now only ensures that the dialog is, in fact, ...
4 years ago (2016-12-15 21:30:16 UTC) #34
msw
This looks pretty good, just one question, hoping that we can do a more rigorous ...
4 years ago (2016-12-15 21:44:56 UTC) #35
kylix_rd
https://codereview.chromium.org/2549543002/diff/160001/components/constrained_window/constrained_window_views_unittest.cc File components/constrained_window/constrained_window_views_unittest.cc (right): https://codereview.chromium.org/2549543002/diff/160001/components/constrained_window/constrained_window_views_unittest.cc#newcode262 components/constrained_window/constrained_window_views_unittest.cc:262: // visible. Due to the constraints set, it may ...
4 years ago (2016-12-15 21:57:56 UTC) #36
msw
https://codereview.chromium.org/2549543002/diff/160001/components/constrained_window/constrained_window_views_unittest.cc File components/constrained_window/constrained_window_views_unittest.cc (right): https://codereview.chromium.org/2549543002/diff/160001/components/constrained_window/constrained_window_views_unittest.cc#newcode262 components/constrained_window/constrained_window_views_unittest.cc:262: // visible. Due to the constraints set, it may ...
4 years ago (2016-12-15 22:17:41 UTC) #37
kylix_rd
https://codereview.chromium.org/2549543002/diff/160001/components/constrained_window/constrained_window_views_unittest.cc File components/constrained_window/constrained_window_views_unittest.cc (right): https://codereview.chromium.org/2549543002/diff/160001/components/constrained_window/constrained_window_views_unittest.cc#newcode262 components/constrained_window/constrained_window_views_unittest.cc:262: // visible. Due to the constraints set, it may ...
4 years ago (2016-12-15 22:21:53 UTC) #38
kylix_rd
Setting the preferred size of the dialog contents works. Thanks for the tip.
4 years ago (2016-12-16 14:56:42 UTC) #39
msw
lgtm
4 years ago (2016-12-16 15:18:04 UTC) #40
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2549543002/180001
4 years ago (2016-12-16 15:45:29 UTC) #43
commit-bot: I haz the power
Committed patchset #8 (id:180001)
4 years ago (2016-12-16 16:48:43 UTC) #46
commit-bot: I haz the power
4 years ago (2016-12-16 16:52:37 UTC) #48
Message was sent while issue was closed.
Patchset 8 (id:??) landed as
https://crrev.com/51116b9a03e97df9962af7b22e0f3661dbd6efb3
Cr-Commit-Position: refs/heads/master@{#439127}

Powered by Google App Engine
This is Rietveld 408576698