[webkit-changes] [WebKit/WebKit] 123df1: [UnifiedPDF] Annotation highlight is misplaced

Simon Fraser noreply at github.com
Tue Feb 13 21:10:57 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 123df1a5b3b0f7708a6076067a25817275e90b1f
      https://github.com/WebKit/WebKit/commit/123df1a5b3b0f7708a6076067a25817275e90b1f
  Author: Simon Fraser <simon.fraser at apple.com>
  Date:   2024-02-13 (Tue, 13 Feb 2024)

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

  Log Message:
  -----------
  [UnifiedPDF] Annotation highlight is misplaced
https://bugs.webkit.org/show_bug.cgi?id=268359
rdar://121907143

Reviewed by Tim Horton.

Fix painting of the blue rectangle for hovered annotations. The bug was that
we were failing to convert the annotation bounds (which are in the coordinates
of the annotation's page) to the correct bounds for painting.

The natural way to fix this is to paint the annoations inside the
per-page painting loop, since we've already set up the coordinate system.

Make it easy to determine that we have something to paint here by adding
`pageIndexWithHoveredAnnotation()` which returns an optional PageIndex.
We can then check that inside the page-page loop.

I also implemented untested versions of `convertFromPageToDocument(FloatRect)`
and `convertFromPageToContents(FloatRect)` but they are unused in this patch.

* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.h: Re-order things to improve logical grouping.
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm:
(WebKit::UnifiedPDFPlugin::paintPDFContent):
(WebKit::textAnnotationHoverColor):
(WebKit::UnifiedPDFPlugin::paintHoveredAnnotationOnPage):
(WebKit::UnifiedPDFPlugin::pageIndexWithHoveredAnnotation const):
(WebKit::UnifiedPDFPlugin::convertFromPageToDocument const):
(WebKit::UnifiedPDFPlugin::convertFromPageToContents const):
(WebKit::AnnotationTrackingState::startAnnotationTracking):
(WebKit::AnnotationTrackingState::finishAnnotationTracking):
(WebKit::UnifiedPDFPlugin::paintPDFOverlays): Deleted.

Canonical link: https://commits.webkit.org/274607@main




More information about the webkit-changes mailing list