Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 9f863a565d7fe45dff1f124af9fe38fb8942ffd7
      
https://github.com/WebKit/WebKit/commit/9f863a565d7fe45dff1f124af9fe38fb8942ffd7
  Author: Abrar Rahman Protyasha <a_protya...@apple.com>
  Date:   2024-07-26 (Fri, 26 Jul 2024)

  Changed paths:
    M Source/WebKit/WebProcess/Plugins/PDF/PDFPluginBase.h
    M Source/WebKit/WebProcess/Plugins/PluginView.cpp
    M Source/WebKit/WebProcess/Plugins/PluginView.h
    M Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm

  Log Message:
  -----------
  REGRESSION(274519@main): "Open with Preview" context menu item does not work 
on locked PDF documents
https://bugs.webkit.org/show_bug.cgi?id=277120
rdar://132033502

Reviewed by Aditya Keerthi.

While it was always possible for WebPage::openPDFWithPreview to be
triggered through non-HUD paths (such as the context menu), we always
looked for an appropriate PDF plugin to act on by querying the web
page's m_pdfPlugInsWithHUD map. Despite the unsound assumption, this
method worked correctly prior to 274519@main, since the HUD was created
for all PDF documents, notably so for locked files.

After 274519@main, though, HUDs are no longer created for locked
documents, but openPDFWithPreview can still be triggered through the
context menu. This meant that the web page would look for a PDF plugin
in its map of plugins _with_ HUDs, which caused the old assumption to
break down and for "Open with Preview" to just not work for locked
documents.

In this patch, we decouple openPDFWithPreview from plugins with HUDs.
Instead, we provide plumbing to expose the identifier of a PluginView's
underlying PDFPlugin, using which we can find a relevant PDFPlugin to
act on from the web page's set of tracked PluginView objects. This is
correct because any plugin, regardless of whether it has a HUD, can be
interacted with to trigger the "Open in Preview" behavior.

* Source/WebKit/WebProcess/Plugins/PDF/PDFPluginBase.h:
* Source/WebKit/WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::accessibilityObject const):
(WebKit::PluginView::setParent):
(WebKit::PluginView::pdfPluginIdentifier const):
(WebKit::PluginView::openWithPreview):
* Source/WebKit/WebProcess/Plugins/PluginView.h:
* Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::openPDFWithPreview):

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