Bug 133205 - [iOS] WK2: Provide implementation for windowFrame
Summary: [iOS] WK2: Provide implementation for windowFrame
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: 528+ (Nightly build)
Hardware: iPhone / iPad All
: P2 Normal
Assignee: Brent Fulgham
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2014-05-22 22:34 PDT by Brent Fulgham
Modified: 2014-05-23 14:33 PDT (History)
4 users (show)

See Also:


Attachments
Patch. (2.73 KB, patch)
2014-05-22 22:41 PDT, Brent Fulgham
no flags Details | Formatted Diff | Diff
Patch (2.78 KB, patch)
2014-05-23 14:22 PDT, Brent Fulgham
benjamin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Brent Fulgham 2014-05-22 22:34:03 PDT
The WK2 layer for iOS was missing an implementation for windowRect, causing DOMWindow::outerWidth and DOMWindow::outerHeight to always return 0, 0.
Comment 1 Brent Fulgham 2014-05-22 22:34:22 PDT
<rdar://problem/16894890>
Comment 2 Brent Fulgham 2014-05-22 22:37:50 PDT
And by windowRect I meant windowFrame.
Comment 3 Brent Fulgham 2014-05-22 22:41:00 PDT
Created attachment 231942 [details]
Patch.
Comment 4 Benjamin Poulain 2014-05-23 02:06:21 PDT
Comment on attachment 231942 [details]
Patch.

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

Let's talk about it tomorrow.

After reading http://www.quirksmode.org/blog/archives/2012/03/windowouterwidt.html
it looks like we have an extra bug to fix on WebKit1... :(

> Source/WebKit2/UIProcess/Cocoa/UIDelegate.mm:252
> +    return WebCore::enclosingIntRect(m_uiDelegate.m_webView.frame);

I think you want to the bounds, not the frame.

We should have an extra step here:
-Try to get the UIWindow from the WebView. If there is a window, return that size.
-If there is not window, return the WebView bounds.

> Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm:309
> +    FloatRect userRect(rect);
> +    userRect.scale(m_webView->_page->deviceScaleFactor());
> +    return userRect;

Sorry, that's my fault. When you said we need to convert the rect to user space, I thought you meant in the WebProcess to convert to ContentCoordinates.

This is not right. I think you can just return the incoming rect here on iOS.
Comment 5 Brent Fulgham 2014-05-23 14:22:39 PDT
Created attachment 231988 [details]
Patch
Comment 6 Benjamin Poulain 2014-05-23 14:24:42 PDT
Comment on attachment 231988 [details]
Patch

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

> Source/WebKit2/UIProcess/Cocoa/UIDelegate.mm:252
> +    UIWindow* window = m_uiDelegate.m_webView.window;

if (UIWindow* window = m_uiDelegate.m_webView.window)
    ...

> Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm:312
> +    return rect; // Nothing to do on iOS

Missing period.
But I think you should remove the comment.
Comment 7 Brent Fulgham 2014-05-23 14:33:10 PDT
Committed r169281: <http://trac.webkit.org/changeset/169281>