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

Issue 11348033: Initialize device scale factor correctly on Android (Closed)

Created:
8 years, 1 month ago by Sami
Modified:
8 years, 1 month ago
CC:
chromium-reviews, joi+watch-content_chromium.org, darin-cc_chromium.org, jam, Peter Beverloo
Visibility:
Public.

Description

Initialize device scale factor correctly on Android The device scale factor was being initialized on Android, but was later getting overridden back to the default value of 1. This patch fixes the problem by moving the scale factor initialization from RenderViewImpl to RenderWidget as is done on other platforms. TEST=ViewportTest Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=168021

Patch Set 1 #

Total comments: 10

Patch Set 2 : Simpler fix and better test #

Total comments: 2

Patch Set 3 : Don't truncate scale factor on Android. Tested on Nexus 4, 7, 10. #

Patch Set 4 : Moved scale factor logic to gfx::Display #

Total comments: 9

Patch Set 5 : Use min(hdpi, vdpi). Make sure device_scale_factor >= 1. #

Total comments: 3

Patch Set 6 : Allocate Display on the stack. #

Patch Set 7 : Hook up WebScreenInfo.deviceScaleFactor #

Total comments: 3

Patch Set 8 : Added TODO for updating device scale factor based on ScreenInfo. #

Patch Set 9 : Don't truncate scale factor on Chrome OS. #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+84 lines, -15 lines) Patch
M content/browser/renderer_host/render_widget_host_view_android.cc View 1 2 3 4 5 6 7 1 chunk +1 line, -0 lines 0 comments Download
M content/browser/renderer_host/render_widget_host_view_aura.cc View 1 2 3 4 5 6 7 1 chunk +1 line, -0 lines 0 comments Download
M content/common/view_messages.h View 1 2 3 4 5 6 7 1 chunk +1 line, -0 lines 0 comments Download
A content/public/android/javatests/src/org/chromium/content/browser/ViewportTest.java View 1 1 chunk +71 lines, -0 lines 0 comments Download
M content/renderer/render_view_impl.cc View 1 2 3 4 5 6 7 1 chunk +0 lines, -2 lines 0 comments Download
M content/renderer/render_widget.cc View 1 2 3 4 5 6 7 4 chunks +2 lines, -12 lines 0 comments Download
M ui/gfx/display.cc View 1 2 3 4 5 6 7 8 1 chunk +8 lines, -1 line 1 comment Download

Messages

Total messages: 44 (0 generated)
Sami
Adding jamesr for content/renderer. johnme, bulach: How do you like the test?
8 years, 1 month ago (2012-10-30 11:42:14 UTC) #1
johnme
Thanks for fixing this! https://codereview.chromium.org/11348033/diff/1/content/public/android/javatests/src/org/chromium/content/browser/ViewportTest.java File content/public/android/javatests/src/org/chromium/content/browser/ViewportTest.java (right): https://codereview.chromium.org/11348033/diff/1/content/public/android/javatests/src/org/chromium/content/browser/ViewportTest.java#newcode60 content/public/android/javatests/src/org/chromium/content/browser/ViewportTest.java:60: // window.devicePixelRatio should match the ...
8 years, 1 month ago (2012-10-30 14:38:23 UTC) #2
jamesr
On 2012/10/30 14:38:23, johnme wrote: > content/renderer/render_widget.cc:134: device_scale_factor_ = > device_info->GetDPIScale(); > There's also device ...
8 years, 1 month ago (2012-10-30 22:20:44 UTC) #3
aelias_OOO_until_Jul13
FYI (not that this is relevant to this patch, but for future work in this ...
8 years, 1 month ago (2012-10-30 22:26:52 UTC) #4
Sami
https://codereview.chromium.org/11348033/diff/1/content/public/android/javatests/src/org/chromium/content/browser/ViewportTest.java File content/public/android/javatests/src/org/chromium/content/browser/ViewportTest.java (right): https://codereview.chromium.org/11348033/diff/1/content/public/android/javatests/src/org/chromium/content/browser/ViewportTest.java#newcode60 content/public/android/javatests/src/org/chromium/content/browser/ViewportTest.java:60: // window.devicePixelRatio should match the default display. Only check ...
8 years, 1 month ago (2012-10-31 11:12:57 UTC) #5
johnme
https://codereview.chromium.org/11348033/diff/7001/content/renderer/render_widget.cc File content/renderer/render_widget.cc (right): https://codereview.chromium.org/11348033/diff/7001/content/renderer/render_widget.cc#newcode121 content/renderer/render_widget.cc:121: #if defined(OS_CHROMEOS) || defined(OS_MACOSX) || defined(OS_ANDROID) Woah, this code ...
8 years, 1 month ago (2012-10-31 11:48:37 UTC) #6
Sami
https://codereview.chromium.org/11348033/diff/7001/content/renderer/render_widget.cc File content/renderer/render_widget.cc (right): https://codereview.chromium.org/11348033/diff/7001/content/renderer/render_widget.cc#newcode121 content/renderer/render_widget.cc:121: #if defined(OS_CHROMEOS) || defined(OS_MACOSX) || defined(OS_ANDROID) On 2012/10/31 11:48:37, ...
8 years, 1 month ago (2012-10-31 11:51:40 UTC) #7
Sami
+ben for ui/gfx. Took another stab at consolidating the scale factor logic to gfx::Display. PTAL.
8 years, 1 month ago (2012-11-02 15:59:07 UTC) #8
Sami
Anyone have a moment to review this?
8 years, 1 month ago (2012-11-06 11:11:13 UTC) #9
bulach
I'm not familiar with this area so will defer to others, sorry! just one question ...
8 years, 1 month ago (2012-11-06 13:42:09 UTC) #10
johnme
https://codereview.chromium.org/11348033/diff/12004/content/public/android/javatests/src/org/chromium/content/browser/ViewportTest.java File content/public/android/javatests/src/org/chromium/content/browser/ViewportTest.java (right): https://codereview.chromium.org/11348033/diff/12004/content/public/android/javatests/src/org/chromium/content/browser/ViewportTest.java#newcode68 content/public/android/javatests/src/org/chromium/content/browser/ViewportTest.java:68: assertTrue(viewportWidth >= 979); On 2012/11/06 13:42:09, bulach wrote: > ...
8 years, 1 month ago (2012-11-06 15:45:34 UTC) #11
johnme
+oshima, who's been heavily involved in display.cc
8 years, 1 month ago (2012-11-06 15:46:12 UTC) #12
Sami
https://codereview.chromium.org/11348033/diff/12004/content/public/android/javatests/src/org/chromium/content/browser/ViewportTest.java File content/public/android/javatests/src/org/chromium/content/browser/ViewportTest.java (right): https://codereview.chromium.org/11348033/diff/12004/content/public/android/javatests/src/org/chromium/content/browser/ViewportTest.java#newcode68 content/public/android/javatests/src/org/chromium/content/browser/ViewportTest.java:68: assertTrue(viewportWidth >= 979); Thanks for confirming that John. I ...
8 years, 1 month ago (2012-11-06 17:08:46 UTC) #13
Sami
On 2012/11/06 17:08:46, Sami wrote: > Good idea, that makes things a little cleaner. Someone ...
8 years, 1 month ago (2012-11-06 17:14:35 UTC) #14
johnme
On 2012/11/06 17:14:35, Sami wrote: > On 2012/11/06 17:08:46, Sami wrote: > > Good idea, ...
8 years, 1 month ago (2012-11-06 18:04:00 UTC) #15
jamesr
lgtm for content/renderer https://codereview.chromium.org/11348033/diff/9005/content/renderer/render_widget.cc File content/renderer/render_widget.cc (right): https://codereview.chromium.org/11348033/diff/9005/content/renderer/render_widget.cc#newcode126 content/renderer/render_widget.cc:126: scoped_ptr<gfx::Display> display(new gfx::Display()); why heap allocate? ...
8 years, 1 month ago (2012-11-06 18:36:13 UTC) #16
Sami
On 2012/11/06 18:36:13, jamesr wrote: > why heap allocate? can't this go on the stack? ...
8 years, 1 month ago (2012-11-06 18:40:32 UTC) #17
oshima
can you add scale factor to ScreenInfo instead as mentioned in crbug.com/155213? https://codereview.chromium.org/11348033/diff/9005/ui/gfx/display.cc File ui/gfx/display.cc ...
8 years, 1 month ago (2012-11-06 18:40:35 UTC) #18
Sami
> can you add scale factor to ScreenInfo instead as mentioned in crbug.com/155213? Thanks for ...
8 years, 1 month ago (2012-11-06 18:52:56 UTC) #19
oshima
On 2012/11/06 18:52:56, Sami wrote: > > can you add scale factor to ScreenInfo instead ...
8 years, 1 month ago (2012-11-06 19:53:08 UTC) #20
johnme
On 2012/11/06 19:53:08, oshima wrote: > IIRC, android used to support scale factor <1.0, but ...
8 years, 1 month ago (2012-11-07 10:44:59 UTC) #21
oshima
On 2012/11/07 10:44:59, johnme wrote: > On 2012/11/06 19:53:08, oshima wrote: > > IIRC, android ...
8 years, 1 month ago (2012-11-07 16:55:42 UTC) #22
Sami
I looked into fixing this in WebScreenInfo and have formulated this cunning 5 step plan: ...
8 years, 1 month ago (2012-11-07 19:09:17 UTC) #23
oshima
On 2012/11/07 19:09:17, Sami wrote: > I looked into fixing this in WebScreenInfo and have ...
8 years, 1 month ago (2012-11-07 21:06:15 UTC) #24
johnme
On 2012/11/07 19:09:17, Sami wrote: > I looked into fixing this in WebScreenInfo and have ...
8 years, 1 month ago (2012-11-08 12:49:46 UTC) #25
Sami
On 2012/11/08 12:49:46, johnme wrote: > - Agree with oshima that it would be nice ...
8 years, 1 month ago (2012-11-08 16:23:35 UTC) #26
Sami
This is a combination of steps 2 and 4 since I realized they can go ...
8 years, 1 month ago (2012-11-09 14:04:37 UTC) #27
Sami
oshima@, do you think this patch looks okay now? If so, I'll try to get ...
8 years, 1 month ago (2012-11-12 21:49:46 UTC) #28
Sami
I checked offline with oshima@ that he's happy with this, so: sky@: could you please ...
8 years, 1 month ago (2012-11-14 16:05:05 UTC) #29
oshima
lgtm with a few questions. https://codereview.chromium.org/11348033/diff/13008/content/renderer/render_widget.cc File content/renderer/render_widget.cc (right): https://codereview.chromium.org/11348033/diff/13008/content/renderer/render_widget.cc#newcode1594 content/renderer/render_widget.cc:1594: screen_info_ = screen_info; can ...
8 years, 1 month ago (2012-11-14 16:52:35 UTC) #30
johnme
https://codereview.chromium.org/11348033/diff/13008/ui/gfx/display.cc File ui/gfx/display.cc (right): https://codereview.chromium.org/11348033/diff/13008/ui/gfx/display.cc#newcode94 ui/gfx/display.cc:94: device_scale_factor_ = std::max(1.0f, device_scale_factor_); On 2012/11/14 16:52:35, oshima wrote: ...
8 years, 1 month ago (2012-11-14 16:56:45 UTC) #31
oshima
On 2012/11/14 16:56:45, johnme wrote: > https://codereview.chromium.org/11348033/diff/13008/ui/gfx/display.cc > File ui/gfx/display.cc (right): > > https://codereview.chromium.org/11348033/diff/13008/ui/gfx/display.cc#newcode94 > ...
8 years, 1 month ago (2012-11-14 17:07:36 UTC) #32
oshima
On 2012/11/14 17:07:36, oshima wrote: > On 2012/11/14 16:56:45, johnme wrote: > > https://codereview.chromium.org/11348033/diff/13008/ui/gfx/display.cc > ...
8 years, 1 month ago (2012-11-14 17:18:45 UTC) #33
johnme
On 2012/11/14 17:18:45, oshima wrote: > On 2012/11/14 17:07:36, oshima wrote: > > We'd like ...
8 years, 1 month ago (2012-11-14 17:47:57 UTC) #34
Sami
On 2012/11/14 16:52:35, oshima wrote: > lgtm with a few questions. > > https://codereview.chromium.org/11348033/diff/13008/content/renderer/render_widget.cc > ...
8 years, 1 month ago (2012-11-14 18:37:26 UTC) #35
oshima
still lgtm On 2012/11/14 17:47:57, johnme wrote: > On 2012/11/14 17:18:45, oshima wrote: > > ...
8 years, 1 month ago (2012-11-14 20:25:50 UTC) #36
Sami
On 2012/11/14 20:25:50, oshima wrote: > Thanks, can you just remove defined(OS_CHROMEOS) then? Done.
8 years, 1 month ago (2012-11-14 20:30:44 UTC) #37
Cris Neckar
lgtm for view_messages
8 years, 1 month ago (2012-11-14 20:36:09 UTC) #38
bulach
lgtm for android/, thanks!
8 years, 1 month ago (2012-11-15 00:39:22 UTC) #39
sky
https://codereview.chromium.org/11348033/diff/12016/ui/gfx/display.cc File ui/gfx/display.cc (right): https://codereview.chromium.org/11348033/diff/12016/ui/gfx/display.cc#newcode87 ui/gfx/display.cc:87: #if defined(OS_MACOSX) Shouldn't this be done at the call ...
8 years, 1 month ago (2012-11-15 17:23:51 UTC) #40
Sami
On 2012/11/15 17:23:51, sky wrote: > https://codereview.chromium.org/11348033/diff/12016/ui/gfx/display.cc > File ui/gfx/display.cc (right): > > https://codereview.chromium.org/11348033/diff/12016/ui/gfx/display.cc#newcode87 > ...
8 years, 1 month ago (2012-11-15 17:31:38 UTC) #41
sky
LGTM
8 years, 1 month ago (2012-11-15 18:26:23 UTC) #42
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/skyostil@chromium.org/11348033/12016
8 years, 1 month ago (2012-11-15 18:49:17 UTC) #43
commit-bot: I haz the power
8 years, 1 month ago (2012-11-15 20:49:55 UTC) #44
Change committed as 168021

Powered by Google App Engine
This is Rietveld 408576698