Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 622b90f2c44db97d10326a6970b96588b7394705
https://github.com/WebKit/WebKit/commit/622b90f2c44db97d10326a6970b96588b7394705
Author: Simon Fraser <[email protected]>
Date: 2024-02-14 (Wed, 14 Feb 2024)
Changed paths:
M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/PDFDocumentLayout.h
M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/PDFDocumentLayout.mm
M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.h
M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm
Log Message:
-----------
[UnifiedPDF] Annotation hover and interaction is broken in rotated pages
https://bugs.webkit.org/show_bug.cgi?id=269344
rdar://122929753
Reviewed by Tim Horton.
The transform math in `documentSpaceToPageSpaceTransform()` was wrong,
resulting in hit-testing
of annotations in rotated pages being wrong.
The page bounds vended by PDFDocumentLayout are normalized, so we can't use
them for coordinate
conversion. We need to go back to the original page crop boxes. Clarify this by
renaming
`boundsForPageAtIndex()` to `layoutBoundsForPageAtIndex()` since it is
normalized, and contains
the layout offset of the page.
Then have PDFDocumentLayout store the original crop box per page. Internally,
it computes
an AffineTransform from page rotation and crop box, and we use that and some
coordinate flipping
to convert points.
Remove the FloatRect conversion functions on UnifiedPDFPlugin that I just
added, because
they were wrong, and unused.
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/PDFDocumentLayout.h:
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/PDFDocumentLayout.mm:
(WebKit::PDFDocumentLayout::updateLayout):
(WebKit::PDFDocumentLayout::layoutSingleColumn):
(WebKit::PDFDocumentLayout::layoutTwoUpColumn):
(WebKit::PDFDocumentLayout::layoutBoundsForPageAtIndex const):
(WebKit::PDFDocumentLayout::toPageTransform const):
(WebKit::PDFDocumentLayout::documentPointToPDFPagePoint const):
(WebKit::PDFDocumentLayout::pdfPagePointToDocumentPoint const):
(WebKit::PDFDocumentLayout::boundsForPageAtIndex const): Deleted.
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.h:
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm:
(WebKit::UnifiedPDFPlugin::updatePageBackgroundLayers):
(WebKit::UnifiedPDFPlugin::pageCoverageForRect const):
(WebKit::UnifiedPDFPlugin::scaleForActualSize const):
(WebKit::UnifiedPDFPlugin::heightForPage const):
(WebKit::UnifiedPDFPlugin::pageIndexForDocumentPoint const):
(WebKit::UnifiedPDFPlugin::convertFromDocumentToPage const):
(WebKit::UnifiedPDFPlugin::convertFromPageToDocument const):
(WebKit::documentSpaceToPageSpaceTransform): Deleted.
Canonical link: https://commits.webkit.org/274625@main
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes