Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
UnifiedPDF: Find highlights sometimes appear in the wrong place if sc…
…rolling was needed https://bugs.webkit.org/show_bug.cgi?id=271087 rdar://123462967 Reviewed by Abrar Rahman Protyasha and Simon Fraser. Fix five bugs in one fell swoop: 1) Find highlights were sometimes painted in the wrong location, often overlapping UI We weren't treating our programmatic scrolls as programmatic, letting them be async and then making the TextIndicator in the wrong location (before the scroll was synchronized). Fix this by marking the scrolls as programmatic explicitly. Factor this out for use of the whole plugin. 2) Find highlights were sometimes blank, especially when far from the current scroll position We can't use async rendering for text indicator snapshots, because we can't repaint them when the tiles come in. Make async rendering opt-in, and only opt-in when we're painting the contents layer, not for other calls into painting code. 3) Find highlights didn't scroll to reveal when their top left corner was visible, even if most of the match was off screen. Adopt correct rect-revelation logic, as used to reveal form fields, and share with that code. 4) Software-painted snaphots are often blank 5) Printed PDFs in subframes are rasterized instead of remaining vectors These are both async rendering regressions that are fixed by the fix for (2). * Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.h: * Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm: (WebKit::UnifiedPDFPlugin::paintContents): Opt contents layer painting into async rendering. (WebKit::UnifiedPDFPlugin::paintPDFContent): Make async rendering opt-in. (WebKit::UnifiedPDFPlugin::scrollToPointInContentsSpace): Factor out this somewhat messy code to temporarily change the currentScrollType on our ScrollableArea to programmatic. (WebKit::UnifiedPDFPlugin::revealRectInContentsSpace): Factor out the logic to reveal a rectangle. (WebKit::UnifiedPDFPlugin::scrollToPointInPage): (WebKit::UnifiedPDFPlugin::scrollToPage): Adopt scrollToPointInContentsSpace. (WebKit::UnifiedPDFPlugin::findString): (WebKit::UnifiedPDFPlugin::setActiveAnnotation): Adopt revealRectInContentsSpace. In the find case, this fixes (3). Canonical link: https://commits.webkit.org/276216@main
- Loading branch information