[webkit-changes] [WebKit/WebKit] d13ee4: [UnifiedPDF] After zooming, subframe/embed PDFs ar...

Simon Fraser noreply at github.com
Tue Feb 27 22:11:48 PST 2024


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

  Changed paths:
    M Source/WebCore/platform/graphics/TiledBacking.h
    M Source/WebCore/platform/graphics/ca/TileController.cpp
    M Source/WebCore/platform/graphics/ca/TileController.h
    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/PDFPageCoverage.h
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/PDFPageCoverage.mm
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm
    M Source/WebKit/WebProcess/WebPage/wc/GraphicsLayerWC.cpp

  Log Message:
  -----------
  [UnifiedPDF] After zooming, subframe/embed PDFs are messed up
https://bugs.webkit.org/show_bug.cgi?id=270211
rdar://123731682

Reviewed by Tim Horton.

The tile caching logic assumed that page scale factor (i.e. what scaleFactor() returns)
is the exact inverse of the scale factor that TiledBacking uses to map between tile coordinates
and painting coordinates.

This is true for main-frame PDFs, where the plugin takes over page scale, but for subframes,
page scale exists on some ancestor GraphicsLayer, yet the plugin's TiledBacking is aware
of this scale, because it's tracked through the GraphicsLayers. TileController accumulates the
scale on all ancestors in order to keep tiles at 512x512 in screen space.

So replace the uses of pageScaleFactor with `tilingScaleFactor` that we get from the TiledBacking.
This fixes computations that map from tile coordinates to painting coordinates, including fixing
blurry tiles, and missing tiles.

Also add a TiledBackingClient function that allows us to bump our configuration identifier when
the tiling scale factor changes, so we don't use stale tiles when the main frame is zoomed.

* Source/WebCore/platform/graphics/TiledBacking.h:
* Source/WebCore/platform/graphics/ca/TileController.cpp:
(WebCore::TileController::setContentsScale):
(WebCore::TileController::tilingScaleFactor const):
* Source/WebCore/platform/graphics/ca/TileController.h:
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/AsyncPDFRenderer.h:
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/AsyncPDFRenderer.mm:
(WebKit::AsyncPDFRenderer::tilingScaleFactorDidChange):
(WebKit::AsyncPDFRenderer::tileToPaintingTransform):
(WebKit::AsyncPDFRenderer::paintingToTileTransform):
(WebKit::AsyncPDFRenderer::enqueuePaintWithClip):
(WebKit::AsyncPDFRenderer::paintPDFIntoBuffer):
(WebKit::AsyncPDFRenderer::transferBufferToMainThread):
(WebKit::AsyncPDFRenderer::paintTilesForPage):
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/PDFPageCoverage.h:
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/PDFPageCoverage.mm:
(WebKit::operator<<):
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm:
(WebKit::UnifiedPDFPlugin::pageCoverageForRect const):
(WebKit::UnifiedPDFPlugin::paintPDFContent):

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