Bug 126633 - PDFDocumentImage can be very slow to do the initial paint
Summary: PDFDocumentImage can be very slow to do the initial paint
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: PDF (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Tim Horton
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2014-01-08 02:25 PST by Tim Horton
Modified: 2014-01-09 14:06 PST (History)
5 users (show)

See Also:


Attachments
patch (2.22 KB, patch)
2014-01-08 02:38 PST, Tim Horton
no flags Details | Formatted Diff | Diff
style (2.22 KB, patch)
2014-01-08 02:43 PST, Tim Horton
simon.fraser: review+
Details | Formatted Diff | Diff
new approach (7.48 KB, patch)
2014-01-09 11:50 PST, Tim Horton
simon.fraser: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tim Horton 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.
Comment 1 Radar WebKit Bug Importer 2014-01-08 02:26:12 PST
<rdar://problem/15770980>
Comment 2 Tim Horton 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).
Comment 3 Tim Horton 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.
Comment 4 WebKit Commit Bot 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.
Comment 5 Tim Horton 2014-01-08 02:43:07 PST
Created attachment 220619 [details]
style
Comment 6 Simon Fraser (smfr) 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?
Comment 7 Tim Horton 2014-01-09 11:50:15 PST
Created attachment 220754 [details]
new approach
Comment 8 Tim Horton 2014-01-09 12:10:50 PST
http://trac.webkit.org/changeset/161568
Comment 9 Tim Horton 2014-01-09 14:06:24 PST
Layout test in http://trac.webkit.org/changeset/161581