Skip to content

Commit

Permalink
REGRESSION(275085@main): [UnifiedPDF] Certain internal macOS builds d…
Browse files Browse the repository at this point in the history
…on't track selections on drag

https://bugs.webkit.org/show_bug.cgi?id=270624
rdar://124197851

Reviewed by Tim Horton.

Specifically, this can be seen in internal builds that satisfy the
HAVE(PDFDOCUMENT_SELECTION_WITH_GRANULARITY) platform condition but don't
actually have an implementation for
-[PDFDocument selectionFromPage:atPoint:toPage:atPoint:withGranularity:].

275085@main failed to specify a fallback behavior for such builds
because the -[PDFDocument selectionFromPage:atPoint:toPage:atPoint:]
call was placed behind the #else branch of the platform condition.

This patch ensures all builds can fallback correctly to the older
PDFDocument API, either if the API is missing from the SDK or has not
been implemented.

* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm:
(WebKit::UnifiedPDFPlugin::extendCurrentSelectionIfNeeded):

Canonical link: https://commits.webkit.org/275802@main
  • Loading branch information
aprotyas committed Mar 7, 2024
1 parent e73e7e8 commit c7082ca
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2606,9 +2606,8 @@ static FloatRect computeMarqueeSelectionRect(const WebCore::FloatPoint& point1,
if ([m_pdfDocument respondsToSelector:@selector(selectionFromPage:atPoint:toPage:atPoint:withGranularity:)])
selection = [m_pdfDocument selectionFromPage:fromPage.get() atPoint:m_selectionTrackingData.startPagePoint toPage:toPage.get() atPoint:pagePoint withGranularity:toPDFSelectionGranularity(m_selectionTrackingData.granularity)];
else
#else
selection = [m_pdfDocument selectionFromPage:fromPage.get() atPoint:m_selectionTrackingData.startPagePoint toPage:toPage.get() atPoint:pagePoint];
#endif
selection = [m_pdfDocument selectionFromPage:fromPage.get() atPoint:m_selectionTrackingData.startPagePoint toPage:toPage.get() atPoint:pagePoint];

if (m_selectionTrackingData.granularity == SelectionGranularity::Character && m_selectionTrackingData.shouldExtendCurrentSelection)
[selection addSelection:m_selectionTrackingData.selectionToExtendWith.get()];
Expand Down

0 comments on commit c7082ca

Please sign in to comment.