Add support for window.print to chromium DRT
authorbenwells@chromium.org <benwells@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 19 Jan 2012 20:47:22 +0000 (20:47 +0000)
committerbenwells@chromium.org <benwells@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 19 Jan 2012 20:47:22 +0000 (20:47 +0000)
https://bugs.webkit.org/show_bug.cgi?id=76479

When used in a test window.print goes into print mode and then
straight out again. This will allow the afterprint event to be
tested by having the afterprint event happen before the dump
happens.

Reviewed by Mihai Parparita.

* DumpRenderTree/chromium/WebViewHost.cpp:
(WebViewHost::printPage):
* DumpRenderTree/chromium/WebViewHost.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@105437 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/DumpRenderTree/chromium/WebViewHost.cpp
Tools/DumpRenderTree/chromium/WebViewHost.h

index 07b6b37..f44e585 100644 (file)
@@ -1,3 +1,19 @@
+2012-01-19  Ben Wells  <benwells@chromium.org>
+
+        Add support for window.print to chromium DRT
+        https://bugs.webkit.org/show_bug.cgi?id=76479
+
+        When used in a test window.print goes into print mode and then
+        straight out again. This will allow the afterprint event to be
+        tested by having the afterprint event happen before the dump
+        happens.
+
+        Reviewed by Mihai Parparita.
+
+        * DumpRenderTree/chromium/WebViewHost.cpp:
+        (WebViewHost::printPage):
+        * DumpRenderTree/chromium/WebViewHost.h:
+
 2012-01-18  Enrica Casucci  <enrica@apple.com>
 
         editingAttributedStringFromRange in WebHTMLConverter does not handle NSUnderlineStyleAttributeName.
index 70beb9f..9acb0a2 100644 (file)
@@ -1715,3 +1715,12 @@ void WebViewHost::displayRepaintMask()
 {
     canvas()->drawARGB(167, 0, 0, 0);
 }
+
+// Simulate a print by going into print mode and then exit straight away.
+void WebViewHost::printPage(WebKit::WebFrame* frame)
+{
+    WebSize pageSizeInPixels = webWidget()->size();
+
+    frame->printBegin(pageSizeInPixels);
+    frame->printEnd();
+}
index 20da17c..d17cef5 100644 (file)
@@ -157,6 +157,7 @@ class WebViewHost : public WebKit::WebSpellCheckClient, public WebKit::WebViewCl
     virtual WebKit::WebSpeechInputController* speechInputController(WebKit::WebSpeechInputListener*);
     virtual WebKit::WebDeviceOrientationClient* deviceOrientationClient();
     virtual WebKit::WebUserMediaClient* userMediaClient();
+    virtual void printPage(WebKit::WebFrame*);
 
     // WebKit::WebWidgetClient
     virtual void didInvalidateRect(const WebKit::WebRect&);