| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "webkit/tools/test_shell/webwidget_host.h" | 5 #include "webkit/tools/test_shell/webwidget_host.h" |
| 6 | 6 |
| 7 #include <cairo/cairo.h> | 7 #include <cairo/cairo.h> |
| 8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "skia/ext/bitmap_platform_device_linux.h" | 12 #include "skia/ext/bitmap_platform_device_linux.h" |
| 13 #include "skia/ext/platform_canvas_linux.h" | 13 #include "skia/ext/platform_canvas_linux.h" |
| 14 #include "skia/ext/platform_device_linux.h" | 14 #include "skia/ext/platform_device_linux.h" |
| 15 #include "third_party/WebKit/WebKit/chromium/public/gtk/WebInputEventFactory.h" | 15 #include "third_party/WebKit/WebKit/chromium/public/gtk/WebInputEventFactory.h" |
| 16 #include "third_party/WebKit/WebKit/chromium/public/gtk/WebScreenInfoFactory.h" | 16 #include "third_party/WebKit/WebKit/chromium/public/x11/WebScreenInfoFactory.h" |
| 17 #include "third_party/WebKit/WebKit/chromium/public/WebInputEvent.h" | 17 #include "third_party/WebKit/WebKit/chromium/public/WebInputEvent.h" |
| 18 #include "third_party/WebKit/WebKit/chromium/public/WebScreenInfo.h" | 18 #include "third_party/WebKit/WebKit/chromium/public/WebScreenInfo.h" |
| 19 #include "third_party/WebKit/WebKit/chromium/public/WebSize.h" | 19 #include "third_party/WebKit/WebKit/chromium/public/WebSize.h" |
| 20 #include "webkit/glue/webwidget.h" | 20 #include "webkit/glue/webwidget.h" |
| 21 #include "webkit/tools/test_shell/test_shell.h" | 21 #include "webkit/tools/test_shell/test_shell.h" |
| 22 #include "webkit/tools/test_shell/test_shell_x11.h" |
| 22 | 23 |
| 23 using WebKit::WebInputEventFactory; | 24 using WebKit::WebInputEventFactory; |
| 24 using WebKit::WebKeyboardEvent; | 25 using WebKit::WebKeyboardEvent; |
| 25 using WebKit::WebMouseEvent; | 26 using WebKit::WebMouseEvent; |
| 26 using WebKit::WebMouseWheelEvent; | 27 using WebKit::WebMouseWheelEvent; |
| 27 using WebKit::WebScreenInfo; | 28 using WebKit::WebScreenInfo; |
| 28 using WebKit::WebScreenInfoFactory; | 29 using WebKit::WebScreenInfoFactory; |
| 29 using WebKit::WebSize; | 30 using WebKit::WebSize; |
| 30 | 31 |
| 31 namespace { | 32 namespace { |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 static_cast<skia::BitmapPlatformDeviceLinux* >(&platdev); | 362 static_cast<skia::BitmapPlatformDeviceLinux* >(&platdev); |
| 362 cairo_t* cairo_drawable = gdk_cairo_create(window); | 363 cairo_t* cairo_drawable = gdk_cairo_create(window); |
| 363 cairo_set_source_surface(cairo_drawable, bitdev->surface(), 0, 0); | 364 cairo_set_source_surface(cairo_drawable, bitdev->surface(), 0, 0); |
| 364 cairo_paint(cairo_drawable); | 365 cairo_paint(cairo_drawable); |
| 365 cairo_destroy(cairo_drawable); | 366 cairo_destroy(cairo_drawable); |
| 366 | 367 |
| 367 gdk_window_end_paint(window); | 368 gdk_window_end_paint(window); |
| 368 } | 369 } |
| 369 | 370 |
| 370 WebScreenInfo WebWidgetHost::GetScreenInfo() { | 371 WebScreenInfo WebWidgetHost::GetScreenInfo() { |
| 371 return WebScreenInfoFactory::screenInfo(view_); | 372 Display* display = test_shell_x11::GtkWidgetGetDisplay(view_); |
| 373 int screen_num = test_shell_x11::GtkWidgetGetScreenNum(view_); |
| 374 return WebScreenInfoFactory::screenInfo(display, screen_num); |
| 372 } | 375 } |
| 373 | 376 |
| 374 void WebWidgetHost::ResetScrollRect() { | 377 void WebWidgetHost::ResetScrollRect() { |
| 375 // This method is only needed for optimized scroll painting, which we don't | 378 // This method is only needed for optimized scroll painting, which we don't |
| 376 // care about in the test shell, yet. | 379 // care about in the test shell, yet. |
| 377 } | 380 } |
| 378 | 381 |
| 379 void WebWidgetHost::PaintRect(const gfx::Rect& rect) { | 382 void WebWidgetHost::PaintRect(const gfx::Rect& rect) { |
| 380 set_painting(true); | 383 set_painting(true); |
| 381 webwidget_->Paint(canvas_.get(), rect); | 384 webwidget_->Paint(canvas_.get(), rect); |
| 382 set_painting(false); | 385 set_painting(false); |
| 383 } | 386 } |
| 384 | 387 |
| 385 void WebWidgetHost::WindowDestroyed() { | 388 void WebWidgetHost::WindowDestroyed() { |
| 386 delete this; | 389 delete this; |
| 387 } | 390 } |
| OLD | NEW |