DescriptionAndroid ScreenInfo size in DIP instead of device pixels.
So far, Chrome for Android has always passed around screen sizes in
physical device pixels instead of DIPs (density independent pixels).
Most other platforms (e.g. Chrome OS) are sizing everything in DIPs
(except in places like the compositor that actually do painting).
This patch make Chrome for Android also size the screen in DIPs.
This is visible all the way to JavaScript/CSS:
- JS screen.{width,availWidth} and CSS @media device-width
- use: width() and availWidth()
in third_party/WebKit/Source/WebCore/page/Screen.cpp
and: device_widthMediaFeatureEval
in third_party/WebKit/Source/WebCore/css/MediaQueryEvaluator.cpp
- that use: screenRect and screenAvailableRect
in third_party/WebKit/
Source/WebCore/platform/chromium/PlatformScreenChromium.cpp
- that use: screenInfo()
in third_party/WebKit/
Source/WebKit/chromium/public/WebWidgetClient.h
- implemented by: content/renderer/render_widget.cc
- whose screen_info_ member is initialized by the constructor
- with a value from: GetWebScreenInfo(WebKit::WebScreenInfo* result)
in content/browser/renderer_host/render_widget_host_impl.cc
- that uses: GetScreenInfo(WebKit::WebScreenInfo* result)
in content/browser/renderer_host/render_widget_host_view_android.cc
- that uses: GetDefaultScreenInfo(WebKit::WebScreenInfo* results)
in content/browser/renderer_host/render_widget_host_view_android.cc
- that before this patch, used: GetDisplayWidth()
in ui/gfx/android/device_display_info.cc
which called out to JNI
- but after this patch, uses: bounds()
in ui/gfx/display.h
- whose bounds_ member is initialized by the constructor
- with a value from: GetPrimaryDisplay()
in ui/gfx/screen_android.cc
- which also uses: GetDisplayWidth()
in ui/gfx/android/device_display_info.cc
but first divides by device_scale_factor
Hence JS screen.{width,availWidth} and CSS @media device-width now
return values in DIPs (which is good) instead of physical device
pixels (which was bad).
Miraculously, this change doesn't seem to have broken anything in
Chrome for Android, though I'm still awaiting the try results ;-)
BUG=168325
Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=183061
Patch Set 1 #
Total comments: 1
Messages
Total messages: 5 (0 generated)
|