blob: 17db0c246ac291ca16313ce4ee8f0448d319a756 [file] [log] [blame]
[email protected]b9b751f22011-03-25 14:04:121// Copyright (c) 2011 The Chromium Authors. All rights reserved.
license.botbf09a502008-08-24 00:55:552// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
initial.commit09911bf2008-07-26 23:55:294
[email protected]2cff0052011-03-18 16:51:445#ifndef CONTENT_RENDERER_RENDER_WIDGET_H_
6#define CONTENT_RENDERER_RENDER_WIDGET_H_
[email protected]32b76ef2010-07-26 23:08:247#pragma once
initial.commit09911bf2008-07-26 23:55:298
9#include <vector>
[email protected]010ea08a2009-10-11 20:21:3210
initial.commit09911bf2008-07-26 23:55:2911#include "base/basictypes.h"
[email protected]f3112a52011-09-30 23:47:4912#include "base/compiler_specific.h"
[email protected]3b63f8f42011-03-28 01:54:1513#include "base/memory/ref_counted.h"
[email protected]8704f89b2011-04-15 00:30:0514#include "base/memory/scoped_ptr.h"
15#include "base/time.h"
[email protected]f3112a52011-09-30 23:47:4916#include "content/common/content_export.h"
[email protected]921f1592011-03-18 00:41:0217#include "content/renderer/paint_aggregator.h"
[email protected]946d1b22009-07-22 23:57:2118#include "ipc/ipc_channel.h"
[email protected]8bd0fe62011-01-17 06:44:3719#include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositionUnderline.h"
20#include "third_party/WebKit/Source/WebKit/chromium/public/WebPopupType.h"
21#include "third_party/WebKit/Source/WebKit/chromium/public/WebRect.h"
22#include "third_party/WebKit/Source/WebKit/chromium/public/WebTextDirection.h"
[email protected]8bd0fe62011-01-17 06:44:3723#include "third_party/WebKit/Source/WebKit/chromium/public/WebWidgetClient.h"
[email protected]d65adb12010-04-28 17:26:4924#include "third_party/skia/include/core/SkBitmap.h"
[email protected]ad26ef42011-06-17 07:59:4525#include "ui/base/ime/text_input_type.h"
[email protected]08397d52011-02-05 01:53:3826#include "ui/gfx/native_widget_types.h"
27#include "ui/gfx/rect.h"
28#include "ui/gfx/size.h"
[email protected]b9b751f22011-03-25 14:04:1229#include "ui/gfx/surface/transport_dib.h"
initial.commit09911bf2008-07-26 23:55:2930#include "webkit/glue/webcursor.h"
initial.commit09911bf2008-07-26 23:55:2931
[email protected]8085dbc82008-09-26 22:53:4432class RenderThreadBase;
33
[email protected]46f36a492010-07-28 19:36:4134namespace gfx {
35class Point;
36}
37
[email protected]484955942010-08-19 16:13:1838namespace IPC {
39class SyncMessage;
40}
41
[email protected]46f36a492010-07-28 19:36:4142namespace skia {
43class PlatformCanvas;
44}
45
[email protected]88efb7ec2009-07-14 16:32:5946namespace WebKit {
[email protected]67bfb83f2011-09-22 03:36:3747class WebInputEvent;
[email protected]6a8ddba52010-09-05 04:38:0648class WebMouseEvent;
[email protected]2d0f2e92011-10-03 09:02:2449class WebTouchEvent;
[email protected]484955942010-08-19 16:13:1850class WebWidget;
[email protected]88efb7ec2009-07-14 16:32:5951struct WebPopupMenuInfo;
52}
53
[email protected]191eb3f72010-12-21 06:27:5054namespace webkit {
55namespace npapi {
[email protected]f103ab72009-09-02 17:10:5956struct WebPluginGeometry;
[email protected]719b36f2010-12-22 20:36:4657} // namespace npapi
58
59namespace ppapi {
60class PluginInstance;
61} // namespace ppapi
62} // namespace webkit
[email protected]f103ab72009-09-02 17:10:5963
initial.commit09911bf2008-07-26 23:55:2964// RenderWidget provides a communication bridge between a WebWidget and
65// a RenderWidgetHost, the latter of which lives in a different process.
[email protected]f3112a52011-09-30 23:47:4966class CONTENT_EXPORT RenderWidget
67 : public IPC::Channel::Listener,
68 public IPC::Message::Sender,
69 NON_EXPORTED_BASE(virtual public WebKit::WebWidgetClient),
70 public base::RefCounted<RenderWidget> {
initial.commit09911bf2008-07-26 23:55:2971 public:
72 // Creates a new RenderWidget. The opener_id is the routing ID of the
[email protected]8085dbc82008-09-26 22:53:4473 // RenderView that this widget lives inside. The render_thread is any
[email protected]8930d472009-02-21 08:05:2874 // RenderThreadBase implementation, mostly commonly RenderThread::current().
[email protected]0ebf3872008-11-07 21:35:0375 static RenderWidget* Create(int32 opener_id,
76 RenderThreadBase* render_thread,
[email protected]3e2b375b2010-04-07 17:03:1277 WebKit::WebPopupType popup_type);
initial.commit09911bf2008-07-26 23:55:2978
[email protected]484955942010-08-19 16:13:1879 // Creates a WebWidget based on the popup type.
80 static WebKit::WebWidget* CreateWebWidget(RenderWidget* render_widget);
81
[email protected]c03a6e72011-04-19 21:42:0682 // The compositing surface assigned by the RenderWidgetHost
83 // (or RenderViewHost). Will be gfx::kNullPluginWindow if not assigned yet,
84 // in which case we should not create any GPU command buffers with it.
initial.commit09911bf2008-07-26 23:55:2985 // The routing ID assigned by the RenderProcess. Will be MSG_ROUTING_NONE if
86 // not yet assigned a view ID, in which case, the process MUST NOT send
87 // messages with this ID to the parent.
88 int32 routing_id() const {
89 return routing_id_;
90 }
91
92 // May return NULL when the window is closing.
[email protected]93b9d692011-04-13 00:44:3193 WebKit::WebWidget* webwidget() const { return webwidget_; }
94 gfx::NativeViewId host_window() const { return host_window_; }
95 gfx::Size size() const { return size_; }
[email protected]589621b2010-09-23 22:01:0796 bool has_focus() const { return has_focus_; }
97
initial.commit09911bf2008-07-26 23:55:2998 // IPC::Channel::Listener
[email protected]a95986a82010-12-24 06:19:2899 virtual bool OnMessageReceived(const IPC::Message& msg);
initial.commit09911bf2008-07-26 23:55:29100
101 // IPC::Message::Sender
102 virtual bool Send(IPC::Message* msg);
103
[email protected]4873c7d2009-07-16 06:36:28104 // WebKit::WebWidgetClient
105 virtual void didInvalidateRect(const WebKit::WebRect&);
106 virtual void didScrollRect(int dx, int dy, const WebKit::WebRect& clipRect);
[email protected]ea162f92011-10-04 23:08:22107 virtual void didActivateCompositor(int compositorIdentifier);
108 virtual void didDeactivateCompositor();
[email protected]f98d7e3c2010-09-13 22:30:46109 virtual void scheduleComposite();
[email protected]5f8b1022011-01-21 23:34:50110 virtual void scheduleAnimation();
[email protected]4873c7d2009-07-16 06:36:28111 virtual void didFocus();
112 virtual void didBlur();
113 virtual void didChangeCursor(const WebKit::WebCursorInfo&);
114 virtual void closeWidgetSoon();
115 virtual void show(WebKit::WebNavigationPolicy);
116 virtual void runModal() {}
117 virtual WebKit::WebRect windowRect();
[email protected]8a9d6ca32011-06-06 20:11:30118 virtual void setToolTipText(const WebKit::WebString& text,
119 WebKit::WebTextDirection hint);
[email protected]4873c7d2009-07-16 06:36:28120 virtual void setWindowRect(const WebKit::WebRect&);
121 virtual WebKit::WebRect windowResizerRect();
122 virtual WebKit::WebRect rootWindowRect();
123 virtual WebKit::WebScreenInfo screenInfo();
[email protected]fa7b1dc2010-06-23 17:53:04124 virtual void resetInputMethod();
[email protected]4873c7d2009-07-16 06:36:28125
126 // Called when a plugin is moved. These events are queued up and sent with
127 // the next paint or scroll message to the host.
[email protected]191eb3f72010-12-21 06:27:50128 void SchedulePluginMove(const webkit::npapi::WebPluginGeometry& move);
initial.commit09911bf2008-07-26 23:55:29129
[email protected]268654772009-08-06 23:02:04130 // Called when a plugin window has been destroyed, to make sure the currently
131 // pending moves don't try to reference it.
132 void CleanupWindowInPluginMoves(gfx::PluginWindowHandle window);
133
initial.commit09911bf2008-07-26 23:55:29134 // Close the underlying WebWidget.
[email protected]60c42a8c72009-10-09 04:08:59135 virtual void Close();
initial.commit09911bf2008-07-26 23:55:29136
[email protected]a1127f82011-09-08 17:27:01137 float filtered_time_per_frame() const {
138 return filtered_time_per_frame_;
139 }
140
initial.commit09911bf2008-07-26 23:55:29141 protected:
[email protected]8085dbc82008-09-26 22:53:44142 // Friend RefCounted so that the dtor can be non-public. Using this class
143 // without ref-counting is an error.
144 friend class base::RefCounted<RenderWidget>;
[email protected]7339cd22010-10-27 00:11:20145 // For unit tests.
146 friend class RenderWidgetTest;
[email protected]8085dbc82008-09-26 22:53:44147
[email protected]3e2b375b2010-04-07 17:03:12148 RenderWidget(RenderThreadBase* render_thread,
149 WebKit::WebPopupType popup_type);
[email protected]8085dbc82008-09-26 22:53:44150 virtual ~RenderWidget();
initial.commit09911bf2008-07-26 23:55:29151
152 // Initializes this view with the given opener. CompleteInit must be called
153 // later.
154 void Init(int32 opener_id);
155
[email protected]484955942010-08-19 16:13:18156 // Called by Init and subclasses to perform initialization.
157 void DoInit(int32 opener_id,
158 WebKit::WebWidget* web_widget,
159 IPC::SyncMessage* create_widget_message);
160
initial.commit09911bf2008-07-26 23:55:29161 // Finishes creation of a pending view started with Init.
[email protected]2d7c8552011-06-27 19:21:55162 void CompleteInit(gfx::NativeViewId parent);
initial.commit09911bf2008-07-26 23:55:29163
[email protected]992db4c2011-05-12 15:37:15164 // Sets whether this RenderWidget has been swapped out to be displayed by
165 // a RenderWidget in a different process. If so, no new IPC messages will be
166 // sent (only ACKs) and the process is free to exit when there are no other
167 // active RenderWidgets.
168 void SetSwappedOut(bool is_swapped_out);
169
[email protected]661eb9d2009-02-03 02:11:48170 // Paints the given rectangular region of the WebWidget into canvas (a
171 // shared memory segment returned by AllocPaintBuf on Windows). The caller
172 // must ensure that the given rect fits within the bounds of the WebWidget.
[email protected]4fb66842009-12-04 21:41:00173 void PaintRect(const gfx::Rect& rect, const gfx::Point& canvas_origin,
174 skia::PlatformCanvas* canvas);
175
176 // Paints a border at the given rect for debugging purposes.
177 void PaintDebugBorder(const gfx::Rect& rect, skia::PlatformCanvas* canvas);
initial.commit09911bf2008-07-26 23:55:29178
[email protected]bd37ae252011-06-03 01:28:18179 bool IsRenderingVSynced();
[email protected]52ccd0ea2011-02-16 01:09:05180 void AnimationCallback();
181 void AnimateIfNeeded();
[email protected]65225772011-05-12 21:10:24182 void InvalidationCallback();
183 void DoDeferredUpdateAndSendInputAck();
[email protected]552e6002009-11-19 05:24:57184 void DoDeferredUpdate();
[email protected]2533ce12009-05-09 00:02:24185 void DoDeferredClose();
186 void DoDeferredSetWindowRect(const WebKit::WebRect& pos);
initial.commit09911bf2008-07-26 23:55:29187
[email protected]699ab0d2009-04-23 23:19:14188 // Set the background of the render widget to a bitmap. The bitmap will be
189 // tiled in both directions if it isn't big enough to fill the area. This is
190 // mainly intended to be used in conjuction with WebView::SetIsTransparent().
191 virtual void SetBackground(const SkBitmap& bitmap);
192
initial.commit09911bf2008-07-26 23:55:29193 // RenderWidget IPC message handlers
194 void OnClose();
[email protected]2d7c8552011-06-27 19:21:55195 void OnCreatingNewAck(gfx::NativeViewId parent);
[email protected]30f75e62009-02-25 22:01:00196 virtual void OnResize(const gfx::Size& new_size,
197 const gfx::Rect& resizer_rect);
[email protected]941e4552010-02-01 21:23:43198 virtual void OnWasHidden();
199 virtual void OnWasRestored(bool needs_repainting);
[email protected]992db4c2011-05-12 15:37:15200 virtual void OnWasSwappedOut();
[email protected]53d3f302009-12-21 04:42:05201 void OnUpdateRectAck();
[email protected]8400e032010-02-26 18:50:11202 void OnCreateVideoAck(int32 video_id);
203 void OnUpdateVideoAck(int32 video_id);
[email protected]2533ce12009-05-09 00:02:24204 void OnRequestMoveAck();
initial.commit09911bf2008-07-26 23:55:29205 void OnHandleInputEvent(const IPC::Message& message);
206 void OnMouseCaptureLost();
[email protected]1e6e3c992010-02-08 15:52:13207 virtual void OnSetFocus(bool enable);
[email protected]fa7b1dc2010-06-23 17:53:04208 void OnSetInputMethodActive(bool is_active);
[email protected]56ea1a62011-05-30 07:05:57209 virtual void OnImeSetComposition(
[email protected]fa7b1dc2010-06-23 17:53:04210 const string16& text,
211 const std::vector<WebKit::WebCompositionUnderline>& underlines,
212 int selection_start,
213 int selection_end);
[email protected]56ea1a62011-05-30 07:05:57214 virtual void OnImeConfirmComposition(const string16& text);
[email protected]d65adb12010-04-28 17:26:49215 void OnMsgPaintAtSize(const TransportDIB::Handle& dib_id,
[email protected]c88c9442010-07-19 18:55:09216 int tag,
[email protected]948f7ab72010-05-28 23:48:08217 const gfx::Size& page_size,
[email protected]d65adb12010-04-28 17:26:49218 const gfx::Size& desired_size);
[email protected]ec7dc112008-08-06 05:30:12219 void OnMsgRepaint(const gfx::Size& size_to_paint);
[email protected]4873c7d2009-07-16 06:36:28220 void OnSetTextDirection(WebKit::WebTextDirection direction);
[email protected]872ae5b2011-05-26 20:20:50221 void OnGetFPS();
initial.commit09911bf2008-07-26 23:55:29222
[email protected]00c39612010-03-06 02:53:28223 // Override point to notify derived classes that a paint has happened.
224 // DidInitiatePaint happens when we've generated a new bitmap and sent it to
225 // the browser. DidFlushPaint happens once we've received the ACK that the
226 // screen has actually been updated.
227 virtual void DidInitiatePaint() {}
228 virtual void DidFlushPaint() {}
[email protected]a2f6bc112009-06-27 16:27:25229
[email protected]65225772011-05-12 21:10:24230 // Override and return true when the widget is rendered with a graphics
[email protected]37a6f302011-07-11 23:43:08231 // context that supports asynchronous swapbuffers. When returning true, the
232 // subclass must call OnSwapBuffersPosted() when swap is posted,
233 // OnSwapBuffersComplete() when swaps complete, and OnSwapBuffersAborted if
234 // the context is lost.
[email protected]65225772011-05-12 21:10:24235 virtual bool SupportsAsynchronousSwapBuffers();
236
237 // Notifies scheduler that the RenderWidget's subclass has finished or aborted
238 // a swap buffers.
[email protected]37a6f302011-07-11 23:43:08239 void OnSwapBuffersPosted();
[email protected]65225772011-05-12 21:10:24240 void OnSwapBuffersComplete();
[email protected]37a6f302011-07-11 23:43:08241 void OnSwapBuffersAborted();
[email protected]65225772011-05-12 21:10:24242
[email protected]ca4847f2010-09-24 05:39:15243 // Detects if a suitable opaque plugin covers the given paint bounds with no
244 // compositing necessary.
245 //
[email protected]719b36f2010-12-22 20:36:46246 // Returns the plugin instance that's the source of the paint if the paint
247 // can be handled by just blitting the plugin bitmap. In this case, the
248 // location, clipping, and ID of the backing store will be filled into the
249 // given output parameters.
[email protected]ca4847f2010-09-24 05:39:15250 //
[email protected]719b36f2010-12-22 20:36:46251 // A return value of null means optimized painting can not be used and we
[email protected]ca4847f2010-09-24 05:39:15252 // should continue with the normal painting code path.
[email protected]719b36f2010-12-22 20:36:46253 virtual webkit::ppapi::PluginInstance* GetBitmapForOptimizedPluginPaint(
[email protected]ca4847f2010-09-24 05:39:15254 const gfx::Rect& paint_bounds,
255 TransportDIB** dib,
256 gfx::Rect* location,
257 gfx::Rect* clip);
258
[email protected]d54169e92011-01-21 09:19:52259 // Gets the scroll offset of this widget, if this widget has a notion of
260 // scroll offset.
[email protected]bcaf2272011-02-15 15:29:43261 virtual gfx::Point GetScrollOffset();
[email protected]d54169e92011-01-21 09:19:52262
[email protected]bee16aab2009-08-26 15:55:03263 // Sets the "hidden" state of this widget. All accesses to is_hidden_ should
264 // use this method so that we can properly inform the RenderThread of our
265 // state.
266 void SetHidden(bool hidden);
267
[email protected]882daa92009-11-05 16:31:31268 bool is_hidden() const { return is_hidden_; }
269
[email protected]53d3f302009-12-21 04:42:05270 // True if an UpdateRect_ACK message is pending.
271 bool update_reply_pending() const {
272 return update_reply_pending_;
initial.commit09911bf2008-07-26 23:55:29273 }
274
[email protected]674741932009-02-04 23:44:46275 bool next_paint_is_resize_ack() const;
276 bool next_paint_is_restore_ack() const;
277 void set_next_paint_is_resize_ack();
278 void set_next_paint_is_restore_ack();
279 void set_next_paint_is_repaint_ack();
[email protected]ec7dc112008-08-06 05:30:12280
[email protected]fa7b1dc2010-06-23 17:53:04281 // Checks if the input method state and caret position have been changed.
282 // If they are changed, the new value will be sent to the browser process.
283 void UpdateInputMethod();
initial.commit09911bf2008-07-26 23:55:29284
[email protected]56ea1a62011-05-30 07:05:57285 // Override point to obtain that the current input method state and caret
286 // position.
[email protected]ad26ef42011-06-17 07:59:45287 virtual ui::TextInputType GetTextInputType();
288
289 // Override point to obtain that the current input method state about
290 // composition text.
291 virtual bool CanComposeInline();
[email protected]56ea1a62011-05-30 07:05:57292
initial.commit09911bf2008-07-26 23:55:29293 // Tells the renderer it does not have focus. Used to prevent us from getting
294 // the focus on our own when the browser did not focus us.
295 void ClearFocus();
296
[email protected]2533ce12009-05-09 00:02:24297 // Set the pending window rect.
298 // Because the real render_widget is hosted in another process, there is
299 // a time period where we may have set a new window rect which has not yet
300 // been processed by the browser. So we maintain a pending window rect
301 // size. If JS code sets the WindowRect, and then immediately calls
302 // GetWindowRect() we'll use this pending window rect as the size.
303 void SetPendingWindowRect(const WebKit::WebRect& r);
304
[email protected]446705872009-09-10 07:22:48305 // Called by OnHandleInputEvent() to notify subclasses that a key event was
306 // just handled.
307 virtual void DidHandleKeyEvent() {}
308
[email protected]67bfb83f2011-09-22 03:36:37309 // Called by OnHandleInputEvent() to notify subclasses that a mouse event is
310 // about to be handled.
311 // Returns true if no further handling is needed. In that case, the event
312 // won't be sent to WebKit or trigger DidHandleMouseEvent().
313 virtual bool WillHandleMouseEvent(const WebKit::WebMouseEvent& event);
314
[email protected]6a8ddba52010-09-05 04:38:06315 // Called by OnHandleInputEvent() to notify subclasses that a mouse event was
316 // just handled.
317 virtual void DidHandleMouseEvent(const WebKit::WebMouseEvent& event) {}
318
[email protected]2d0f2e92011-10-03 09:02:24319 // Called by OnHandleInputEvent() to notify subclasses that a touch event was
320 // just handled.
321 virtual void DidHandleTouchEvent(const WebKit::WebTouchEvent& event) {}
322
initial.commit09911bf2008-07-26 23:55:29323 // Routing ID that allows us to communicate to the parent browser process
324 // RenderWidgetHost. When MSG_ROUTING_NONE, no messages may be sent.
325 int32 routing_id_;
326
[email protected]c5b3b5e2009-02-13 06:41:11327 // We are responsible for destroying this object via its Close method.
[email protected]4873c7d2009-07-16 06:36:28328 WebKit::WebWidget* webwidget_;
initial.commit09911bf2008-07-26 23:55:29329
330 // Set to the ID of the view that initiated creating this view, if any. When
331 // the view was initiated by the browser (the common case), this will be
332 // MSG_ROUTING_NONE. This is used in determining ownership when opening
333 // child tabs. See RenderWidget::createWebViewWithRequest.
334 //
335 // This ID may refer to an invalid view if that view is closed before this
336 // view is.
337 int32 opener_id_;
338
[email protected]8085dbc82008-09-26 22:53:44339 // The thread that does our IPC.
340 RenderThreadBase* render_thread_;
341
initial.commit09911bf2008-07-26 23:55:29342 // The position where this view should be initially shown.
343 gfx::Rect initial_pos_;
344
345 // The window we are embedded within. TODO(darin): kill this.
[email protected]18bcc3c2009-01-27 21:39:15346 gfx::NativeViewId host_window_;
initial.commit09911bf2008-07-26 23:55:29347
348 // We store the current cursor object so we can avoid spamming SetCursor
349 // messages.
350 WebCursor current_cursor_;
[email protected]88efb7ec2009-07-14 16:32:59351
initial.commit09911bf2008-07-26 23:55:29352 // The size of the RenderWidget.
353 gfx::Size size_;
354
[email protected]b4d08452010-10-05 17:34:35355 // The TransportDIB that is being used to transfer an image to the browser.
356 TransportDIB* current_paint_buf_;
initial.commit09911bf2008-07-26 23:55:29357
[email protected]552e6002009-11-19 05:24:57358 PaintAggregator paint_aggregator_;
initial.commit09911bf2008-07-26 23:55:29359
[email protected]f21c613a2009-02-12 14:46:17360 // The area that must be reserved for drawing the resize corner.
361 gfx::Rect resizer_rect_;
362
[email protected]53d3f302009-12-21 04:42:05363 // Flags for the next ViewHostMsg_UpdateRect message.
initial.commit09911bf2008-07-26 23:55:29364 int next_paint_flags_;
365
[email protected]872ae5b2011-05-26 20:20:50366 // Filtered time per frame based on UpdateRect messages.
367 float filtered_time_per_frame_;
368
[email protected]53d3f302009-12-21 04:42:05369 // True if we are expecting an UpdateRect_ACK message (i.e., that a
370 // UpdateRect message has been sent).
371 bool update_reply_pending_;
initial.commit09911bf2008-07-26 23:55:29372
[email protected]65225772011-05-12 21:10:24373 // True if the underlying graphics context supports asynchronous swap.
374 // Cached on the RenderWidget because determining support is costly.
375 bool using_asynchronous_swapbuffers_;
376
377 // Number of OnSwapBuffersComplete we are expecting. Incremented each time
378 // WebWidget::composite has been been performed when the RenderWidget subclass
379 // SupportsAsynchronousSwapBuffers. Decremented in OnSwapBuffers. Will block
380 // rendering.
381 int num_swapbuffers_complete_pending_;
382
383 // When accelerated rendering is on, is the maximum number of swapbuffers that
384 // can be outstanding before we start throttling based on
385 // OnSwapBuffersComplete callback.
[email protected]82ca9b92011-09-12 23:33:07386 static const int kMaxSwapBuffersPending = 2;
[email protected]65225772011-05-12 21:10:24387
initial.commit09911bf2008-07-26 23:55:29388 // Set to true if we should ignore RenderWidget::Show calls.
389 bool did_show_;
390
391 // Indicates that we shouldn't bother generated paint events.
392 bool is_hidden_;
393
394 // Indicates that we should be repainted when restored. This flag is set to
395 // true if we receive an invalidation / scroll event from webkit while our
396 // is_hidden_ flag is set to true. This is used to force a repaint once we
397 // restore to account for the fact that our host would not know about the
398 // invalidation / scroll event(s) from webkit while we are hidden.
399 bool needs_repainting_on_restore_;
400
401 // Indicates whether we have been focused/unfocused by the browser.
402 bool has_focus_;
403
[email protected]5dd768212009-08-13 23:34:49404 // Are we currently handling an input event?
405 bool handling_input_event_;
406
initial.commit09911bf2008-07-26 23:55:29407 // True if we have requested this widget be closed. No more messages will
408 // be sent, except for a Close.
409 bool closing_;
410
[email protected]992db4c2011-05-12 15:37:15411 // Whether this RenderWidget is currently swapped out, such that the view is
412 // being rendered by another process. If all RenderWidgets in a process are
413 // swapped out, the process can exit.
414 bool is_swapped_out_;
415
[email protected]fa7b1dc2010-06-23 17:53:04416 // Indicates if an input method is active in the browser process.
417 bool input_method_is_active_;
initial.commit09911bf2008-07-26 23:55:29418
[email protected]fa7b1dc2010-06-23 17:53:04419 // Stores the current text input type of |webwidget_|.
[email protected]ad26ef42011-06-17 07:59:45420 ui::TextInputType text_input_type_;
421
422 // Stores the current type of composition text rendering of |webwidget_|.
423 bool can_compose_inline_;
[email protected]fa7b1dc2010-06-23 17:53:04424
425 // Stores the current caret bounds of input focus.
426 WebKit::WebRect caret_bounds_;
initial.commit09911bf2008-07-26 23:55:29427
[email protected]3e2b375b2010-04-07 17:03:12428 // The kind of popup this widget represents, NONE if not a popup.
429 WebKit::WebPopupType popup_type_;
[email protected]0ebf3872008-11-07 21:35:03430
initial.commit09911bf2008-07-26 23:55:29431 // Holds all the needed plugin window moves for a scroll.
[email protected]191eb3f72010-12-21 06:27:50432 typedef std::vector<webkit::npapi::WebPluginGeometry> WebPluginGeometryVector;
[email protected]268654772009-08-06 23:02:04433 WebPluginGeometryVector plugin_window_moves_;
initial.commit09911bf2008-07-26 23:55:29434
[email protected]699ab0d2009-04-23 23:19:14435 // A custom background for the widget.
436 SkBitmap background_;
437
[email protected]2533ce12009-05-09 00:02:24438 // While we are waiting for the browser to update window sizes,
439 // we track the pending size temporarily.
440 int pending_window_rect_count_;
441 WebKit::WebRect pending_window_rect_;
442
[email protected]12fbad812009-09-01 18:21:24443 scoped_ptr<IPC::Message> pending_input_event_ack_;
444
[email protected]867125a02009-12-10 06:01:48445 // Indicates if the next sequence of Char events should be suppressed or not.
446 bool suppress_next_char_events_;
447
[email protected]a79d8a632010-11-18 22:35:56448 // Set to true if painting to the window is handled by the accelerated
449 // compositor.
450 bool is_accelerated_compositing_active_;
[email protected]edbcde932010-05-07 17:10:46451
[email protected]5f8b1022011-01-21 23:34:50452 base::Time animation_floor_time_;
453 bool animation_update_pending_;
[email protected]52ccd0ea2011-02-16 01:09:05454 bool animation_task_posted_;
[email protected]65225772011-05-12 21:10:24455 bool invalidation_task_posted_;
[email protected]5f8b1022011-01-21 23:34:50456
[email protected]bd37ae252011-06-03 01:28:18457 bool has_disable_gpu_vsync_switch_;
[email protected]0fb93f572011-05-18 23:13:56458 base::TimeTicks last_do_deferred_update_time_;
459
[email protected]05d478752009-04-08 23:38:16460 DISALLOW_COPY_AND_ASSIGN(RenderWidget);
initial.commit09911bf2008-07-26 23:55:29461};
462
[email protected]2cff0052011-03-18 16:51:44463#endif // CONTENT_RENDERER_RENDER_WIDGET_H_