Bug 131821 - [iOS] Hook up screen.{availHeight, availWidth, height, width}
Summary: [iOS] Hook up screen.{availHeight, availWidth, height, width}
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: 528+ (Nightly build)
Hardware: iPhone / iPad Unspecified
: P2 Normal
Assignee: Daniel Bates
Keywords: InRadar
Depends on:
Reported: 2014-04-17 15:14 PDT by Daniel Bates
Modified: 2014-04-18 10:21 PDT (History)
8 users (show)

See Also:

Patch (12.34 KB, patch)
2014-04-17 15:38 PDT, Daniel Bates
no flags Details | Formatted Diff | Diff
Patch (12.43 KB, patch)
2014-04-17 15:45 PDT, Daniel Bates
no flags Details | Formatted Diff | Diff
Patch (22.40 KB, patch)
2014-04-17 17:54 PDT, Daniel Bates
no flags Details | Formatted Diff | Diff
Patch (26.35 KB, patch)
2014-04-17 20:15 PDT, Daniel Bates
benjamin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Bates 2014-04-17 15:14:16 PDT
Currently querying properties window.screen.{availHeight, availWidth, height, width} always returns 0 in WebKit2 on iOS. We should hook up the platform-specific logic so that these properties return the actual screen size and available screen size dimensions.
Comment 1 Daniel Bates 2014-04-17 15:14:31 PDT
Comment 2 Daniel Bates 2014-04-17 15:38:16 PDT
Created attachment 229586 [details]
Comment 3 Daniel Bates 2014-04-17 15:45:33 PDT
Created attachment 229587 [details]
Comment 4 Daniel Bates 2014-04-17 16:12:31 PDT
Comment on attachment 229587 [details]

After talking with Tim Horton in-person today, it's sufficient to use WKGetViewportScreenSize() and the associated WebKit2 logic for the screen size. We can take a similar approach for exposing the available screen size.
Comment 5 Daniel Bates 2014-04-17 17:54:02 PDT
Created attachment 229603 [details]
Comment 6 Benjamin Poulain 2014-04-17 18:53:52 PDT
Comment on attachment 229603 [details]

View in context: https://bugs.webkit.org/attachment.cgi?id=229603&action=review

Why does the code use the name "viewportAvailableScreenSize"? The screen size is completely orthogonal to the viewport?

> Source/WebKit/ios/WebCoreSupport/WebChromeClientIOS.mm:182
> +    return FloatSize(WKGetViewportAvailableScreenSize());


> Source/WebKit2/UIProcess/WebPageProxy.cpp:4151
>      parameters.viewportScreenSize = viewportScreenSize();
> +    parameters.viewportAvailableScreenSize = viewportAvailableScreenSize();

Let's unify this, name it screenSize, and push it to the viewport.
Comment 7 Daniel Bates 2014-04-17 20:15:31 PDT
Created attachment 229617 [details]

Updated patch based on Benjamin Poulain's remarks
Comment 8 Daniel Bates 2014-04-17 20:51:48 PDT
Committed r167481: <http://trac.webkit.org/changeset/167481>
Comment 9 Daniel Bates 2014-04-18 10:21:11 PDT
Sorted added entries to WebCore.exp.in and substituted _wkGetAvailableScreenSize for _wkGetViewportAvailableScreenSize in the ChangeLog entry for <http://trac.webkit.org/changeset/167481> and committed this fix in <http://trac.webkit.org/changeset/167493>.