RESOLVED FIXED 126633
PDFDocumentImage can be very slow to do the initial paint
https://bugs.webkit.org/show_bug.cgi?id=126633
Summary PDFDocumentImage can be very slow to do the initial paint
Tim Horton
Reported 2014-01-08 02:25:59 PST
When going to paint, PDFDocumentImage transforms the context by scaling into "page" space. It currently does so on a per-axis basis, but this means that sometimes small floating-point rounding issues can cause the scales to be slightly different. This causes us to do a non-uniform scale which both imperceptibly squishes the PDF and throws CoreGraphics onto a slow painting path.
Attachments
patch (2.22 KB, patch)
2014-01-08 02:38 PST, Tim Horton
no flags
style (2.22 KB, patch)
2014-01-08 02:43 PST, Tim Horton
simon.fraser: review+
new approach (7.48 KB, patch)
2014-01-09 11:50 PST, Tim Horton
simon.fraser: review+
Radar WebKit Bug Importer
Comment 1 2014-01-08 02:26:12 PST
Tim Horton
Comment 2 2014-01-08 02:37:38 PST
I guess we have to decide whether PDF-in-<img> should behave like an image (and stretch if width and height are both specified) or like an SVG (and fit inside the box).
Tim Horton
Comment 3 2014-01-08 02:38:39 PST
Created attachment 220617 [details] patch If we decide it should behave like SVG and fit inside the box, this patch will do.
WebKit Commit Bot
Comment 4 2014-01-08 02:39:36 PST
Attachment 220617 [details] did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebCore/ChangeLog', u'Source/WebCore/platform/graphics/cg/PDFDocumentImage.cpp', '--commit-queue']" exit_code: 1 ERROR: Source/WebCore/platform/graphics/cg/PDFDocumentImage.cpp:139: Use std::min() or std::min<type>() instead of the MIN() macro. [runtime/max_min_macros] [4] Total errors found: 1 in 2 files If any of these errors are false positives, please file a bug against check-webkit-style.
Tim Horton
Comment 5 2014-01-08 02:43:07 PST
Simon Fraser (smfr)
Comment 6 2014-01-08 08:40:24 PST
Comment on attachment 220619 [details] style Nice find! This is really an "aspect-ratio fit" right? Do we have other code for that?
Tim Horton
Comment 7 2014-01-09 11:50:15 PST
Created attachment 220754 [details] new approach
Tim Horton
Comment 8 2014-01-09 12:10:50 PST
Tim Horton
Comment 9 2014-01-09 14:06:24 PST
Note You need to log in before you can comment on or make changes to this bug.