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

See Also:


Attachments
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
<rdar://problem/16413795>
Comment 2 Daniel Bates 2014-04-17 15:38:16 PDT
Created attachment 229586 [details]
Patch
Comment 3 Daniel Bates 2014-04-17 15:45:33 PDT
Created attachment 229587 [details]
Patch
Comment 4 Daniel Bates 2014-04-17 16:12:31 PDT
Comment on attachment 229587 [details]
Patch

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]
Patch
Comment 6 Benjamin Poulain 2014-04-17 18:53:52 PDT
Comment on attachment 229603 [details]
Patch

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());

Probably ASSERT_NOT_REACHED here.

> 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]
Patch

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>.