[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-10851-g50815da
andersca at apple.com
andersca at apple.com
Wed Dec 22 18:18:20 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 481efa35336707f81fe20eed37920019bbb9a825
Author: andersca at apple.com <andersca at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Dec 9 18:37:30 2010 +0000
Add support for custom representation
https://bugs.webkit.org/show_bug.cgi?id=50767
Reviewed by Sam Weinig.
* Shared/WebProcessCreationParameters.cpp:
(WebKit::WebProcessCreationParameters::encode):
(WebKit::WebProcessCreationParameters::decode):
* Shared/WebProcessCreationParameters.h:
Add mimeTypesWithCustomRepresentation and encode and decode accordingly.
* UIProcess/API/mac/PageClientImpl.h:
* UIProcess/API/mac/PageClientImpl.mm:
(WebKit::PageClientImpl::didCommitLoadForMainFrame):
(WebKit::PageClientImpl::didFinishLoadingDataForCustomRepresentation):
Add empty stubs for now.
* UIProcess/API/qt/qwkpage.cpp:
(QWKPagePrivate::didCommitLoadForMainFrame):
(QWKPagePrivate::didFinishLoadingDataForCustomRepresentation):
* UIProcess/API/qt/qwkpage_p.h:
Add empty stubs.
* UIProcess/PageClient.h:
Add new functions for custom representations.
* UIProcess/WebFrameProxy.cpp:
(WebKit::WebFrameProxy::canShowMIMEType):
Check that the mime type is not null.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didCommitLoadForFrame):
This now takes an additional frameHasCustomRepresentation parameter.
Call the page client function.
(WebKit::WebPageProxy::didFinishLoadingDataForCustomRepresentation):
Call the page client function.
* UIProcess/WebPageProxy.messages.in:
Change DidCommitLoadForFrame message, add DidFinishLoadingDataForCustomRepresentation message.
* UIProcess/mac/WebContextMac.mm:
(WebKit::WebContext::platformInitializeWebProcess):
We want to use custom representations for PDF and PostScript MIME types.
* UIProcess/win/WebView.cpp:
(WebKit::WebView::didCommitLoadForMainFrame):
(WebKit::WebView::didFinishLoadingDataForCustomRepresentation):
* UIProcess/win/WebView.h:
Add stubs.
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::WebFrameLoaderClient):
Initialize m_frameHasCustomRepresentation.
(WebKit::WebFrameLoaderClient::hasHTMLView):
The frame has a HTML view unless it has a custom representation.
(WebKit::WebFrameLoaderClient::dispatchDidCommitLoad):
Pass along whether the frame has a custom representation.
(WebKit::WebFrameLoaderClient::committedLoad):
Don't send data back to WebCore if the frame has a custom representation.
(WebKit::WebFrameLoaderClient::finishedLoading):
Send all the data to the UI process.
(WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage):
Update the m_frameHasCustomRepresentation state based on the MIME type.
* WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
(WebKit::WebFrameLoaderClient::frameHasCustomRepresentation):
Add getter.
* WebProcess/WebPage/mac/ChunkedUpdateDrawingAreaMac.cpp:
(WebKit::ChunkedUpdateDrawingArea::paintIntoUpdateChunk):
Don't do any painting if the main frame has a custom representation.
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::initializeWebProcess):
Add all the MIME types with custom representations.
* WebProcess/WebProcess.h:
(WebKit::WebProcess::shouldUseCustomRepresentationForMIMEType):
Add getter.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@73625 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 4b97442..418053b 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,91 @@
+2010-12-09 Anders Carlsson <andersca at apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Add support for custom representation
+ https://bugs.webkit.org/show_bug.cgi?id=50767
+
+ * Shared/WebProcessCreationParameters.cpp:
+ (WebKit::WebProcessCreationParameters::encode):
+ (WebKit::WebProcessCreationParameters::decode):
+ * Shared/WebProcessCreationParameters.h:
+ Add mimeTypesWithCustomRepresentation and encode and decode accordingly.
+
+ * UIProcess/API/mac/PageClientImpl.h:
+ * UIProcess/API/mac/PageClientImpl.mm:
+ (WebKit::PageClientImpl::didCommitLoadForMainFrame):
+ (WebKit::PageClientImpl::didFinishLoadingDataForCustomRepresentation):
+ Add empty stubs for now.
+
+ * UIProcess/API/qt/qwkpage.cpp:
+ (QWKPagePrivate::didCommitLoadForMainFrame):
+ (QWKPagePrivate::didFinishLoadingDataForCustomRepresentation):
+ * UIProcess/API/qt/qwkpage_p.h:
+ Add empty stubs.
+
+ * UIProcess/PageClient.h:
+ Add new functions for custom representations.
+
+ * UIProcess/WebFrameProxy.cpp:
+ (WebKit::WebFrameProxy::canShowMIMEType):
+ Check that the mime type is not null.
+
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::didCommitLoadForFrame):
+ This now takes an additional frameHasCustomRepresentation parameter.
+ Call the page client function.
+
+ (WebKit::WebPageProxy::didFinishLoadingDataForCustomRepresentation):
+ Call the page client function.
+
+ * UIProcess/WebPageProxy.messages.in:
+ Change DidCommitLoadForFrame message, add DidFinishLoadingDataForCustomRepresentation message.
+
+ * UIProcess/mac/WebContextMac.mm:
+ (WebKit::WebContext::platformInitializeWebProcess):
+ We want to use custom representations for PDF and PostScript MIME types.
+
+ * UIProcess/win/WebView.cpp:
+ (WebKit::WebView::didCommitLoadForMainFrame):
+ (WebKit::WebView::didFinishLoadingDataForCustomRepresentation):
+ * UIProcess/win/WebView.h:
+ Add stubs.
+
+ * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+ (WebKit::WebFrameLoaderClient::WebFrameLoaderClient):
+ Initialize m_frameHasCustomRepresentation.
+
+ (WebKit::WebFrameLoaderClient::hasHTMLView):
+ The frame has a HTML view unless it has a custom representation.
+
+ (WebKit::WebFrameLoaderClient::dispatchDidCommitLoad):
+ Pass along whether the frame has a custom representation.
+
+ (WebKit::WebFrameLoaderClient::committedLoad):
+ Don't send data back to WebCore if the frame has a custom representation.
+
+ (WebKit::WebFrameLoaderClient::finishedLoading):
+ Send all the data to the UI process.
+
+ (WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage):
+ Update the m_frameHasCustomRepresentation state based on the MIME type.
+
+ * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
+ (WebKit::WebFrameLoaderClient::frameHasCustomRepresentation):
+ Add getter.
+
+ * WebProcess/WebPage/mac/ChunkedUpdateDrawingAreaMac.cpp:
+ (WebKit::ChunkedUpdateDrawingArea::paintIntoUpdateChunk):
+ Don't do any painting if the main frame has a custom representation.
+
+ * WebProcess/WebProcess.cpp:
+ (WebKit::WebProcess::initializeWebProcess):
+ Add all the MIME types with custom representations.
+
+ * WebProcess/WebProcess.h:
+ (WebKit::WebProcess::shouldUseCustomRepresentationForMIMEType):
+ Add getter.
+
2010-12-09 Maciej Stachowiak <mjs at apple.com>
Reviewed by Dan Bernstein.
diff --git a/WebKit2/Shared/WebProcessCreationParameters.cpp b/WebKit2/Shared/WebProcessCreationParameters.cpp
index 4a00106..8b20d5b 100644
--- a/WebKit2/Shared/WebProcessCreationParameters.cpp
+++ b/WebKit2/Shared/WebProcessCreationParameters.cpp
@@ -46,6 +46,7 @@ void WebProcessCreationParameters::encode(CoreIPC::ArgumentEncoder* encoder) con
encoder->encode(urlSchemesRegistererdAsEmptyDocument);
encoder->encode(urlSchemesRegisteredAsSecure);
encoder->encode(urlSchemesForWhichDomainRelaxationIsForbidden);
+ encoder->encode(mimeTypesWithCustomRepresentation);
encoder->encode(static_cast<uint32_t>(cacheModel));
encoder->encode(shouldTrackVisitedLinks);
encoder->encode(languageCode);
@@ -72,6 +73,8 @@ bool WebProcessCreationParameters::decode(CoreIPC::ArgumentDecoder* decoder, Web
return false;
if (!decoder->decode(parameters.urlSchemesForWhichDomainRelaxationIsForbidden))
return false;
+ if (!decoder->decode(parameters.mimeTypesWithCustomRepresentation))
+ return false;
uint32_t cacheModel;
if (!decoder->decode(cacheModel))
diff --git a/WebKit2/Shared/WebProcessCreationParameters.h b/WebKit2/Shared/WebProcessCreationParameters.h
index 4bd2a7b..f490f9f 100644
--- a/WebKit2/Shared/WebProcessCreationParameters.h
+++ b/WebKit2/Shared/WebProcessCreationParameters.h
@@ -56,6 +56,9 @@ struct WebProcessCreationParameters {
Vector<String> urlSchemesRegisteredAsSecure;
Vector<String> urlSchemesForWhichDomainRelaxationIsForbidden;
+ // MIME types for which the UI process will handle showing the data.
+ Vector<String> mimeTypesWithCustomRepresentation;
+
CacheModel cacheModel;
bool shouldTrackVisitedLinks;
diff --git a/WebKit2/UIProcess/API/mac/PageClientImpl.h b/WebKit2/UIProcess/API/mac/PageClientImpl.h
index 72ef0d1..66b6f6f 100644
--- a/WebKit2/UIProcess/API/mac/PageClientImpl.h
+++ b/WebKit2/UIProcess/API/mac/PageClientImpl.h
@@ -76,6 +76,9 @@ private:
virtual void pageDidLeaveAcceleratedCompositing();
#endif
+ virtual void didCommitLoadForMainFrame(bool useCustomRepresentation);
+ virtual void didFinishLoadingDataForCustomRepresentation(const CoreIPC::DataReference&);
+
WKView* m_wkView;
RetainPtr<WebEditorUndoTargetObjC> m_undoTarget;
};
diff --git a/WebKit2/UIProcess/API/mac/PageClientImpl.mm b/WebKit2/UIProcess/API/mac/PageClientImpl.mm
index 192defb..57297a2 100644
--- a/WebKit2/UIProcess/API/mac/PageClientImpl.mm
+++ b/WebKit2/UIProcess/API/mac/PageClientImpl.mm
@@ -273,4 +273,12 @@ void PageClientImpl::pageDidLeaveAcceleratedCompositing()
}
#endif // USE(ACCELERATED_COMPOSITING)
+void PageClientImpl::didCommitLoadForMainFrame(bool useCustomRepresentation)
+{
+}
+
+void PageClientImpl::didFinishLoadingDataForCustomRepresentation(const CoreIPC::DataReference&)
+{
+}
+
} // namespace WebKit
diff --git a/WebKit2/UIProcess/API/qt/qwkpage.cpp b/WebKit2/UIProcess/API/qt/qwkpage.cpp
index cebac2b..2a5e018 100644
--- a/WebKit2/UIProcess/API/qt/qwkpage.cpp
+++ b/WebKit2/UIProcess/API/qt/qwkpage.cpp
@@ -159,6 +159,14 @@ void QWKPagePrivate::setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut)
{
}
+void QWKPagePrivate::didCommitLoadForMainFrame(bool useCustomRepresentation)
+{
+}
+
+void QWKPagePrivate::didFinishLoadingDataForCustomRepresentation(const CoreIPC::DataReference&)
+{
+}
+
void QWKPagePrivate::paint(QPainter* painter, QRect area)
{
painter->save();
diff --git a/WebKit2/UIProcess/API/qt/qwkpage_p.h b/WebKit2/UIProcess/API/qt/qwkpage_p.h
index 55ff764..1d8cb5b 100644
--- a/WebKit2/UIProcess/API/qt/qwkpage_p.h
+++ b/WebKit2/UIProcess/API/qt/qwkpage_p.h
@@ -68,6 +68,9 @@ public:
virtual void setFindIndicator(PassRefPtr<WebKit::FindIndicator>, bool fadeOut);
+ virtual void didCommitLoadForMainFrame(bool useCustomRepresentation);
+ virtual void didFinishLoadingDataForCustomRepresentation(const CoreIPC::DataReference&);
+
void paint(QPainter* painter, QRect);
void keyPressEvent(QKeyEvent*);
diff --git a/WebKit2/UIProcess/PageClient.h b/WebKit2/UIProcess/PageClient.h
index c3e5a6a..bb6cc5f 100644
--- a/WebKit2/UIProcess/PageClient.h
+++ b/WebKit2/UIProcess/PageClient.h
@@ -90,6 +90,10 @@ public:
#if PLATFORM(WIN)
virtual HWND nativeWindow() = 0;
#endif
+
+ // Custom representations.
+ virtual void didCommitLoadForMainFrame(bool useCustomRepresentation) = 0;
+ virtual void didFinishLoadingDataForCustomRepresentation(const CoreIPC::DataReference&) = 0;
};
} // namespace WebKit
diff --git a/WebKit2/UIProcess/WebFrameProxy.cpp b/WebKit2/UIProcess/WebFrameProxy.cpp
index a480e51..73b321d 100644
--- a/WebKit2/UIProcess/WebFrameProxy.cpp
+++ b/WebKit2/UIProcess/WebFrameProxy.cpp
@@ -87,7 +87,7 @@ bool WebFrameProxy::canShowMIMEType(const String& mimeType) const
#if PLATFORM(MAC)
// On Mac, we can show PDFs in the main frame.
- if (isMainFrame())
+ if (isMainFrame() && !mimeType.isEmpty())
return WebContext::pdfAndPostScriptMIMETypes().contains(mimeType);
#endif
diff --git a/WebKit2/UIProcess/WebPageProxy.cpp b/WebKit2/UIProcess/WebPageProxy.cpp
index 5ed3bc8..8892b65 100644
--- a/WebKit2/UIProcess/WebPageProxy.cpp
+++ b/WebKit2/UIProcess/WebPageProxy.cpp
@@ -27,6 +27,7 @@
#include "AuthenticationChallengeProxy.h"
#include "AuthenticationDecisionListener.h"
+#include "DataReference.h"
#include "DrawingAreaProxy.h"
#include "FindIndicator.h"
#include "MessageID.h"
@@ -809,7 +810,7 @@ void WebPageProxy::didFailProvisionalLoadForFrame(uint64_t frameID, const Resour
m_loaderClient.didFailProvisionalLoadWithErrorForFrame(this, frame, error, userData.get());
}
-void WebPageProxy::didCommitLoadForFrame(uint64_t frameID, const String& mimeType, const PlatformCertificateInfo& certificateInfo, CoreIPC::ArgumentDecoder* arguments)
+void WebPageProxy::didCommitLoadForFrame(uint64_t frameID, const String& mimeType, bool frameHasCustomRepresentation, const PlatformCertificateInfo& certificateInfo, CoreIPC::ArgumentDecoder* arguments)
{
RefPtr<APIObject> userData;
WebContextUserMessageDecoder messageDecoder(userData, pageNamespace()->context());
@@ -822,6 +823,10 @@ void WebPageProxy::didCommitLoadForFrame(uint64_t frameID, const String& mimeTyp
frame->setIsFrameSet(false);
frame->setCertificateInfo(WebCertificateInfo::create(certificateInfo));
frame->didCommitLoad();
+
+ if (frame->isMainFrame())
+ m_pageClient->didCommitLoadForMainFrame(frameHasCustomRepresentation);
+
m_loaderClient.didCommitLoadForFrame(this, frame, userData.get());
}
@@ -1570,4 +1575,9 @@ void WebPageProxy::exceededDatabaseQuota(uint64_t frameID, const String& originI
newQuota = m_uiClient.exceededDatabaseQuota(this, frame, origin.get(), databaseName, displayName, currentQuota, currentUsage, expectedUsage);
}
+void WebPageProxy::didFinishLoadingDataForCustomRepresentation(const CoreIPC::DataReference& dataReference)
+{
+ m_pageClient->didFinishLoadingDataForCustomRepresentation(dataReference);
+}
+
} // namespace WebKit
diff --git a/WebKit2/UIProcess/WebPageProxy.h b/WebKit2/UIProcess/WebPageProxy.h
index 689bb80..4230bb1 100644
--- a/WebKit2/UIProcess/WebPageProxy.h
+++ b/WebKit2/UIProcess/WebPageProxy.h
@@ -279,7 +279,7 @@ private:
void didStartProvisionalLoadForFrame(uint64_t frameID, const String&, bool loadingSubstituteDataForUnreachableURL, CoreIPC::ArgumentDecoder*);
void didReceiveServerRedirectForProvisionalLoadForFrame(uint64_t frameID, const String&, CoreIPC::ArgumentDecoder*);
void didFailProvisionalLoadForFrame(uint64_t frameID, const WebCore::ResourceError&, CoreIPC::ArgumentDecoder*);
- void didCommitLoadForFrame(uint64_t frameID, const String& mimeType, const PlatformCertificateInfo&, CoreIPC::ArgumentDecoder*);
+ void didCommitLoadForFrame(uint64_t frameID, const String& mimeType, bool frameHasCustomRepresentation, const PlatformCertificateInfo&, CoreIPC::ArgumentDecoder*);
void didFinishDocumentLoadForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder*);
void didFinishLoadForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder*);
void didFailLoadForFrame(uint64_t frameID, const WebCore::ResourceError&, CoreIPC::ArgumentDecoder*);
@@ -384,6 +384,8 @@ private:
void canAuthenticateAgainstProtectionSpaceInFrame(uint64_t frameID, const WebCore::ProtectionSpace&, bool& canAuthenticate);
void didReceiveAuthenticationChallenge(uint64_t frameID, const WebCore::AuthenticationChallenge&, uint64_t challengeID);
+ void didFinishLoadingDataForCustomRepresentation(const CoreIPC::DataReference& data);
+
PageClient* m_pageClient;
WebLoaderClient m_loaderClient;
WebPolicyClient m_policyClient;
diff --git a/WebKit2/UIProcess/WebPageProxy.messages.in b/WebKit2/UIProcess/WebPageProxy.messages.in
index 7ed86e2..bab579e 100644
--- a/WebKit2/UIProcess/WebPageProxy.messages.in
+++ b/WebKit2/UIProcess/WebPageProxy.messages.in
@@ -73,7 +73,7 @@ messages -> WebPageProxy {
DidCreateSubFrame(uint64_t frameID)
# Frame load messages.
- DidCommitLoadForFrame(uint64_t frameID, WTF::String mimeType, WebKit::PlatformCertificateInfo certificateInfo, WebKit::InjectedBundleUserMessageEncoder userData)
+ DidCommitLoadForFrame(uint64_t frameID, WTF::String mimeType, bool hasCustomRepresentation, WebKit::PlatformCertificateInfo certificateInfo, WebKit::InjectedBundleUserMessageEncoder userData)
DidFailLoadForFrame(uint64_t frameID, WebCore::ResourceError error, WebKit::InjectedBundleUserMessageEncoder userData)
DidFailProvisionalLoadForFrame(uint64_t frameID, WebCore::ResourceError error, WebKit::InjectedBundleUserMessageEncoder userData)
DidFinishDocumentLoadForFrame(uint64_t frameID, WebKit::InjectedBundleUserMessageEncoder userData)
@@ -90,6 +90,9 @@ messages -> WebPageProxy {
FrameDidBecomeFrameSet(uint64_t frameID, bool value)
+ # Custom representations
+ DidFinishLoadingDataForCustomRepresentation(CoreIPC::DataReference data)
+
# Forms messages.
WillSubmitForm(uint64_t frameID, uint64_t sourceFrameID, WebKit::StringPairVector textFieldValues, uint64_t listenerID, WebKit::InjectedBundleUserMessageEncoder userData)
diff --git a/WebKit2/UIProcess/mac/WebContextMac.mm b/WebKit2/UIProcess/mac/WebContextMac.mm
index 3beaa53..f04fa5f 100644
--- a/WebKit2/UIProcess/mac/WebContextMac.mm
+++ b/WebKit2/UIProcess/mac/WebContextMac.mm
@@ -64,6 +64,10 @@ String WebContext::applicationCacheDirectory()
void WebContext::platformInitializeWebProcess(WebProcessCreationParameters& parameters)
{
+ // We want to use a PDF view in the UI process for PDF MIME types.
+ HashSet<String, CaseFoldingHash> mimeType = pdfAndPostScriptMIMETypes();
+ parameters.mimeTypesWithCustomRepresentation.appendRange(mimeType.begin(), mimeType.end());
+
#if USE(ACCELERATED_COMPOSITING) && HAVE(HOSTED_CORE_ANIMATION)
mach_port_t renderServerPort = WKInitializeRenderServer();
if (renderServerPort != MACH_PORT_NULL)
diff --git a/WebKit2/UIProcess/win/WebView.cpp b/WebKit2/UIProcess/win/WebView.cpp
index 58ee9ee..a82709e 100644
--- a/WebKit2/UIProcess/win/WebView.cpp
+++ b/WebKit2/UIProcess/win/WebView.cpp
@@ -642,6 +642,14 @@ void WebView::setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut)
// FIXME: Implement.
}
+void WebView::didCommitLoadForMainFrame(bool useCustomRepresentation)
+{
+}
+
+void WebView::didFinishLoadingDataForCustomRepresentation(const CoreIPC::DataReference&)
+{
+}
+
void WebView::setIsInWindow(bool isInWindow)
{
m_page->setIsInWindow(isInWindow);
diff --git a/WebKit2/UIProcess/win/WebView.h b/WebKit2/UIProcess/win/WebView.h
index e1946ef..994f23c 100644
--- a/WebKit2/UIProcess/win/WebView.h
+++ b/WebKit2/UIProcess/win/WebView.h
@@ -116,6 +116,9 @@ private:
void switchToDrawingAreaTypeIfNecessary(DrawingAreaInfo::Type);
#endif
+ void didCommitLoadForMainFrame(bool useCustomRepresentation);
+ void didFinishLoadingDataForCustomRepresentation(const CoreIPC::DataReference&);
+
virtual HWND nativeWindow();
// WebCore::WindowMessageListener
diff --git a/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp b/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
index 97c5a04..9178d20 100644
--- a/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
+++ b/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
@@ -29,6 +29,7 @@
#include "NotImplemented.h"
#include "AuthenticationManager.h"
+#include "DataReference.h"
#include "InjectedBundleUserMessageCoders.h"
#include "PlatformCertificateInfo.h"
#include "PluginView.h"
@@ -73,6 +74,7 @@ namespace WebKit {
WebFrameLoaderClient::WebFrameLoaderClient(WebFrame* frame)
: m_frame(frame)
, m_hasSentResponseToPluginView(false)
+ , m_frameHasCustomRepresentation(false)
{
}
@@ -90,7 +92,7 @@ void WebFrameLoaderClient::frameLoaderDestroyed()
bool WebFrameLoaderClient::hasHTMLView() const
{
- return true;
+ return !m_frameHasCustomRepresentation;
}
bool WebFrameLoaderClient::hasWebView() const
@@ -396,7 +398,7 @@ void WebFrameLoaderClient::dispatchDidCommitLoad()
webPage->sandboxExtensionTracker().didCommitProvisionalLoad(m_frame);
// Notify the UIProcess.
- webPage->send(Messages::WebPageProxy::DidCommitLoadForFrame(m_frame->frameID(), response.mimeType(), PlatformCertificateInfo(response), InjectedBundleUserMessageEncoder(userData.get())));
+ webPage->send(Messages::WebPageProxy::DidCommitLoadForFrame(m_frame->frameID(), response.mimeType(), m_frameHasCustomRepresentation, PlatformCertificateInfo(response), InjectedBundleUserMessageEncoder(userData.get())));
}
void WebFrameLoaderClient::dispatchDidFailProvisionalLoad(const ResourceError& error)
@@ -747,6 +749,10 @@ void WebFrameLoaderClient::didChangeTitle(DocumentLoader*)
void WebFrameLoaderClient::committedLoad(DocumentLoader* loader, const char* data, int length)
{
+ // If we're loading a custom representation, we don't want to hand off the data to WebCore.
+ if (m_frameHasCustomRepresentation)
+ return;
+
if (!m_pluginView)
loader->commitData(data, length);
@@ -775,6 +781,18 @@ void WebFrameLoaderClient::finishedLoading(DocumentLoader* loader)
{
if (!m_pluginView) {
committedLoad(loader, 0, 0);
+
+ if (m_frameHasCustomRepresentation) {
+ WebPage* webPage = m_frame->page();
+ if (!webPage)
+ return;
+
+ RefPtr<SharedBuffer> mainResourceData = loader->mainResourceData();
+ CoreIPC::DataReference dataReference(reinterpret_cast<const uint8_t*>(mainResourceData ? mainResourceData->data() : 0), mainResourceData ? mainResourceData->size() : 0);
+
+ webPage->send(Messages::WebPageProxy::DidFinishLoadingDataForCustomRepresentation(dataReference));
+ }
+
return;
}
@@ -1013,12 +1031,12 @@ void WebFrameLoaderClient::transitionToCommittedFromCachedFrame(CachedFrame*)
void WebFrameLoaderClient::transitionToCommittedForNewPage()
{
-#if ENABLE(TILED_BACKING_STORE)
WebPage* webPage = m_frame->page();
bool isMainFrame = webPage->mainFrame() == m_frame;
- IntSize currentVisibleContentSize = m_frame->coreFrame()->view() ? m_frame->coreFrame()->view()->actualVisibleContentRect().size() : IntSize();
+#if ENABLE(TILED_BACKING_STORE)
+ IntSize currentVisibleContentSize = m_frame->coreFrame()->view() ? m_frame->coreFrame()->view()->actualVisibleContentRect().size() : IntSize();
m_frame->coreFrame()->createView(m_frame->page()->size(), Color::white, false, webPage->resizesToContentsLayoutSize(), isMainFrame && webPage->resizesToContentsEnabled());
if (isMainFrame && webPage->resizesToContentsEnabled()) {
@@ -1029,6 +1047,9 @@ void WebFrameLoaderClient::transitionToCommittedForNewPage()
// The HistoryController will update the scroll position later if needed.
m_frame->coreFrame()->view()->setActualVisibleContentRect(IntRect(IntPoint::zero(), currentVisibleContentSize));
#else
+ const String& mimeType = m_frame->coreFrame()->loader()->documentLoader()->response().mimeType();
+ m_frameHasCustomRepresentation = isMainFrame && WebProcess::shared().shouldUseCustomRepresentationForMIMEType(mimeType);
+
m_frame->coreFrame()->createView(m_frame->page()->size(), Color::white, false, IntSize(), false);
#endif
}
diff --git a/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h b/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h
index ab0288c..191aeb7 100644
--- a/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h
+++ b/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h
@@ -40,6 +40,8 @@ public:
WebFrame* webFrame() const { return m_frame; }
+ bool frameHasCustomRepresentation() const { return m_frameHasCustomRepresentation; }
+
private:
virtual void frameLoaderDestroyed();
@@ -212,6 +214,7 @@ private:
WebFrame* m_frame;
RefPtr<PluginView> m_pluginView;
bool m_hasSentResponseToPluginView;
+ bool m_frameHasCustomRepresentation;
};
uint32_t modifiersForNavigationAction(const WebCore::NavigationAction&);
diff --git a/WebKit2/WebProcess/WebPage/mac/ChunkedUpdateDrawingAreaMac.cpp b/WebKit2/WebProcess/WebPage/mac/ChunkedUpdateDrawingAreaMac.cpp
index a59521a..8fb82c8 100644
--- a/WebKit2/WebProcess/WebPage/mac/ChunkedUpdateDrawingAreaMac.cpp
+++ b/WebKit2/WebProcess/WebPage/mac/ChunkedUpdateDrawingAreaMac.cpp
@@ -26,7 +26,10 @@
#include "ChunkedUpdateDrawingArea.h"
#include "UpdateChunk.h"
+#include "WebFrame.h"
#include "WebPage.h"
+#include "WebFrameLoaderClient.h"
+#include <WebCore/Frame.h>
#include <WebCore/GraphicsContext.h>
#include <wtf/RetainPtr.h>
@@ -36,6 +39,10 @@ namespace WebKit {
void ChunkedUpdateDrawingArea::paintIntoUpdateChunk(UpdateChunk* updateChunk)
{
+ // FIXME: It would be better if we could avoid painting altogether when there is a custom representation.
+ if (static_cast<WebFrameLoaderClient*>(m_webPage->mainFrame()->coreFrame()->loader()->client())->frameHasCustomRepresentation())
+ return;
+
RetainPtr<CGColorSpaceRef> colorSpace(AdoptCF, CGColorSpaceCreateDeviceRGB());
RetainPtr<CGContextRef> bitmapContext(AdoptCF, CGBitmapContextCreate(updateChunk->data(), updateChunk->rect().width(), updateChunk->rect().height(), 8, updateChunk->rect().width() * 4, colorSpace.get(), kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host));
diff --git a/WebKit2/WebProcess/WebProcess.cpp b/WebKit2/WebProcess/WebProcess.cpp
index 389f995..5047086 100644
--- a/WebKit2/WebProcess/WebProcess.cpp
+++ b/WebKit2/WebProcess/WebProcess.cpp
@@ -164,6 +164,9 @@ void WebProcess::initializeWebProcess(const WebProcessCreationParameters& parame
for (size_t i = 0; i < parameters.urlSchemesForWhichDomainRelaxationIsForbidden.size(); ++i)
setDomainRelaxationForbiddenForURLScheme(parameters.urlSchemesForWhichDomainRelaxationIsForbidden[i]);
+ for (size_t i = 0; i < parameters.mimeTypesWithCustomRepresentation.size(); ++i)
+ m_mimeTypesWithCustomRepresentations.add(parameters.mimeTypesWithCustomRepresentation[i]);
+
if (parameters.clearResourceCaches)
clearResourceCaches();
if (parameters.clearApplicationCache)
diff --git a/WebKit2/WebProcess/WebProcess.h b/WebKit2/WebProcess/WebProcess.h
index 56ee543..4cba630 100644
--- a/WebKit2/WebProcess/WebProcess.h
+++ b/WebKit2/WebProcess/WebProcess.h
@@ -35,6 +35,7 @@
#include <WebCore/LinkHash.h>
#include <wtf/Forward.h>
#include <wtf/HashMap.h>
+#include <wtf/HashSet.h>
#if PLATFORM(MAC)
#include "MachPort.h"
@@ -90,6 +91,8 @@ public:
// Will shut down the web process if there are no live pages or downloads.
void shutdownIfPossible();
+ bool shouldUseCustomRepresentationForMIMEType(const String& mimeType) const { return m_mimeTypesWithCustomRepresentations.contains(mimeType); }
+
private:
WebProcess();
@@ -146,6 +149,8 @@ private:
#endif
HashMap<uint64_t, WebFrame*> m_frameMap;
+
+ HashSet<String, CaseFoldingHash> m_mimeTypesWithCustomRepresentations;
};
} // namespace WebKit
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list