[webkit-changes] [WebKit/WebKit] b11f28: UnifiedPDF: Find highlights sometimes appear in th...

Tim Horton noreply at github.com
Fri Mar 15 17:50:29 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: b11f283a59bc576ff8212d0fbac2763b20d81787
      https://github.com/WebKit/WebKit/commit/b11f283a59bc576ff8212d0fbac2763b20d81787
  Author: Tim Horton <thorton at apple.com>
  Date:   2024-03-15 (Fri, 15 Mar 2024)

  Changed paths:
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.h
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm

  Log Message:
  -----------
  UnifiedPDF: Find highlights sometimes appear in the wrong place if scrolling 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



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list