Diff
Modified: trunk/Source/WebKit2/ChangeLog (125001 => 125002)
--- trunk/Source/WebKit2/ChangeLog 2012-08-08 07:06:28 UTC (rev 125001)
+++ trunk/Source/WebKit2/ChangeLog 2012-08-08 07:12:26 UTC (rev 125002)
@@ -1,3 +1,33 @@
+2012-08-08 Mario Sanchez Prada <msanc...@igalia.com>
+
+ [WK2] Add new C API to generate MHTML data from the UI process
+ https://bugs.webkit.org/show_bug.cgi?id=89872
+
+ Reviewed by Anders Carlsson.
+
+ Add new C API in the UI Process, using ENABLE(MHTML) guards as needed.
+
+ * UIProcess/API/C/WKPage.cpp:
+ (WKPageGetContentsAsMHTMLData):
+ * UIProcess/API/C/WKPage.h:
+
+ Implementation in the UI Process's WebPage proxy object.
+
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit):
+ (WebKit::WebPageProxy::getContentsAsMHTMLData):
+ * UIProcess/WebPageProxy.h:
+ (WebPageProxy):
+
+ Implementation in the WebProcess, relying in WebCore::MHTMLArchive.
+
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit):
+ (WebKit::WebPage::getContentsAsMHTMLData):
+ * WebProcess/WebPage/WebPage.h:
+ (WebPage):
+ * WebProcess/WebPage/WebPage.messages.in:
+
2012-08-07 YoungTaeck Song <youngtaeck.s...@samsung.com>
[WK2][EFL] Implement accelerated compositing on WK2 Efl port
Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp (125001 => 125002)
--- trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp 2012-08-08 07:06:28 UTC (rev 125001)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp 2012-08-08 07:12:26 UTC (rev 125002)
@@ -582,6 +582,13 @@
}
#endif
+void WKPageGetContentsAsMHTMLData(WKPageRef pageRef, bool useBinaryEncoding, void* context, WKPageGetContentsAsMHTMLDataFunction callback)
+{
+#if ENABLE(MHTML)
+ toImpl(pageRef)->getContentsAsMHTMLData(DataCallback::create(context, callback), useBinaryEncoding);
+#endif
+}
+
void WKPageForceRepaint(WKPageRef pageRef, void* context, WKPageForceRepaintFunction callback)
{
toImpl(pageRef)->forceRepaint(VoidCallback::create(context, callback));
Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPage.h (125001 => 125002)
--- trunk/Source/WebKit2/UIProcess/API/C/WKPage.h 2012-08-08 07:06:28 UTC (rev 125001)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPage.h 2012-08-08 07:12:26 UTC (rev 125002)
@@ -465,6 +465,9 @@
WK_EXPORT void WKPageGetContentsAsString_b(WKPageRef page, WKPageGetContentsAsStringBlock block);
#endif
+typedef void (*WKPageGetContentsAsMHTMLDataFunction)(WKDataRef, WKErrorRef, void*);
+WK_EXPORT void WKPageGetContentsAsMHTMLData(WKPageRef page, bool useBinaryEncoding, void* context, WKPageGetContentsAsMHTMLDataFunction function);
+
typedef void (*WKPageForceRepaintFunction)(WKErrorRef, void*);
WK_EXPORT void WKPageForceRepaint(WKPageRef page, void* context, WKPageForceRepaintFunction function);
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (125001 => 125002)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2012-08-08 07:06:28 UTC (rev 125001)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2012-08-08 07:12:26 UTC (rev 125002)
@@ -1656,6 +1656,21 @@
process()->send(Messages::WebPage::GetContentsAsString(callbackID), m_pageID);
}
+#if ENABLE(MHTML)
+void WebPageProxy::getContentsAsMHTMLData(PassRefPtr<DataCallback> prpCallback, bool useBinaryEncoding)
+{
+ RefPtr<DataCallback> callback = prpCallback;
+ if (!isValid()) {
+ callback->invalidate();
+ return;
+ }
+
+ uint64_t callbackID = callback->callbackID();
+ m_dataCallbacks.set(callbackID, callback.get());
+ process()->send(Messages::WebPage::GetContentsAsMHTMLData(callbackID, useBinaryEncoding), m_pageID);
+}
+#endif
+
void WebPageProxy::getSelectionOrContentsAsString(PassRefPtr<StringCallback> prpCallback)
{
RefPtr<StringCallback> callback = prpCallback;
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (125001 => 125002)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2012-08-08 07:06:28 UTC (rev 125001)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2012-08-08 07:12:26 UTC (rev 125002)
@@ -528,6 +528,9 @@
#endif
void getContentsAsString(PassRefPtr<StringCallback>);
+#if ENABLE(MHTML)
+ void getContentsAsMHTMLData(PassRefPtr<DataCallback>, bool useBinaryEncoding);
+#endif
void getMainResourceDataOfFrame(WebFrameProxy*, PassRefPtr<DataCallback>);
void getResourceDataFromFrame(WebFrameProxy*, WebURL*, PassRefPtr<DataCallback>);
void getRenderTreeExternalRepresentation(PassRefPtr<StringCallback>);
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (125001 => 125002)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2012-08-08 07:06:28 UTC (rev 125001)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2012-08-08 07:12:26 UTC (rev 125002)
@@ -120,6 +120,10 @@
#include <WebCore/Range.h>
#include <WebCore/VisiblePosition.h>
+#if ENABLE(MHTML)
+#include <WebCore/MHTMLArchive.h>
+#endif
+
#if ENABLE(PLUGIN_PROCESS)
#if PLATFORM(MAC)
#include "MachPort.h"
@@ -1857,6 +1861,22 @@
send(Messages::WebPageProxy::StringCallback(resultString, callbackID));
}
+#if ENABLE(MHTML)
+void WebPage::getContentsAsMHTMLData(uint64_t callbackID, bool useBinaryEncoding)
+{
+ CoreIPC::DataReference dataReference;
+
+ RefPtr<SharedBuffer> buffer = useBinaryEncoding
+ ? MHTMLArchive::generateMHTMLDataUsingBinaryEncoding(m_page.get())
+ : MHTMLArchive::generateMHTMLData(m_page.get());
+
+ if (buffer)
+ dataReference = CoreIPC::DataReference(reinterpret_cast<const uint8_t*>(buffer->data()), buffer->size());
+
+ send(Messages::WebPageProxy::DataCallback(dataReference, callbackID));
+}
+#endif
+
void WebPage::getRenderTreeExternalRepresentation(uint64_t callbackID)
{
String resultString = renderTreeExternalRepresentation();
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (125001 => 125002)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h 2012-08-08 07:06:28 UTC (rev 125001)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h 2012-08-08 07:12:26 UTC (rev 125002)
@@ -657,6 +657,9 @@
void viewWillEndLiveResize();
void getContentsAsString(uint64_t callbackID);
+#if ENABLE(MHTML)
+ void getContentsAsMHTMLData(uint64_t callbackID, bool useBinaryEncoding);
+#endif
void getMainResourceDataOfFrame(uint64_t frameID, uint64_t callbackID);
void getResourceDataFromFrame(uint64_t frameID, const String& resourceURL, uint64_t callbackID);
void getRenderTreeExternalRepresentation(uint64_t callbackID);
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in (125001 => 125002)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in 2012-08-08 07:06:28 UTC (rev 125001)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in 2012-08-08 07:12:26 UTC (rev 125002)
@@ -91,6 +91,9 @@
# Callbacks.
GetContentsAsString(uint64_t callbackID)
+#if ENABLE(MHTML)
+ GetContentsAsMHTMLData(uint64_t callbackID, bool useBinaryEncoding)
+#endif
GetMainResourceDataOfFrame(uint64_t frameID, uint64_t callbackID)
GetResourceDataFromFrame(uint64_t frameID, WTF::String resourceURL, uint64_t callbackID)
GetRenderTreeExternalRepresentation(uint64_t callbackID)