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

Unified Diff: ui/gfx/screen_android.cc

Issue 374303002: ui: Use physical size for gfx::Display on Android if available. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « android_webview/javatests/src/org/chromium/android_webview/test/AwLegacyQuirksTest.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/screen_android.cc
diff --git a/ui/gfx/screen_android.cc b/ui/gfx/screen_android.cc
index 9114b8554537519fb2eec3966cc4c12710b308ab..31e3baaeea5bf4c77677dd37e72216857d8e41bb 100644
--- a/ui/gfx/screen_android.cc
+++ b/ui/gfx/screen_android.cc
@@ -33,10 +33,16 @@ class ScreenAndroid : public Screen {
virtual gfx::Display GetPrimaryDisplay() const OVERRIDE {
gfx::DeviceDisplayInfo device_info;
const float device_scale_factor = device_info.GetDIPScale();
+ // Note: GetPhysicalDisplayWidth/Height() does not subtract window
+ // decorations etc. Use it instead of GetDisplayWidth/Height() when
+ // available.
const gfx::Rect bounds_in_pixels =
- gfx::Rect(
- device_info.GetDisplayWidth(),
- device_info.GetDisplayHeight());
+ gfx::Rect(device_info.GetPhysicalDisplayWidth()
+ ? device_info.GetPhysicalDisplayWidth()
+ : device_info.GetDisplayWidth(),
+ device_info.GetPhysicalDisplayHeight()
+ ? device_info.GetPhysicalDisplayHeight()
+ : device_info.GetDisplayHeight());
const gfx::Rect bounds_in_dip =
gfx::Rect(gfx::ToCeiledSize(gfx::ScaleSize(
bounds_in_pixels.size(), 1.0f / device_scale_factor)));
« no previous file with comments | « android_webview/javatests/src/org/chromium/android_webview/test/AwLegacyQuirksTest.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698