[email protected] | 9f4f332 | 2012-01-18 22:29:56 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
license.bot | bf09a50 | 2008-08-24 00:55:55 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 4 | |
[email protected] | 2cff005 | 2011-03-18 16:51:44 | [diff] [blame] | 5 | #ifndef CONTENT_RENDERER_RENDER_WIDGET_H_ |
| 6 | #define CONTENT_RENDERER_RENDER_WIDGET_H_ |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 7 | |
[email protected] | aa4117f | 2011-12-09 22:19:21 | [diff] [blame] | 8 | #include <deque> |
[email protected] | 0e241b4b | 2012-08-18 09:06:27 | [diff] [blame] | 9 | #include <map> |
[email protected] | 010ea08a | 2009-10-11 20:21:32 | [diff] [blame] | 10 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 11 | #include "base/basictypes.h" |
[email protected] | f3112a5 | 2011-09-30 23:47:49 | [diff] [blame] | 12 | #include "base/compiler_specific.h" |
[email protected] | 3b63f8f4 | 2011-03-28 01:54:15 | [diff] [blame] | 13 | #include "base/memory/ref_counted.h" |
[email protected] | 8704f89b | 2011-04-15 00:30:05 | [diff] [blame] | 14 | #include "base/memory/scoped_ptr.h" |
| 15 | #include "base/time.h" |
[email protected] | 350ce870 | 2012-03-09 04:23:38 | [diff] [blame] | 16 | #include "base/timer.h" |
[email protected] | b63d58d | 2012-11-26 22:37:44 | [diff] [blame] | 17 | #include "cc/rendering_stats.h" |
[email protected] | f3112a5 | 2011-09-30 23:47:49 | [diff] [blame] | 18 | #include "content/common/content_export.h" |
[email protected] | 921f159 | 2011-03-18 00:41:02 | [diff] [blame] | 19 | #include "content/renderer/paint_aggregator.h" |
[email protected] | 4f86bdb | 2012-11-10 19:11:19 | [diff] [blame] | 20 | #include "ipc/ipc_listener.h" |
| 21 | #include "ipc/ipc_sender.h" |
[email protected] | 8bd0fe6 | 2011-01-17 06:44:37 | [diff] [blame] | 22 | #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositionUnderline.h" |
| 23 | #include "third_party/WebKit/Source/WebKit/chromium/public/WebPopupType.h" |
[email protected] | 8bd0fe6 | 2011-01-17 06:44:37 | [diff] [blame] | 24 | #include "third_party/WebKit/Source/WebKit/chromium/public/WebTextDirection.h" |
[email protected] | 5b739cb | 2012-08-21 20:35:21 | [diff] [blame] | 25 | #include "third_party/WebKit/Source/WebKit/chromium/public/WebTextInputInfo.h" |
[email protected] | 8bd0fe6 | 2011-01-17 06:44:37 | [diff] [blame] | 26 | #include "third_party/WebKit/Source/WebKit/chromium/public/WebWidgetClient.h" |
[email protected] | d353541f | 2012-05-03 22:45:41 | [diff] [blame] | 27 | #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebRect.h" |
[email protected] | d65adb1 | 2010-04-28 17:26:49 | [diff] [blame] | 28 | #include "third_party/skia/include/core/SkBitmap.h" |
[email protected] | ad26ef4 | 2011-06-17 07:59:45 | [diff] [blame] | 29 | #include "ui/base/ime/text_input_type.h" |
[email protected] | 58b48a0d | 2012-06-13 07:01:35 | [diff] [blame] | 30 | #include "ui/base/range/range.h" |
[email protected] | 08397d5 | 2011-02-05 01:53:38 | [diff] [blame] | 31 | #include "ui/gfx/native_widget_types.h" |
| 32 | #include "ui/gfx/rect.h" |
[email protected] | 990278ff | 2012-11-13 02:12:55 | [diff] [blame] | 33 | #include "ui/gfx/vector2d.h" |
[email protected] | d353541f | 2012-05-03 22:45:41 | [diff] [blame] | 34 | #include "ui/surface/transport_dib.h" |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 35 | #include "webkit/glue/webcursor.h" |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 36 | |
[email protected] | aa4117f | 2011-12-09 22:19:21 | [diff] [blame] | 37 | struct ViewHostMsg_UpdateRect_Params; |
| 38 | class ViewHostMsg_UpdateRect; |
| 39 | |
[email protected] | 48495594 | 2010-08-19 16:13:18 | [diff] [blame] | 40 | namespace IPC { |
| 41 | class SyncMessage; |
| 42 | } |
| 43 | |
[email protected] | 88efb7ec | 2009-07-14 16:32:59 | [diff] [blame] | 44 | namespace WebKit { |
[email protected] | 41d8685 | 2012-11-07 12:23:24 | [diff] [blame] | 45 | class WebGestureEvent; |
[email protected] | 0dea165 | 2012-12-14 00:09:09 | [diff] [blame^] | 46 | class WebInputEvent; |
[email protected] | 6a8ddba5 | 2010-09-05 04:38:06 | [diff] [blame] | 47 | class WebMouseEvent; |
[email protected] | b63d58d | 2012-11-26 22:37:44 | [diff] [blame] | 48 | struct WebRenderingStatsImpl; |
[email protected] | 3d5c243b | 2012-11-30 00:26:01 | [diff] [blame] | 49 | struct WebPoint; |
[email protected] | 2d0f2e9 | 2011-10-03 09:02:24 | [diff] [blame] | 50 | class WebTouchEvent; |
[email protected] | 52647690 | 2011-10-06 20:34:06 | [diff] [blame] | 51 | } |
| 52 | |
[email protected] | 4de6d169 | 2011-10-12 08:45:44 | [diff] [blame] | 53 | namespace ui { |
| 54 | class Range; |
| 55 | } |
| 56 | |
[email protected] | 191eb3f7 | 2010-12-21 06:27:50 | [diff] [blame] | 57 | namespace webkit { |
| 58 | namespace npapi { |
[email protected] | f103ab7 | 2009-09-02 17:10:59 | [diff] [blame] | 59 | struct WebPluginGeometry; |
[email protected] | 719b36f | 2010-12-22 20:36:46 | [diff] [blame] | 60 | } // namespace npapi |
| 61 | |
| 62 | namespace ppapi { |
| 63 | class PluginInstance; |
| 64 | } // namespace ppapi |
| 65 | } // namespace webkit |
[email protected] | f103ab7 | 2009-09-02 17:10:59 | [diff] [blame] | 66 | |
[email protected] | e9ff79c | 2012-10-19 21:31:26 | [diff] [blame] | 67 | namespace content { |
| 68 | struct GpuRenderingStats; |
| 69 | class RenderWidgetTest; |
| 70 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 71 | // RenderWidget provides a communication bridge between a WebWidget and |
| 72 | // a RenderWidgetHost, the latter of which lives in a different process. |
[email protected] | f3112a5 | 2011-09-30 23:47:49 | [diff] [blame] | 73 | class CONTENT_EXPORT RenderWidget |
[email protected] | c47317e | 2012-06-20 22:35:31 | [diff] [blame] | 74 | : public IPC::Listener, |
| 75 | public IPC::Sender, |
[email protected] | f3112a5 | 2011-09-30 23:47:49 | [diff] [blame] | 76 | NON_EXPORTED_BASE(virtual public WebKit::WebWidgetClient), |
| 77 | public base::RefCounted<RenderWidget> { |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 78 | public: |
| 79 | // Creates a new RenderWidget. The opener_id is the routing ID of the |
[email protected] | 38024409 | 2011-10-07 17:26:27 | [diff] [blame] | 80 | // RenderView that this widget lives inside. |
[email protected] | 0ebf387 | 2008-11-07 21:35:03 | [diff] [blame] | 81 | static RenderWidget* Create(int32 opener_id, |
[email protected] | 842f1065 | 2012-06-06 01:54:04 | [diff] [blame] | 82 | WebKit::WebPopupType popup_type, |
| 83 | const WebKit::WebScreenInfo& screen_info); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 84 | |
[email protected] | 48495594 | 2010-08-19 16:13:18 | [diff] [blame] | 85 | // Creates a WebWidget based on the popup type. |
| 86 | static WebKit::WebWidget* CreateWebWidget(RenderWidget* render_widget); |
| 87 | |
[email protected] | c03a6e7 | 2011-04-19 21:42:06 | [diff] [blame] | 88 | // The compositing surface assigned by the RenderWidgetHost |
| 89 | // (or RenderViewHost). Will be gfx::kNullPluginWindow if not assigned yet, |
| 90 | // in which case we should not create any GPU command buffers with it. |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 91 | // The routing ID assigned by the RenderProcess. Will be MSG_ROUTING_NONE if |
| 92 | // not yet assigned a view ID, in which case, the process MUST NOT send |
| 93 | // messages with this ID to the parent. |
| 94 | int32 routing_id() const { |
| 95 | return routing_id_; |
| 96 | } |
| 97 | |
[email protected] | 9f4f332 | 2012-01-18 22:29:56 | [diff] [blame] | 98 | int32 surface_id() const { |
| 99 | return surface_id_; |
| 100 | } |
| 101 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 102 | // May return NULL when the window is closing. |
[email protected] | 93b9d69 | 2011-04-13 00:44:31 | [diff] [blame] | 103 | WebKit::WebWidget* webwidget() const { return webwidget_; } |
[email protected] | ee41e7d2 | 2011-10-14 19:34:09 | [diff] [blame] | 104 | |
[email protected] | 93b9d69 | 2011-04-13 00:44:31 | [diff] [blame] | 105 | gfx::Size size() const { return size_; } |
[email protected] | 589621b | 2010-09-23 22:01:07 | [diff] [blame] | 106 | bool has_focus() const { return has_focus_; } |
[email protected] | ee41e7d2 | 2011-10-14 19:34:09 | [diff] [blame] | 107 | bool is_fullscreen() const { return is_fullscreen_; } |
[email protected] | 204f1df | 2012-01-04 20:21:13 | [diff] [blame] | 108 | bool is_hidden() const { return is_hidden_; } |
[email protected] | 589621b | 2010-09-23 22:01:07 | [diff] [blame] | 109 | |
[email protected] | c47317e | 2012-06-20 22:35:31 | [diff] [blame] | 110 | // IPC::Listener |
[email protected] | edc64de | 2011-11-17 20:07:38 | [diff] [blame] | 111 | virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 112 | |
[email protected] | c47317e | 2012-06-20 22:35:31 | [diff] [blame] | 113 | // IPC::Sender |
[email protected] | edc64de | 2011-11-17 20:07:38 | [diff] [blame] | 114 | virtual bool Send(IPC::Message* msg) OVERRIDE; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 115 | |
[email protected] | 4873c7d | 2009-07-16 06:36:28 | [diff] [blame] | 116 | // WebKit::WebWidgetClient |
[email protected] | 9cd43a6 | 2012-03-26 08:03:56 | [diff] [blame] | 117 | virtual void willBeginCompositorFrame(); |
[email protected] | 4873c7d | 2009-07-16 06:36:28 | [diff] [blame] | 118 | virtual void didInvalidateRect(const WebKit::WebRect&); |
[email protected] | 990278ff | 2012-11-13 02:12:55 | [diff] [blame] | 119 | virtual void didScrollRect(int dx, int dy, |
| 120 | const WebKit::WebRect& clipRect); |
[email protected] | 244ac189 | 2011-12-02 17:04:47 | [diff] [blame] | 121 | virtual void didAutoResize(const WebKit::WebSize& new_size); |
[email protected] | 91acd1c | 2012-03-14 08:32:39 | [diff] [blame] | 122 | virtual void didActivateCompositor(int input_handler_identifier); |
[email protected] | ea162f9 | 2011-10-04 23:08:22 | [diff] [blame] | 123 | virtual void didDeactivateCompositor(); |
[email protected] | 3391a077 | 2012-03-28 00:32:07 | [diff] [blame] | 124 | virtual void didBecomeReadyForAdditionalInput(); |
[email protected] | 58264a3 | 2011-11-17 23:36:15 | [diff] [blame] | 125 | virtual void didCommitAndDrawCompositorFrame(); |
| 126 | virtual void didCompleteSwapBuffers(); |
[email protected] | f98d7e3c | 2010-09-13 22:30:46 | [diff] [blame] | 127 | virtual void scheduleComposite(); |
[email protected] | 5f8b102 | 2011-01-21 23:34:50 | [diff] [blame] | 128 | virtual void scheduleAnimation(); |
[email protected] | 4873c7d | 2009-07-16 06:36:28 | [diff] [blame] | 129 | virtual void didFocus(); |
| 130 | virtual void didBlur(); |
| 131 | virtual void didChangeCursor(const WebKit::WebCursorInfo&); |
| 132 | virtual void closeWidgetSoon(); |
| 133 | virtual void show(WebKit::WebNavigationPolicy); |
| 134 | virtual void runModal() {} |
| 135 | virtual WebKit::WebRect windowRect(); |
[email protected] | 8a9d6ca3 | 2011-06-06 20:11:30 | [diff] [blame] | 136 | virtual void setToolTipText(const WebKit::WebString& text, |
| 137 | WebKit::WebTextDirection hint); |
[email protected] | 4873c7d | 2009-07-16 06:36:28 | [diff] [blame] | 138 | virtual void setWindowRect(const WebKit::WebRect&); |
| 139 | virtual WebKit::WebRect windowResizerRect(); |
| 140 | virtual WebKit::WebRect rootWindowRect(); |
| 141 | virtual WebKit::WebScreenInfo screenInfo(); |
[email protected] | f660d9c | 2012-06-06 18:31:21 | [diff] [blame] | 142 | virtual float deviceScaleFactor(); |
[email protected] | fa7b1dc | 2010-06-23 17:53:04 | [diff] [blame] | 143 | virtual void resetInputMethod(); |
[email protected] | 4873c7d | 2009-07-16 06:36:28 | [diff] [blame] | 144 | |
| 145 | // Called when a plugin is moved. These events are queued up and sent with |
| 146 | // the next paint or scroll message to the host. |
[email protected] | 191eb3f7 | 2010-12-21 06:27:50 | [diff] [blame] | 147 | void SchedulePluginMove(const webkit::npapi::WebPluginGeometry& move); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 148 | |
[email protected] | 26865477 | 2009-08-06 23:02:04 | [diff] [blame] | 149 | // Called when a plugin window has been destroyed, to make sure the currently |
| 150 | // pending moves don't try to reference it. |
| 151 | void CleanupWindowInPluginMoves(gfx::PluginWindowHandle window); |
| 152 | |
[email protected] | b63d58d | 2012-11-26 22:37:44 | [diff] [blame] | 153 | // Fills in a WebRenderingStatsImpl struct containing information about |
[email protected] | fef5e397 | 2012-08-07 03:59:47 | [diff] [blame] | 154 | // rendering, e.g. count of frames rendered, time spent painting. |
| 155 | // This call is relatively expensive in threaded compositing mode, |
| 156 | // as it blocks on the compositor thread. |
[email protected] | b63d58d | 2012-11-26 22:37:44 | [diff] [blame] | 157 | void GetRenderingStats(WebKit::WebRenderingStatsImpl&) const; |
[email protected] | fef5e397 | 2012-08-07 03:59:47 | [diff] [blame] | 158 | |
[email protected] | 63b46592 | 2012-09-06 02:04:52 | [diff] [blame] | 159 | // Fills in a GpuRenderingStats struct containing information about |
| 160 | // GPU rendering, e.g. count of texture uploads performed, time spent |
| 161 | // uploading. |
| 162 | // This call is relatively expensive as it blocks on the GPU process |
[email protected] | e9ff79c | 2012-10-19 21:31:26 | [diff] [blame] | 163 | bool GetGpuRenderingStats(GpuRenderingStats*) const; |
[email protected] | 63b46592 | 2012-09-06 02:04:52 | [diff] [blame] | 164 | |
[email protected] | 0e241b4b | 2012-08-18 09:06:27 | [diff] [blame] | 165 | // Callback for use with BeginSmoothScroll. |
| 166 | typedef base::Callback<void()> SmoothScrollCompletionCallback; |
| 167 | |
[email protected] | a39ca165 | 2012-07-13 21:30:58 | [diff] [blame] | 168 | // Directs the host to begin a smooth scroll. This scroll should have the same |
[email protected] | 0e241b4b | 2012-08-18 09:06:27 | [diff] [blame] | 169 | // performance characteristics as a user-initiated scroll. Returns an ID of |
| 170 | // the scroll gesture. |
| 171 | void BeginSmoothScroll(bool scroll_down, |
[email protected] | ebd8b56 | 2012-10-09 14:44:29 | [diff] [blame] | 172 | const SmoothScrollCompletionCallback& callback, |
[email protected] | 267909d | 2012-10-20 04:36:19 | [diff] [blame] | 173 | int pixels_to_scroll, |
[email protected] | ebd8b56 | 2012-10-09 14:44:29 | [diff] [blame] | 174 | int mouse_event_x, |
| 175 | int mouse_event_y); |
[email protected] | a39ca165 | 2012-07-13 21:30:58 | [diff] [blame] | 176 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 177 | // Close the underlying WebWidget. |
[email protected] | 60c42a8c7 | 2009-10-09 04:08:59 | [diff] [blame] | 178 | virtual void Close(); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 179 | |
[email protected] | a1127f8 | 2011-09-08 17:27:01 | [diff] [blame] | 180 | float filtered_time_per_frame() const { |
| 181 | return filtered_time_per_frame_; |
| 182 | } |
| 183 | |
[email protected] | 3306f26 | 2012-09-21 19:20:42 | [diff] [blame] | 184 | enum ShowIme { |
| 185 | DO_NOT_SHOW_IME, |
| 186 | SHOW_IME_IF_NEEDED |
| 187 | }; |
| 188 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 189 | protected: |
[email protected] | 8085dbc8 | 2008-09-26 22:53:44 | [diff] [blame] | 190 | // Friend RefCounted so that the dtor can be non-public. Using this class |
| 191 | // without ref-counting is an error. |
| 192 | friend class base::RefCounted<RenderWidget>; |
[email protected] | 7339cd2 | 2010-10-27 00:11:20 | [diff] [blame] | 193 | // For unit tests. |
[email protected] | e9ff79c | 2012-10-19 21:31:26 | [diff] [blame] | 194 | friend class RenderWidgetTest; |
[email protected] | 8085dbc8 | 2008-09-26 22:53:44 | [diff] [blame] | 195 | |
[email protected] | 61e2b3cc | 2012-03-02 16:13:34 | [diff] [blame] | 196 | enum ResizeAck { |
| 197 | SEND_RESIZE_ACK, |
| 198 | NO_RESIZE_ACK, |
| 199 | }; |
| 200 | |
[email protected] | 6fd35b7 | 2012-03-01 19:46:41 | [diff] [blame] | 201 | RenderWidget(WebKit::WebPopupType popup_type, |
[email protected] | 842f1065 | 2012-06-06 01:54:04 | [diff] [blame] | 202 | const WebKit::WebScreenInfo& screen_info, |
[email protected] | 14392a5 | 2012-05-02 20:28:44 | [diff] [blame] | 203 | bool swapped_out); |
[email protected] | ce2b28e | 2012-08-09 15:53:57 | [diff] [blame] | 204 | |
[email protected] | 8085dbc8 | 2008-09-26 22:53:44 | [diff] [blame] | 205 | virtual ~RenderWidget(); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 206 | |
| 207 | // Initializes this view with the given opener. CompleteInit must be called |
| 208 | // later. |
[email protected] | a635f94 | 2012-12-07 10:34:29 | [diff] [blame] | 209 | bool Init(int32 opener_id); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 210 | |
[email protected] | 48495594 | 2010-08-19 16:13:18 | [diff] [blame] | 211 | // Called by Init and subclasses to perform initialization. |
[email protected] | a635f94 | 2012-12-07 10:34:29 | [diff] [blame] | 212 | bool DoInit(int32 opener_id, |
[email protected] | 48495594 | 2010-08-19 16:13:18 | [diff] [blame] | 213 | WebKit::WebWidget* web_widget, |
| 214 | IPC::SyncMessage* create_widget_message); |
| 215 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 216 | // Finishes creation of a pending view started with Init. |
[email protected] | fc4404d | 2012-11-07 19:53:30 | [diff] [blame] | 217 | void CompleteInit(); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 218 | |
[email protected] | 992db4c | 2011-05-12 15:37:15 | [diff] [blame] | 219 | // Sets whether this RenderWidget has been swapped out to be displayed by |
| 220 | // a RenderWidget in a different process. If so, no new IPC messages will be |
| 221 | // sent (only ACKs) and the process is free to exit when there are no other |
| 222 | // active RenderWidgets. |
| 223 | void SetSwappedOut(bool is_swapped_out); |
| 224 | |
[email protected] | 661eb9d | 2009-02-03 02:11:48 | [diff] [blame] | 225 | // Paints the given rectangular region of the WebWidget into canvas (a |
| 226 | // shared memory segment returned by AllocPaintBuf on Windows). The caller |
| 227 | // must ensure that the given rect fits within the bounds of the WebWidget. |
[email protected] | 4fb6684 | 2009-12-04 21:41:00 | [diff] [blame] | 228 | void PaintRect(const gfx::Rect& rect, const gfx::Point& canvas_origin, |
[email protected] | 9d611ca | 2012-11-14 13:46:56 | [diff] [blame] | 229 | SkCanvas* canvas); |
[email protected] | 4fb6684 | 2009-12-04 21:41:00 | [diff] [blame] | 230 | |
| 231 | // Paints a border at the given rect for debugging purposes. |
[email protected] | 9d611ca | 2012-11-14 13:46:56 | [diff] [blame] | 232 | void PaintDebugBorder(const gfx::Rect& rect, SkCanvas* canvas); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 233 | |
[email protected] | bd37ae25 | 2011-06-03 01:28:18 | [diff] [blame] | 234 | bool IsRenderingVSynced(); |
[email protected] | 52ccd0ea | 2011-02-16 01:09:05 | [diff] [blame] | 235 | void AnimationCallback(); |
| 236 | void AnimateIfNeeded(); |
[email protected] | 6522577 | 2011-05-12 21:10:24 | [diff] [blame] | 237 | void InvalidationCallback(); |
| 238 | void DoDeferredUpdateAndSendInputAck(); |
[email protected] | 552e600 | 2009-11-19 05:24:57 | [diff] [blame] | 239 | void DoDeferredUpdate(); |
[email protected] | 2533ce1 | 2009-05-09 00:02:24 | [diff] [blame] | 240 | void DoDeferredClose(); |
| 241 | void DoDeferredSetWindowRect(const WebKit::WebRect& pos); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 242 | |
[email protected] | 699ab0d | 2009-04-23 23:19:14 | [diff] [blame] | 243 | // Set the background of the render widget to a bitmap. The bitmap will be |
| 244 | // tiled in both directions if it isn't big enough to fill the area. This is |
| 245 | // mainly intended to be used in conjuction with WebView::SetIsTransparent(). |
| 246 | virtual void SetBackground(const SkBitmap& bitmap); |
| 247 | |
[email protected] | 61e2b3cc | 2012-03-02 16:13:34 | [diff] [blame] | 248 | // Resizes the render widget. |
| 249 | void Resize(const gfx::Size& new_size, |
| 250 | const gfx::Rect& resizer_rect, |
| 251 | bool is_fullscreen, |
| 252 | ResizeAck resize_ack); |
| 253 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 254 | // RenderWidget IPC message handlers |
| 255 | void OnClose(); |
[email protected] | fc4404d | 2012-11-07 19:53:30 | [diff] [blame] | 256 | void OnCreatingNewAck(); |
[email protected] | 30f75e6 | 2009-02-25 22:01:00 | [diff] [blame] | 257 | virtual void OnResize(const gfx::Size& new_size, |
[email protected] | ee41e7d2 | 2011-10-14 19:34:09 | [diff] [blame] | 258 | const gfx::Rect& resizer_rect, |
| 259 | bool is_fullscreen); |
[email protected] | b5913d7 | 2012-02-07 22:26:54 | [diff] [blame] | 260 | void OnChangeResizeRect(const gfx::Rect& resizer_rect); |
[email protected] | 941e455 | 2010-02-01 21:23:43 | [diff] [blame] | 261 | virtual void OnWasHidden(); |
[email protected] | 9e2e463 | 2012-07-27 16:38:41 | [diff] [blame] | 262 | virtual void OnWasShown(bool needs_repainting); |
[email protected] | 992db4c | 2011-05-12 15:37:15 | [diff] [blame] | 263 | virtual void OnWasSwappedOut(); |
[email protected] | 53d3f30 | 2009-12-21 04:42:05 | [diff] [blame] | 264 | void OnUpdateRectAck(); |
[email protected] | 8400e03 | 2010-02-26 18:50:11 | [diff] [blame] | 265 | void OnCreateVideoAck(int32 video_id); |
| 266 | void OnUpdateVideoAck(int32 video_id); |
[email protected] | 2533ce1 | 2009-05-09 00:02:24 | [diff] [blame] | 267 | void OnRequestMoveAck(); |
[email protected] | 0dea165 | 2012-12-14 00:09:09 | [diff] [blame^] | 268 | void OnHandleInputEvent(const WebKit::WebInputEvent* event, |
| 269 | bool keyboard_shortcut); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 270 | void OnMouseCaptureLost(); |
[email protected] | 1e6e3c99 | 2010-02-08 15:52:13 | [diff] [blame] | 271 | virtual void OnSetFocus(bool enable); |
[email protected] | fa7b1dc | 2010-06-23 17:53:04 | [diff] [blame] | 272 | void OnSetInputMethodActive(bool is_active); |
[email protected] | 56ea1a6 | 2011-05-30 07:05:57 | [diff] [blame] | 273 | virtual void OnImeSetComposition( |
[email protected] | fa7b1dc | 2010-06-23 17:53:04 | [diff] [blame] | 274 | const string16& text, |
| 275 | const std::vector<WebKit::WebCompositionUnderline>& underlines, |
| 276 | int selection_start, |
| 277 | int selection_end); |
[email protected] | 4de6d169 | 2011-10-12 08:45:44 | [diff] [blame] | 278 | virtual void OnImeConfirmComposition( |
| 279 | const string16& text, const ui::Range& replacement_range); |
[email protected] | d65adb1 | 2010-04-28 17:26:49 | [diff] [blame] | 280 | void OnMsgPaintAtSize(const TransportDIB::Handle& dib_id, |
[email protected] | c88c944 | 2010-07-19 18:55:09 | [diff] [blame] | 281 | int tag, |
[email protected] | 948f7ab7 | 2010-05-28 23:48:08 | [diff] [blame] | 282 | const gfx::Size& page_size, |
[email protected] | d65adb1 | 2010-04-28 17:26:49 | [diff] [blame] | 283 | const gfx::Size& desired_size); |
[email protected] | ec7dc11 | 2008-08-06 05:30:12 | [diff] [blame] | 284 | void OnMsgRepaint(const gfx::Size& size_to_paint); |
[email protected] | 0e241b4b | 2012-08-18 09:06:27 | [diff] [blame] | 285 | void OnMsgSmoothScrollCompleted(int gesture_id); |
[email protected] | 4873c7d | 2009-07-16 06:36:28 | [diff] [blame] | 286 | void OnSetTextDirection(WebKit::WebTextDirection direction); |
[email protected] | 872ae5b | 2011-05-26 20:20:50 | [diff] [blame] | 287 | void OnGetFPS(); |
[email protected] | 6131a64 | 2012-06-15 23:26:53 | [diff] [blame] | 288 | void OnScreenInfoChanged(const WebKit::WebScreenInfo& screen_info); |
[email protected] | 80ad862 | 2012-11-07 16:33:03 | [diff] [blame] | 289 | void OnUpdateScreenRects(const gfx::Rect& view_screen_rect, |
| 290 | const gfx::Rect& window_screen_rect); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 291 | |
[email protected] | 468ac58 | 2012-11-20 00:53:19 | [diff] [blame] | 292 | virtual void SetDeviceScaleFactor(float device_scale_factor); |
| 293 | |
[email protected] | 29ed96a | 2012-02-04 18:12:16 | [diff] [blame] | 294 | // Override points to notify derived classes that a paint has happened. |
| 295 | // WillInitiatePaint happens when we're about to generate a new bitmap and |
| 296 | // send it to the browser. DidInitiatePaint happens when that has completed, |
| 297 | // and subsequent rendering won't affect the painted content. DidFlushPaint |
| 298 | // happens once we've received the ACK that the screen has been updated. |
| 299 | // For a given paint operation, these overrides will always be called in the |
| 300 | // order WillInitiatePaint, DidInitiatePaint, DidFlushPaint. |
| 301 | virtual void WillInitiatePaint() {} |
[email protected] | 00c3961 | 2010-03-06 02:53:28 | [diff] [blame] | 302 | virtual void DidInitiatePaint() {} |
| 303 | virtual void DidFlushPaint() {} |
[email protected] | a2f6bc11 | 2009-06-27 16:27:25 | [diff] [blame] | 304 | |
[email protected] | 6522577 | 2011-05-12 21:10:24 | [diff] [blame] | 305 | // Override and return true when the widget is rendered with a graphics |
[email protected] | 37a6f30 | 2011-07-11 23:43:08 | [diff] [blame] | 306 | // context that supports asynchronous swapbuffers. When returning true, the |
| 307 | // subclass must call OnSwapBuffersPosted() when swap is posted, |
| 308 | // OnSwapBuffersComplete() when swaps complete, and OnSwapBuffersAborted if |
| 309 | // the context is lost. |
[email protected] | 6522577 | 2011-05-12 21:10:24 | [diff] [blame] | 310 | virtual bool SupportsAsynchronousSwapBuffers(); |
| 311 | |
[email protected] | 479b017 | 2012-10-29 19:27:09 | [diff] [blame] | 312 | virtual bool ForceCompositingModeEnabled(); |
| 313 | |
[email protected] | 6522577 | 2011-05-12 21:10:24 | [diff] [blame] | 314 | // Notifies scheduler that the RenderWidget's subclass has finished or aborted |
| 315 | // a swap buffers. |
[email protected] | 37a6f30 | 2011-07-11 23:43:08 | [diff] [blame] | 316 | void OnSwapBuffersPosted(); |
[email protected] | 6522577 | 2011-05-12 21:10:24 | [diff] [blame] | 317 | void OnSwapBuffersComplete(); |
[email protected] | 37a6f30 | 2011-07-11 23:43:08 | [diff] [blame] | 318 | void OnSwapBuffersAborted(); |
[email protected] | 6522577 | 2011-05-12 21:10:24 | [diff] [blame] | 319 | |
[email protected] | ca4847f | 2010-09-24 05:39:15 | [diff] [blame] | 320 | // Detects if a suitable opaque plugin covers the given paint bounds with no |
| 321 | // compositing necessary. |
| 322 | // |
[email protected] | 719b36f | 2010-12-22 20:36:46 | [diff] [blame] | 323 | // Returns the plugin instance that's the source of the paint if the paint |
| 324 | // can be handled by just blitting the plugin bitmap. In this case, the |
| 325 | // location, clipping, and ID of the backing store will be filled into the |
| 326 | // given output parameters. |
[email protected] | ca4847f | 2010-09-24 05:39:15 | [diff] [blame] | 327 | // |
[email protected] | 719b36f | 2010-12-22 20:36:46 | [diff] [blame] | 328 | // A return value of null means optimized painting can not be used and we |
[email protected] | ca4847f | 2010-09-24 05:39:15 | [diff] [blame] | 329 | // should continue with the normal painting code path. |
[email protected] | 719b36f | 2010-12-22 20:36:46 | [diff] [blame] | 330 | virtual webkit::ppapi::PluginInstance* GetBitmapForOptimizedPluginPaint( |
[email protected] | ca4847f | 2010-09-24 05:39:15 | [diff] [blame] | 331 | const gfx::Rect& paint_bounds, |
| 332 | TransportDIB** dib, |
| 333 | gfx::Rect* location, |
[email protected] | 0f3a2d1 | 2012-09-01 03:37:20 | [diff] [blame] | 334 | gfx::Rect* clip, |
| 335 | float* scale_factor); |
[email protected] | ca4847f | 2010-09-24 05:39:15 | [diff] [blame] | 336 | |
[email protected] | d54169e9 | 2011-01-21 09:19:52 | [diff] [blame] | 337 | // Gets the scroll offset of this widget, if this widget has a notion of |
| 338 | // scroll offset. |
[email protected] | ceb36f7d | 2012-10-31 18:33:24 | [diff] [blame] | 339 | virtual gfx::Vector2d GetScrollOffset(); |
[email protected] | d54169e9 | 2011-01-21 09:19:52 | [diff] [blame] | 340 | |
[email protected] | bee16aab | 2009-08-26 15:55:03 | [diff] [blame] | 341 | // Sets the "hidden" state of this widget. All accesses to is_hidden_ should |
| 342 | // use this method so that we can properly inform the RenderThread of our |
| 343 | // state. |
| 344 | void SetHidden(bool hidden); |
| 345 | |
[email protected] | 2b624c56 | 2011-10-27 22:58:26 | [diff] [blame] | 346 | void WillToggleFullscreen(); |
| 347 | void DidToggleFullscreen(); |
| 348 | |
[email protected] | 67474193 | 2009-02-04 23:44:46 | [diff] [blame] | 349 | bool next_paint_is_resize_ack() const; |
| 350 | bool next_paint_is_restore_ack() const; |
| 351 | void set_next_paint_is_resize_ack(); |
| 352 | void set_next_paint_is_restore_ack(); |
| 353 | void set_next_paint_is_repaint_ack(); |
[email protected] | ec7dc11 | 2008-08-06 05:30:12 | [diff] [blame] | 354 | |
[email protected] | ce2b28e | 2012-08-09 15:53:57 | [diff] [blame] | 355 | void set_throttle_input_events(bool throttle_input_events) { |
| 356 | throttle_input_events_ = throttle_input_events; |
| 357 | } |
| 358 | |
[email protected] | e99ef6f | 2011-10-16 01:13:00 | [diff] [blame] | 359 | // Checks if the text input state and compose inline mode have been changed. |
[email protected] | fa7b1dc | 2010-06-23 17:53:04 | [diff] [blame] | 360 | // If they are changed, the new value will be sent to the browser process. |
[email protected] | 3306f26 | 2012-09-21 19:20:42 | [diff] [blame] | 361 | // |show_ime_if_needed| should be SHOW_IME_IF_NEEDED iff the update may cause |
| 362 | // the ime to be displayed, e.g. after a tap on an input field on mobile. |
| 363 | void UpdateTextInputState(ShowIme show_ime); |
[email protected] | e99ef6f | 2011-10-16 01:13:00 | [diff] [blame] | 364 | |
| 365 | // Checks if the selection bounds have been changed. If they are changed, |
| 366 | // the new value will be sent to the browser process. |
[email protected] | 58b48a0d | 2012-06-13 07:01:35 | [diff] [blame] | 367 | virtual void UpdateSelectionBounds(); |
| 368 | |
| 369 | // Checks if the composition range or composition character bounds have been |
| 370 | // changed. If they are changed, the new value will be sent to the browser |
| 371 | // process. |
| 372 | virtual void UpdateCompositionInfo( |
| 373 | const ui::Range& range, |
| 374 | const std::vector<gfx::Rect>& character_bounds); |
| 375 | |
[email protected] | 56ea1a6 | 2011-05-30 07:05:57 | [diff] [blame] | 376 | // Override point to obtain that the current input method state and caret |
| 377 | // position. |
[email protected] | ad26ef4 | 2011-06-17 07:59:45 | [diff] [blame] | 378 | virtual ui::TextInputType GetTextInputType(); |
[email protected] | 3f78336 | 2011-10-21 22:40:50 | [diff] [blame] | 379 | virtual void GetSelectionBounds(gfx::Rect* start, gfx::Rect* end); |
[email protected] | 5b739cb | 2012-08-21 20:35:21 | [diff] [blame] | 380 | virtual ui::TextInputType WebKitToUiTextInputType( |
| 381 | WebKit::WebTextInputType type); |
[email protected] | ad26ef4 | 2011-06-17 07:59:45 | [diff] [blame] | 382 | |
[email protected] | 58b48a0d | 2012-06-13 07:01:35 | [diff] [blame] | 383 | // Override point to obtain that the current composition character bounds. |
| 384 | // In the case of surrogate pairs, the character is treated as two characters: |
| 385 | // the bounds for first character is actual one, and the bounds for second |
| 386 | // character is zero width rectangle. |
| 387 | virtual void GetCompositionCharacterBounds( |
| 388 | std::vector<gfx::Rect>* character_bounds); |
| 389 | |
| 390 | // Returns true if the composition range or composition character bounds |
| 391 | // should be sent to the browser process. |
| 392 | bool ShouldUpdateCompositionInfo( |
| 393 | const ui::Range& range, |
| 394 | const std::vector<gfx::Rect>& bounds); |
| 395 | |
[email protected] | ad26ef4 | 2011-06-17 07:59:45 | [diff] [blame] | 396 | // Override point to obtain that the current input method state about |
| 397 | // composition text. |
| 398 | virtual bool CanComposeInline(); |
[email protected] | 56ea1a6 | 2011-05-30 07:05:57 | [diff] [blame] | 399 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 400 | // Tells the renderer it does not have focus. Used to prevent us from getting |
| 401 | // the focus on our own when the browser did not focus us. |
| 402 | void ClearFocus(); |
| 403 | |
[email protected] | 2533ce1 | 2009-05-09 00:02:24 | [diff] [blame] | 404 | // Set the pending window rect. |
| 405 | // Because the real render_widget is hosted in another process, there is |
| 406 | // a time period where we may have set a new window rect which has not yet |
| 407 | // been processed by the browser. So we maintain a pending window rect |
| 408 | // size. If JS code sets the WindowRect, and then immediately calls |
| 409 | // GetWindowRect() we'll use this pending window rect as the size. |
| 410 | void SetPendingWindowRect(const WebKit::WebRect& r); |
| 411 | |
[email protected] | 44670587 | 2009-09-10 07:22:48 | [diff] [blame] | 412 | // Called by OnHandleInputEvent() to notify subclasses that a key event was |
| 413 | // just handled. |
| 414 | virtual void DidHandleKeyEvent() {} |
| 415 | |
[email protected] | 67bfb83f | 2011-09-22 03:36:37 | [diff] [blame] | 416 | // Called by OnHandleInputEvent() to notify subclasses that a mouse event is |
| 417 | // about to be handled. |
| 418 | // Returns true if no further handling is needed. In that case, the event |
| 419 | // won't be sent to WebKit or trigger DidHandleMouseEvent(). |
| 420 | virtual bool WillHandleMouseEvent(const WebKit::WebMouseEvent& event); |
| 421 | |
[email protected] | 41d8685 | 2012-11-07 12:23:24 | [diff] [blame] | 422 | // Called by OnHandleInputEvent() to notify subclasses that a gesture event is |
| 423 | // about to be handled. |
| 424 | // Returns true if no further handling is needed. In that case, the event |
| 425 | // won't be sent to WebKit. |
| 426 | virtual bool WillHandleGestureEvent(const WebKit::WebGestureEvent& event); |
| 427 | |
[email protected] | 6a8ddba5 | 2010-09-05 04:38:06 | [diff] [blame] | 428 | // Called by OnHandleInputEvent() to notify subclasses that a mouse event was |
| 429 | // just handled. |
| 430 | virtual void DidHandleMouseEvent(const WebKit::WebMouseEvent& event) {} |
| 431 | |
[email protected] | 2d0f2e9 | 2011-10-03 09:02:24 | [diff] [blame] | 432 | // Called by OnHandleInputEvent() to notify subclasses that a touch event was |
| 433 | // just handled. |
| 434 | virtual void DidHandleTouchEvent(const WebKit::WebTouchEvent& event) {} |
| 435 | |
[email protected] | 3d5c243b | 2012-11-30 00:26:01 | [diff] [blame] | 436 | // Check whether the WebWidget has any touch event handlers registered |
| 437 | // at the given point. |
| 438 | virtual bool HasTouchEventHandlersAt(const gfx::Point& point) const; |
| 439 | |
[email protected] | c3d4553 | 2011-10-07 19:20:40 | [diff] [blame] | 440 | // Should return true if the underlying WebWidget is responsible for |
| 441 | // the scheduling of compositing requests. |
| 442 | virtual bool WebWidgetHandlesCompositorScheduling() const; |
| 443 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 444 | // Routing ID that allows us to communicate to the parent browser process |
| 445 | // RenderWidgetHost. When MSG_ROUTING_NONE, no messages may be sent. |
| 446 | int32 routing_id_; |
| 447 | |
[email protected] | 9f4f332 | 2012-01-18 22:29:56 | [diff] [blame] | 448 | int32 surface_id_; |
| 449 | |
[email protected] | c5b3b5e | 2009-02-13 06:41:11 | [diff] [blame] | 450 | // We are responsible for destroying this object via its Close method. |
[email protected] | 4873c7d | 2009-07-16 06:36:28 | [diff] [blame] | 451 | WebKit::WebWidget* webwidget_; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 452 | |
| 453 | // Set to the ID of the view that initiated creating this view, if any. When |
| 454 | // the view was initiated by the browser (the common case), this will be |
| 455 | // MSG_ROUTING_NONE. This is used in determining ownership when opening |
| 456 | // child tabs. See RenderWidget::createWebViewWithRequest. |
| 457 | // |
| 458 | // This ID may refer to an invalid view if that view is closed before this |
| 459 | // view is. |
| 460 | int32 opener_id_; |
| 461 | |
| 462 | // The position where this view should be initially shown. |
| 463 | gfx::Rect initial_pos_; |
| 464 | |
[email protected] | fc4404d | 2012-11-07 19:53:30 | [diff] [blame] | 465 | bool init_complete_; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 466 | |
| 467 | // We store the current cursor object so we can avoid spamming SetCursor |
| 468 | // messages. |
| 469 | WebCursor current_cursor_; |
[email protected] | 88efb7ec | 2009-07-14 16:32:59 | [diff] [blame] | 470 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 471 | // The size of the RenderWidget. |
| 472 | gfx::Size size_; |
| 473 | |
[email protected] | b4d0845 | 2010-10-05 17:34:35 | [diff] [blame] | 474 | // The TransportDIB that is being used to transfer an image to the browser. |
| 475 | TransportDIB* current_paint_buf_; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 476 | |
[email protected] | 552e600 | 2009-11-19 05:24:57 | [diff] [blame] | 477 | PaintAggregator paint_aggregator_; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 478 | |
[email protected] | f21c613a | 2009-02-12 14:46:17 | [diff] [blame] | 479 | // The area that must be reserved for drawing the resize corner. |
| 480 | gfx::Rect resizer_rect_; |
| 481 | |
[email protected] | 53d3f30 | 2009-12-21 04:42:05 | [diff] [blame] | 482 | // Flags for the next ViewHostMsg_UpdateRect message. |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 483 | int next_paint_flags_; |
| 484 | |
[email protected] | 872ae5b | 2011-05-26 20:20:50 | [diff] [blame] | 485 | // Filtered time per frame based on UpdateRect messages. |
| 486 | float filtered_time_per_frame_; |
| 487 | |
[email protected] | 53d3f30 | 2009-12-21 04:42:05 | [diff] [blame] | 488 | // True if we are expecting an UpdateRect_ACK message (i.e., that a |
| 489 | // UpdateRect message has been sent). |
| 490 | bool update_reply_pending_; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 491 | |
[email protected] | ea3ee0a | 2012-05-15 03:43:09 | [diff] [blame] | 492 | // True if we need to send an UpdateRect message to notify the browser about |
| 493 | // an already-completed auto-resize. |
| 494 | bool need_update_rect_for_auto_resize_; |
| 495 | |
[email protected] | 6522577 | 2011-05-12 21:10:24 | [diff] [blame] | 496 | // True if the underlying graphics context supports asynchronous swap. |
| 497 | // Cached on the RenderWidget because determining support is costly. |
| 498 | bool using_asynchronous_swapbuffers_; |
| 499 | |
| 500 | // Number of OnSwapBuffersComplete we are expecting. Incremented each time |
| 501 | // WebWidget::composite has been been performed when the RenderWidget subclass |
| 502 | // SupportsAsynchronousSwapBuffers. Decremented in OnSwapBuffers. Will block |
| 503 | // rendering. |
| 504 | int num_swapbuffers_complete_pending_; |
| 505 | |
| 506 | // When accelerated rendering is on, is the maximum number of swapbuffers that |
| 507 | // can be outstanding before we start throttling based on |
| 508 | // OnSwapBuffersComplete callback. |
[email protected] | 82ca9b9 | 2011-09-12 23:33:07 | [diff] [blame] | 509 | static const int kMaxSwapBuffersPending = 2; |
[email protected] | 6522577 | 2011-05-12 21:10:24 | [diff] [blame] | 510 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 511 | // Set to true if we should ignore RenderWidget::Show calls. |
| 512 | bool did_show_; |
| 513 | |
| 514 | // Indicates that we shouldn't bother generated paint events. |
| 515 | bool is_hidden_; |
| 516 | |
[email protected] | ee41e7d2 | 2011-10-14 19:34:09 | [diff] [blame] | 517 | // Indicates that we are in fullscreen mode. |
| 518 | bool is_fullscreen_; |
| 519 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 520 | // Indicates that we should be repainted when restored. This flag is set to |
| 521 | // true if we receive an invalidation / scroll event from webkit while our |
| 522 | // is_hidden_ flag is set to true. This is used to force a repaint once we |
| 523 | // restore to account for the fact that our host would not know about the |
| 524 | // invalidation / scroll event(s) from webkit while we are hidden. |
| 525 | bool needs_repainting_on_restore_; |
| 526 | |
| 527 | // Indicates whether we have been focused/unfocused by the browser. |
| 528 | bool has_focus_; |
| 529 | |
[email protected] | 5dd76821 | 2009-08-13 23:34:49 | [diff] [blame] | 530 | // Are we currently handling an input event? |
| 531 | bool handling_input_event_; |
| 532 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 533 | // True if we have requested this widget be closed. No more messages will |
| 534 | // be sent, except for a Close. |
| 535 | bool closing_; |
| 536 | |
[email protected] | 992db4c | 2011-05-12 15:37:15 | [diff] [blame] | 537 | // Whether this RenderWidget is currently swapped out, such that the view is |
| 538 | // being rendered by another process. If all RenderWidgets in a process are |
| 539 | // swapped out, the process can exit. |
| 540 | bool is_swapped_out_; |
| 541 | |
[email protected] | fa7b1dc | 2010-06-23 17:53:04 | [diff] [blame] | 542 | // Indicates if an input method is active in the browser process. |
| 543 | bool input_method_is_active_; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 544 | |
[email protected] | 5b739cb | 2012-08-21 20:35:21 | [diff] [blame] | 545 | // Stores information about the current text input. |
| 546 | WebKit::WebTextInputInfo text_input_info_; |
| 547 | |
[email protected] | fa7b1dc | 2010-06-23 17:53:04 | [diff] [blame] | 548 | // Stores the current text input type of |webwidget_|. |
[email protected] | ad26ef4 | 2011-06-17 07:59:45 | [diff] [blame] | 549 | ui::TextInputType text_input_type_; |
| 550 | |
| 551 | // Stores the current type of composition text rendering of |webwidget_|. |
| 552 | bool can_compose_inline_; |
[email protected] | fa7b1dc | 2010-06-23 17:53:04 | [diff] [blame] | 553 | |
[email protected] | e99ef6f | 2011-10-16 01:13:00 | [diff] [blame] | 554 | // Stores the current selection bounds. |
| 555 | gfx::Rect selection_start_rect_; |
| 556 | gfx::Rect selection_end_rect_; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 557 | |
[email protected] | 58b48a0d | 2012-06-13 07:01:35 | [diff] [blame] | 558 | // Stores the current composition character bounds. |
| 559 | std::vector<gfx::Rect> composition_character_bounds_; |
| 560 | |
| 561 | // Stores the current composition range. |
| 562 | ui::Range composition_range_; |
| 563 | |
[email protected] | 3e2b375b | 2010-04-07 17:03:12 | [diff] [blame] | 564 | // The kind of popup this widget represents, NONE if not a popup. |
| 565 | WebKit::WebPopupType popup_type_; |
[email protected] | 0ebf387 | 2008-11-07 21:35:03 | [diff] [blame] | 566 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 567 | // Holds all the needed plugin window moves for a scroll. |
[email protected] | 191eb3f7 | 2010-12-21 06:27:50 | [diff] [blame] | 568 | typedef std::vector<webkit::npapi::WebPluginGeometry> WebPluginGeometryVector; |
[email protected] | 26865477 | 2009-08-06 23:02:04 | [diff] [blame] | 569 | WebPluginGeometryVector plugin_window_moves_; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 570 | |
[email protected] | 699ab0d | 2009-04-23 23:19:14 | [diff] [blame] | 571 | // A custom background for the widget. |
| 572 | SkBitmap background_; |
| 573 | |
[email protected] | 80ad862 | 2012-11-07 16:33:03 | [diff] [blame] | 574 | // While we are waiting for the browser to update window sizes, we track the |
| 575 | // pending size temporarily. |
[email protected] | 2533ce1 | 2009-05-09 00:02:24 | [diff] [blame] | 576 | int pending_window_rect_count_; |
| 577 | WebKit::WebRect pending_window_rect_; |
| 578 | |
[email protected] | 80ad862 | 2012-11-07 16:33:03 | [diff] [blame] | 579 | // The screen rects of the view and the window that contains it. |
| 580 | gfx::Rect view_screen_rect_; |
| 581 | gfx::Rect window_screen_rect_; |
| 582 | |
[email protected] | 12fbad81 | 2009-09-01 18:21:24 | [diff] [blame] | 583 | scoped_ptr<IPC::Message> pending_input_event_ack_; |
| 584 | |
[email protected] | b68a0e5 | 2011-12-08 15:11:12 | [diff] [blame] | 585 | // Indicates if the next sequence of Char events should be suppressed or not. |
| 586 | bool suppress_next_char_events_; |
| 587 | |
[email protected] | a79d8a63 | 2010-11-18 22:35:56 | [diff] [blame] | 588 | // Set to true if painting to the window is handled by the accelerated |
| 589 | // compositor. |
| 590 | bool is_accelerated_compositing_active_; |
[email protected] | edbcde93 | 2010-05-07 17:10:46 | [diff] [blame] | 591 | |
[email protected] | 350ce870 | 2012-03-09 04:23:38 | [diff] [blame] | 592 | base::OneShotTimer<RenderWidget> animation_timer_; |
[email protected] | 5f8b102 | 2011-01-21 23:34:50 | [diff] [blame] | 593 | base::Time animation_floor_time_; |
| 594 | bool animation_update_pending_; |
[email protected] | 6522577 | 2011-05-12 21:10:24 | [diff] [blame] | 595 | bool invalidation_task_posted_; |
[email protected] | 5f8b102 | 2011-01-21 23:34:50 | [diff] [blame] | 596 | |
[email protected] | bd37ae25 | 2011-06-03 01:28:18 | [diff] [blame] | 597 | bool has_disable_gpu_vsync_switch_; |
[email protected] | 0fb93f5 | 2011-05-18 23:13:56 | [diff] [blame] | 598 | base::TimeTicks last_do_deferred_update_time_; |
| 599 | |
[email protected] | b63d58d | 2012-11-26 22:37:44 | [diff] [blame] | 600 | cc::RenderingStats software_stats_; |
[email protected] | fef5e397 | 2012-08-07 03:59:47 | [diff] [blame] | 601 | |
[email protected] | aa4117f | 2011-12-09 22:19:21 | [diff] [blame] | 602 | // UpdateRect parameters for the current compositing pass. This is used to |
| 603 | // pass state between DoDeferredUpdate and OnSwapBuffersPosted. |
| 604 | scoped_ptr<ViewHostMsg_UpdateRect_Params> pending_update_params_; |
| 605 | |
| 606 | // Queue of UpdateRect messages corresponding to a SwapBuffers. We want to |
| 607 | // delay sending of UpdateRect until the corresponding SwapBuffers has been |
| 608 | // executed. Since we can have several in flight, we need to keep them in a |
| 609 | // queue. Note: some SwapBuffers may not correspond to an update, in which |
| 610 | // case NULL is added to the queue. |
| 611 | std::deque<ViewHostMsg_UpdateRect*> updates_pending_swap_; |
| 612 | |
[email protected] | 842f1065 | 2012-06-06 01:54:04 | [diff] [blame] | 613 | // Properties of the screen hosting this RenderWidget instance. |
| 614 | WebKit::WebScreenInfo screen_info_; |
| 615 | |
[email protected] | f1cccb3 | 2012-06-06 18:29:59 | [diff] [blame] | 616 | // The device scale factor. This value is computed from the DPI entries in |
| 617 | // |screen_info_| on some platforms, and defaults to 1 on other platforms. |
[email protected] | faec7b1 | 2012-06-19 14:42:13 | [diff] [blame] | 618 | float device_scale_factor_; |
[email protected] | f1cccb3 | 2012-06-06 18:29:59 | [diff] [blame] | 619 | |
[email protected] | ce2b28e | 2012-08-09 15:53:57 | [diff] [blame] | 620 | // Specifies whether input event throttling is enabled for this widget. |
| 621 | bool throttle_input_events_; |
| 622 | |
[email protected] | 0e241b4b | 2012-08-18 09:06:27 | [diff] [blame] | 623 | // State associated with the BeginSmoothScroll synthetic scrolling function. |
| 624 | int next_smooth_scroll_gesture_id_; |
| 625 | typedef std::map<int, SmoothScrollCompletionCallback> |
| 626 | PendingSmoothScrollGestureMap; |
| 627 | PendingSmoothScrollGestureMap pending_smooth_scroll_gestures_; |
| 628 | |
[email protected] | cb643093 | 2012-10-31 00:53:36 | [diff] [blame] | 629 | // Specified whether the compositor will run in its own thread. |
| 630 | bool is_threaded_compositing_enabled_; |
| 631 | |
[email protected] | 05d47875 | 2009-04-08 23:38:16 | [diff] [blame] | 632 | DISALLOW_COPY_AND_ASSIGN(RenderWidget); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 633 | }; |
| 634 | |
[email protected] | e9ff79c | 2012-10-19 21:31:26 | [diff] [blame] | 635 | } // namespace content |
| 636 | |
[email protected] | 2cff005 | 2011-03-18 16:51:44 | [diff] [blame] | 637 | #endif // CONTENT_RENDERER_RENDER_WIDGET_H_ |