Bug 190504 - [iOS] Allow SPI clients to lay out at arbitrarily scaled sizes and scale to fit the view
Summary: [iOS] Allow SPI clients to lay out at arbitrarily scaled sizes and scale to f...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit API (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Wenson Hsieh
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-10-11 18:50 PDT by Wenson Hsieh
Modified: 2018-10-15 10:39 PDT (History)
5 users (show)

See Also:


Attachments
First pass (45.28 KB, patch)
2018-10-11 20:17 PDT, Wenson Hsieh
no flags Details | Formatted Diff | Diff
Fix WPE/GTK builds (45.84 KB, patch)
2018-10-11 22:40 PDT, Wenson Hsieh
thorton: review+
Details | Formatted Diff | Diff
Patch for EWS (48.52 KB, patch)
2018-10-12 14:49 PDT, Wenson Hsieh
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Wenson Hsieh 2018-10-11 18:50:47 PDT
<rdar://problem/45117760>
Comment 1 Wenson Hsieh 2018-10-11 20:17:08 PDT
Created attachment 352130 [details]
First pass
Comment 2 Wenson Hsieh 2018-10-11 22:40:28 PDT
Created attachment 352136 [details]
Fix WPE/GTK builds
Comment 3 Tim Horton 2018-10-12 13:21:24 PDT
Comment on attachment 352136 [details]
Fix WPE/GTK builds

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

> Source/WebCore/page/ViewportConfiguration.cpp:434
> +    m_configuration.initialScale *= m_layoutSizeScaleFactor;

Hi-larious

> Source/WebCore/page/ViewportConfiguration.cpp:549
> +    ts.dumpProperty("initialScaleIgnoringLayoutScaleFactor", parameters.initialScaleIgnoringLayoutScaleFactor);

Probably also print out m_layoutSizeScaleFactor??

> Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:5166
>      if (viewScale <= 0 || isnan(viewScale) || isinf(viewScale))
>          [NSException raise:NSInvalidArgumentException format:@"View scale should be a positive number"];

Why is this in the !PLATFORM(MAC) section

> Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h:180
> +@property (nonatomic, setter=_setViewScale:) CGFloat _viewScale WK_API_AVAILABLE(macosx(10.11), ios(9.0));

Whoops

> Tools/ChangeLog:22
> +        Add a new file for UIScriptController methods on Cocoa platforms.

Noice. There's some other stuff we can move here.
Comment 4 Wenson Hsieh 2018-10-12 13:44:36 PDT
Comment on attachment 352136 [details]
Fix WPE/GTK builds

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

>> Source/WebCore/page/ViewportConfiguration.cpp:549
>> +    ts.dumpProperty("initialScaleIgnoringLayoutScaleFactor", parameters.initialScaleIgnoringLayoutScaleFactor);
> 
> Probably also print out m_layoutSizeScaleFactor??

Yes!

>> Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:5166
>>          [NSException raise:NSInvalidArgumentException format:@"View scale should be a positive number"];
> 
> Why is this in the !PLATFORM(MAC) section

Can't think of a good reason! Interestingly, WebViewImpl::setViewScale throws this same exception. I'll lift this `+[NSException raise:]` call out of !MAC for now, and move the identical macOS exception throwing logic from WebViewImpl to WKView.

>> Tools/ChangeLog:22
>> +        Add a new file for UIScriptController methods on Cocoa platforms.
> 
> Noice. There's some other stuff we can move here.

Indeed! Will move cross-macOS-iOS functionality here in a followup.

> LayoutTests/resources/ui-helper.js:348
> +        return new Promise(resolve => testRunner.runUIScript(`uiController.setViewScale(${scale})`, () => resolve()));

Note to self: I should just pass `resolve` here rather than wrapping it in another callback.
Comment 5 Wenson Hsieh 2018-10-12 14:49:04 PDT
Created attachment 352206 [details]
Patch for EWS
Comment 6 WebKit Commit Bot 2018-10-12 16:13:45 PDT
Comment on attachment 352206 [details]
Patch for EWS

Clearing flags on attachment: 352206

Committed r237087: <https://trac.webkit.org/changeset/237087>