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

Issue 1426933002: Refactor Windows DPI Point, Rect, and Size for Multiple Monitor DPI Awareness (Closed)

Created:
5 years, 1 month ago by robliao
Modified:
4 years, 7 months ago
Reviewers:
oshima, sky, scottmg
CC:
chromium-reviews, extensions-reviews_chromium.org, tdanderson+views_chromium.org, kalyank, tapted, tfarina, jam, sievers+watch_chromium.org, jbauman+watch_chromium.org, nona+watch_chromium.org, Matt Giuca, darin-cc_chromium.org, shuchen+watch_chromium.org, piman+watch_chromium.org, chromium-apps-reviews_chromium.org, danakj+watch_chromium.org, James Su, yusukes+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Refactor Windows DPI Point, Rect, and Size for Multiple Monitor DPI Awareness In Windows 8.1 and above, a machine with multiple monitors can have a different DPI for each monitor. This means that we can no longer use global DPI scaling to convert between screen pixels and device-independent points. Additionally, top-level windows can span multiple monitors. Fortunately, the window is affine to a DPI, so within a window, a single DPI will apply. To begin to accommodate multiple-DPIs, these Windows scaling functions will now take an HWND to determine the DPI context and then perform the scale. Given that the DPI will be determined by gfx::Display in gfx::Screen, ScreenWin seems like an appropriate home for these now. All callers of the old functions have been directed to use the new functions. The visual behavior of Chrome should not change with this CL. BUG=426656

Patch Set 1 #

Total comments: 16

Patch Set 2 : CR Feedback #

Total comments: 8

Patch Set 3 : CR Feedback #

Patch Set 4 : Rebase to fa85647 #

Patch Set 5 : Continuous DIP Space #

Patch Set 6 : Rebase to 4e67acc and Support Windows Virtualized DPI #

Patch Set 7 : Rebase to b840e2f #

Total comments: 3

Patch Set 8 : Make DisplayWin Standalone #

Patch Set 9 : Fixed Other Unit Tests - Moved Inner Classes Outside #

Total comments: 4
Unified diffs Side-by-side diffs Delta from patch set Stats (+2691 lines, -302 lines) Patch
M chrome/browser/extensions/display_info_provider_win.cc View 1 2 3 4 5 2 chunks +3 lines, -5 lines 0 comments Download
M chrome/browser/ui/views/frame/browser_desktop_window_tree_host_win.cc View 1 2 3 4 5 2 chunks +3 lines, -2 lines 0 comments Download
M chrome/browser/ui/views/tabs/tab_strip.cc View 1 2 3 4 5 6 2 chunks +2 lines, -2 lines 0 comments Download
M chrome/browser/ui/views/tabs/window_finder_win.cc View 1 2 3 4 5 3 chunks +3 lines, -3 lines 0 comments Download
M content/browser/renderer_host/input/web_input_event_builders_win.cc View 1 2 3 4 5 6 2 chunks +2 lines, -2 lines 0 comments Download
M content/browser/renderer_host/legacy_render_widget_host_win.cc View 1 2 3 2 chunks +2 lines, -2 lines 0 comments Download
M content/browser/renderer_host/render_widget_host_view_aura.cc View 1 2 3 4 5 6 4 chunks +6 lines, -5 lines 0 comments Download
M content/browser/renderer_host/render_widget_host_view_base.cc View 1 2 3 4 5 4 chunks +5 lines, -4 lines 0 comments Download
M content/child/npapi/webplugin_delegate_impl_win.cc View 1 2 3 4 5 2 chunks +5 lines, -3 lines 0 comments Download
M ui/app_list/views/apps_grid_view.cc View 1 2 3 4 5 2 chunks +3 lines, -2 lines 0 comments Download
M ui/base/ime/input_method_win.cc View 1 2 3 4 5 3 chunks +5 lines, -3 lines 0 comments Download
M ui/gfx/BUILD.gn View 1 2 3 4 5 6 7 8 1 chunk +10 lines, -0 lines 0 comments Download
M ui/gfx/display.h View 1 2 3 4 5 6 7 8 1 chunk +2 lines, -0 lines 2 comments Download
M ui/gfx/gfx.gyp View 1 2 3 4 5 6 7 8 1 chunk +10 lines, -0 lines 0 comments Download
M ui/gfx/gfx_tests.gyp View 1 2 3 4 1 chunk +1 line, -0 lines 0 comments Download
M ui/gfx/screen.h View 1 2 3 4 5 1 chunk +10 lines, -0 lines 0 comments Download
M ui/gfx/screen.cc View 1 2 3 4 5 2 chunks +18 lines, -1 line 0 comments Download
M ui/gfx/screen_win.h View 1 2 3 4 5 6 7 8 2 chunks +104 lines, -18 lines 0 comments Download
M ui/gfx/screen_win.cc View 1 2 3 4 5 6 7 8 6 chunks +168 lines, -125 lines 0 comments Download
M ui/gfx/screen_win_unittest.cc View 1 2 3 4 5 6 7 8 3 chunks +980 lines, -15 lines 0 comments Download
A ui/gfx/win/display_info.h View 1 2 3 4 5 6 7 8 1 chunk +46 lines, -0 lines 0 comments Download
A ui/gfx/win/display_info.cc View 1 2 3 4 5 6 7 8 1 chunk +88 lines, -0 lines 0 comments Download
A ui/gfx/win/display_manager.h View 1 2 3 4 5 6 7 8 1 chunk +85 lines, -0 lines 0 comments Download
A ui/gfx/win/display_manager.cc View 1 2 3 4 5 6 7 8 1 chunk +286 lines, -0 lines 0 comments Download
A ui/gfx/win/display_manager_observer.h View 1 2 3 4 5 6 7 8 1 chunk +31 lines, -0 lines 0 comments Download
A ui/gfx/win/display_manager_observer.cc View 1 2 3 4 5 6 7 8 1 chunk +13 lines, -0 lines 0 comments Download
M ui/gfx/win/dpi.h View 1 2 3 4 5 6 7 8 3 chunks +1 line, -18 lines 0 comments Download
M ui/gfx/win/dpi.cc View 1 2 3 4 5 6 7 8 4 chunks +13 lines, -55 lines 0 comments Download
A ui/gfx/win/rect_util.h View 1 2 3 4 5 6 7 8 1 chunk +73 lines, -0 lines 0 comments Download
A ui/gfx/win/rect_util.cc View 1 2 3 4 5 6 7 8 1 chunk +250 lines, -0 lines 0 comments Download
A ui/gfx/win/rect_util_unittest.cc View 1 2 3 4 5 6 7 8 1 chunk +322 lines, -0 lines 0 comments Download
A ui/gfx/win/screen_win_display.h View 1 2 3 4 5 6 7 8 1 chunk +42 lines, -0 lines 0 comments Download
A ui/gfx/win/screen_win_display.cc View 1 2 3 4 5 6 7 8 1 chunk +58 lines, -0 lines 0 comments Download
M ui/views/controls/menu/menu_controller.cc View 1 2 3 4 5 6 2 chunks +2 lines, -2 lines 0 comments Download
M ui/views/corewm/tooltip_win.cc View 4 chunks +7 lines, -6 lines 0 comments Download
M ui/views/widget/desktop_aura/desktop_native_widget_aura.cc View 1 2 3 4 5 2 chunks +3 lines, -12 lines 0 comments Download
M ui/views/widget/desktop_aura/desktop_window_tree_host_win.h View 1 2 3 4 5 1 chunk +1 line, -0 lines 0 comments Download
M ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc View 1 2 3 4 5 6 9 chunks +19 lines, -10 lines 0 comments Download
M ui/views/win/hwnd_message_handler.cc View 1 2 3 4 5 2 chunks +2 lines, -3 lines 0 comments Download
M ui/views/win/hwnd_message_handler_delegate.h View 1 2 3 4 5 1 chunk +2 lines, -0 lines 0 comments Download
M ui/wm/core/default_screen_position_client.cc View 1 2 3 4 5 2 chunks +5 lines, -4 lines 2 comments Download

Messages

Total messages: 43 (16 generated)
robliao
Here's a first shot and the first part of handling multiple monitor DPI.
5 years, 1 month ago (2015-10-28 17:51:08 UTC) #2
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1426933002/1 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1426933002/1
5 years, 1 month ago (2015-10-28 17:54:04 UTC) #4
scottmg
Great stuff! I'm a little concerned/sad that we still diverge from CrOS. Is this necessary ...
5 years, 1 month ago (2015-10-28 18:48:21 UTC) #8
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: win_chromium_x64_rel_ng on tryserver.chromium.win (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.win/builders/win_chromium_x64_rel_ng/builds/123172)
5 years, 1 month ago (2015-10-28 19:39:53 UTC) #10
robliao
Thanks for the comments! > I'm a little concerned/sad that we still diverge from CrOS. ...
5 years, 1 month ago (2015-10-29 00:30:24 UTC) #11
sky
https://codereview.chromium.org/1426933002/diff/20001/chrome/browser/ui/views/frame/browser_desktop_window_tree_host_win.cc File chrome/browser/ui/views/frame/browser_desktop_window_tree_host_win.cc (right): https://codereview.chromium.org/1426933002/diff/20001/chrome/browser/ui/views/frame/browser_desktop_window_tree_host_win.cc#newcode323 chrome/browser/ui/views/frame/browser_desktop_window_tree_host_win.cc:323: tabstrip_bounds = gfx::ScreenWin::DIPToClientRect(GetHWND(), Is there a reason for changing ...
5 years, 1 month ago (2015-10-29 15:51:51 UTC) #12
oshima
On 2015/10/29 00:30:24, robliao (OOO through Sept. 2) wrote: > Thanks for the comments! > ...
5 years, 1 month ago (2015-10-29 19:01:52 UTC) #13
robliao
After a busy week, I finally have time to get to this review! Thanks for ...
5 years, 1 month ago (2015-11-07 00:56:40 UTC) #14
oshima
On Fri, Nov 6, 2015 at 4:56 PM, <robliao@chromium.org> wrote: > After a busy week, ...
5 years, 1 month ago (2015-11-07 01:45:36 UTC) #15
robliao
I'm at a point where the DIP layout is converging (at least the tests are) ...
5 years ago (2015-12-18 09:45:43 UTC) #21
robliao
Alright. I think things are converging here. Feel free to take a look. Thanks!
4 years, 11 months ago (2016-01-13 00:41:34 UTC) #24
robliao
On 2016/01/13 00:41:34, robliao wrote: > Alright. I think things are converging here. Feel free ...
4 years, 11 months ago (2016-01-15 18:11:03 UTC) #25
oshima
can you update the description with brief description of what this CL changes existing code? ...
4 years, 11 months ago (2016-01-15 18:26:03 UTC) #26
robliao
Added "All callers of the old functions have been directed to use the new functions." ...
4 years, 11 months ago (2016-01-15 19:28:16 UTC) #29
oshima
https://codereview.chromium.org/1426933002/diff/260001/ui/gfx/display.h File ui/gfx/display.h (right): https://codereview.chromium.org/1426933002/diff/260001/ui/gfx/display.h#newcode61 ui/gfx/display.h:61: virtual ~Display(); On 2016/01/15 19:28:16, robliao wrote: > On ...
4 years, 11 months ago (2016-01-15 19:55:53 UTC) #30
robliao
On 2016/01/15 19:55:53, oshima wrote: > https://codereview.chromium.org/1426933002/diff/260001/ui/gfx/display.h > File ui/gfx/display.h (right): > > https://codereview.chromium.org/1426933002/diff/260001/ui/gfx/display.h#newcode61 > ...
4 years, 11 months ago (2016-01-15 20:10:46 UTC) #31
robliao
On 2016/01/15 20:10:46, robliao wrote: > On 2016/01/15 19:55:53, oshima wrote: > > https://codereview.chromium.org/1426933002/diff/260001/ui/gfx/display.h > ...
4 years, 11 months ago (2016-01-15 21:41:17 UTC) #33
oshima
On 2016/01/15 20:10:46, robliao wrote: > On 2016/01/15 19:55:53, oshima wrote: > > https://codereview.chromium.org/1426933002/diff/260001/ui/gfx/display.h > ...
4 years, 11 months ago (2016-01-15 21:41:59 UTC) #34
robliao
On 2016/01/15 21:41:59, oshima wrote: > On 2016/01/15 20:10:46, robliao wrote: > > On 2016/01/15 ...
4 years, 11 months ago (2016-01-16 02:16:45 UTC) #35
robliao
scottmg: Per oshima@, feel free to take a look at the latest patch. Thanks!
4 years, 11 months ago (2016-01-21 01:59:21 UTC) #36
scottmg
On 2016/01/21 01:59:21, robliao wrote: > scottmg: Per oshima@, feel free to take a look ...
4 years, 11 months ago (2016-01-21 03:51:25 UTC) #37
robliao
On 2016/01/21 03:51:25, scottmg wrote: > On 2016/01/21 01:59:21, robliao wrote: > > scottmg: Per ...
4 years, 11 months ago (2016-01-21 17:07:40 UTC) #38
robliao
On 2016/01/21 17:07:40, robliao wrote: > On 2016/01/21 03:51:25, scottmg wrote: > > On 2016/01/21 ...
4 years, 11 months ago (2016-01-21 17:47:27 UTC) #39
oshima
one nit and one qq. https://codereview.chromium.org/1426933002/diff/320001/ui/gfx/display.h File ui/gfx/display.h (right): https://codereview.chromium.org/1426933002/diff/320001/ui/gfx/display.h#newcode25 ui/gfx/display.h:25: // Display is designed ...
4 years, 11 months ago (2016-01-21 17:47:44 UTC) #40
scottmg
On 2016/01/21 17:47:27, robliao wrote: > On 2016/01/21 17:07:40, robliao wrote: > > On 2016/01/21 ...
4 years, 11 months ago (2016-01-21 17:59:47 UTC) #41
robliao
https://codereview.chromium.org/1426933002/diff/320001/ui/gfx/display.h File ui/gfx/display.h (right): https://codereview.chromium.org/1426933002/diff/320001/ui/gfx/display.h#newcode25 ui/gfx/display.h:25: // Display is designed to be copied, so don't ...
4 years, 11 months ago (2016-01-21 18:19:20 UTC) #42
oshima
4 years, 11 months ago (2016-01-21 18:31:11 UTC) #43
On 2016/01/21 18:19:20, robliao wrote:
> https://codereview.chromium.org/1426933002/diff/320001/ui/gfx/display.h
> File ui/gfx/display.h (right):
> 
>
https://codereview.chromium.org/1426933002/diff/320001/ui/gfx/display.h#newco...
> ui/gfx/display.h:25: // Display is designed to be copied, so don't inherit
from
> this class!
> On 2016/01/21 17:47:44, oshima wrote:
> > can you make the class final instead? I believe it's allowed now.
> 
> Will do! That can be a separate CL too.
> 
>
https://codereview.chromium.org/1426933002/diff/320001/ui/wm/core/default_scr...
> File ui/wm/core/default_screen_position_client.cc (right):
> 
>
https://codereview.chromium.org/1426933002/diff/320001/ui/wm/core/default_scr...
> ui/wm/core/default_screen_position_client.cc:26: gfx::Rect dip_bounds =
> screen->ScreenToDIPRectInWindow(window, screen_bounds);
> On 2016/01/21 17:47:44, oshima wrote:
> > is this screen_bounds in native screen coordinates?
> 
> We really need that units refactor.
> 
> GetOriginInScreen returns a Screen point in DIP units.
> root_window->GetHost()->GetBounds() returns a rect in Screen coordinates in
> physical pixel units (In Windows, it calls directly into GetClientRect + a
> ClientToScreen call)

If that's only the difference, how about having WTH::GetBoundsInNavie and
GetBoundsInDIP (which are the same on chromeos/mac but differ on Windows), and
use that instead?

> 
> The conversion step turns it into screen coordinates + DIP units.

Powered by Google App Engine
This is Rietveld 408576698