Bug 188772 - Allow override of viewport configuration
Summary: Allow override of viewport configuration
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-08-20 18:18 PDT by James Savage
Modified: 2018-09-26 15:31 PDT (History)
9 users (show)

See Also:


Attachments
Patch (9.55 KB, patch)
2018-08-20 18:26 PDT, James Savage
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews202 for win-future (12.73 MB, application/zip)
2018-08-21 09:08 PDT, EWS Watchlist
no flags Details
Patch (9.51 KB, patch)
2018-08-28 13:20 PDT, James Savage
no flags Details | Formatted Diff | Diff
Patch (16.19 KB, patch)
2018-09-13 00:27 PDT, James Savage
no flags Details | Formatted Diff | Diff
Patch (16.94 KB, patch)
2018-09-25 15:20 PDT, James Savage
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description James Savage 2018-08-20 18:18:35 PDT
<rdar://problem/43538408>
Comment 1 Radar WebKit Bug Importer 2018-08-20 18:19:42 PDT
<rdar://problem/43538892>
Comment 2 James Savage 2018-08-20 18:26:50 PDT
Created attachment 347590 [details]
Patch
Comment 3 Simon Fraser (smfr) 2018-08-20 18:34:24 PDT
Comment on attachment 347590 [details]
Patch

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

> Source/WebCore/page/ViewportConfiguration.h:105
> +    WEBCORE_EXPORT static Parameters deviceWebpageParameters();

This is a somewhat confusing name. Maybe put it above webpageParameters() and add a comment saying that it uses device width and scale 1.

> Source/WebKit/WebProcess/WebPage/WebPage.cpp:1803
> +    if (m_page->settings().shouldIgnoreMetaViewport() || m_viewportConfiguration.setViewportArguments(viewportArguments))
>          viewportConfigurationChanged();

Why trigger viewportConfigurationChanged() every time if meta viewport is ignored?

> Source/WebKit/WebProcess/WebPage/WebPage.cpp:5320
> +    if (!m_page->settings().shouldIgnoreMetaViewport() && m_viewportConfiguration.setViewportArguments(coreFrame->document()->viewportArguments()))
>          viewportChanged = true;

Ditto.
Comment 4 James Savage 2018-08-20 18:36:40 PDT
Comment on attachment 347590 [details]
Patch

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

>> Source/WebKit/WebProcess/WebPage/WebPage.cpp:1803
>>          viewportConfigurationChanged();
> 
> Why trigger viewportConfigurationChanged() every time if meta viewport is ignored?

I could be misremembering, but if I skipped this then web content would not re-layout when the web view size changed.

>> Source/WebKit/WebProcess/WebPage/WebPage.cpp:5320
>>          viewportChanged = true;
> 
> Ditto.

Same for this.
Comment 5 EWS Watchlist 2018-08-21 09:08:08 PDT
Comment on attachment 347590 [details]
Patch

Attachment 347590 [details] did not pass win-ews (win):
Output: https://webkit-queues.webkit.org/results/8930504

New failing tests:
http/tests/security/video-poster-cross-origin-crash2.html
Comment 6 EWS Watchlist 2018-08-21 09:08:20 PDT
Created attachment 347645 [details]
Archive of layout-test-results from ews202 for win-future

The attached test failures were seen while running run-webkit-tests on the win-ews.
Bot: ews202  Port: win-future  Platform: CYGWIN_NT-6.1-2.10.0-0.325-5-3-x86_64-64bit
Comment 7 Simon Fraser (smfr) 2018-08-21 12:14:48 PDT
Comment on attachment 347590 [details]
Patch

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

> Source/WebKit/UIProcess/API/Cocoa/WKPreferences.mm:785
> +#if PLATFORM(IOS)

We don't like the #ifdefs. Maybe just leave this stuff on for all platforms; it will just be a no-op on macOS.

> Source/WebKit/UIProcess/API/Cocoa/WKPreferencesPrivate.h:146
> -#if !TARGET_OS_IPHONE
> +#if TARGET_OS_IPHONE
> +@property (nonatomic, setter=_setShouldIgnoreMetaViewport:) BOOL _shouldIgnoreMetaViewport WK_API_AVAILABLE(ios(WK_IOS_TBA));
> +#else

We don't like the #ifdefs. Maybe just leave this stuff on for all platforms; it will just be a no-op on macOS.
Comment 8 James Savage 2018-08-28 13:20:18 PDT
Created attachment 348329 [details]
Patch
Comment 9 Simon Fraser (smfr) 2018-08-29 13:15:59 PDT
Comment on attachment 348329 [details]
Patch

Looks good but this needs to have some tests. It should be possible to test with TestWebKitAPI tests.
Comment 10 mitz 2018-09-12 23:45:21 PDT
How does this bug relate to bug 167734? Is it a duplicate? It’s best to not end up with multiple similar but subtly different APIs for doing things in this area.
Comment 11 James Savage 2018-09-13 00:27:32 PDT
Created attachment 349638 [details]
Patch
Comment 12 Simon Fraser (smfr) 2018-09-13 17:30:30 PDT
Comment on attachment 349638 [details]
Patch

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

> LayoutTests/ChangeLog:15
> +        * fast/viewport/ios/ipad/baseline.html: Added.

baseline.html is a confusing name. Maybe just no-viewport.html.

> LayoutTests/ChangeLog:17
> +        * fast/viewport/ios/ipad/meta-viewport-disabled.html: Added.

I would not use  -disabled in a test name; it's too easily confused with the test being disabled. Call it meta-viewport-ignored.html.

> LayoutTests/fast/viewport/ios/ipad/baseline.html:5
> +    <meta name="viewport" content="">

Is this equivalent to no viewport tag at all?
Comment 13 James Savage 2018-09-13 17:32:11 PDT
Comment on attachment 349638 [details]
Patch

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

>> LayoutTests/ChangeLog:15
>> +        * fast/viewport/ios/ipad/baseline.html: Added.
> 
> baseline.html is a confusing name. Maybe just no-viewport.html.

Will change.

>> LayoutTests/ChangeLog:17
>> +        * fast/viewport/ios/ipad/meta-viewport-disabled.html: Added.
> 
> I would not use  -disabled in a test name; it's too easily confused with the test being disabled. Call it meta-viewport-ignored.html.

Will change.

>> LayoutTests/fast/viewport/ios/ipad/baseline.html:5
>> +    <meta name="viewport" content="">
> 
> Is this equivalent to no viewport tag at all?

As best I can tell yes. I chose this route to avoid updating the test javascript, which makes the assumption that there will be a viewport tag and hits an exception if there is not. But if you’d rather I can patch the JS to deal with no meta tag rather than doing this.
Comment 14 James Savage 2018-09-25 15:20:08 PDT
Created attachment 350799 [details]
Patch
Comment 15 WebKit Commit Bot 2018-09-26 15:31:26 PDT
Comment on attachment 350799 [details]
Patch

Clearing flags on attachment: 350799

Committed r236530: <https://trac.webkit.org/changeset/236530>
Comment 16 WebKit Commit Bot 2018-09-26 15:31:28 PDT
All reviewed patches have been landed.  Closing bug.