Bug 177582 - Request for PDF URL targets for specific pages, sections, etc.
Summary: Request for PDF URL targets for specific pages, sections, etc.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: PDF (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-09-27 16:50 PDT by Aishwarya Nirmal
Modified: 2022-05-12 08:46 PDT (History)
7 users (show)

See Also:


Attachments
Patch (2.37 KB, patch)
2017-09-27 16:57 PDT, Aishwarya Nirmal
no flags Details | Formatted Diff | Diff
Patch (2.48 KB, patch)
2017-09-28 10:32 PDT, Aishwarya Nirmal
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Aishwarya Nirmal 2017-09-27 16:50:31 PDT
<rdar://33496301>
Comment 1 Aishwarya Nirmal 2017-09-27 16:57:56 PDT
Created attachment 322043 [details]
Patch
Comment 2 Tim Horton 2017-09-27 17:05:04 PDT
Comment on attachment 322043 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=322043&action=review

> Source/WebKit/ChangeLog:5
> +        <rdar://problem/33496301>

This should be 5692679; the one you mentioned is a dupe.

> Source/WebKit/WebProcess/Plugins/PDF/PDFLayerControllerSPI.h:71
> +@property (nonatomic, strong) NSString* URLFragment;

The asterisk is on the wrong side; we put them on the left for C++ types and on the right for ObjC types (it's weird, I know).

> Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm:1039
> +        m_pdfLayerController.get().URLFragment = pdfURL.substring(index);

This should get wrapped in an __MAC_OS_X_VERSION_MIN_REQUIRED ifdef, because it's not available in shipping versions of macOS.
Comment 3 Tim Horton 2017-09-27 17:07:30 PDT
Comment on attachment 322043 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=322043&action=review

> Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm:1037
> +    size_t index = pdfURL.reverseFind('#');

I bet our URL parser has a better way to do this! We should ask Alex.

>> Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm:1039
>> +        m_pdfLayerController.get().URLFragment = pdfURL.substring(index);
> 
> This should get wrapped in an __MAC_OS_X_VERSION_MIN_REQUIRED ifdef, because it's not available in shipping versions of macOS.

Also I generally prefer the [m_pdfLayerController setURLFragment:] variant instead of dot notation in the case where you've got a RetainPtr. (.get() is so ugly)
Comment 4 Tim Horton 2017-09-27 17:08:22 PDT
Comment on attachment 322043 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=322043&action=review

>> Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm:1037
>> +    size_t index = pdfURL.reverseFind('#');
> 
> I bet our URL parser has a better way to do this! We should ask Alex.

Actually, I don't even think we need to ask Alex; URL has fragmentIdentifier()
Comment 5 Wenson Hsieh 2017-09-28 10:05:28 PDT
(In reply to Tim Horton from comment #2)
> Comment on attachment 322043 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=322043&action=review
> 
> > Source/WebKit/ChangeLog:5
> > +        <rdar://problem/33496301>
> 
> This should be 5692679; the one you mentioned is a dupe.
> 
> > Source/WebKit/WebProcess/Plugins/PDF/PDFLayerControllerSPI.h:71
> > +@property (nonatomic, strong) NSString* URLFragment;
> 
> The asterisk is on the wrong side; we put them on the left for C++ types and
> on the right for ObjC types (it's weird, I know).
> 
> > Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm:1039
> > +        m_pdfLayerController.get().URLFragment = pdfURL.substring(index);
> 
> This should get wrapped in an __MAC_OS_X_VERSION_MIN_REQUIRED ifdef, because
> it's not available in shipping versions of macOS.

If I understand correctly, this should be a MIN_REQUIRED check in the implementation file and a MAX_ALLOWED check in PDFLayerControllerSPI.h?
Comment 6 Aishwarya Nirmal 2017-09-28 10:32:06 PDT
Created attachment 322096 [details]
Patch
Comment 7 Aishwarya Nirmal 2017-09-28 10:34:43 PDT
(In reply to Aishwarya Nirmal from comment #0)
> <rdar://33496301>

The original bug is <rdar://5692679>
Comment 8 Tim Horton 2017-09-28 11:13:32 PDT
The title from 5692679 would have been preferable (it makes more sense), for future reference.
Comment 9 WebKit Commit Bot 2017-09-28 11:40:45 PDT
Comment on attachment 322096 [details]
Patch

Clearing flags on attachment: 322096

Committed r222620: <http://trac.webkit.org/changeset/222620>
Comment 10 WebKit Commit Bot 2017-09-28 11:40:46 PDT
All reviewed patches have been landed.  Closing bug.
Comment 11 Tim Horton 2017-09-28 12:35:37 PDT
Minor follow up in https://trac.webkit.org/changeset/222624/webkit
Comment 12 Karim Ardalan 2022-05-12 08:46:44 PDT
This feature is working in Safari for MacOS but still isn't working for Safari on iOS/iPadOS. Could you please fix this?

https://helpx.adobe.com/acrobat/kb/link-html-pdf-page-acrobat.html