cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Joe Bowser (JIRA)" <>
Subject [jira] [Commented] (CB-10378) Viewport dimensions swapped after app restore in Android
Date Mon, 18 Jan 2016 23:05:39 GMT


Joe Bowser commented on CB-10378:

I can reproduce this with both Crosswalk and the Android WebView, but I think this is a Chromium/Android
bug that we really have very little control over, or is something that would be technically
expensive to fix.

It seems that when you restore an application, the WebView is rendered in portrait, then resized
to landscape and the screen.availWidth and screen.availHeight values aren't updated.  This
is really irritating, but without messing with the WebView initialization, we can't do anything
about this.  I think forcing the WebView to reset its state after we restore it would cause
a lot more problems, which is why I don't want to do it in this case.

I would recommend using window.innerHeight and window.innerWidth, since unlike screen.width
or screen.availWidth.  I don't see any distortions on the screen suggesting that the application
viewport is rendered a the wrong scale, so it appears that it's just the values that are screwed

> Viewport dimensions swapped after app restore in Android
> --------------------------------------------------------
>                 Key: CB-10378
>                 URL:
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Android
>    Affects Versions: 5.4.1
>         Environment: Cordova Android 4.1.1 or 5.0.0
>            Reporter: Mathijs
> h1. Steps to reproduce
> 1. Assure {{<preference name="Orientation" value="landscape" />}} in {{config.xml}}
> 2. (Clean) start the app
> 3. Press the back button
> 4. Open the app switcher
> 5. Select the app
> h1. Expected behaviour
> As the app is started the measurements.js code dumps {{screen.availWidth}} and {{screen.availHeight}}.
When restoring it after pressing the back button, the app initializes again and the same values
should be displayed.
> h1. Perceived behaviour
> The values for {{screen.availWidth}} and {{screen.availHeight}} are swapped. This causes
the app's viewport to be renedered at the wrong scale.

This message was sent by Atlassian JIRA

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message