[webkit-changes] [WebKit/WebKit] d583f1: [Unified PDF] Form control partial repaint for "re...

Sammy Gill noreply at github.com
Tue Mar 5 21:22:22 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: d583f18ce8eded8a598b3aafd181c9f1864fd3f6
      https://github.com/WebKit/WebKit/commit/d583f18ce8eded8a598b3aafd181c9f1864fd3f6
  Author: Sammy Gill <sammy.gill at apple.com>
  Date:   2024-03-05 (Tue, 05 Mar 2024)

  Changed paths:
    M Source/WebKit/Platform/spi/Cocoa/PDFKitSPI.h
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/AsyncPDFRenderer.mm
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.h
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm

  Log Message:
  -----------
  [Unified PDF] Form control partial repaint for "related" fields is broken, results in fields getting stuck.
https://bugs.webkit.org/show_bug.cgi?id=270539
rdar://123637341

Reviewed by Abrar Rahman Protyasha and Tim Horton.

In order to avoid repainting the world we attempt to perform very
targeted repaints. For annotations this generally means we need to find
the bounds for the annotation and provide the geometry of the area to
the async renderer to that it can repaint the affected area. However,
certain annotations may also have an effect on a set of related
annotations. For example, when interacting with radio buttons in the
same group we want to make sure that not only is the newly selected
radio button displayed as active but also that the previously selected one
is no longer active. For these annotations we want to make sure that
those get repainted as well in order to properly display the state
changes.

Since we already have an observer that listens for form field changes
that are sent by the document, we can use the same notification to tell
the plugin of the field that changed and get the geometry of the
annotations. We can take the field name given by the observer and ask
the document for all of the annotations associated with this field name
through IPI.

In order for the repainting to happen correctly we had to slightly
change how the async renderer handled requests for tile repaints.
Previously, it would check to see if a repaint request for a particular
tile had already been enqueued and drop the current request if it had.
This approach was too conservative since multiple annotations may need
to get repainted within a tile and observer gets notified of multiple
fields independently (e.g. a button action that resets form fields
sends a separate notification for each field in the form). Now the
async observer will drop the request if:

1.) There is not a clip rect provided for the request (to match current
behavior)
2.) The tile rect clip for the repaint request is already contained
completely within the tile rect clip for the enqueued tile update

If a repaint request comes in for the same tile but it is not being
handled by an enqueued tile update then we will take the existing
update's tile rect, combine it with the rect in the new request, and
update the enqueued tile update. As we complete the tile update we will
check to see if the area that was repainted is the same as the one that
was enqueued. If it is not this means that the tile update was updated
with a new rect so we do not proceed to cache the tile.

* Source/WebKit/Platform/spi/Cocoa/PDFKitSPI.h:
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/AsyncPDFRenderer.mm:
(WebKit::AsyncPDFRenderer::didCompleteTileUpdateRender):
(WebKit::AsyncPDFRenderer::updateTilesForPaintingRect):
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.h:
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm:
(-[WKPDFFormMutationObserver formChanged:]):
(WebKit::UnifiedPDFPlugin::repaintAnnotationsForFormField):

Canonical link: https://commits.webkit.org/275727@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