Commit c59b58e4 authored by Henrique Ferreiro's avatar Henrique Ferreiro Committed by Commit Bot

Share code between content::Get{Default,NativeView}ScreenInfo

On Aura platforms, calling display::screen::GetDisplayNearestView() with
a nullptr as the native view always results in the primary display being
returned. Use this fact to implement GetDefaultScreenInfo() in terms of
GetNativeViewScreenInfo().

Change-Id: I51275e03449f73450d4aa20629a674beb7298182
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2228531Reviewed-by: default avatarccameron <ccameron@chromium.org>
Commit-Queue: Henrique Ferreiro <hferreiro@igalia.com>
Cr-Commit-Position: refs/heads/master@{#774832}
parent 1e149a4d
......@@ -53,21 +53,7 @@ void DisplayUtil::DisplayToScreenInfo(ScreenInfo* screen_info,
// static
void DisplayUtil::GetDefaultScreenInfo(ScreenInfo* screen_info) {
// Some tests are run with no Screen initialized.
display::Screen* screen = display::Screen::GetScreen();
if (!screen) {
*screen_info = ScreenInfo();
return;
}
#if defined(USE_AURA)
// This behavior difference between Aura and other platforms may or may not
// be intentional, and may or may not have any effect.
gfx::NativeView null_native_view = nullptr;
display::Display display = screen->GetDisplayNearestView(null_native_view);
#else
display::Display display = screen->GetPrimaryDisplay();
#endif
DisplayToScreenInfo(screen_info, display);
return GetNativeViewScreenInfo(screen_info, nullptr);
}
// static
......
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