Bug 172495

Summary: Zoom in/out is slow in Safari with large PDFs
Product: WebKit Reporter: Tim Horton <thorton>
Component: New BugsAssignee: Tim Horton <thorton>
Status: RESOLVED FIXED    
Severity: Normal CC: bdakin, kling, sam, simon.fraser
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch simon.fraser: review+

Tim Horton
Reported 2017-05-23 02:01:26 PDT
Zoom in/out is slow in Safari with large PDFs
Attachments
Patch (2.13 KB, patch)
2017-05-23 02:01 PDT, Tim Horton
no flags
Patch (4.98 KB, patch)
2017-05-23 11:50 PDT, Tim Horton
simon.fraser: review+
Tim Horton
Comment 1 2017-05-23 02:01:52 PDT
Andreas Kling
Comment 2 2017-05-23 09:49:38 PDT
Comment on attachment 310987 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=310987&action=review > Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.mm:1156 > + size_t pageCount = [m_pdfDocument pageCount]; > + for (size_t i = 0; i < pageCount; ++i) > + m_pageBoxes.append(enclosingIntRect([[m_pdfDocument pageAtIndex:i] boundsForBox:kPDFDisplayBoxCropBox])); I'm no expert on this code, but shouldn't we clear m_pageBoxes somehow before appending all the boxes to it? Or is this going to only run once?
Sam Weinig
Comment 3 2017-05-23 10:10:01 PDT
Comment on attachment 310987 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=310987&action=review >> Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.mm:1156 >> + m_pageBoxes.append(enclosingIntRect([[m_pdfDocument pageAtIndex:i] boundsForBox:kPDFDisplayBoxCropBox])); > > I'm no expert on this code, but shouldn't we clear m_pageBoxes somehow before appending all the boxes to it? > Or is this going to only run once? Also, since we know how many things are getting appened, you can reserve capacity and then do uncheckedAppends.
Tim Horton
Comment 4 2017-05-23 11:36:02 PDT
(In reply to Andreas Kling from comment #2) > Comment on attachment 310987 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=310987&action=review > > > Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.mm:1156 > > + size_t pageCount = [m_pdfDocument pageCount]; > > + for (size_t i = 0; i < pageCount; ++i) > > + m_pageBoxes.append(enclosingIntRect([[m_pdfDocument pageAtIndex:i] boundsForBox:kPDFDisplayBoxCropBox])); > > I'm no expert on this code, but shouldn't we clear m_pageBoxes somehow > before appending all the boxes to it? > Or is this going to only run once? LOL, yes, and this has always been broken, but has never really mattered much because we only use the first box... which means we can simplify this a great deal and do even less work!
Tim Horton
Comment 5 2017-05-23 11:50:33 PDT
Simon Fraser (smfr)
Comment 6 2017-05-23 11:53:06 PDT
Comment on attachment 311035 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=311035&action=review > Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.mm:1160 > + m_firstPageHeight = static_cast<unsigned>(CGCeiling([[m_pdfDocument pageAtIndex:0] boundsForBox:kPDFDisplayBoxCropBox].size.height)); Do we always have a page 0?
Tim Horton
Comment 7 2017-05-23 11:58:30 PDT
Note You need to log in before you can comment on or make changes to this bug.