summaryrefslogtreecommitdiffstats
path: root/webkit/tools/test_shell/webwidget_host_win.cc
diff options
context:
space:
mode:
authorericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-10 23:06:06 +0000
committerericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-10 23:06:06 +0000
commit76d940b7d89f94f3ff4eea19f5970b57e0adcf93 (patch)
treed9ad129eb0b1c9c0b2463f5af484b4b4455aee89 /webkit/tools/test_shell/webwidget_host_win.cc
parent185e83e4d68bad4ddc8bc48d93a38c9bc4219ba3 (diff)
downloadchromium_src-76d940b7d89f94f3ff4eea19f5970b57e0adcf93.zip
chromium_src-76d940b7d89f94f3ff4eea19f5970b57e0adcf93.tar.gz
chromium_src-76d940b7d89f94f3ff4eea19f5970b57e0adcf93.tar.bz2
Add support for the "repaint" layout tests (LayoutTests/fast/repaint/*), which draw a gray mask over regions that have not been updated.
This still doesn't match the mac expected results, because clip area is wrong. BUG=8630 Review URL: http://codereview.chromium.org/21192 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11396 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/tools/test_shell/webwidget_host_win.cc')
-rw-r--r--webkit/tools/test_shell/webwidget_host_win.cc24
1 files changed, 20 insertions, 4 deletions
diff --git a/webkit/tools/test_shell/webwidget_host_win.cc b/webkit/tools/test_shell/webwidget_host_win.cc
index fc4be75..a8b561c 100644
--- a/webkit/tools/test_shell/webwidget_host_win.cc
+++ b/webkit/tools/test_shell/webwidget_host_win.cc
@@ -210,6 +210,11 @@ void WebWidgetHost::UpdatePaintRect(const gfx::Rect& rect) {
}
void WebWidgetHost::Paint() {
+ PaintToCanvas();
+ PaintCanvasToView();
+}
+
+void WebWidgetHost::PaintToCanvas() {
RECT r;
GetClientRect(view_, &r);
gfx::Rect client_rect(r);
@@ -251,8 +256,9 @@ void WebWidgetHost::Paint() {
}
}
DCHECK(paint_rect_.IsEmpty());
+}
- // Paint to the screen
+void WebWidgetHost::PaintCanvasToView() {
PAINTSTRUCT ps;
BeginPaint(view_, &ps);
canvas_->getTopPlatformDevice().drawToHDC(ps.hdc,
@@ -265,6 +271,16 @@ void WebWidgetHost::Paint() {
UpdateWindow(view_);
}
+void WebWidgetHost::DisplayForRepaint() {
+ PaintToCanvas();
+
+ // Paint a gray mask over everything for the repaint Layout tests.
+ const SkColor kMaskColor = SkColorSetARGB(168, 0, 0, 0); // alpha=0.66
+ canvas_->drawColor(kMaskColor, SkPorterDuff::kSrcOver_Mode);
+
+ PaintCanvasToView();
+}
+
void WebWidgetHost::Resize(LPARAM lparam) {
// Force an entire re-paint. TODO(darin): Maybe reuse this memory buffer.
DiscardBackingStore();
@@ -283,9 +299,9 @@ void WebWidgetHost::MouseEvent(UINT message, WPARAM wparam, LPARAM lparam) {
break;
case WebInputEvent::MOUSE_DOWN:
SetCapture(view_);
- // This mimics a temporary workaround in RenderWidgetHostViewWin
- // for bug 765011 to get focus when the mouse is clicked. This
- // happens after the mouse down event is sent to the renderer
+ // This mimics a temporary workaround in RenderWidgetHostViewWin
+ // for bug 765011 to get focus when the mouse is clicked. This
+ // happens after the mouse down event is sent to the renderer
// because normally Windows does a WM_SETFOCUS after WM_LBUTTONDOWN.
::SetFocus(view_);
break;