[webkit-changes] [WebKit/WebKit] 31001e: [UnifiedPDF] PDF content is offset in snapshots

Simon Fraser noreply at github.com
Thu Dec 21 23:46:27 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 31001e9814a15c1e2639a8fb4836b1ec65cc2fd1
      https://github.com/WebKit/WebKit/commit/31001e9814a15c1e2639a8fb4836b1ec65cc2fd1
  Author: Simon Fraser <simon.fraser at apple.com>
  Date:   2023-12-21 (Thu, 21 Dec 2023)

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

  Log Message:
  -----------
  [UnifiedPDF] PDF content is offset in snapshots
https://bugs.webkit.org/show_bug.cgi?id=266791
rdar://120014898

Reviewed by Tim Horton.

UnifiedPDFPlugin had two issues related to painting; first, it painted the PDF content as well
as rendering it into a layer. Second, that painted content was in the wrong location.

Fix the first issue by checking for a snapshotting paint in PluginView::paint(), and returning
if not snapshotting and the plugin uses PluginLayerHostingStrategy::GraphicsLayer, which is only
true for the UnifiedPDFPlugin. Also factor the PDF painting into a new function,
UnifiedPDFPlugin::paintPDFContent(), which avoids the confusion of passing in m_contentsLayer
when doing a software paint.

The second issue is also fixed in PluginView::paint(); we have to undo the context transform
that RenderWidget::paintContents() does.

Minor cleanup in PluginView::invalidateRect() to use a Checked<> pointer.

* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.h:
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm:
(WebKit::UnifiedPDFPlugin::paint):
(WebKit::UnifiedPDFPlugin::paintContents):
(WebKit::UnifiedPDFPlugin::paintPDFContent):
* Source/WebKit/WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::protectedPlugin const):
(WebKit::PluginView::paint):
(WebKit::PluginView::checkedRenderer const):
(WebKit::PluginView::invalidateRect):
* Source/WebKit/WebProcess/Plugins/PluginView.h:

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




More information about the webkit-changes mailing list