blob: 13574d0f9abf0fb2f3952248c8fc39d7b546fc13 [file] [log] [blame]
[email protected]9f4f3322012-01-18 22:29:561// Copyright (c) 2012 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_
initial.commit09911bf2008-07-26 23:55:297
[email protected]aa4117f2011-12-09 22:19:218#include <deque>
[email protected]0e241b4b2012-08-18 09:06:279#include <map>
[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"
[email protected]bffc8302014-01-23 20:52:1615#include "base/observer_list.h"
[email protected]abb522162013-06-28 01:54:1616#include "base/time/time.h"
17#include "base/timer/timer.h"
[email protected]c1e6cc062013-08-24 03:35:3518#include "cc/debug/rendering_stats_instrumentation.h"
[email protected]f3112a52011-09-30 23:47:4919#include "content/common/content_export.h"
[email protected]c2809346d2014-03-20 00:11:0320#include "content/common/cursors/webcursor.h"
[email protected]ed7defa2013-03-12 21:29:5921#include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h"
[email protected]9017d7852013-11-21 17:47:3522#include "content/common/input/synthetic_gesture_params.h"
[email protected]921f1592011-03-18 00:41:0223#include "content/renderer/paint_aggregator.h"
[email protected]4f86bdb2012-11-10 19:11:1924#include "ipc/ipc_listener.h"
25#include "ipc/ipc_sender.h"
[email protected]5c30b5e02013-05-30 03:46:0826#include "third_party/WebKit/public/platform/WebRect.h"
[email protected]2255a9332013-06-17 05:12:3127#include "third_party/WebKit/public/web/WebCompositionUnderline.h"
28#include "third_party/WebKit/public/web/WebPopupType.h"
29#include "third_party/WebKit/public/web/WebTextDirection.h"
30#include "third_party/WebKit/public/web/WebTextInputInfo.h"
[email protected]5d0bbdfa92013-12-10 00:35:5131#include "third_party/WebKit/public/web/WebTouchAction.h"
[email protected]0e45bd02013-07-12 20:20:0232#include "third_party/WebKit/public/web/WebWidget.h"
[email protected]2255a9332013-06-17 05:12:3133#include "third_party/WebKit/public/web/WebWidgetClient.h"
[email protected]d65adb12010-04-28 17:26:4934#include "third_party/skia/include/core/SkBitmap.h"
[email protected]b256eca2013-07-11 10:57:4035#include "ui/base/ime/text_input_mode.h"
[email protected]ad26ef42011-06-17 07:59:4536#include "ui/base/ime/text_input_type.h"
[email protected]a09d53ce2014-01-31 00:46:4237#include "ui/base/ui_base_types.h"
[email protected]08397d52011-02-05 01:53:3838#include "ui/gfx/native_widget_types.h"
[email protected]db4fc1e2013-09-06 20:01:5139#include "ui/gfx/range/range.h"
[email protected]08397d52011-02-05 01:53:3840#include "ui/gfx/rect.h"
[email protected]990278ff2012-11-13 02:12:5541#include "ui/gfx/vector2d.h"
[email protected]a2b5ded2013-05-20 21:32:5342#include "ui/gfx/vector2d_f.h"
[email protected]d353541f2012-05-03 22:45:4143#include "ui/surface/transport_dib.h"
initial.commit09911bf2008-07-26 23:55:2944
[email protected]aa4117f2011-12-09 22:19:2145struct ViewHostMsg_UpdateRect_Params;
[email protected]0fdd5012013-05-29 08:05:5646struct ViewMsg_Resize_Params;
[email protected]aa4117f2011-12-09 22:19:2147class ViewHostMsg_UpdateRect;
48
[email protected]484955942010-08-19 16:13:1849namespace IPC {
50class SyncMessage;
51}
52
[email protected]180ef242013-11-07 06:50:4653namespace blink {
[email protected]19193682014-04-03 15:01:4354struct WebDeviceEmulationParams;
[email protected]41d86852012-11-07 12:23:2455class WebGestureEvent;
[email protected]0dea1652012-12-14 00:09:0956class WebInputEvent;
[email protected]f56c7872013-06-18 12:31:5757class WebKeyboardEvent;
[email protected]6a8ddba52010-09-05 04:38:0658class WebMouseEvent;
[email protected]2d0f2e92011-10-03 09:02:2459class WebTouchEvent;
[email protected]526476902011-10-06 20:34:0660}
61
[email protected]ba91a792013-02-06 09:48:2862namespace cc { class OutputSurface; }
63
[email protected]db4fc1e2013-09-06 20:01:5164namespace gfx {
[email protected]4de6d1692011-10-12 08:45:4465class Range;
66}
67
[email protected]e9ff79c2012-10-19 21:31:2668namespace content {
[email protected]b2e4c70132013-10-03 02:07:5169class ExternalPopupMenu;
[email protected]adab2332013-07-25 18:04:3270class PepperPluginInstanceImpl;
[email protected]bffc8302014-01-23 20:52:1671class RenderFrameImpl;
[email protected]ba91a792013-02-06 09:48:2872class RenderWidgetCompositor;
[email protected]e9ff79c2012-10-19 21:31:2673class RenderWidgetTest;
[email protected]5b45ad42013-10-25 00:42:0474class ResizingModeSelector;
[email protected]b2e4c70132013-10-03 02:07:5175struct ContextMenuParams;
[email protected]29e2fb42013-07-19 01:13:4776struct WebPluginGeometry;
[email protected]e9ff79c2012-10-19 21:31:2677
initial.commit09911bf2008-07-26 23:55:2978// RenderWidget provides a communication bridge between a WebWidget and
79// a RenderWidgetHost, the latter of which lives in a different process.
[email protected]f3112a52011-09-30 23:47:4980class CONTENT_EXPORT RenderWidget
[email protected]c47317e2012-06-20 22:35:3181 : public IPC::Listener,
82 public IPC::Sender,
[email protected]180ef242013-11-07 06:50:4683 NON_EXPORTED_BASE(virtual public blink::WebWidgetClient),
[email protected]f3112a52011-09-30 23:47:4984 public base::RefCounted<RenderWidget> {
initial.commit09911bf2008-07-26 23:55:2985 public:
86 // Creates a new RenderWidget. The opener_id is the routing ID of the
[email protected]380244092011-10-07 17:26:2787 // RenderView that this widget lives inside.
[email protected]0ebf3872008-11-07 21:35:0388 static RenderWidget* Create(int32 opener_id,
[email protected]180ef242013-11-07 06:50:4689 blink::WebPopupType popup_type,
90 const blink::WebScreenInfo& screen_info);
initial.commit09911bf2008-07-26 23:55:2991
[email protected]484955942010-08-19 16:13:1892 // Creates a WebWidget based on the popup type.
[email protected]180ef242013-11-07 06:50:4693 static blink::WebWidget* CreateWebWidget(RenderWidget* render_widget);
[email protected]484955942010-08-19 16:13:1894
[email protected]4ee64622014-03-21 22:34:1595 int32 routing_id() const { return routing_id_; }
96 int32 surface_id() const { return surface_id_; }
[email protected]180ef242013-11-07 06:50:4697 blink::WebWidget* webwidget() const { return webwidget_; }
[email protected]93b9d692011-04-13 00:44:3198 gfx::Size size() const { return size_; }
[email protected]4ee64622014-03-21 22:34:1599 float filtered_time_per_frame() const { return filtered_time_per_frame_; }
[email protected]589621b2010-09-23 22:01:07100 bool has_focus() const { return has_focus_; }
[email protected]ee41e7d22011-10-14 19:34:09101 bool is_fullscreen() const { return is_fullscreen_; }
[email protected]204f1df2012-01-04 20:21:13102 bool is_hidden() const { return is_hidden_; }
[email protected]4ee64622014-03-21 22:34:15103 bool handling_input_event() const { return handling_input_event_; }
104 // Temporary for debugging purposes...
105 bool closing() const { return closing_; }
106 bool is_swapped_out() { return is_swapped_out_; }
107 ui::MenuSourceType context_menu_source_type() {
108 return context_menu_source_type_; }
109 gfx::Point touch_editing_context_menu_location() {
110 return touch_editing_context_menu_location_;
111 }
[email protected]589621b2010-09-23 22:01:07112
[email protected]bffc8302014-01-23 20:52:16113 // Functions to track out-of-process frames for special notifications.
114 void RegisterSwappedOutChildFrame(RenderFrameImpl* frame);
115 void UnregisterSwappedOutChildFrame(RenderFrameImpl* frame);
116
[email protected]c47317e2012-06-20 22:35:31117 // IPC::Listener
[email protected]edc64de2011-11-17 20:07:38118 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
initial.commit09911bf2008-07-26 23:55:29119
[email protected]c47317e2012-06-20 22:35:31120 // IPC::Sender
[email protected]edc64de2011-11-17 20:07:38121 virtual bool Send(IPC::Message* msg) OVERRIDE;
initial.commit09911bf2008-07-26 23:55:29122
[email protected]180ef242013-11-07 06:50:46123 // blink::WebWidgetClient
[email protected]9ed83fe2013-02-27 01:52:28124 virtual void suppressCompositorScheduling(bool enable);
[email protected]9cd43a62012-03-26 08:03:56125 virtual void willBeginCompositorFrame();
[email protected]180ef242013-11-07 06:50:46126 virtual void didInvalidateRect(const blink::WebRect&);
[email protected]990278ff2012-11-13 02:12:55127 virtual void didScrollRect(int dx, int dy,
[email protected]180ef242013-11-07 06:50:46128 const blink::WebRect& clipRect);
129 virtual void didAutoResize(const blink::WebSize& new_size);
[email protected]c0b0bd12014-03-13 00:39:58130 // FIXME: To be removed as soon as chromium and blink side changes land
131 // didActivateCompositor with parameters is still kept in order to land
132 // these changes s-chromium - https://codereview.chromium.org/137893025/.
133 // s-blink - https://codereview.chromium.org/138523003/
[email protected]91acd1c2012-03-14 08:32:39134 virtual void didActivateCompositor(int input_handler_identifier);
[email protected]c0b0bd12014-03-13 00:39:58135 virtual void didActivateCompositor() OVERRIDE;
[email protected]ea162f92011-10-04 23:08:22136 virtual void didDeactivateCompositor();
[email protected]e195e582013-03-08 01:32:59137 virtual void initializeLayerTreeView();
[email protected]180ef242013-11-07 06:50:46138 virtual blink::WebLayerTreeView* layerTreeView();
[email protected]3391a0772012-03-28 00:32:07139 virtual void didBecomeReadyForAdditionalInput();
[email protected]58264a32011-11-17 23:36:15140 virtual void didCommitAndDrawCompositorFrame();
141 virtual void didCompleteSwapBuffers();
[email protected]8b9e52b2014-01-17 16:35:31142 virtual void scheduleComposite();
143 virtual void scheduleAnimation();
[email protected]4873c7d2009-07-16 06:36:28144 virtual void didFocus();
145 virtual void didBlur();
[email protected]180ef242013-11-07 06:50:46146 virtual void didChangeCursor(const blink::WebCursorInfo&);
[email protected]4873c7d2009-07-16 06:36:28147 virtual void closeWidgetSoon();
[email protected]180ef242013-11-07 06:50:46148 virtual void show(blink::WebNavigationPolicy);
[email protected]dd48d492014-03-16 05:04:39149 virtual void runModal() {}
[email protected]180ef242013-11-07 06:50:46150 virtual blink::WebRect windowRect();
151 virtual void setToolTipText(const blink::WebString& text,
152 blink::WebTextDirection hint);
153 virtual void setWindowRect(const blink::WebRect&);
154 virtual blink::WebRect windowResizerRect();
155 virtual blink::WebRect rootWindowRect();
156 virtual blink::WebScreenInfo screenInfo();
[email protected]f660d9c2012-06-06 18:31:21157 virtual float deviceScaleFactor();
[email protected]fa7b1dc2010-06-23 17:53:04158 virtual void resetInputMethod();
[email protected]180ef242013-11-07 06:50:46159 virtual void didHandleGestureEvent(const blink::WebGestureEvent& event,
[email protected]c68c3e4e2013-01-24 00:36:56160 bool event_cancelled);
[email protected]4873c7d2009-07-16 06:36:28161
162 // Called when a plugin is moved. These events are queued up and sent with
163 // the next paint or scroll message to the host.
[email protected]29e2fb42013-07-19 01:13:47164 void SchedulePluginMove(const WebPluginGeometry& move);
initial.commit09911bf2008-07-26 23:55:29165
[email protected]268654772009-08-06 23:02:04166 // Called when a plugin window has been destroyed, to make sure the currently
167 // pending moves don't try to reference it.
168 void CleanupWindowInPluginMoves(gfx::PluginWindowHandle window);
169
[email protected]24ed0432013-04-24 07:50:31170 RenderWidgetCompositor* compositor() const;
171
[email protected]ebc0e1df2013-08-01 02:46:22172 virtual scoped_ptr<cc::OutputSurface> CreateOutputSurface(bool fallback);
[email protected]ba91a792013-02-06 09:48:28173
[email protected]79fa22e2013-08-23 15:18:12174 // Callback for use with synthetic gestures (e.g. BeginSmoothScroll).
175 typedef base::Callback<void()> SyntheticGestureCompletionCallback;
[email protected]0e241b4b2012-08-18 09:06:27176
[email protected]9017d7852013-11-21 17:47:35177 // Send a synthetic gesture to the browser to be queued to the synthetic
178 // gesture controller.
179 void QueueSyntheticGesture(
180 scoped_ptr<SyntheticGestureParams> gesture_params,
181 const SyntheticGestureCompletionCallback& callback);
[email protected]1e1dd182013-09-12 01:51:15182
initial.commit09911bf2008-07-26 23:55:29183 // Close the underlying WebWidget.
[email protected]60c42a8c72009-10-09 04:08:59184 virtual void Close();
initial.commit09911bf2008-07-26 23:55:29185
[email protected]6fceb912013-02-15 06:24:15186 // Notifies about a compositor frame commit operation having finished.
187 virtual void DidCommitCompositorFrame();
188
[email protected]66fca5bc2013-05-23 06:58:29189 // Handle common setup/teardown for handling IME events.
190 void StartHandlingImeEvent();
191 void FinishHandlingImeEvent();
192
[email protected]4ee64622014-03-21 22:34:15193 // Returns whether we currently should handle an IME event.
194 bool ShouldHandleImeEvent();
195
[email protected]33004772013-11-12 09:49:23196 virtual void InstrumentWillBeginFrame(int frame_id) {}
[email protected]35134e12013-02-22 20:07:40197 virtual void InstrumentDidBeginFrame() {}
198 virtual void InstrumentDidCancelFrame() {}
199 virtual void InstrumentWillComposite() {}
200
[email protected]c8cbae72013-05-23 10:45:03201 bool UsingSynchronousRendererCompositor() const;
[email protected]34bb3ac2013-03-08 02:41:28202
[email protected]b2e4c70132013-10-03 02:07:51203 // ScreenMetricsEmulator class manages screen emulation inside a render
204 // widget. This includes resizing, placing view on the screen at desired
205 // position, changing device scale factor, and scaling down the whole
206 // widget if required to fit into the browser window.
207 class ScreenMetricsEmulator;
208
209 // Emulates screen and widget metrics. Supplied values override everything
210 // coming from host.
211 void EnableScreenMetricsEmulation(
[email protected]19193682014-04-03 15:01:43212 const blink::WebDeviceEmulationParams& params);
[email protected]b2e4c70132013-10-03 02:07:51213 void DisableScreenMetricsEmulation();
214 void SetPopupOriginAdjustmentsForEmulation(ScreenMetricsEmulator* emulator);
215
[email protected]7d08a9352013-10-15 08:24:56216 void ScheduleCompositeWithForcedRedraw();
217
[email protected]4d7e46a2013-11-08 05:33:40218 // Called by the compositor in single-threaded mode when a swap is posted,
219 // completes or is aborted.
220 void OnSwapBuffersPosted();
221 void OnSwapBuffersComplete();
222 void OnSwapBuffersAborted();
223
[email protected]7a4e2532013-12-02 21:30:02224 // Checks if the text input state and compose inline mode have been changed.
225 // If they are changed, the new value will be sent to the browser process.
226 void UpdateTextInputType();
227
228 // Checks if the selection bounds have been changed. If they are changed,
229 // the new value will be sent to the browser process.
230 void UpdateSelectionBounds();
231
[email protected]e5e438d62014-03-27 21:47:16232 virtual void GetSelectionBounds(gfx::Rect* start, gfx::Rect* end);
233
[email protected]a09d53ce2014-01-31 00:46:42234 void OnShowHostContextMenu(ContextMenuParams* params);
[email protected]7a4e2532013-12-02 21:30:02235
[email protected]4ee64622014-03-21 22:34:15236#if defined(OS_ANDROID) || defined(USE_AURA)
[email protected]90f24152014-04-09 12:41:36237 enum ShowIme {
238 SHOW_IME_IF_NEEDED,
239 NO_SHOW_IME,
240 };
241
242 enum ChangeSource {
243 FROM_NON_IME,
244 FROM_IME,
245 };
246
247 // |show_ime| should be SHOW_IME_IF_NEEDED iff the update may cause the ime to
248 // be displayed, e.g. after a tap on an input field on mobile.
249 // |change_source| should be FROM_NON_IME when the renderer has to wait for
250 // the browser to acknowledge the change before the renderer handles any more
251 // IME events. This is when the text change did not originate from the IME in
252 // the browser side, such as changes by JavaScript or autofill.
253 void UpdateTextInputState(ShowIme show_ime, ChangeSource change_source);
[email protected]4ee64622014-03-21 22:34:15254#endif
255
[email protected]f9db7d2d2014-04-11 16:07:11256#if defined(OS_MACOSX) || defined(USE_AURA)
[email protected]7a4e2532013-12-02 21:30:02257 // Checks if the composition range or composition character bounds have been
258 // changed. If they are changed, the new value will be sent to the browser
259 // process.
260 void UpdateCompositionInfo(bool should_update_range);
261#endif
262
initial.commit09911bf2008-07-26 23:55:29263 protected:
[email protected]8085dbc82008-09-26 22:53:44264 // Friend RefCounted so that the dtor can be non-public. Using this class
265 // without ref-counting is an error.
266 friend class base::RefCounted<RenderWidget>;
[email protected]7339cd22010-10-27 00:11:20267 // For unit tests.
[email protected]e9ff79c2012-10-19 21:31:26268 friend class RenderWidgetTest;
[email protected]8085dbc82008-09-26 22:53:44269
[email protected]61e2b3cc2012-03-02 16:13:34270 enum ResizeAck {
271 SEND_RESIZE_ACK,
272 NO_RESIZE_ACK,
273 };
274
[email protected]180ef242013-11-07 06:50:46275 RenderWidget(blink::WebPopupType popup_type,
276 const blink::WebScreenInfo& screen_info,
[email protected]1ac10dca2013-08-20 20:47:04277 bool swapped_out,
278 bool hidden);
[email protected]ce2b28e2012-08-09 15:53:57279
[email protected]8085dbc82008-09-26 22:53:44280 virtual ~RenderWidget();
initial.commit09911bf2008-07-26 23:55:29281
282 // Initializes this view with the given opener. CompleteInit must be called
283 // later.
[email protected]a635f942012-12-07 10:34:29284 bool Init(int32 opener_id);
initial.commit09911bf2008-07-26 23:55:29285
[email protected]484955942010-08-19 16:13:18286 // Called by Init and subclasses to perform initialization.
[email protected]a635f942012-12-07 10:34:29287 bool DoInit(int32 opener_id,
[email protected]180ef242013-11-07 06:50:46288 blink::WebWidget* web_widget,
[email protected]484955942010-08-19 16:13:18289 IPC::SyncMessage* create_widget_message);
290
initial.commit09911bf2008-07-26 23:55:29291 // Finishes creation of a pending view started with Init.
[email protected]fc4404d2012-11-07 19:53:30292 void CompleteInit();
initial.commit09911bf2008-07-26 23:55:29293
[email protected]992db4c2011-05-12 15:37:15294 // Sets whether this RenderWidget has been swapped out to be displayed by
295 // a RenderWidget in a different process. If so, no new IPC messages will be
296 // sent (only ACKs) and the process is free to exit when there are no other
297 // active RenderWidgets.
298 void SetSwappedOut(bool is_swapped_out);
299
[email protected]661eb9d2009-02-03 02:11:48300 // Paints the given rectangular region of the WebWidget into canvas (a
301 // shared memory segment returned by AllocPaintBuf on Windows). The caller
302 // must ensure that the given rect fits within the bounds of the WebWidget.
[email protected]4fb66842009-12-04 21:41:00303 void PaintRect(const gfx::Rect& rect, const gfx::Point& canvas_origin,
[email protected]9d611ca2012-11-14 13:46:56304 SkCanvas* canvas);
[email protected]4fb66842009-12-04 21:41:00305
306 // Paints a border at the given rect for debugging purposes.
[email protected]9d611ca2012-11-14 13:46:56307 void PaintDebugBorder(const gfx::Rect& rect, SkCanvas* canvas);
initial.commit09911bf2008-07-26 23:55:29308
[email protected]bd37ae252011-06-03 01:28:18309 bool IsRenderingVSynced();
[email protected]52ccd0ea2011-02-16 01:09:05310 void AnimationCallback();
311 void AnimateIfNeeded();
[email protected]65225772011-05-12 21:10:24312 void InvalidationCallback();
[email protected]fd847792013-10-24 17:12:35313 void FlushPendingInputEventAck();
[email protected]65225772011-05-12 21:10:24314 void DoDeferredUpdateAndSendInputAck();
[email protected]552e6002009-11-19 05:24:57315 void DoDeferredUpdate();
[email protected]2533ce12009-05-09 00:02:24316 void DoDeferredClose();
[email protected]180ef242013-11-07 06:50:46317 void DoDeferredSetWindowRect(const blink::WebRect& pos);
[email protected]f0c2a242013-03-15 19:34:52318 virtual void Composite(base::TimeTicks frame_begin_time);
initial.commit09911bf2008-07-26 23:55:29319
[email protected]699ab0d2009-04-23 23:19:14320 // Set the background of the render widget to a bitmap. The bitmap will be
321 // tiled in both directions if it isn't big enough to fill the area. This is
322 // mainly intended to be used in conjuction with WebView::SetIsTransparent().
323 virtual void SetBackground(const SkBitmap& bitmap);
324
[email protected]61e2b3cc2012-03-02 16:13:34325 // Resizes the render widget.
326 void Resize(const gfx::Size& new_size,
[email protected]60d47ac2013-03-01 23:42:44327 const gfx::Size& physical_backing_size,
[email protected]d9083762013-03-24 01:36:40328 float overdraw_bottom_height,
[email protected]61e2b3cc2012-03-02 16:13:34329 const gfx::Rect& resizer_rect,
330 bool is_fullscreen,
331 ResizeAck resize_ack);
[email protected]92650162013-10-30 03:31:02332 // Used to force the size of a window when running layout tests.
333 void ResizeSynchronously(const gfx::Rect& new_position);
[email protected]b2e4c70132013-10-03 02:07:51334 virtual void SetScreenMetricsEmulationParameters(
[email protected]7f99fc22013-11-08 14:05:58335 float device_scale_factor,
336 const gfx::Point& root_layer_offset,
337 float root_layer_scale);
[email protected]53907862014-03-25 15:42:40338#if defined(OS_MACOSX) || defined(OS_ANDROID)
[email protected]b2e4c70132013-10-03 02:07:51339 void SetExternalPopupOriginAdjustmentsForEmulation(
340 ExternalPopupMenu* popup, ScreenMetricsEmulator* emulator);
[email protected]53907862014-03-25 15:42:40341#endif
[email protected]61e2b3cc2012-03-02 16:13:34342
initial.commit09911bf2008-07-26 23:55:29343 // RenderWidget IPC message handlers
[email protected]180ef242013-11-07 06:50:46344 void OnHandleInputEvent(const blink::WebInputEvent* event,
[email protected]205294b2014-03-18 20:48:35345 const ui::LatencyInfo& latency_info,
[email protected]c084330e02013-04-27 01:08:15346 bool keyboard_shortcut);
[email protected]34202de2013-05-06 23:36:22347 void OnCursorVisibilityChange(bool is_visible);
[email protected]c084330e02013-04-27 01:08:15348 void OnMouseCaptureLost();
349 virtual void OnSetFocus(bool enable);
initial.commit09911bf2008-07-26 23:55:29350 void OnClose();
[email protected]fc4404d2012-11-07 19:53:30351 void OnCreatingNewAck();
[email protected]0fdd5012013-05-29 08:05:56352 virtual void OnResize(const ViewMsg_Resize_Params& params);
[email protected]b5913d72012-02-07 22:26:54353 void OnChangeResizeRect(const gfx::Rect& resizer_rect);
[email protected]941e4552010-02-01 21:23:43354 virtual void OnWasHidden();
[email protected]9e2e4632012-07-27 16:38:41355 virtual void OnWasShown(bool needs_repainting);
[email protected]992db4c2011-05-12 15:37:15356 virtual void OnWasSwappedOut();
[email protected]53d3f302009-12-21 04:42:05357 void OnUpdateRectAck();
[email protected]8400e032010-02-26 18:50:11358 void OnCreateVideoAck(int32 video_id);
359 void OnUpdateVideoAck(int32 video_id);
[email protected]2533ce12009-05-09 00:02:24360 void OnRequestMoveAck();
[email protected]fa7b1dc2010-06-23 17:53:04361 void OnSetInputMethodActive(bool is_active);
[email protected]37a241c2013-12-03 03:16:17362 void OnCandidateWindowShown();
363 void OnCandidateWindowUpdated();
364 void OnCandidateWindowHidden();
[email protected]56ea1a62011-05-30 07:05:57365 virtual void OnImeSetComposition(
[email protected]fcf75d42013-12-03 20:11:26366 const base::string16& text,
[email protected]180ef242013-11-07 06:50:46367 const std::vector<blink::WebCompositionUnderline>& underlines,
[email protected]fa7b1dc2010-06-23 17:53:04368 int selection_start,
369 int selection_end);
[email protected]fcf75d42013-12-03 20:11:26370 virtual void OnImeConfirmComposition(const base::string16& text,
[email protected]db4fc1e2013-09-06 20:01:51371 const gfx::Range& replacement_range,
[email protected]0e45bd02013-07-12 20:20:02372 bool keep_selection);
[email protected]0bc1f572013-04-17 01:46:31373 void OnRepaint(gfx::Size size_to_paint);
[email protected]79fa22e2013-08-23 15:18:12374 void OnSyntheticGestureCompleted();
[email protected]180ef242013-11-07 06:50:46375 void OnSetTextDirection(blink::WebTextDirection direction);
[email protected]872ae5b2011-05-26 20:20:50376 void OnGetFPS();
[email protected]80ad8622012-11-07 16:33:03377 void OnUpdateScreenRects(const gfx::Rect& view_screen_rect,
378 const gfx::Rect& window_screen_rect);
[email protected]105dffb42013-02-20 03:46:21379#if defined(OS_ANDROID)
[email protected]2384b6c2013-02-28 23:58:51380 void OnShowImeIfNeeded();
[email protected]0d1ebed12013-08-05 22:01:13381
382 // Whenever an IME event that needs an acknowledgement is sent to the browser,
383 // the number of outstanding IME events that needs acknowledgement should be
384 // incremented. All IME events will be dropped until we receive an ack from
385 // the browser.
386 void IncrementOutstandingImeEventAcks();
387
388 // Called by the browser process for every required IME acknowledgement.
389 void OnImeEventAck();
[email protected]105dffb42013-02-20 03:46:21390#endif
[email protected]0d1ebed12013-08-05 22:01:13391
[email protected]51a49502013-03-23 01:50:19392 void OnSnapshot(const gfx::Rect& src_subrect);
initial.commit09911bf2008-07-26 23:55:29393
[email protected]847a2582013-03-09 02:29:51394 // Notify the compositor about a change in viewport size. This should be
395 // used only with auto resize mode WebWidgets, as normal WebWidgets should
396 // go through OnResize.
[email protected]97e1bf72013-03-06 14:06:05397 void AutoResizeCompositor();
398
[email protected]468ac582012-11-20 00:53:19399 virtual void SetDeviceScaleFactor(float device_scale_factor);
400
[email protected]29ed96a2012-02-04 18:12:16401 // Override points to notify derived classes that a paint has happened.
[email protected]0704ac32013-10-03 15:24:22402 // DidInitiatePaint happens when that has completed, and subsequent rendering
403 // won't affect the painted content. DidFlushPaint happens once we've received
404 // the ACK that the screen has been updated. For a given paint operation,
405 // these overrides will always be called in the order DidInitiatePaint,
406 // DidFlushPaint.
[email protected]00c39612010-03-06 02:53:28407 virtual void DidInitiatePaint() {}
408 virtual void DidFlushPaint() {}
[email protected]a2f6bc112009-06-27 16:27:25409
[email protected]65225772011-05-12 21:10:24410 // Override and return true when the widget is rendered with a graphics
[email protected]37a6f302011-07-11 23:43:08411 // context that supports asynchronous swapbuffers. When returning true, the
412 // subclass must call OnSwapBuffersPosted() when swap is posted,
413 // OnSwapBuffersComplete() when swaps complete, and OnSwapBuffersAborted if
414 // the context is lost.
[email protected]65225772011-05-12 21:10:24415 virtual bool SupportsAsynchronousSwapBuffers();
[email protected]ed7defa2013-03-12 21:29:59416 virtual GURL GetURLForGraphicsContext3D();
[email protected]65225772011-05-12 21:10:24417
[email protected]479b0172012-10-29 19:27:09418 virtual bool ForceCompositingModeEnabled();
419
[email protected]d54169e92011-01-21 09:19:52420 // Gets the scroll offset of this widget, if this widget has a notion of
421 // scroll offset.
[email protected]ceb36f7d2012-10-31 18:33:24422 virtual gfx::Vector2d GetScrollOffset();
[email protected]d54169e92011-01-21 09:19:52423
[email protected]bee16aab2009-08-26 15:55:03424 // Sets the "hidden" state of this widget. All accesses to is_hidden_ should
425 // use this method so that we can properly inform the RenderThread of our
426 // state.
427 void SetHidden(bool hidden);
428
[email protected]2b624c562011-10-27 22:58:26429 void WillToggleFullscreen();
430 void DidToggleFullscreen();
431
[email protected]674741932009-02-04 23:44:46432 bool next_paint_is_resize_ack() const;
433 bool next_paint_is_restore_ack() const;
434 void set_next_paint_is_resize_ack();
435 void set_next_paint_is_restore_ack();
436 void set_next_paint_is_repaint_ack();
[email protected]ec7dc112008-08-06 05:30:12437
[email protected]56ea1a62011-05-30 07:05:57438 // Override point to obtain that the current input method state and caret
439 // position.
[email protected]ad26ef42011-06-17 07:59:45440 virtual ui::TextInputType GetTextInputType();
[email protected]5b739cb2012-08-21 20:35:21441 virtual ui::TextInputType WebKitToUiTextInputType(
[email protected]180ef242013-11-07 06:50:46442 blink::WebTextInputType type);
[email protected]ad26ef42011-06-17 07:59:45443
[email protected]f9db7d2d2014-04-11 16:07:11444#if defined(OS_MACOSX) || defined(USE_AURA)
[email protected]58b48a0d2012-06-13 07:01:35445 // Override point to obtain that the current composition character bounds.
446 // In the case of surrogate pairs, the character is treated as two characters:
447 // the bounds for first character is actual one, and the bounds for second
448 // character is zero width rectangle.
449 virtual void GetCompositionCharacterBounds(
450 std::vector<gfx::Rect>* character_bounds);
451
[email protected]88dbe32f2013-06-20 23:31:36452 // Returns the range of the text that is being composed or the selection if
453 // the composition does not exist.
[email protected]db4fc1e2013-09-06 20:01:51454 virtual void GetCompositionRange(gfx::Range* range);
[email protected]88dbe32f2013-06-20 23:31:36455
[email protected]58b48a0d2012-06-13 07:01:35456 // Returns true if the composition range or composition character bounds
457 // should be sent to the browser process.
458 bool ShouldUpdateCompositionInfo(
[email protected]db4fc1e2013-09-06 20:01:51459 const gfx::Range& range,
[email protected]58b48a0d2012-06-13 07:01:35460 const std::vector<gfx::Rect>& bounds);
[email protected]501ea13d2013-07-09 17:03:29461#endif
[email protected]58b48a0d2012-06-13 07:01:35462
[email protected]ad26ef42011-06-17 07:59:45463 // Override point to obtain that the current input method state about
464 // composition text.
465 virtual bool CanComposeInline();
[email protected]56ea1a62011-05-30 07:05:57466
initial.commit09911bf2008-07-26 23:55:29467 // Tells the renderer it does not have focus. Used to prevent us from getting
468 // the focus on our own when the browser did not focus us.
469 void ClearFocus();
470
[email protected]2533ce12009-05-09 00:02:24471 // Set the pending window rect.
472 // Because the real render_widget is hosted in another process, there is
473 // a time period where we may have set a new window rect which has not yet
474 // been processed by the browser. So we maintain a pending window rect
475 // size. If JS code sets the WindowRect, and then immediately calls
476 // GetWindowRect() we'll use this pending window rect as the size.
[email protected]180ef242013-11-07 06:50:46477 void SetPendingWindowRect(const blink::WebRect& r);
[email protected]2533ce12009-05-09 00:02:24478
[email protected]446705872009-09-10 07:22:48479 // Called by OnHandleInputEvent() to notify subclasses that a key event was
480 // just handled.
481 virtual void DidHandleKeyEvent() {}
482
[email protected]72aee842014-02-20 19:41:41483 // Called by OnHandleInputEvent() to notify subclasses that a user gesture
484 // event will be processed.
485 virtual void WillProcessUserGesture() {}
486
[email protected]67bfb83f2011-09-22 03:36:37487 // Called by OnHandleInputEvent() to notify subclasses that a mouse event is
488 // about to be handled.
489 // Returns true if no further handling is needed. In that case, the event
490 // won't be sent to WebKit or trigger DidHandleMouseEvent().
[email protected]180ef242013-11-07 06:50:46491 virtual bool WillHandleMouseEvent(const blink::WebMouseEvent& event);
[email protected]67bfb83f2011-09-22 03:36:37492
[email protected]41d86852012-11-07 12:23:24493 // Called by OnHandleInputEvent() to notify subclasses that a gesture event is
494 // about to be handled.
495 // Returns true if no further handling is needed. In that case, the event
496 // won't be sent to WebKit.
[email protected]180ef242013-11-07 06:50:46497 virtual bool WillHandleGestureEvent(const blink::WebGestureEvent& event);
[email protected]41d86852012-11-07 12:23:24498
[email protected]6a8ddba52010-09-05 04:38:06499 // Called by OnHandleInputEvent() to notify subclasses that a mouse event was
500 // just handled.
[email protected]180ef242013-11-07 06:50:46501 virtual void DidHandleMouseEvent(const blink::WebMouseEvent& event) {}
[email protected]6a8ddba52010-09-05 04:38:06502
[email protected]2d0f2e92011-10-03 09:02:24503 // Called by OnHandleInputEvent() to notify subclasses that a touch event was
504 // just handled.
[email protected]180ef242013-11-07 06:50:46505 virtual void DidHandleTouchEvent(const blink::WebTouchEvent& event) {}
[email protected]2d0f2e92011-10-03 09:02:24506
[email protected]3d5c243b2012-11-30 00:26:01507 // Check whether the WebWidget has any touch event handlers registered
508 // at the given point.
509 virtual bool HasTouchEventHandlersAt(const gfx::Point& point) const;
510
[email protected]ce6689f2013-03-29 12:52:55511 // Check whether the WebWidget has any touch event handlers registered.
512 virtual void hasTouchEventHandlers(bool has_handlers);
513
[email protected]5d0bbdfa92013-12-10 00:35:51514 // Tell the browser about the actions permitted for a new touch point.
515 virtual void setTouchAction(blink::WebTouchAction touch_action);
516
[email protected]90f24152014-04-09 12:41:36517 // Called when value of focused text field gets dirty, e.g. value is modified
518 // by script, not by user input.
519 virtual void didUpdateTextOfFocusedElementByNonUserInput();
520
[email protected]a80aea72014-03-14 21:10:15521#if defined(OS_ANDROID)
522 // Checks if the selection root bounds have changed. If they have changed, the
523 // new value will be sent to the browser process.
524 virtual void UpdateSelectionRootBounds();
525#endif
526
[email protected]ed7defa2013-03-12 21:29:59527 // Creates a 3D context associated with this view.
[email protected]828a3932014-04-02 14:43:13528 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> CreateGraphicsContext3D();
[email protected]ed7defa2013-03-12 21:29:59529
[email protected]51a49502013-03-23 01:50:19530 bool OnSnapshotHelper(const gfx::Rect& src_subrect, SkBitmap* bitmap);
531
initial.commit09911bf2008-07-26 23:55:29532 // Routing ID that allows us to communicate to the parent browser process
533 // RenderWidgetHost. When MSG_ROUTING_NONE, no messages may be sent.
534 int32 routing_id_;
535
[email protected]9f4f3322012-01-18 22:29:56536 int32 surface_id_;
537
[email protected]c5b3b5e2009-02-13 06:41:11538 // We are responsible for destroying this object via its Close method.
[email protected]4ee64622014-03-21 22:34:15539 // May be NULL when the window is closing.
[email protected]180ef242013-11-07 06:50:46540 blink::WebWidget* webwidget_;
initial.commit09911bf2008-07-26 23:55:29541
[email protected]8926c602013-01-23 05:32:06542 // This is lazily constructed and must not outlive webwidget_.
[email protected]ba91a792013-02-06 09:48:28543 scoped_ptr<RenderWidgetCompositor> compositor_;
[email protected]8926c602013-01-23 05:32:06544
initial.commit09911bf2008-07-26 23:55:29545 // Set to the ID of the view that initiated creating this view, if any. When
546 // the view was initiated by the browser (the common case), this will be
547 // MSG_ROUTING_NONE. This is used in determining ownership when opening
548 // child tabs. See RenderWidget::createWebViewWithRequest.
549 //
550 // This ID may refer to an invalid view if that view is closed before this
551 // view is.
552 int32 opener_id_;
553
554 // The position where this view should be initially shown.
555 gfx::Rect initial_pos_;
556
[email protected]fc4404d2012-11-07 19:53:30557 bool init_complete_;
initial.commit09911bf2008-07-26 23:55:29558
559 // We store the current cursor object so we can avoid spamming SetCursor
560 // messages.
561 WebCursor current_cursor_;
[email protected]88efb7ec2009-07-14 16:32:59562
initial.commit09911bf2008-07-26 23:55:29563 // The size of the RenderWidget.
564 gfx::Size size_;
565
[email protected]b4d08452010-10-05 17:34:35566 // The TransportDIB that is being used to transfer an image to the browser.
567 TransportDIB* current_paint_buf_;
initial.commit09911bf2008-07-26 23:55:29568
[email protected]552e6002009-11-19 05:24:57569 PaintAggregator paint_aggregator_;
initial.commit09911bf2008-07-26 23:55:29570
[email protected]60d47ac2013-03-01 23:42:44571 // The size of the view's backing surface in non-DPI-adjusted pixels.
572 gfx::Size physical_backing_size_;
573
[email protected]d9083762013-03-24 01:36:40574 // The height of the physical backing surface that is overdrawn opaquely in
575 // the browser, for example by an on-screen-keyboard (in DPI-adjusted pixels).
576 float overdraw_bottom_height_;
577
[email protected]f21c613a2009-02-12 14:46:17578 // The area that must be reserved for drawing the resize corner.
579 gfx::Rect resizer_rect_;
580
[email protected]53d3f302009-12-21 04:42:05581 // Flags for the next ViewHostMsg_UpdateRect message.
initial.commit09911bf2008-07-26 23:55:29582 int next_paint_flags_;
583
[email protected]872ae5b2011-05-26 20:20:50584 // Filtered time per frame based on UpdateRect messages.
585 float filtered_time_per_frame_;
586
[email protected]53d3f302009-12-21 04:42:05587 // True if we are expecting an UpdateRect_ACK message (i.e., that a
588 // UpdateRect message has been sent).
589 bool update_reply_pending_;
initial.commit09911bf2008-07-26 23:55:29590
[email protected]847a2582013-03-09 02:29:51591 // Whether the WebWidget is in auto resize mode, which is used for example
592 // by extension popups.
593 bool auto_resize_mode_;
594
[email protected]ea3ee0a2012-05-15 03:43:09595 // True if we need to send an UpdateRect message to notify the browser about
596 // an already-completed auto-resize.
597 bool need_update_rect_for_auto_resize_;
598
[email protected]65225772011-05-12 21:10:24599 // True if the underlying graphics context supports asynchronous swap.
600 // Cached on the RenderWidget because determining support is costly.
601 bool using_asynchronous_swapbuffers_;
602
603 // Number of OnSwapBuffersComplete we are expecting. Incremented each time
604 // WebWidget::composite has been been performed when the RenderWidget subclass
605 // SupportsAsynchronousSwapBuffers. Decremented in OnSwapBuffers. Will block
606 // rendering.
607 int num_swapbuffers_complete_pending_;
608
609 // When accelerated rendering is on, is the maximum number of swapbuffers that
610 // can be outstanding before we start throttling based on
611 // OnSwapBuffersComplete callback.
[email protected]82ca9b92011-09-12 23:33:07612 static const int kMaxSwapBuffersPending = 2;
[email protected]65225772011-05-12 21:10:24613
initial.commit09911bf2008-07-26 23:55:29614 // Set to true if we should ignore RenderWidget::Show calls.
615 bool did_show_;
616
617 // Indicates that we shouldn't bother generated paint events.
618 bool is_hidden_;
619
[email protected]ee41e7d22011-10-14 19:34:09620 // Indicates that we are in fullscreen mode.
621 bool is_fullscreen_;
622
initial.commit09911bf2008-07-26 23:55:29623 // Indicates that we should be repainted when restored. This flag is set to
624 // true if we receive an invalidation / scroll event from webkit while our
625 // is_hidden_ flag is set to true. This is used to force a repaint once we
626 // restore to account for the fact that our host would not know about the
627 // invalidation / scroll event(s) from webkit while we are hidden.
628 bool needs_repainting_on_restore_;
629
630 // Indicates whether we have been focused/unfocused by the browser.
631 bool has_focus_;
632
[email protected]5dd768212009-08-13 23:34:49633 // Are we currently handling an input event?
634 bool handling_input_event_;
635
[email protected]e8f775f2013-02-14 21:00:50636 // Are we currently handling an ime event?
637 bool handling_ime_event_;
638
[email protected]5d0bbdfa92013-12-10 00:35:51639 // Are we currently handling a touchstart event?
640 bool handling_touchstart_event_;
641
initial.commit09911bf2008-07-26 23:55:29642 // True if we have requested this widget be closed. No more messages will
643 // be sent, except for a Close.
644 bool closing_;
645
[email protected]992db4c2011-05-12 15:37:15646 // Whether this RenderWidget is currently swapped out, such that the view is
647 // being rendered by another process. If all RenderWidgets in a process are
648 // swapped out, the process can exit.
649 bool is_swapped_out_;
650
[email protected]fa7b1dc2010-06-23 17:53:04651 // Indicates if an input method is active in the browser process.
652 bool input_method_is_active_;
initial.commit09911bf2008-07-26 23:55:29653
[email protected]5b739cb2012-08-21 20:35:21654 // Stores information about the current text input.
[email protected]180ef242013-11-07 06:50:46655 blink::WebTextInputInfo text_input_info_;
[email protected]5b739cb2012-08-21 20:35:21656
[email protected]fa7b1dc2010-06-23 17:53:04657 // Stores the current text input type of |webwidget_|.
[email protected]ad26ef42011-06-17 07:59:45658 ui::TextInputType text_input_type_;
659
[email protected]b256eca2013-07-11 10:57:40660 // Stores the current text input mode of |webwidget_|.
661 ui::TextInputMode text_input_mode_;
662
[email protected]86ba5fcb2013-09-04 00:36:53663 // Stores the current type of composition text rendering of |webwidget_|.
664 bool can_compose_inline_;
665
[email protected]e99ef6f2011-10-16 01:13:00666 // Stores the current selection bounds.
[email protected]7c8873e2013-02-05 08:03:01667 gfx::Rect selection_focus_rect_;
668 gfx::Rect selection_anchor_rect_;
initial.commit09911bf2008-07-26 23:55:29669
[email protected]a80aea72014-03-14 21:10:15670 // Stores the current selection root bounds.
671#if defined(OS_ANDROID)
672 gfx::Rect selection_root_rect_;
673#endif
674
[email protected]58b48a0d2012-06-13 07:01:35675 // Stores the current composition character bounds.
676 std::vector<gfx::Rect> composition_character_bounds_;
677
678 // Stores the current composition range.
[email protected]db4fc1e2013-09-06 20:01:51679 gfx::Range composition_range_;
[email protected]58b48a0d2012-06-13 07:01:35680
[email protected]3e2b375b2010-04-07 17:03:12681 // The kind of popup this widget represents, NONE if not a popup.
[email protected]180ef242013-11-07 06:50:46682 blink::WebPopupType popup_type_;
[email protected]0ebf3872008-11-07 21:35:03683
initial.commit09911bf2008-07-26 23:55:29684 // Holds all the needed plugin window moves for a scroll.
[email protected]29e2fb42013-07-19 01:13:47685 typedef std::vector<WebPluginGeometry> WebPluginGeometryVector;
[email protected]268654772009-08-06 23:02:04686 WebPluginGeometryVector plugin_window_moves_;
initial.commit09911bf2008-07-26 23:55:29687
[email protected]699ab0d2009-04-23 23:19:14688 // A custom background for the widget.
689 SkBitmap background_;
690
[email protected]80ad8622012-11-07 16:33:03691 // While we are waiting for the browser to update window sizes, we track the
692 // pending size temporarily.
[email protected]2533ce12009-05-09 00:02:24693 int pending_window_rect_count_;
[email protected]180ef242013-11-07 06:50:46694 blink::WebRect pending_window_rect_;
[email protected]2533ce12009-05-09 00:02:24695
[email protected]80ad8622012-11-07 16:33:03696 // The screen rects of the view and the window that contains it.
697 gfx::Rect view_screen_rect_;
698 gfx::Rect window_screen_rect_;
699
[email protected]12fbad812009-09-01 18:21:24700 scoped_ptr<IPC::Message> pending_input_event_ack_;
701
[email protected]fd847792013-10-24 17:12:35702 // The time spent in input handlers this frame. Used to throttle input acks.
703 base::TimeDelta total_input_handling_time_this_frame_;
704
[email protected]b68a0e52011-12-08 15:11:12705 // Indicates if the next sequence of Char events should be suppressed or not.
706 bool suppress_next_char_events_;
707
[email protected]a79d8a632010-11-18 22:35:56708 // Set to true if painting to the window is handled by the accelerated
709 // compositor.
710 bool is_accelerated_compositing_active_;
[email protected]edbcde932010-05-07 17:10:46711
[email protected]d8a6c5d12013-09-23 04:37:10712 // Set to true if compositing has ever been active for this widget. Once a
713 // widget has used compositing, it will act as though force compositing mode
714 // is on for the remainder of the widget's lifetime.
715 bool was_accelerated_compositing_ever_active_;
716
[email protected]350ce8702012-03-09 04:23:38717 base::OneShotTimer<RenderWidget> animation_timer_;
[email protected]5f8b1022011-01-21 23:34:50718 base::Time animation_floor_time_;
719 bool animation_update_pending_;
[email protected]65225772011-05-12 21:10:24720 bool invalidation_task_posted_;
[email protected]5f8b1022011-01-21 23:34:50721
[email protected]bd37ae252011-06-03 01:28:18722 bool has_disable_gpu_vsync_switch_;
[email protected]0fb93f52011-05-18 23:13:56723 base::TimeTicks last_do_deferred_update_time_;
724
[email protected]c1e6cc062013-08-24 03:35:35725 // Stats for legacy software mode
726 scoped_ptr<cc::RenderingStatsInstrumentation> legacy_software_mode_stats_;
[email protected]fef5e3972012-08-07 03:59:47727
[email protected]aa4117f2011-12-09 22:19:21728 // UpdateRect parameters for the current compositing pass. This is used to
729 // pass state between DoDeferredUpdate and OnSwapBuffersPosted.
730 scoped_ptr<ViewHostMsg_UpdateRect_Params> pending_update_params_;
731
732 // Queue of UpdateRect messages corresponding to a SwapBuffers. We want to
733 // delay sending of UpdateRect until the corresponding SwapBuffers has been
734 // executed. Since we can have several in flight, we need to keep them in a
735 // queue. Note: some SwapBuffers may not correspond to an update, in which
736 // case NULL is added to the queue.
737 std::deque<ViewHostMsg_UpdateRect*> updates_pending_swap_;
738
[email protected]842f10652012-06-06 01:54:04739 // Properties of the screen hosting this RenderWidget instance.
[email protected]180ef242013-11-07 06:50:46740 blink::WebScreenInfo screen_info_;
[email protected]842f10652012-06-06 01:54:04741
[email protected]f1cccb32012-06-06 18:29:59742 // The device scale factor. This value is computed from the DPI entries in
743 // |screen_info_| on some platforms, and defaults to 1 on other platforms.
[email protected]faec7b12012-06-19 14:42:13744 float device_scale_factor_;
[email protected]f1cccb32012-06-06 18:29:59745
[email protected]9017d7852013-11-21 17:47:35746 // State associated with synthetic gestures. Synthetic gestures are processed
747 // in-order, so a queue is sufficient to identify the correct state for a
748 // completed gesture.
749 std::queue<SyntheticGestureCompletionCallback>
750 pending_synthetic_gesture_callbacks_;
[email protected]0e241b4b2012-08-18 09:06:27751
[email protected]cb6430932012-10-31 00:53:36752 // Specified whether the compositor will run in its own thread.
753 bool is_threaded_compositing_enabled_;
754
[email protected]256737c2013-06-08 04:39:10755 // The latency information for any current non-accelerated-compositing
756 // frame.
[email protected]98a04472013-12-23 20:42:50757 std::vector<ui::LatencyInfo> latency_info_;
[email protected]256737c2013-06-08 04:39:10758
[email protected]53b4cc12013-07-18 23:02:30759 uint32 next_output_surface_id_;
760
[email protected]0d1ebed12013-08-05 22:01:13761#if defined(OS_ANDROID)
[email protected]90f24152014-04-09 12:41:36762 // Indicates value in the focused text field is in dirty state, i.e. modified
763 // by script etc., not by user input.
764 bool text_field_is_dirty_;
765
[email protected]0d1ebed12013-08-05 22:01:13766 // A counter for number of outstanding messages from the renderer to the
767 // browser regarding IME-type events that have not been acknowledged by the
768 // browser. If this value is not 0 IME events will be dropped.
769 int outstanding_ime_acks_;
770#endif
771
[email protected]b2e4c70132013-10-03 02:07:51772 scoped_ptr<ScreenMetricsEmulator> screen_metrics_emulator_;
773
774 // Popups may be displaced when screen metrics emulation is enabled.
775 // These values are used to properly adjust popup position.
776 gfx::Point popup_view_origin_for_emulation_;
777 gfx::Point popup_screen_origin_for_emulation_;
778 float popup_origin_scale_for_emulation_;
779
[email protected]5b45ad42013-10-25 00:42:04780 scoped_ptr<ResizingModeSelector> resizing_mode_selector_;
781
[email protected]bffc8302014-01-23 20:52:16782 // A list of swapped out RenderFrames that need to be notified
783 // of compositing-related events (e.g. DidCommitCompositorFrame).
784 ObserverList<RenderFrameImpl> swapped_out_frames_;
785
[email protected]a09d53ce2014-01-31 00:46:42786 ui::MenuSourceType context_menu_source_type_;
787 gfx::Point touch_editing_context_menu_location_;
788
[email protected]05d478752009-04-08 23:38:16789 DISALLOW_COPY_AND_ASSIGN(RenderWidget);
initial.commit09911bf2008-07-26 23:55:29790};
791
[email protected]e9ff79c2012-10-19 21:31:26792} // namespace content
793
[email protected]2cff0052011-03-18 16:51:44794#endif // CONTENT_RENDERER_RENDER_WIDGET_H_