diff options
-rw-r--r-- | webkit/tools/test_shell/webwidget_host.cc | 11 | ||||
-rw-r--r-- | webkit/tools/test_shell/webwidget_host.h | 11 |
2 files changed, 13 insertions, 9 deletions
diff --git a/webkit/tools/test_shell/webwidget_host.cc b/webkit/tools/test_shell/webwidget_host.cc index ca0289e..5c384a5 100644 --- a/webkit/tools/test_shell/webwidget_host.cc +++ b/webkit/tools/test_shell/webwidget_host.cc @@ -59,9 +59,14 @@ LRESULT CALLBACK WebWidgetHost::WndProc(HWND hwnd, UINT message, WPARAM wparam, delete host; break; - case WM_PAINT: + case WM_PAINT: { + RECT rect; + if (GetUpdateRect(hwnd, &rect, FALSE)) { + host->UpdatePaintRect(gfx::Rect(rect)); + } host->Paint(); return 0; + } case WM_ERASEBKGND: // Do nothing here to avoid flashing, the background will be erased @@ -195,6 +200,10 @@ bool WebWidgetHost::WndProc(UINT message, WPARAM wparam, LPARAM lparam) { return false; } +void WebWidgetHost::UpdatePaintRect(const gfx::Rect& rect) { + paint_rect_ = paint_rect_.Union(rect); +} + void WebWidgetHost::Paint() { RECT r; GetClientRect(view_, &r); diff --git a/webkit/tools/test_shell/webwidget_host.h b/webkit/tools/test_shell/webwidget_host.h index 4f78744..3bb7b5c 100644 --- a/webkit/tools/test_shell/webwidget_host.h +++ b/webkit/tools/test_shell/webwidget_host.h @@ -42,20 +42,15 @@ class WebWidgetHost { #endif void DiscardBackingStore(); + // Allow clients to update the paint rect. For example, if we get a gdk + // expose or WM_PAINT event, we need to update the paint rect. + void UpdatePaintRect(const gfx::Rect& rect); void Paint(); protected: WebWidgetHost(); ~WebWidgetHost(); -#if defined(OS_MACOSX) || defined(OS_LINUX) - public: - // Allow clients to update the paint rect. For example, if we get a gdk - // expose event, we need to update the paint rect. - void UpdatePaintRect(const gfx::Rect& rect); - protected: -#endif - #if defined(OS_WIN) // Per-class wndproc. Returns true if the event should be swallowed. virtual bool WndProc(UINT message, WPARAM wparam, LPARAM lparam); |