Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 1c0f305b2a21c9cbf2887b9317afd1e5ac0d6ec5
      
https://github.com/WebKit/WebKit/commit/1c0f305b2a21c9cbf2887b9317afd1e5ac0d6ec5
  Author: Abrar Rahman Protyasha <[email protected]>
  Date:   2024-02-07 (Wed, 07 Feb 2024)

  Changed paths:
    M Source/WebCore/page/Page.h
    M Source/WebKit/Platform/spi/Cocoa/PDFKitSPI.h
    M Source/WebKit/WebProcess/Plugins/PDF/PDFPluginBase.h
    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
    M Source/WebKit/WebProcess/WebPage/WebPage.cpp
    M Source/WebKit/WebProcess/WebPage/WebPage.h

  Log Message:
  -----------
  [UnifiedPDF] Tracked text selections should be drawn in the page space
https://bugs.webkit.org/show_bug.cgi?id=268808
rdar://122371772

Reviewed by Simon Fraser.

Currently, there is no visual indication that we keep track of text
selections on mouse drag. This patch addresses the issue by delegating
the painting of PDFSelection elements to PDFKit, as well as laying some
groundwork to meet that end.

Specifically, this patch does the following:
1. Ask PDFKit to draw the current selection through the PDFSelection SPI
   drawForPage:withBox:active:inContext:. Also provided a forward
   declaration for the interface to keep the build happy.
2. Added hooks to inform the PDF plugin when window activity has
   changed. This allows the PDF plugin to be aware of whether or not the
   window it is in is currently active. This knowledge is vended from
   the plugin to PDFKit to ensure we draw secondary colors when we don't
   have focus.
3. Drive-by fix: remove the unnecessary concept of "committing" a
   selection, as well as the now redundant "isActive" state. There was
   extra motivation to do this since it may be confusing if it lived
   next to the window activity state.

* Source/WebCore/page/Page.h:
* Source/WebKit/Platform/spi/Cocoa/PDFKitSPI.h:
* Source/WebKit/WebProcess/Plugins/PDF/PDFPluginBase.h:
(WebKit::PDFPluginBase::windowActivityDidChange):
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.h:
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm:
(WebKit::UnifiedPDFPlugin::windowActivityDidChange):
(WebKit::UnifiedPDFPlugin::paintPDFContent):
(WebKit::UnifiedPDFPlugin::handleMouseEvent):
(WebKit::UnifiedPDFPlugin::beginTrackingSelection):
(WebKit::UnifiedPDFPlugin::continueTrackingSelection):
(WebKit::UnifiedPDFPlugin::setCurrentSelection):
(WebKit::UnifiedPDFPlugin::commitCurrentSelection): Deleted.
* Source/WebKit/WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::windowActivityDidChange):
* Source/WebKit/WebProcess/Plugins/PluginView.h:
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::windowActivityDidChange):
(WebKit::WebPage::setActivityState):
* Source/WebKit/WebProcess/WebPage/WebPage.h:

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


_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to