Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(362)

Unified Diff: webkit/tools/test_shell/test_shell.cc

Issue 180033: Implement layoutTestController.display() method.... (Closed) Base URL: svn://chrome-svn.corp.google.com/chrome/trunk/src/
Patch Set: Prettify. Created 11 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/tools/test_shell/test_shell.h ('k') | webkit/tools/test_shell/webwidget_host.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/tools/test_shell/test_shell.cc
diff --git a/webkit/tools/test_shell/test_shell.cc b/webkit/tools/test_shell/test_shell.cc
index 5563505622afdbb2dd64f0795e206ad7819731fa..317a746293201d7ad60aead47698f9b422fb610c 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.
« no previous file with comments | « webkit/tools/test_shell/test_shell.h ('k') | webkit/tools/test_shell/webwidget_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698