Commit 02315226 authored by ap@apple.com's avatar ap@apple.com
Browse files

Reviewed by Darin Adler.

        https://bugs.webkit.org/show_bug.cgi?id=52849
        Make window.print work with WebKit2

        * UIProcess/API/qt/qwkpage.cpp:
        (QWKPage::QWKPage):
        * UIProcess/WebPageProxy.cpp:
        (WebKit::WebPageProxy::printFrame):
        * UIProcess/WebPageProxy.h:
        * UIProcess/WebPageProxy.messages.in:
        * UIProcess/WebUIClient.cpp:
        (WebKit::WebUIClient::printFrame):
        * UIProcess/WebUIClient.h:
        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
        (WebKit::WebChromeClient::print):
        Just pass through deelagte call to a WebKit2 client.

        * UIProcess/API/C/WKPage.h: Also added "Callback" suffix to other printing related function
        types.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@76306 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent f51f2f8a
2011-01-20 Alexey Proskuryakov <ap@apple.com>
Reviewed by Darin Adler.
https://bugs.webkit.org/show_bug.cgi?id=52849
Make window.print work with WebKit2
* UIProcess/API/qt/qwkpage.cpp:
(QWKPage::QWKPage):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::printFrame):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* UIProcess/WebUIClient.cpp:
(WebKit::WebUIClient::printFrame):
* UIProcess/WebUIClient.h:
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::print):
Just pass through deelagte call to a WebKit2 client.
* UIProcess/API/C/WKPage.h: Also added "Callback" suffix to other printing related function
types.
2011-01-20 Anders Carlsson <andersca@apple.com>
 
Reviewed by Darin Adler.
......@@ -177,10 +177,11 @@ typedef void (*WKPageDidScrollCallback)(WKPageRef page, const void *clientInfo);
typedef unsigned long long (*WKPageExceededDatabaseQuotaCallback)(WKPageRef page, WKFrameRef frame, WKSecurityOriginRef origin, WKStringRef databaseName, WKStringRef displayName, unsigned long long currentQuota, unsigned long long currentUsage, unsigned long long expectedUsage, const void *clientInfo);
typedef void (*WKPageRunOpenPanelCallback)(WKPageRef page, WKFrameRef frame, WKOpenPanelParametersRef parameters, WKOpenPanelResultListenerRef listener, const void *clientInfo);
typedef void (*WKPageDecidePolicyForGeolocationPermissionRequestCallback)(WKPageRef page, WKFrameRef frame, WKSecurityOriginRef origin, WKGeolocationPermissionRequestRef permissionRequest, const void* clientInfo);
typedef float (*WKPageHeaderHeight)(WKPageRef page, WKFrameRef frame, const void* clientInfo);
typedef float (*WKPageFooterHeight)(WKPageRef page, WKFrameRef frame, const void* clientInfo);
typedef void (*WKPageDrawHeader)(WKPageRef page, WKFrameRef frame, WKRect rect, const void* clientInfo);
typedef void (*WKPageDrawFooter)(WKPageRef page, WKFrameRef frame, WKRect rect, const void* clientInfo);
typedef float (*WKPageHeaderHeightCallback)(WKPageRef page, WKFrameRef frame, const void* clientInfo);
typedef float (*WKPageFooterHeightCallback)(WKPageRef page, WKFrameRef frame, const void* clientInfo);
typedef void (*WKPageDrawHeaderCallback)(WKPageRef page, WKFrameRef frame, WKRect rect, const void* clientInfo);
typedef void (*WKPageDrawFooterCallback)(WKPageRef page, WKFrameRef frame, WKRect rect, const void* clientInfo);
typedef void (*WKPagePrintFrameCallback)(WKPageRef page, WKFrameRef frame, const void* clientInfo);
struct WKPageUIClient {
int version;
......@@ -211,10 +212,11 @@ struct WKPageUIClient {
WKPageExceededDatabaseQuotaCallback exceededDatabaseQuota;
WKPageRunOpenPanelCallback runOpenPanel;
WKPageDecidePolicyForGeolocationPermissionRequestCallback decidePolicyForGeolocationPermissionRequest;
WKPageHeaderHeight headerHeight;
WKPageFooterHeight footerHeight;
WKPageDrawHeader drawHeader;
WKPageDrawFooter drawFooter;
WKPageHeaderHeightCallback headerHeight;
WKPageFooterHeightCallback footerHeight;
WKPageDrawHeaderCallback drawHeader;
WKPageDrawFooterCallback drawFooter;
WKPagePrintFrameCallback printFrame;
};
typedef struct WKPageUIClient WKPageUIClient;
......
......@@ -457,7 +457,8 @@ QWKPage::QWKPage(QWKContext* context)
0, /* headerHeight */
0, /* footerHeight */
0, /* drawHeader */
0 /* drawFooter */
0, /* drawFooter */
0 /* printFrame */
};
WKPageSetPageUIClient(pageRef(), &uiClient);
}
......
......@@ -1672,6 +1672,14 @@ void WebPageProxy::runOpenPanel(uint64_t frameID, const WebOpenPanelParameters::
didCancelForOpenPanel();
}
void WebPageProxy::printFrame(uint64_t frameID)
{
WebFrameProxy* frame = process()->webFrame(frameID);
MESSAGE_CHECK(frame);
m_uiClient.printFrame(this, frame);
}
#if PLATFORM(QT)
void WebPageProxy::didChangeContentsSize(const WebCore::IntSize& size)
{
......
......@@ -438,6 +438,7 @@ private:
void didChangeViewportData(const WebCore::ViewportArguments&);
void pageDidScroll();
void runOpenPanel(uint64_t frameID, const WebOpenPanelParameters::Data&);
void printFrame(uint64_t frameID);
void exceededDatabaseQuota(uint64_t frameID, const String& originIdentifier, const String& databaseName, const String& displayName, uint64_t currentQuota, uint64_t currentUsage, uint64_t expectedUsage, uint64_t& newQuota);
void requestGeolocationPermissionForFrame(uint64_t geolocationID, uint64_t frameID, String originIdentifier);
......
......@@ -53,6 +53,7 @@ messages -> WebPageProxy {
RunBeforeUnloadConfirmPanel(WTF::String message, uint64_t frameID) -> (bool shouldClose)
PageDidScroll()
RunOpenPanel(uint64_t frameID, WebKit::WebOpenPanelParameters::Data parameters)
PrintFrame(uint64_t frameID) -> ()
#if ENABLE(TILED_BACKING_STORE)
PageDidRequestScroll(WebCore::IntSize delta)
......
......@@ -305,4 +305,12 @@ void WebUIClient::drawFooter(WebPageProxy* page, WebFrameProxy* frame, const Web
m_client.drawFooter(toAPI(page), toAPI(frame), toAPI(rect), m_client.clientInfo);
}
void WebUIClient::printFrame(WebPageProxy* page, WebFrameProxy* frame)
{
if (!m_client.printFrame)
return;
m_client.printFrame(toAPI(page), toAPI(frame), m_client.clientInfo);
}
} // namespace WebKit
......@@ -92,6 +92,7 @@ public:
float footerHeight(WebPageProxy*, WebFrameProxy*);
void drawHeader(WebPageProxy*, WebFrameProxy*, const WebCore::FloatRect&);
void drawFooter(WebPageProxy*, WebFrameProxy*, const WebCore::FloatRect&);
void printFrame(WebPageProxy*, WebFrameProxy*);
};
} // namespace WebKit
......
......@@ -466,9 +466,10 @@ void WebChromeClient::setToolTip(const String& toolTip, TextDirection)
m_page->send(Messages::WebPageProxy::SetToolTip(m_cachedToolTip));
}
void WebChromeClient::print(Frame*)
void WebChromeClient::print(Frame* frame)
{
notImplemented();
WebFrame* webFrame = static_cast<WebFrameLoaderClient*>(frame->loader()->client())->webFrame();
m_page->sendSync(Messages::WebPageProxy::PrintFrame(webFrame->frameID()), Messages::WebPageProxy::PrintFrame::Reply());
}
#if ENABLE(DATABASE)
......
2011-01-20 Alexey Proskuryakov <ap@apple.com>
Reviewed by Darin Adler.
https://bugs.webkit.org/show_bug.cgi?id=52849
Make window.print work with WebKit2
* MiniBrowser/mac/BrowserWindowController.m:
(-[BrowserWindowController awakeFromNib]):
* WebKitTestRunner/TestController.cpp:
(WTR::createOtherPage):
(WTR::TestController::initialize):
Added zeroes to WKPageUIClient structures to avoid build failures.
2011-01-20 Dirk Pranke <dpranke@chromium.org>
 
Reviewed by Eric Seidel.
......@@ -643,6 +643,7 @@ - (void)awakeFromNib
0, // footerHeight
0, // drawHeader
0, // drawFooter
0, // printFrame
};
WKPageSetPageUIClient(_webView.pageRef, &uiClient);
}
......
......@@ -150,6 +150,7 @@ static WKPageRef createOtherPage(WKPageRef oldPage, WKDictionaryRef, WKEventModi
0, // footerHeight
0, // drawHeader
0, // drawFooter
0, // printFrame
};
WKPageSetPageUIClient(newPage, &otherPageUIClient);
......@@ -259,6 +260,7 @@ void TestController::initialize(int argc, const char* argv[])
0, // footerHeight
0, // drawHeader
0, // drawFooter
0, // printFrame
};
WKPageSetPageUIClient(m_mainWebView->page(), &pageUIClient);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment