Bug 131821

Summary: [iOS] Hook up screen.{availHeight, availWidth, height, width}
Product: WebKit Reporter: Daniel Bates <dbates>
Component: WebKit2Assignee: Daniel Bates <dbates>
Status: RESOLVED FIXED    
Severity: Normal CC: andersca, commit-queue, ddkilzer, esprehn+autocc, kangil.han, sam, simon.fraser, thorton
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: iPhone / iPad   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch benjamin: review+

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