[webkit-changes] [WebKit/WebKit] f3cb4f: UnifiedPDF: Use page coverage for PDF content inva...

Kimmo Kinnunen noreply at github.com
Thu Jan 2 05:43:14 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: f3cb4f879b8c9c03157dc096af84ffbd8c37d96c
      https://github.com/WebKit/WebKit/commit/f3cb4f879b8c9c03157dc096af84ffbd8c37d96c
  Author: Kimmo Kinnunen <kkinnunen at apple.com>
  Date:   2025-01-02 (Thu, 02 Jan 2025)

  Changed paths:
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/AsyncPDFRenderer.h
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/AsyncPDFRenderer.mm
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/PDFDiscretePresentationController.h
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/PDFDiscretePresentationController.mm
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/PDFPageCoverage.h
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/PDFPresentationController.h
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/PDFPresentationController.mm
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/PDFScrollingPresentationController.h
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/PDFScrollingPresentationController.mm
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.h
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm

  Log Message:
  -----------
  UnifiedPDF: Use page coverage for PDF content invalidation
https://bugs.webkit.org/show_bug.cgi?id=285018
rdar://141819648

Reviewed by Simon Fraser and Abrar Rahman Protyasha.

Simplify the PDF content invalidation by preserving the info in
page coverage instead of transforming to document layout rect.
This work is towards supporting multiple PDF content GraphicsLayers.

PDF content invalidations are caused by:
- annotation updates
- selection changes
- incremental rendering

In the first two repainted areas are computed in terms of PDF page coverage.
The code would then convert the coverage to document layer rect.

Later on, for most part the code would need to convert the rect
back to page coverage to resolve:
 - Which GraphicsLayer in discrete mode would need to be invalidated
 - Which page preview PDF render would need to be updated

This conversion of the coverage would be hard to understand and
error-prone.

Discrete mode would have bugs in its handling of incremental rendering
invalidation and page coverage calculation.

The interfaces would have problematic "layout row" parameter that
sometimes would be nullopt.

Fix by:
- Pass the invalidation as PDF page coverage. This preserves all
  information accurately.
- Instead of having various virtual functions for invalidation, have
  just one function that resolves the layer coverage for particual
  invalidation page coverage.

This way the presentation controllers can be updated to correctly use
GraphicsLayer per PDF page.

* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/AsyncPDFRenderer.h:
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/AsyncPDFRenderer.mm:
(WebKit::AsyncPDFRenderer::setNeedsRenderForRect):
(WebKit::AsyncPDFRenderer::setNeedsPagePreviewRenderForPageCoverage):
(WebKit::AsyncPDFRenderer::pdfContentChangedInRect): Deleted.
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/PDFDiscretePresentationController.h:
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/PDFDiscretePresentationController.mm:
(WebKit::PDFDiscretePresentationController::layerCoveragesForRepaintPageCoverage):
(WebKit::PDFDiscretePresentationController::repaintForIncrementalLoad): Deleted.
(WebKit::PDFDiscretePresentationController::setNeedsRepaintInDocumentRect): Deleted.
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/PDFPageCoverage.h:
(WebKit::unite):
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/PDFPresentationController.h:
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/PDFPresentationController.mm:
(WebKit::PDFPresentationController::setNeedsRepaintForPageCoverage):
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/PDFScrollingPresentationController.h:
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/PDFScrollingPresentationController.mm:
(WebKit::PDFScrollingPresentationController::layerCoveragesForRepaintPageCoverage):
(WebKit::PDFScrollingPresentationController::repaintForIncrementalLoad): Deleted.
(WebKit::PDFScrollingPresentationController::setNeedsRepaintInDocumentRect): Deleted.
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.h:
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm:
(WebKit::UnifiedPDFPlugin::incrementalLoadingDidFinish):
(WebKit::UnifiedPDFPlugin::setNeedsRepaintForAnnotation):
(WebKit::UnifiedPDFPlugin::incrementalLoadingRepaintTimerFired):
(WebKit::UnifiedPDFPlugin::setNeedsRepaintForIncrementalLoad):
(WebKit::UnifiedPDFPlugin::repaintOnSelectionChange):
(WebKit::UnifiedPDFPlugin::setNeedsRepaintInDocumentRect): Deleted.
(WebKit::UnifiedPDFPlugin::repaintForIncrementalLoad): Deleted.

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