Bug 196680

Summary: Add @page margin support
Product: WebKit Reporter: zalan <zalan>
Component: Layout and RenderingAssignee: zalan <zalan>
Status: RESOLVED FIXED    
Severity: Normal CC: bfulgham, commit-queue, Hironori.Fujii, jonlee, ryanhaddad, simon.fraser, thorton, zalan
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=85062
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch
none
Patch none

Description zalan 2019-04-06 13:43:10 PDT
@page {
    margin: 5.0mm;
}
Comment 1 zalan 2019-04-06 13:48:53 PDT
Created attachment 366889 [details]
Patch
Comment 2 zalan 2019-04-06 16:40:56 PDT
Created attachment 366893 [details]
Patch
Comment 3 zalan 2019-04-11 13:20:37 PDT
<rdar://problem/45217707>
Comment 4 zalan 2019-04-11 13:44:40 PDT
Created attachment 367238 [details]
Patch
Comment 5 Tim Horton 2019-04-11 13:55:08 PDT
Comment on attachment 367238 [details]
Patch

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

> Source/WebKit/Shared/PrintInfo.h:60
> +    // These values are in 'point' unit (and not css pixel).

CSS

> Source/WebKit/Shared/WebPreferences.yaml:1639
> +  webcoreBinding: RuntimeEnabledFeatures

Why is this not just a Setting!

> Source/WebKit/UIProcess/API/C/WKPreferences.cpp:2131
> +
> +void WKPreferencesSetPageAtRuleSupportEnabled(WKPreferencesRef preferencesRef, bool flag)
> +{
> +    toImpl(preferencesRef)->setPageAtRuleSupportEnabled(flag);
> +}
> +
> +bool WKPreferencesGetPageAtRuleSupportEnabled(WKPreferencesRef preferencesRef)
> +{
> +    return toImpl(preferencesRef)->pageAtRuleSupportEnabled();
> +}

No need for new C API

> Source/WebKit/UIProcess/mac/WKPrintingView.mm:329
> +        [printInfo setBottomMargin: computedPageMargin.bottom()];

No spaces after colons!

> Source/WebKitLegacy/mac/WebView/WebPreferenceKeysPrivate.h:271
> +#define WebKitPageAtRuleSupportEnabledPreferenceKey @"WebKitPageAtRuleSupportEnabled"

No need for WebKitLegacy API
Comment 6 zalan 2019-04-11 14:51:42 PDT
Created attachment 367242 [details]
Patch
Comment 7 zalan 2019-04-11 14:57:07 PDT
Created attachment 367245 [details]
Patch
Comment 8 WebKit Commit Bot 2019-04-11 16:33:48 PDT
Comment on attachment 367245 [details]
Patch

Clearing flags on attachment: 367245

Committed r244202: <https://trac.webkit.org/changeset/244202>
Comment 9 WebKit Commit Bot 2019-04-11 16:33:49 PDT
All reviewed patches have been landed.  Closing bug.
Comment 10 Ryan Haddad 2019-04-11 17:14:46 PDT
This change broke Windows builds:

c:\cygwin\home\buildbot\worker\win10-release\build\source\webcore\platform\rectedges.h(39): error C2665: 'std::forward': none of the 2 overloads could convert all the argument types

https://build.webkit.org/builders/Apple%20Win%2010%20Release%20%28Build%29/builds/3604
Comment 11 zalan 2019-04-11 18:43:30 PDT
(In reply to Ryan Haddad from comment #10)
> This change broke Windows builds:
> 
> c:\cygwin\home\buildbot\worker\win10-
> release\build\source\webcore\platform\rectedges.h(39): error C2665:
> 'std::forward': none of the 2 overloads could convert all the argument types
> 
> https://build.webkit.org/builders/Apple%20Win%2010%20Release%20%28Build%29/
> builds/3604
Fixing it.
Comment 12 zalan 2019-04-11 18:56:17 PDT
Let's see if https://trac.webkit.org/changeset/244208 fixes it.