[iOS][wk2] Use ImageDocument to display subframe PDFs
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 18 Jun 2014 01:35:32 +0000 (01:35 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 18 Jun 2014 01:35:32 +0000 (01:35 +0000)
commitd910ffd6a246229de1b9ad812474cf05b5a4a6ef
tree3cd470247c302db381d3781d6ea32af814e455df
parent84a1403036685a35e845d0b65dc0b91c1c78de72
[iOS][wk2] Use ImageDocument to display subframe PDFs
https://bugs.webkit.org/show_bug.cgi?id=133944
<rdar://problem/17205983>

Reviewed by Dan Bates.

* dom/DOMImplementation.cpp:
(WebCore::DOMImplementation::createDocument):
Make a ImageDocument to show our subframe PDF, if the setting is enabled.

* html/ImageDocument.cpp:
(WebCore::ImageDocument::finishedParsing):
(WebCore::ImageDocument::createDocumentStructure):
Set the ResourceResponse on the ImageElement upon creation, instead of
when the load finishes. This way, when the internal CachedImage creates
its Image, it can have the correct MIME type for the response, and can
make a PDFDocumentImage if necessary.

We never noticed this before because CachedImage falls back to making a
BitmapImage, and that was the only case that was normally used.

Throw an explicit white background behind PDF ImageDocuments; PDFDocumentImage
paints with a transparent background, but when used as an ImageDocument
it seems reasonable to assume that there should be a white page background
(similar to what PDFPlugin and friends do).

* loader/DocumentWriter.cpp:
(WebCore::DocumentWriter::createDocument):
Don't make a PDFDocument if we want to use an ImageDocument for this subframe PDF.

* page/Settings.in:

* platform/MIMETypeRegistry.cpp:
(WebCore::MIMETypeRegistry::isPDFMIMEType):
* platform/MIMETypeRegistry.h:
Expose the already implemented pdfMIMETypes table just like all the rest.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences):
Always use ImageDocument for subframe PDFs in WebKit2 on iOS.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@170091 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/dom/DOMImplementation.cpp
Source/WebCore/html/ImageDocument.cpp
Source/WebCore/loader/DocumentWriter.cpp
Source/WebCore/page/Settings.in
Source/WebCore/platform/MIMETypeRegistry.cpp
Source/WebCore/platform/MIMETypeRegistry.h
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebPage/WebPage.cpp