Bug 235970 - Create PDFDocument stub
Summary: Create PDFDocument stub
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: PDF (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Tim Nguyen (:ntim)
URL:
Keywords: InRadar
Depends on: 236529
Blocks: 235969
  Show dependency treegraph
 
Reported: 2022-02-01 12:48 PST by Tim Nguyen (:ntim)
Modified: 2022-02-11 15:12 PST (History)
12 users (show)

See Also:


Attachments
Patch (13.40 KB, patch)
2022-02-02 14:58 PST, Tim Nguyen (:ntim)
bfulgham: review+
bfulgham: commit-queue-
Details | Formatted Diff | Diff
[fast-cq] Patch (13.40 KB, patch)
2022-02-03 00:11 PST, Tim Nguyen (:ntim)
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tim Nguyen (:ntim) 2022-02-01 12:48:02 PST
Empty stub
Comment 1 Radar WebKit Bug Importer 2022-02-01 15:31:32 PST
<rdar://problem/88351855>
Comment 2 Tim Nguyen (:ntim) 2022-02-02 14:58:48 PST
Created attachment 450700 [details]
Patch
Comment 3 Brent Fulgham 2022-02-02 16:30:04 PST
Comment on attachment 450700 [details]
Patch

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

I think this looks fine as a first step, but needs a few adjustments before you land.

> Source/WebCore/dom/DOMImplementation.cpp:156
> +    if (settings.pdfJSViewerEnabled() && MIMETypeRegistry::isPDFMIMEType(contentType))

You should check for nullptr frame, like we do for the image case.

> Source/WebCore/html/PDFDocument.cpp:97
> +    // FIXME: add actual viewer URL

// FIXME: Replace about:blank with actual viewer URL

> Source/WebCore/html/PDFDocument.cpp:106
> +    body->setAttribute(styleAttr, "margin: 0px;height: 100vh;");

body->setAttribute(styleAttr, AtomString("margin: 0px;height: 100vh;", AtomString::ConstructFromLiteral));

> Source/WebCore/html/PDFDocument.cpp:111
> +    iframe->setAttribute(styleAttr, "width: 100%; height: 100%; border: 0; display: block;");

iframe->setAttribute(styleAttr, AtomString("width: 100%; height: 100%; border: 0; display: block;", AtomString::ConstructFromLiteral));

> Source/WebCore/html/PDFDocument.cpp:121
> +    // FIXME: Collect bytes during parsing

We usually do:
notImplemented();

> Source/WebCore/html/PDFDocument.cpp:127
> +    // FIXME: Send bytes as a blob into the iframe, and ask it to render that blob

Ditto.
Comment 4 Tim Nguyen (:ntim) 2022-02-03 00:08:50 PST
(In reply to Brent Fulgham from comment #3)
> Comment on attachment 450700 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=450700&action=review
> 
> I think this looks fine as a first step, but needs a few adjustments before
> you land.
> 
> > Source/WebCore/dom/DOMImplementation.cpp:156
> > +    if (settings.pdfJSViewerEnabled() && MIMETypeRegistry::isPDFMIMEType(contentType))
> 
> You should check for nullptr frame, like we do for the image case.
> 
> > Source/WebCore/html/PDFDocument.cpp:97
> > +    // FIXME: add actual viewer URL
> 
> // FIXME: Replace about:blank with actual viewer URL
> 
> > Source/WebCore/html/PDFDocument.cpp:106
> > +    body->setAttribute(styleAttr, "margin: 0px;height: 100vh;");
> 
> body->setAttribute(styleAttr, AtomString("margin: 0px;height: 100vh;",
> AtomString::ConstructFromLiteral));
> 
> > Source/WebCore/html/PDFDocument.cpp:111
> > +    iframe->setAttribute(styleAttr, "width: 100%; height: 100%; border: 0; display: block;");
> 
> iframe->setAttribute(styleAttr, AtomString("width: 100%; height: 100%;
> border: 0; display: block;", AtomString::ConstructFromLiteral));

Done.

> > Source/WebCore/html/PDFDocument.cpp:121
> > +    // FIXME: Collect bytes during parsing
> 
> We usually do:
> notImplemented();
> 
> > Source/WebCore/html/PDFDocument.cpp:127
> > +    // FIXME: Send bytes as a blob into the iframe, and ask it to render that blob
> 
> Ditto.

First iteration will be URL-based, so I'll remove those comments for now. I'll file an bug to change it from URL-based to blob-based.
Comment 5 Tim Nguyen (:ntim) 2022-02-03 00:11:56 PST
Created attachment 450739 [details]
[fast-cq] Patch
Comment 6 EWS 2022-02-03 00:16:48 PST
Committed r289031 (246739@main): <https://commits.webkit.org/246739@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 450739 [details].