Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: d618a7ea2dabc54d6d27e60b6ea5362a09769ac9
      
https://github.com/WebKit/WebKit/commit/d618a7ea2dabc54d6d27e60b6ea5362a09769ac9
  Author: Wenson Hsieh <[email protected]>
  Date:   2024-12-16 (Mon, 16 Dec 2024)

  Changed paths:
    M Source/WebKit/DerivedSources-input.xcfilelist
    M Source/WebKit/DerivedSources.make
    A Source/WebKit/Shared/ios/CursorContext.h
    A Source/WebKit/Shared/ios/CursorContext.serialization.in
    M Source/WebKit/Shared/ios/InteractionInformationAtPosition.h
    M Source/WebKit/Shared/ios/InteractionInformationAtPosition.serialization.in
    M Source/WebKit/Shared/ios/InteractionInformationRequest.cpp
    M Source/WebKit/Shared/ios/InteractionInformationRequest.h
    M Source/WebKit/Shared/ios/InteractionInformationRequest.serialization.in
    M Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
    M Source/WebKit/WebKit.xcodeproj/project.pbxproj
    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/ios/WebPageIOS.mm

  Log Message:
  -----------
  [UnifiedPDF] [iPadOS] Support pointer cursor updates during mouse hover
https://bugs.webkit.org/show_bug.cgi?id=284674
rdar://141325020

Reviewed by Aditya Keerthi.

Add support for pointer styles (in particular, showing an iBeam when hovering 
over text in PDFs)
when unified PDF is enabled. See below for more details.

* Source/WebKit/DerivedSources-input.xcfilelist:
* Source/WebKit/DerivedSources.make:
* Source/WebKit/Shared/ios/CursorContext.h: Copied from 
Source/WebKit/Shared/ios/InteractionInformationRequest.cpp.
* Source/WebKit/Shared/ios/CursorContext.serialization.in: Copied from 
Source/WebKit/Shared/ios/InteractionInformationRequest.serialization.in.

Split out several cursor-related members on `InteractionInformationAtPosition` 
into a separate
struct, `WebKit::CursorContext`; this allows the new PDF plugin override point 
below to simply
return this struct containing only information about the cursor, rather than 
receiving and
populating the entire `InteractionInformationAtPosition` struct (most of which 
is irrelevant for
PDFs).

* Source/WebKit/Shared/ios/InteractionInformationAtPosition.h:

Instead of sending `caretLength` as a separate member over IPC, drop it 
entirely. This value is
redundant with either the width or height of the `lineCaretExtent`, depending 
on whether we're in
vertical writing mode.

* Source/WebKit/Shared/ios/InteractionInformationAtPosition.serialization.in:
* Source/WebKit/Shared/ios/InteractionInformationRequest.cpp:

See above.

(WebKit::InteractionInformationRequest::isValidForRequest const):

Also rename `includeCaretContext` to `includeCursorContext`, to clarify that 
this information is
about the mouse cursor (rather than the selection caret).

* Source/WebKit/Shared/ios/InteractionInformationRequest.h:
(WebKit::InteractionInformationRequest::InteractionInformationRequest):
* Source/WebKit/Shared/ios/InteractionInformationRequest.serialization.in:
* Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _updateLastPointerRegionIfNeeded:]):

Adjust some existing code to get information about the cursor through the new 
`CursorContext` struct
on the position information.

(-[WKContentView pointerRegionForPositionInformation:point:]):
(-[WKContentView pointerInteraction:styleForRegion:]):
* Source/WebKit/WebKit.xcodeproj/project.pbxproj:
* Source/WebKit/WebProcess/Plugins/PDF/PDFPluginBase.h:
(WebKit::PDFPluginBase::cursorContext const):
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.h:
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm:
(WebKit::UnifiedPDFPlugin::pdfElementTypesForPluginPoint const):
(WebKit::UnifiedPDFPlugin::pdfElementTypesForPagePoint const):

Add a variation of this helper method that takes a `PDFPage` and a point in the 
page. Make the
existing `pdfElementTypesForPluginPoint` helper use this method.

(WebKit::UnifiedPDFPlugin::moveSelectionEndpoint):
(WebKit::UnifiedPDFPlugin::extendInitialSelection):

Drive-by fix: remove several unnecessary `WebCore::`.

(WebKit::UnifiedPDFPlugin::platformPopulateEditorStateIfNeeded const):

Adopt the new `pageToRootView` helper below.

(WebKit::UnifiedPDFPlugin::cursorContext const):

Add a new method hook to obtain the cursor context from the unified PDF plugin. 
This works by hit-
testing to find the line (as a `PDFSelection`) closest to the requested point, 
and checking to see
if the requested point is inside of that selection. If so, we set the cursor to 
an IBeam and also
retrieve the bounds of the line in root view coordinates; otherwise, fall back 
on the default
cursor.

(WebKit::UnifiedPDFPlugin::pageToRootView const):

Add new helpers to map from PDF page coordinates to root view coordinates.

(WebKit::UnifiedPDFPlugin::rootViewToPage const):
* Source/WebKit/WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::cursorContext const):
* Source/WebKit/WebProcess/Plugins/PluginView.h:
* Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::cursorContext):
(WebKit::WebPage::positionInformation):

Defer to the PDF plugin in the case where `includeCursorContext` is set, and 
the frame under the
cursor is a plugin.

(WebKit::populateCaretContext): Deleted.

Rename this to `cursorContext`, and have it return a struct for clarity. The 
extant helper method is
currently a bit confusing, since the caller must pass it a mutable position 
information struct, with
only the `cursor` member set.

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



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

Reply via email to