Bug 237516 - PDF.js content script is adding custom cocoa style unconditionally
Summary: PDF.js content script is adding custom cocoa style unconditionally
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: 235969 237527
  Show dependency treegraph
 
Reported: 2022-03-07 02:52 PST by Carlos Garcia Campos
Modified: 2022-03-08 01:27 PST (History)
10 users (show)

See Also:


Attachments
Patch (5.96 KB, patch)
2022-03-07 02:56 PST, Carlos Garcia Campos
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Carlos Garcia Campos 2022-03-07 02:52:09 PST
I should be possible to add different style depending on the platform.
Comment 1 Carlos Garcia Campos 2022-03-07 02:56:02 PST
Created attachment 453953 [details]
Patch
Comment 2 Tim Nguyen (:ntim) 2022-03-07 08:48:21 PST
Comment on attachment 453953 [details]
Patch

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

> Source/WebCore/html/PDFDocument.cpp:217
> +#if PLATFORM(COCOA)
> +    link->setAttribute(hrefAttr, "webkit-pdfjs-viewer://pdfjs/extras/cocoa/style.css"_s);
> +#endif

Do #if preprocessing conditions not work in the JS file? If they do, I'd rather see this logic in the JS file.
Comment 3 Carlos Garcia Campos 2022-03-08 00:33:07 PST
Comment on attachment 453953 [details]
Patch

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

>> Source/WebCore/html/PDFDocument.cpp:217
>> +#endif
> 
> Do #if preprocessing conditions not work in the JS file? If they do, I'd rather see this logic in the JS file.

I don't think so, the script is injected as is, without any preprocessing. I don't know how to make it platform dependent in a JS file, that's why I moved it to cpp.
Comment 4 EWS 2022-03-08 01:26:50 PST
Committed r290983 (248161@main): <https://commits.webkit.org/248161@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 453953 [details].
Comment 5 Radar WebKit Bug Importer 2022-03-08 01:27:21 PST
<rdar://problem/89955906>