Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 8feb3943337028bf46df4837262ae202e7fe30db
      
https://github.com/WebKit/WebKit/commit/8feb3943337028bf46df4837262ae202e7fe30db
  Author: Simon Fraser <simon.fra...@apple.com>
  Date:   2024-04-22 (Mon, 22 Apr 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/WebCore/platform/graphics/ca/TileGrid.cpp
    M Source/WebCore/platform/graphics/ca/TileGrid.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/UnifiedPDFPlugin.mm
    M Source/WebKit/WebProcess/WebPage/wc/GraphicsLayerWC.cpp

  Log Message:
  -----------
  [UnifiedPDF] Do more fine-grained tile invalidation
https://bugs.webkit.org/show_bug.cgi?id=273016
rdar://126779250

Reviewed by Tim Horton.

AsyncPDFRenderer's tile invalidation was based on the 
PDFConfigurationIdentifier changing,
which happened on scaling and layout changes. However, some kinds of layout 
(e.g. window
resize without automatic resizing) don't change the per-tile PDF contents, so 
in those cases
we can preserve rendered tiles, which can avoid large amounts of re-rendering 
for PDFs
which are expensive to render.

We can compare `TileRenderInfo`s to know if a tile has changed, since 
`PDFPageCoverage`
gives us page-relative rects for this tile.

Remove PDFConfigurationIdentifiers which we no longer need. Make it possible to 
test `TileRenderInfo`
for painting equality (which ignores the optional clip rect), and implement 
`renderInfoForTile()` which
allows us to compute a `TileRenderInfo` from the current state of the PDF and 
tile grid (we need
`rectForTile()` for this, which is added to `TiledBacking`).

Now `willRepaintTile()` can ask if we have a valid cached tile using more data 
than just
the tile index. `enqueueTilePaintIfNecessary()` can also early return if we 
have an existing
queued paint which is valid, and `didCompleteTileRender()` can ask whether the 
paint we
just completed asynchronously is still valid.

We do need a new identifier, PDFContentsVersionIdentifier, which increments 
when the PDF
contents change (e.g. an annotation update); this allows us to ask whether an 
enqueued
tile paint is still valid (e.g. for partial updates on form control changes).

* Source/WebCore/platform/graphics/TiledBacking.h:
* Source/WebCore/platform/graphics/ca/TileController.cpp:
(WebCore::TileController::rectForTile const):
* Source/WebCore/platform/graphics/ca/TileController.h:
* Source/WebCore/platform/graphics/ca/TileGrid.cpp:
(WebCore::TileGrid::rectForTile const):
* Source/WebCore/platform/graphics/ca/TileGrid.h:
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/AsyncPDFRenderer.h:
(WebKit::AsyncPDFRenderer::TileRenderInfo::equivalentForPainting const):
(WebKit::AsyncPDFRenderer::renderInfoForTile):
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/AsyncPDFRenderer.mm:
(WebKit::AsyncPDFRenderer::AsyncPDFRenderer):
(WebKit::AsyncPDFRenderer::renderInfoIsValidForTile const):
(WebKit::AsyncPDFRenderer::willRepaintTile):
(WebKit::AsyncPDFRenderer::tilingScaleFactorDidChange):
(WebKit::AsyncPDFRenderer::enqueueTilePaintIfNecessary):
(WebKit::AsyncPDFRenderer::renderInfoForTile const):
(WebKit::AsyncPDFRenderer::enqueuePaintWithClip):
(WebKit::AsyncPDFRenderer::paintPDFIntoBuffer):
(WebKit::AsyncPDFRenderer::didCompleteTileRender):
(WebKit::AsyncPDFRenderer::paintTilesForPage):
(WebKit::AsyncPDFRenderer::pdfContentChangedInRect):
(WebKit::AsyncPDFRenderer::layoutConfigurationChanged): Deleted.
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/PDFPageCoverage.h:
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm:
(WebKit::UnifiedPDFPlugin::updateLayerHierarchy):
(WebKit::UnifiedPDFPlugin::setScaleFactor):
* Source/WebKit/WebProcess/WebPage/wc/GraphicsLayerWC.cpp:

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to