Bug 126591

Summary: vw units don't look at the right viewport in print media
Product: WebKit Reporter: Brad <brkemper>
Component: PrintingAssignee: Benjamin Poulain <benjamin>
Status: NEW ---    
Severity: Major CC: ahmad.saleem792, ap, benjamin, bfulgham, brkemper, dbates, dino, dwaal, hi, hyatt, jtherrien2020, koivisto, simon.fraser, webkit-bug-importer, webkit, zalan
Priority: P2 Keywords: HasReduction, InRadar
Version: WebKit Nightly Build   
Hardware: Mac   
OS: OS X 10.11   
URL: http://output.jsbin.com/duyosa/1/quiet
Attachments:
Description Flags
Patch
none
Safari Technology Preview 152 Print in PDF
none
Chrome Canary 107 Print Output none

Description Brad 2014-01-07 12:56:51 PST
VW units are supposed to be based on the width of the initial containing block (which is divided into 100 VW units). But when printed, the ICB is the page area (the printable area of the piece of paper). Webkit seems to be using the width of the window on the monitor instead as its reference for print VWs. What's more, it does this even when the page is inside an iframe: it uses the width of the outer window instead of the width of the iframe. 1VW should instead be 1/100 of the print area of the page.
Comment 1 Brad 2014-01-07 12:58:06 PST
Correction: 1VW should instead be 1/100 of the WIDTH of the print area of the page.
Comment 2 Benjamin Poulain 2014-07-06 21:10:44 PDT
Created attachment 234476 [details]
Patch
Comment 3 Benjamin Poulain 2014-07-06 21:17:42 PDT
Dave, Antti, Dean, could you please have a look at this first patch? I need to add tests and fix the exports, but I would like some early feedback.

Something I know nothing about is the other type of pagination. I have no idea how the layout works for epub or paginated UIWebView.
Comment 4 Frances de Waal 2015-08-07 05:09:16 PDT
Not sure if this is related, but if font-size is set with vw it will not be printed at all in a webkit browser.
Comment 5 Chris Rebert 2015-09-10 01:29:53 PDT
(In reply to comment #4)
> Not sure if this is related, but if font-size is set with vw it will not be
> printed at all in a webkit browser.

That sounds like https://code.google.com/p/chromium/issues/detail?id=382313
Comment 6 Chris Rebert 2016-04-11 22:22:05 PDT
Still reproduces in recent Nightly.
Comment 7 Ahmad Saleem 2022-08-31 15:25:38 PDT
Created attachment 462057 [details]
Safari Technology Preview 152 Print in PDF
Comment 8 Ahmad Saleem 2022-08-31 15:26:52 PDT
Created attachment 462058 [details]
Chrome Canary 107 Print Output

It is same for Firefox Nightly 106.
Comment 9 Ahmad Saleem 2022-08-31 15:27:15 PDT
I am able to reproduce this bug in STP 152 and please refer to attached PDF for reference. Thanks!
Comment 10 Radar WebKit Bug Importer 2022-08-31 16:06:25 PDT
<rdar://problem/99408675>