diff options
author | dglazkov@chromium.org <dglazkov@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-04 15:26:55 +0000 |
---|---|---|
committer | dglazkov@chromium.org <dglazkov@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-04 15:26:55 +0000 |
commit | 6cea7c48bac15dff8ea8d9b4862b75f5deb59109 (patch) | |
tree | 98ea1b71d6150ccad9ce8ee204985dfc34b24f58 /webkit/tools/test_shell | |
parent | 4fad45a6ce06e3c599280920780a496a69d82c3a (diff) | |
download | chromium_src-6cea7c48bac15dff8ea8d9b4862b75f5deb59109.zip chromium_src-6cea7c48bac15dff8ea8d9b4862b75f5deb59109.tar.gz chromium_src-6cea7c48bac15dff8ea8d9b4862b75f5deb59109.tar.bz2 |
Implement layoutTestController.display() method.
BUG=8630
TEST=LayoutTests/fast/repaint/layer-visibility.html should pass.
R=darin
Review URL: http://codereview.chromium.org/180033
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25454 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/tools/test_shell')
-rw-r--r-- | webkit/tools/test_shell/layout_test_controller.cc | 3 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell.cc | 20 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell.h | 2 | ||||
-rw-r--r-- | webkit/tools/test_shell/webwidget_host.h | 6 |
4 files changed, 17 insertions, 14 deletions
diff --git a/webkit/tools/test_shell/layout_test_controller.cc b/webkit/tools/test_shell/layout_test_controller.cc index c2c2bcc..be19c95 100644 --- a/webkit/tools/test_shell/layout_test_controller.cc +++ b/webkit/tools/test_shell/layout_test_controller.cc @@ -754,6 +754,9 @@ void LayoutTestController::dumpSelectionRect( void LayoutTestController::display( const CppArgumentList& args, CppVariant* result) { + WebViewHost* view_host = shell_->webViewHost(); + view_host->Paint(); + view_host->DisplayRepaintMask(); result->SetNull(); } diff --git a/webkit/tools/test_shell/test_shell.cc b/webkit/tools/test_shell/test_shell.cc index 5563505..317a746 100644 --- a/webkit/tools/test_shell/test_shell.cc +++ b/webkit/tools/test_shell/test_shell.cc @@ -241,8 +241,11 @@ void TestShell::Dump(TestShell* shell) { // command line (for the dump pixels argument), and the MD5 sum to // stdout. dumped_anything = true; - std::string md5sum = DumpImage(shell->webView(), params->pixel_file_name, - params->pixel_hash); + WebViewHost* view_host = shell->webViewHost(); + view_host->webview()->layout(); + view_host->Paint(); + std::string md5sum = DumpImage(view_host->canvas(), + params->pixel_file_name, params->pixel_hash); printf("#MD5:%s\n", md5sum.c_str()); } if (dumped_anything) @@ -252,19 +255,10 @@ void TestShell::Dump(TestShell* shell) { } // static -std::string TestShell::DumpImage(WebView* view, +std::string TestShell::DumpImage(skia::PlatformCanvas* canvas, const std::wstring& file_name, const std::string& pixel_hash) { - view->layout(); - const WebSize& size = view->size(); - - skia::PlatformCanvas canvas; - if (!canvas.initialize(size.width, size.height, true)) - return std::string(); - view->paint(webkit_glue::ToWebCanvas(&canvas), - WebRect(0, 0, size.width, size.height)); - skia::BitmapPlatformDevice& device = - static_cast<skia::BitmapPlatformDevice&>(canvas.getTopPlatformDevice()); + static_cast<skia::BitmapPlatformDevice&>(canvas->getTopPlatformDevice()); const SkBitmap& src_bmp = device.accessBitmap(false); // Encode image. diff --git a/webkit/tools/test_shell/test_shell.h b/webkit/tools/test_shell/test_shell.h index 4b6ed14..b1bff50 100644 --- a/webkit/tools/test_shell/test_shell.h +++ b/webkit/tools/test_shell/test_shell.h @@ -212,7 +212,7 @@ public: // Writes the image captured from the given web frame to the given file. // The returned string is the ASCII-ized MD5 sum of the image. - static std::string DumpImage(WebView* view, + static std::string DumpImage(skia::PlatformCanvas* canvas, const std::wstring& file_name, const std::string& pixel_hash); diff --git a/webkit/tools/test_shell/webwidget_host.h b/webkit/tools/test_shell/webwidget_host.h index 2fc2a10..49c0ba7 100644 --- a/webkit/tools/test_shell/webwidget_host.h +++ b/webkit/tools/test_shell/webwidget_host.h @@ -61,6 +61,12 @@ class WebWidgetHost { WebKit::WebScreenInfo GetScreenInfo(); + // Paints the entire canvas a semi-transparent black (grayish). This is used + // by the layout tests in fast/repaint. The alpha value matches upstream. + void DisplayRepaintMask() { + canvas()->drawARGB(167, 0, 0, 0); + } + protected: WebWidgetHost(); ~WebWidgetHost(); |