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 #ifndef WEBKIT_TOOLS_TEST_SHELL_WEBWIDGET_HOST_H_ | 5 #ifndef WEBKIT_TOOLS_TEST_SHELL_WEBWIDGET_HOST_H_ |
6 #define WEBKIT_TOOLS_TEST_SHELL_WEBWIDGET_HOST_H_ | 6 #define WEBKIT_TOOLS_TEST_SHELL_WEBWIDGET_HOST_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/gfx/native_widget_types.h" | 9 #include "base/gfx/native_widget_types.h" |
10 #include "base/gfx/rect.h" | 10 #include "base/gfx/rect.h" |
| 11 #include "base/gfx/size.h" |
11 #include "base/scoped_ptr.h" | 12 #include "base/scoped_ptr.h" |
12 #include "skia/ext/platform_canvas.h" | 13 #include "skia/ext/platform_canvas.h" |
13 | 14 |
14 class WebWidget; | 15 class WebWidget; |
15 class WebWidgetDelegate; | 16 class WebWidgetDelegate; |
16 | 17 |
17 namespace gfx { | |
18 class Size; | |
19 } | |
20 | |
21 namespace WebKit { | 18 namespace WebKit { |
22 struct WebScreenInfo; | 19 struct WebScreenInfo; |
23 } | 20 } |
24 | 21 |
25 #if defined(OS_MACOSX) | 22 #if defined(OS_MACOSX) |
26 #ifdef __OBJC__ | 23 #ifdef __OBJC__ |
27 @class NSEvent; | 24 @class NSEvent; |
28 #else | 25 #else |
29 class NSEvent; | 26 class NSEvent; |
30 #endif | 27 #endif |
(...skipping 13 matching lines...) Expand all Loading... |
44 #endif | 41 #endif |
45 | 42 |
46 gfx::NativeView view_handle() const { return view_; } | 43 gfx::NativeView view_handle() const { return view_; } |
47 WebWidget* webwidget() const { return webwidget_; } | 44 WebWidget* webwidget() const { return webwidget_; } |
48 | 45 |
49 void DidInvalidateRect(const gfx::Rect& rect); | 46 void DidInvalidateRect(const gfx::Rect& rect); |
50 void DidScrollRect(int dx, int dy, const gfx::Rect& clip_rect); | 47 void DidScrollRect(int dx, int dy, const gfx::Rect& clip_rect); |
51 #if defined(OS_WIN) | 48 #if defined(OS_WIN) |
52 void SetCursor(HCURSOR cursor); | 49 void SetCursor(HCURSOR cursor); |
53 #endif | 50 #endif |
| 51 #if defined(LINUX2) |
| 52 const gfx::Size& size() const { return size_; } |
| 53 #endif |
54 | 54 |
55 void DiscardBackingStore(); | 55 void DiscardBackingStore(); |
56 // Allow clients to update the paint rect. For example, if we get a gdk | 56 // Allow clients to update the paint rect. For example, if we get a gdk |
57 // expose or WM_PAINT event, we need to update the paint rect. | 57 // expose or WM_PAINT event, we need to update the paint rect. |
58 void UpdatePaintRect(const gfx::Rect& rect); | 58 void UpdatePaintRect(const gfx::Rect& rect); |
59 void Paint(); | 59 void Paint(); |
60 | 60 |
| 61 skia::PlatformCanvas* canvas() const { return canvas_.get(); } |
| 62 |
61 WebKit::WebScreenInfo GetScreenInfo(); | 63 WebKit::WebScreenInfo GetScreenInfo(); |
62 | 64 |
63 protected: | 65 protected: |
64 WebWidgetHost(); | 66 WebWidgetHost(); |
65 ~WebWidgetHost(); | 67 ~WebWidgetHost(); |
66 | 68 |
67 #if defined(OS_WIN) | 69 #if defined(OS_WIN) |
68 // Per-class wndproc. Returns true if the event should be swallowed. | 70 // Per-class wndproc. Returns true if the event should be swallowed. |
69 virtual bool WndProc(UINT message, WPARAM wparam, LPARAM lparam); | 71 virtual bool WndProc(UINT message, WPARAM wparam, LPARAM lparam); |
70 | 72 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 void TrackMouseLeave(bool enable); | 107 void TrackMouseLeave(bool enable); |
106 void ResetScrollRect(); | 108 void ResetScrollRect(); |
107 void PaintRect(const gfx::Rect& rect); | 109 void PaintRect(const gfx::Rect& rect); |
108 | 110 |
109 void set_painting(bool value) { | 111 void set_painting(bool value) { |
110 #ifndef NDEBUG | 112 #ifndef NDEBUG |
111 painting_ = value; | 113 painting_ = value; |
112 #endif | 114 #endif |
113 } | 115 } |
114 | 116 |
| 117 #if defined(LINUX2) |
| 118 void ScheduleRepaint(const gfx::Rect& bounds); |
| 119 |
| 120 gfx::Size size_; |
| 121 #endif |
| 122 |
115 gfx::NativeView view_; | 123 gfx::NativeView view_; |
116 WebWidget* webwidget_; | 124 WebWidget* webwidget_; |
117 scoped_ptr<skia::PlatformCanvas> canvas_; | 125 scoped_ptr<skia::PlatformCanvas> canvas_; |
118 | 126 |
119 // specifies the portion of the webwidget that needs painting | 127 // specifies the portion of the webwidget that needs painting |
120 gfx::Rect paint_rect_; | 128 gfx::Rect paint_rect_; |
121 | 129 |
122 // specifies the portion of the webwidget that needs scrolling | 130 // specifies the portion of the webwidget that needs scrolling |
123 gfx::Rect scroll_rect_; | 131 gfx::Rect scroll_rect_; |
124 int scroll_dx_; | 132 int scroll_dx_; |
125 int scroll_dy_; | 133 int scroll_dy_; |
126 | 134 |
127 bool track_mouse_leave_; | 135 bool track_mouse_leave_; |
128 | 136 |
129 #ifndef NDEBUG | 137 #ifndef NDEBUG |
130 bool painting_; | 138 bool painting_; |
131 #endif | 139 #endif |
132 }; | 140 }; |
133 | 141 |
134 #endif // WEBKIT_TOOLS_TEST_SHELL_WEBWIDGET_HOST_H_ | 142 #endif // WEBKIT_TOOLS_TEST_SHELL_WEBWIDGET_HOST_H_ |
OLD | NEW |