Bug 64032

Summary: Work around Skia PDF's lack of inverted path support.
Product: WebKit Reporter: Steve VanDeBogart <vandebo>
Component: WebCore Misc.Assignee: Chris Guillory <ctguil>
Status: RESOLVED FIXED    
Severity: Normal CC: agl, ctguil, eric, hamaji, jamesr, tony, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
Don't use clip antialias hack when printing.
none
Don't use clip antialias hack when printing.
none
Adding descriptive comment in changelog and inline for Steve none

Description Steve VanDeBogart 2011-07-06 14:22:25 PDT
The trick used in http://neugierig.org/software/chromium/notes/2010/07/clipping.html to support antialiased clips doesn't work when printing to Skia's PDF backend because the backend does not support inverted paths (PDF does not support it natively meaning Skia would need a full geometry engine to support it).  This manifests as rounded buttons not being drawn when printing, tracked as Chrome bug 79519.

However, when the output is a vector device, like PDF, we don't need antialiased clips - it's up to the PDF rendering engine to do that.  So we can simply disable the antialiased clip code if the output is a vector device.

I think the fix isn't testable because it requires examining the printed output.
Comment 1 Steve VanDeBogart 2011-07-06 14:51:23 PDT
Created attachment 99885 [details]
Don't use clip antialias hack when printing.
Comment 2 WebKit Review Bot 2011-07-06 14:53:50 PDT
Attachment 99885 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebCore/ChangeLog', u'Source/WebCor..." exit_code: 1

Source/WebCore/ChangeLog:1:  ChangeLog entry has no bug number  [changelog/bugnumber] [5]
Total errors found: 1 in 2 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Steve VanDeBogart 2011-07-06 14:57:50 PDT
Created attachment 99887 [details]
Don't use clip antialias hack when printing.
Comment 4 Chris Guillory 2011-07-06 15:33:57 PDT
James, can you take a look at this change?
Comment 5 James Robinson 2011-07-06 15:42:05 PDT
Why can't we test printed output?
Comment 6 Steve VanDeBogart 2011-07-06 15:44:31 PDT
As far as I'm aware, there's not a PDF renderer available in the testing pipeline.
Comment 7 James Robinson 2011-07-06 15:46:05 PDT
Who's working on fixing that?
Comment 8 Tony Chang 2011-07-06 15:47:54 PDT
Have you tried layoutTestController.setPrinting()?  There are a few examples of this in the tree (e.g., printing/compositing-layer-printing.html and printing/media-queries-print.html).

It might only work on Mac, which probably doesn't go through this code path, in which case you can ignore me.
Comment 9 Tony Chang 2011-07-06 15:48:41 PDT
Hamaji may have other ideas on how to test printing.
Comment 10 Steve VanDeBogart 2011-07-06 15:56:11 PDT
There's a bug in Skia, assigned to me: http://code.google.com/p/skia/issues/detail?id=246

For awhile the plan was to use Chrome's PDF plugin, but licensing didn't work out on that. I investigated using ghostscript, but it has some very strange rendering quirks for the existing skia test set.  Ben Wagner recently proposed some code to use lib poppler, which we may use, though it does not handle shaders or soft masks correctly.
Comment 11 Chris Guillory 2011-07-06 17:27:19 PDT
LayoutTests/platform/chromium/test_expectations.txt skips printing/compositing-layer-printing.html and printing/media-queries-print.html for the chromium port. With the comment:
// These tests try to print a PDF file as the expected result.  I don't think
// we plan on supporting this anytime soon.

I think Eric said before that automated testing of printing with DumpRenderTree is not possible.
Comment 12 Eric Seidel (no email) 2011-07-06 18:27:01 PDT
Yup, printing tests were a dream.  But never a reality.  PDFs (at least on OS X) include all sorts of per-machine information, making them a poor reference image format.
Comment 13 James Robinson 2011-07-07 11:51:02 PDT
Comment on attachment 99887 [details]
Don't use clip antialias hack when printing.

OK, but please add a descriptive comment in the changelog and inline to explain what is going on.
Comment 14 Chris Guillory 2011-07-07 14:52:02 PDT
Created attachment 100036 [details]
Adding descriptive comment in changelog and inline for Steve
Comment 15 James Robinson 2011-07-07 15:55:13 PDT
Comment on attachment 100036 [details]
Adding descriptive comment in changelog and inline for Steve

Thanks for the explanation, I'm sure the next person to debug through this bit of code will appreciate it greatly.
Comment 16 WebKit Review Bot 2011-07-07 16:16:32 PDT
Comment on attachment 100036 [details]
Adding descriptive comment in changelog and inline for Steve

Clearing flags on attachment: 100036

Committed r90599: <http://trac.webkit.org/changeset/90599>
Comment 17 WebKit Review Bot 2011-07-07 16:16:37 PDT
All reviewed patches have been landed.  Closing bug.