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

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

Issue 21192: Add support for the "repaint" layout tests (LayoutTests/fast/repaint/*), whic... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 10 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
Index: webkit/tools/test_shell/webwidget_host_gtk.cc
===================================================================
--- webkit/tools/test_shell/webwidget_host_gtk.cc (revision 9433)
+++ webkit/tools/test_shell/webwidget_host_gtk.cc (working copy)
@@ -278,6 +278,11 @@
}
void WebWidgetHost::Paint() {
+ PaintToCanvas();
+ PaintCanvasToView();
+}
+
+void WebWidgetHost::PaintToCanvas() {
int width = view_->allocation.width;
int height = view_->allocation.height;
gfx::Rect client_rect(width, height);
@@ -316,14 +321,17 @@
}
DCHECK(paint_rect_.IsEmpty());
+}
+
+void WebWidgetHost::PaintCanvasToView() {
// Invalidate the paint region on the widget's underlying gdk window. Note
// that gdk_window_invalidate_* will generate extra expose events, which
// we wish to avoid. So instead we use calls to begin_paint/end_paint.
GdkRectangle grect = {
- total_paint.x(),
- total_paint.y(),
- total_paint.width(),
- total_paint.height(),
+ 0,
+ 0,
+ canvas_->width(),
+ canvas_->height(),
};
GdkWindow* window = view_->window;
gdk_window_begin_paint_rect(window, &grect);
@@ -340,6 +348,16 @@
gdk_window_end_paint(window);
}
+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::ResetScrollRect() {
// This method is only needed for optimized scroll painting, which we don't
// care about in the test shell, yet.

Powered by Google App Engine
This is Rietveld 408576698