blob: 85d41a2d59befb9ac090299b3b052b8805760415 [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
avi1023d012015-12-25 02:39:148#include <stddef.h>
9#include <stdint.h>
10
[email protected]aa4117f2011-12-09 22:19:2111#include <deque>
[email protected]0e241b4b2012-08-18 09:06:2712#include <map>
dchengcedca5612016-04-09 01:40:1513#include <memory>
xlai180af792016-08-26 22:07:4214#include <queue>
[email protected]010ea08a2009-10-11 20:21:3215
[email protected]586871b2014-07-22 17:05:1116#include "base/callback.h"
[email protected]f3112a52011-09-30 23:47:4917#include "base/compiler_specific.h"
avi1023d012015-12-25 02:39:1418#include "base/macros.h"
[email protected]3b63f8f42011-03-28 01:54:1519#include "base/memory/ref_counted.h"
[email protected]bffc8302014-01-23 20:52:1620#include "base/observer_list.h"
[email protected]abb522162013-06-28 01:54:1621#include "base/time/time.h"
avi1023d012015-12-25 02:39:1422#include "build/build_config.h"
[email protected]f3112a52011-09-30 23:47:4923#include "content/common/content_export.h"
[email protected]c2809346d2014-03-20 00:11:0324#include "content/common/cursors/webcursor.h"
alexmos56567492016-09-13 00:52:4625#include "content/common/edit_command.h"
[email protected]9017d7852013-11-21 17:47:3526#include "content/common/input/synthetic_gesture_params.h"
ccameron2f451532016-09-07 21:49:2727#include "content/public/common/screen_info.h"
mfomitchev2600fd7c2016-02-17 20:53:3928#include "content/renderer/devtools/render_widget_screen_metrics_emulator_delegate.h"
fsamuel78f86e42016-01-20 04:10:2329#include "content/renderer/gpu/render_widget_compositor_delegate.h"
fsamuel72464894f2015-12-15 06:59:3130#include "content/renderer/input/render_widget_input_handler.h"
31#include "content/renderer/input/render_widget_input_handler_delegate.h"
[email protected]586871b2014-07-22 17:05:1132#include "content/renderer/message_delivery_policy.h"
lfgbee1e0a2016-06-08 21:24:2133#include "content/renderer/mouse_lock_dispatcher.h"
34#include "content/renderer/render_widget_mouse_lock_dispatcher.h"
[email protected]4f86bdb2012-11-10 19:11:1935#include "ipc/ipc_listener.h"
36#include "ipc/ipc_sender.h"
mikhail.pozdnyakovc0e251b2015-04-15 06:51:1237#include "third_party/WebKit/public/platform/WebDisplayMode.h"
[email protected]5c30b5e02013-05-30 03:46:0838#include "third_party/WebKit/public/platform/WebRect.h"
[email protected]2255a9332013-06-17 05:12:3139#include "third_party/WebKit/public/web/WebCompositionUnderline.h"
[email protected]c27dd4f2014-05-22 18:05:1940#include "third_party/WebKit/public/web/WebInputEvent.h"
[email protected]2255a9332013-06-17 05:12:3141#include "third_party/WebKit/public/web/WebPopupType.h"
42#include "third_party/WebKit/public/web/WebTextDirection.h"
43#include "third_party/WebKit/public/web/WebTextInputInfo.h"
[email protected]5d0bbdfa92013-12-10 00:35:5144#include "third_party/WebKit/public/web/WebTouchAction.h"
[email protected]0e45bd02013-07-12 20:20:0245#include "third_party/WebKit/public/web/WebWidget.h"
[email protected]2255a9332013-06-17 05:12:3146#include "third_party/WebKit/public/web/WebWidgetClient.h"
[email protected]b256eca2013-07-11 10:57:4047#include "ui/base/ime/text_input_mode.h"
[email protected]ad26ef42011-06-17 07:59:4548#include "ui/base/ime/text_input_type.h"
[email protected]a09d53ce2014-01-31 00:46:4249#include "ui/base/ui_base_types.h"
tfarina93bfa912014-12-05 14:23:1550#include "ui/gfx/geometry/rect.h"
tfarina93bfa912014-12-05 14:23:1551#include "ui/gfx/geometry/vector2d_f.h"
[email protected]08397d52011-02-05 01:53:3852#include "ui/gfx/native_widget_types.h"
[email protected]db4fc1e2013-09-06 20:01:5153#include "ui/gfx/range/range.h"
[email protected]d353541f2012-05-03 22:45:4154#include "ui/surface/transport_dib.h"
initial.commit09911bf2008-07-26 23:55:2955
danakj870925d2016-05-03 20:07:3856class GURL;
57
[email protected]484955942010-08-19 16:13:1858namespace IPC {
59class SyncMessage;
[email protected]586871b2014-07-22 17:05:1160class SyncMessageFilter;
[email protected]484955942010-08-19 16:13:1861}
62
[email protected]180ef242013-11-07 06:50:4663namespace blink {
skyostil529caa292016-08-10 17:44:5164namespace scheduler {
65class RenderWidgetSchedulingState;
66}
[email protected]19193682014-04-03 15:01:4367struct WebDeviceEmulationParams;
lfgcaab5142016-02-26 19:06:5268class WebFrameWidget;
[email protected]41d86852012-11-07 12:23:2469class WebGestureEvent;
kenrba7199832015-01-22 23:44:5970class WebLocalFrame;
[email protected]6a8ddba52010-09-05 04:38:0671class WebMouseEvent;
donnda070f3c2015-01-16 19:54:1172class WebNode;
73struct WebPoint;
[email protected]526476902011-10-06 20:34:0674}
75
[email protected]586871b2014-07-22 17:05:1176namespace cc {
danakj1120f4c2016-09-15 02:05:3277class CompositorFrameSink;
fsamuele0f705b2016-10-01 14:07:1478class FrameSinkId;
[email protected]586871b2014-07-22 17:05:1179class SwapPromise;
80}
[email protected]ba91a792013-02-06 09:48:2881
[email protected]db4fc1e2013-09-06 20:01:5182namespace gfx {
[email protected]4de6d1692011-10-12 08:45:4483class Range;
84}
85
chongza8ba91fc2016-08-16 21:39:1786namespace ui {
87struct DidOverscrollParams;
88}
89
[email protected]e9ff79c2012-10-19 21:31:2690namespace content {
danakj6e3bf8012014-12-16 18:27:5391class CompositorDependencies;
[email protected]b2e4c70132013-10-03 02:07:5192class ExternalPopupMenu;
[email protected]586871b2014-07-22 17:05:1193class FrameSwapMessageQueue;
changwanf2a707b2015-10-30 08:22:1694class ImeEventGuard;
ekaramad2a46d632016-07-19 13:33:0995class PepperPluginInstanceImpl;
[email protected]bffc8302014-01-23 20:52:1696class RenderFrameImpl;
[email protected]e3244ed2014-06-20 20:04:2797class RenderFrameProxy;
[email protected]ba91a792013-02-06 09:48:2898class RenderWidgetCompositor;
avi40b5be7a2016-03-03 21:13:4499class RenderWidgetOwnerDelegate;
mfomitchev2600fd7c2016-02-17 20:53:39100class RenderWidgetScreenMetricsEmulator;
[email protected]5b45ad42013-10-25 00:42:04101class ResizingModeSelector;
ekaramad330ba4232016-09-23 17:57:47102class TextInputClientObserver;
[email protected]b2e4c70132013-10-03 02:07:51103struct ContextMenuParams;
fsamuel664e8b62016-01-20 19:54:01104struct ResizeParams;
[email protected]e9ff79c2012-10-19 21:31:26105
initial.commit09911bf2008-07-26 23:55:29106// RenderWidget provides a communication bridge between a WebWidget and
107// a RenderWidgetHost, the latter of which lives in a different process.
dchengd96a27a2015-07-24 20:17:32108//
109// RenderWidget is used to implement:
110// - RenderViewImpl (deprecated)
111// - Fullscreen mode (RenderWidgetFullScreen)
112// - Popup "menus" (like the color chooser and date picker)
113// - Widgets for frames (for out-of-process iframe support)
[email protected]f3112a52011-09-30 23:47:49114class CONTENT_EXPORT RenderWidget
[email protected]c47317e2012-06-20 22:35:31115 : public IPC::Listener,
116 public IPC::Sender,
[email protected]180ef242013-11-07 06:50:46117 NON_EXPORTED_BASE(virtual public blink::WebWidgetClient),
fsamuel78f86e42016-01-20 04:10:23118 public RenderWidgetCompositorDelegate,
fsamuel72464894f2015-12-15 06:59:31119 public RenderWidgetInputHandlerDelegate,
mfomitchev2600fd7c2016-02-17 20:53:39120 public RenderWidgetScreenMetricsEmulatorDelegate,
[email protected]f3112a52011-09-30 23:47:49121 public base::RefCounted<RenderWidget> {
initial.commit09911bf2008-07-26 23:55:29122 public:
123 // Creates a new RenderWidget. The opener_id is the routing ID of the
[email protected]380244092011-10-07 17:26:27124 // RenderView that this widget lives inside.
avi1023d012015-12-25 02:39:14125 static RenderWidget* Create(int32_t opener_id,
danakj6e3bf8012014-12-16 18:27:53126 CompositorDependencies* compositor_deps,
[email protected]180ef242013-11-07 06:50:46127 blink::WebPopupType popup_type,
ccameron2f451532016-09-07 21:49:27128 const ScreenInfo& screen_info);
initial.commit09911bf2008-07-26 23:55:29129
kenrba7199832015-01-22 23:44:59130 // Creates a new RenderWidget that will be attached to a RenderFrame.
131 static RenderWidget* CreateForFrame(int routing_id,
kenrba7199832015-01-22 23:44:59132 bool hidden,
ccameron2f451532016-09-07 21:49:27133 const ScreenInfo& screen_info,
kenrba7199832015-01-22 23:44:59134 CompositorDependencies* compositor_deps,
135 blink::WebLocalFrame* frame);
136
lfg1568d112016-08-30 16:06:29137 // Used by content_layouttest_support to hook into the creation of
138 // RenderWidgets.
139 using CreateRenderWidgetFunction =
140 RenderWidget* (*)(CompositorDependencies*,
141 blink::WebPopupType,
ccameron2f451532016-09-07 21:49:27142 const ScreenInfo&,
lfg1568d112016-08-30 16:06:29143 bool,
144 bool,
145 bool);
146 using RenderWidgetInitializedCallback = void (*)(RenderWidget*);
147 static void InstallCreateHook(
148 CreateRenderWidgetFunction create_render_widget,
149 RenderWidgetInitializedCallback render_widget_initialized_callback);
150
dchengda9b4bb2015-07-20 20:58:08151 // Closes a RenderWidget that was created by |CreateForFrame|.
dcheng3ce04b62015-10-26 23:30:55152 // TODO(avi): De-virtualize this once RenderViewImpl has-a RenderWidget.
153 // https://crbug.com/545684
154 virtual void CloseForFrame();
[email protected]484955942010-08-19 16:13:18155
avi1023d012015-12-25 02:39:14156 int32_t routing_id() const { return routing_id_; }
fsamuele8326c742016-01-12 00:49:39157 void SetRoutingID(int32_t routing_id);
158
danakj6e3bf8012014-12-16 18:27:53159 CompositorDependencies* compositor_deps() const { return compositor_deps_; }
lfg8ff33912016-09-13 20:59:21160 virtual blink::WebWidget* GetWebWidget() const;
mfomitchev2600fd7c2016-02-17 20:53:39161 const gfx::Size& size() const { return size_; }
mikhail.pozdnyakovf2c902a2015-04-14 08:09:12162 bool is_fullscreen_granted() const { return is_fullscreen_granted_; }
mikhail.pozdnyakovc0e251b2015-04-15 06:51:12163 blink::WebDisplayMode display_mode() const { return display_mode_; }
[email protected]204f1df2012-01-04 20:21:13164 bool is_hidden() const { return is_hidden_; }
[email protected]4ee64622014-03-21 22:34:15165 // Temporary for debugging purposes...
166 bool closing() const { return closing_; }
167 bool is_swapped_out() { return is_swapped_out_; }
[email protected]be1af0662014-07-29 19:55:51168 bool has_host_context_menu_location() {
169 return has_host_context_menu_location_;
170 }
171 gfx::Point host_context_menu_location() {
172 return host_context_menu_location_;
[email protected]4ee64622014-03-21 22:34:15173 }
[email protected]589621b2010-09-23 22:01:07174
avi40b5be7a2016-03-03 21:13:44175 void set_owner_delegate(RenderWidgetOwnerDelegate* owner_delegate) {
176 DCHECK(!owner_delegate_);
177 owner_delegate_ = owner_delegate;
178 }
179
180 RenderWidgetOwnerDelegate* owner_delegate() { return owner_delegate_; }
181
kenrba7199832015-01-22 23:44:59182 // ScreenInfo exposed so it can be passed to subframe RenderWidgets.
ccameron2f451532016-09-07 21:49:27183 ScreenInfo screen_info() const { return screen_info_; }
kenrba7199832015-01-22 23:44:59184
alexmos56567492016-09-13 00:52:46185 // Manage edit commands to be used for the next keyboard event.
186 const EditCommands& edit_commands() const { return edit_commands_; }
187 void SetEditCommandForNextKeyEvent(const std::string& name,
188 const std::string& value);
189 void ClearEditCommands();
190
[email protected]bffc8302014-01-23 20:52:16191 // Functions to track out-of-process frames for special notifications.
[email protected]e3244ed2014-06-20 20:04:27192 void RegisterRenderFrameProxy(RenderFrameProxy* proxy);
193 void UnregisterRenderFrameProxy(RenderFrameProxy* proxy);
[email protected]bffc8302014-01-23 20:52:16194
[email protected]de3c5d82014-05-28 22:12:59195 // Functions to track all RenderFrame objects associated with this
196 // RenderWidget.
197 void RegisterRenderFrame(RenderFrameImpl* frame);
198 void UnregisterRenderFrame(RenderFrameImpl* frame);
199
[email protected]c47317e2012-06-20 22:35:31200 // IPC::Listener
dcheng6d18e402014-10-21 12:32:52201 bool OnMessageReceived(const IPC::Message& msg) override;
initial.commit09911bf2008-07-26 23:55:29202
[email protected]c47317e2012-06-20 22:35:31203 // IPC::Sender
dcheng6d18e402014-10-21 12:32:52204 bool Send(IPC::Message* msg) override;
initial.commit09911bf2008-07-26 23:55:29205
dtapuska3d5624d32016-08-30 04:34:00206 // Requests a BeginMainFrame callback from the compositor.
207 void SetNeedsMainFrame();
208
fsamuel78f86e42016-01-20 04:10:23209 // RenderWidgetCompositorDelegate
210 void ApplyViewportDeltas(const gfx::Vector2dF& inner_delta,
211 const gfx::Vector2dF& outer_delta,
212 const gfx::Vector2dF& elastic_overscroll_delta,
213 float page_scale,
214 float top_controls_delta) override;
215 void BeginMainFrame(double frame_time_sec) override;
danakj1120f4c2016-09-15 02:05:32216 std::unique_ptr<cc::CompositorFrameSink> CreateCompositorFrameSink(
dchengcedca5612016-04-09 01:40:15217 bool fallback) override;
fsamuel78f86e42016-01-20 04:10:23218 void DidCommitAndDrawCompositorFrame() override;
219 void DidCommitCompositorFrame() override;
220 void DidCompletePageScaleAnimation() override;
221 void DidCompleteSwapBuffers() override;
fsamuel78f86e42016-01-20 04:10:23222 void ForwardCompositorProto(const std::vector<uint8_t>& proto) override;
223 bool IsClosing() const override;
224 void OnSwapBuffersAborted() override;
225 void OnSwapBuffersComplete() override;
226 void OnSwapBuffersPosted() override;
danakj53eccbc2016-03-02 22:51:07227 void RequestScheduleAnimation() override;
fsamuel78f86e42016-01-20 04:10:23228 void UpdateVisualState() override;
229 void WillBeginCompositorFrame() override;
jbroman6ccbc7d472016-07-27 04:45:41230 std::unique_ptr<cc::SwapPromise> RequestCopyOfOutputForLayoutTest(
231 std::unique_ptr<cc::CopyOutputRequest> request) override;
fsamuel78f86e42016-01-20 04:10:23232
fsamuel72464894f2015-12-15 06:59:31233 // RenderWidgetInputHandlerDelegate
234 void FocusChangeComplete() override;
235 bool HasTouchEventHandlersAt(const gfx::Point& point) const override;
dtapuska1827dd22016-03-11 15:24:59236 void ObserveGestureEventAndResult(const blink::WebGestureEvent& gesture_event,
237 const gfx::Vector2dF& unused_delta,
238 bool event_processed) override;
239
fsamuel72464894f2015-12-15 06:59:31240 void OnDidHandleKeyEvent() override;
chongza8ba91fc2016-08-16 21:39:17241 void OnDidOverscroll(const ui::DidOverscrollParams& params) override;
dchengcedca5612016-04-09 01:40:15242 void OnInputEventAck(std::unique_ptr<InputEventAck> input_event_ack) override;
dtapuskab08721e62016-06-29 03:35:07243 void NotifyInputEventHandled(blink::WebInputEvent::Type handled_type,
244 InputEventAckState ack_result) override;
fsamuele8326c742016-01-12 00:49:39245 void SetInputHandler(RenderWidgetInputHandler* input_handler) override;
fsamuel72464894f2015-12-15 06:59:31246 void UpdateTextInputState(ShowIme show_ime,
247 ChangeSource change_source) override;
248 bool WillHandleGestureEvent(const blink::WebGestureEvent& event) override;
249 bool WillHandleMouseEvent(const blink::WebMouseEvent& event) override;
250
mfomitchev2600fd7c2016-02-17 20:53:39251 // RenderWidgetScreenMetricsDelegate
252 void Redraw() override;
253 void Resize(const ResizeParams& resize_params) override;
254 void SetScreenMetricsEmulationParameters(
255 bool enabled,
256 const blink::WebDeviceEmulationParams& params) override;
257 void SetScreenRects(const gfx::Rect& view_screen_rect,
258 const gfx::Rect& window_screen_rect) override;
259
[email protected]180ef242013-11-07 06:50:46260 // blink::WebWidgetClient
avi5c77d212015-09-25 20:08:25261 void initializeLayerTreeView() override;
262 blink::WebLayerTreeView* layerTreeView() override;
dglazkovf0e1d6d2015-10-10 02:13:48263 void didMeaningfulLayout(blink::WebMeaningfulLayout layout_type) override;
avi5c77d212015-09-25 20:08:25264 void didChangeCursor(const blink::WebCursorInfo&) override;
265 void closeWidgetSoon() override;
266 void show(blink::WebNavigationPolicy) override;
267 blink::WebRect windowRect() override;
bokan6b08cd22016-10-05 00:55:21268 blink::WebRect viewRect() override;
avi5c77d212015-09-25 20:08:25269 void setToolTipText(const blink::WebString& text,
270 blink::WebTextDirection hint) override;
271 void setWindowRect(const blink::WebRect&) override;
272 blink::WebRect windowResizerRect() override;
avi5c77d212015-09-25 20:08:25273 blink::WebScreenInfo screenInfo() override;
avi5c77d212015-09-25 20:08:25274 void resetInputMethod() override;
275 void didHandleGestureEvent(const blink::WebGestureEvent& event,
276 bool event_cancelled) override;
bokane53a10f2016-04-13 23:48:31277 void didOverscroll(const blink::WebFloatSize& overscrollDelta,
278 const blink::WebFloatSize& accumulatedOverscroll,
avi5c77d212015-09-25 20:08:25279 const blink::WebFloatPoint& position,
280 const blink::WebFloatSize& velocity) override;
281 void showImeIfNeeded() override;
oshima581cf3f62015-12-16 20:08:01282 void convertViewportToWindow(blink::WebRect* rect) override;
oshimaa6985b62016-01-27 08:58:30283 void convertWindowToViewport(blink::WebFloatRect* rect) override;
lfgbee1e0a2016-06-08 21:24:21284 bool requestPointerLock() override;
285 void requestPointerUnlock() override;
286 bool isPointerLocked() override;
[email protected]4873c7d2009-07-16 06:36:28287
fsamuel72464894f2015-12-15 06:59:31288 // Override point to obtain that the current input method state and caret
289 // position.
290 virtual ui::TextInputType GetTextInputType();
291 virtual ui::TextInputType WebKitToUiTextInputType(
292 blink::WebTextInputType type);
293
donnda070f3c2015-01-16 19:54:11294#if defined(OS_ANDROID)
295 // Notifies that a tap was not consumed, so showing a UI for the unhandled
296 // tap may be needed.
donnd57e54f52015-02-26 19:03:37297 // Performs various checks on the given WebNode to apply heuristics to
298 // determine if triggering is appropriate.
avi5c77d212015-09-25 20:08:25299 void showUnhandledTapUIIfNeeded(const blink::WebPoint& tapped_position,
300 const blink::WebNode& tapped_node,
301 bool page_changed) override;
donnda070f3c2015-01-16 19:54:11302#endif
303
[email protected]7912e822014-04-16 02:37:03304 // Begins the compositor's scheduler to start producing frames.
305 void StartCompositor();
306
[email protected]aeeedad2014-08-22 18:16:22307 // Stop compositing.
ennef3c58142014-12-09 21:44:38308 void WillCloseLayerTreeView();
[email protected]aeeedad2014-08-22 18:16:22309
[email protected]24ed0432013-04-24 07:50:31310 RenderWidgetCompositor* compositor() const;
311
fsamuel72464894f2015-12-15 06:59:31312 const RenderWidgetInputHandler& input_handler() const {
fsamuele8326c742016-01-12 00:49:39313 return *input_handler_;
fsamuel72464894f2015-12-15 06:59:31314 }
315
316 void SetHandlingInputEventForTesting(bool handling_input_event);
317
318 // When paused in debugger, we send ack for mouse event early. This ensures
319 // that we continue receiving mouse moves and pass them to debugger. Returns
320 // whether we are paused in mouse move event and have sent the ack.
321 bool SendAckForMouseMoveFromDebugger();
322
323 // When resumed from pause in debugger while handling mouse move,
324 // we should not send an extra ack (see SendAckForMouseMoveFromDebugger).
325 void IgnoreAckForMouseMoveFromDebugger();
326
[email protected]79fa22e2013-08-23 15:18:12327 // Callback for use with synthetic gestures (e.g. BeginSmoothScroll).
328 typedef base::Callback<void()> SyntheticGestureCompletionCallback;
[email protected]0e241b4b2012-08-18 09:06:27329
[email protected]9017d7852013-11-21 17:47:35330 // Send a synthetic gesture to the browser to be queued to the synthetic
331 // gesture controller.
332 void QueueSyntheticGesture(
dchengcedca5612016-04-09 01:40:15333 std::unique_ptr<SyntheticGestureParams> gesture_params,
[email protected]9017d7852013-11-21 17:47:35334 const SyntheticGestureCompletionCallback& callback);
[email protected]1e1dd182013-09-12 01:51:15335
[email protected]586871b2014-07-22 17:05:11336 // Deliveres |message| together with compositor state change updates. The
337 // exact behavior depends on |policy|.
338 // This mechanism is not a drop-in replacement for IPC: messages sent this way
339 // will not be automatically available to BrowserMessageFilter, for example.
340 // FIFO ordering is preserved between messages enqueued with the same
341 // |policy|, the ordering between messages enqueued for different policies is
342 // undefined.
343 //
344 // |msg| message to send, ownership of |msg| is transferred.
345 // |policy| see the comment on MessageDeliveryPolicy.
346 void QueueMessage(IPC::Message* msg, MessageDeliveryPolicy policy);
347
changwan8c342742016-02-26 00:53:39348 // Check whether IME thread is being used or not.
349 bool IsUsingImeThread();
350
changwanf2a707b2015-10-30 08:22:16351 // Handle start and finish of IME event guard.
352 void OnImeEventGuardStart(ImeEventGuard* guard);
353 void OnImeEventGuardFinish(ImeEventGuard* guard);
[email protected]66fca5bc2013-05-23 06:58:29354
[email protected]4ee64622014-03-21 22:34:15355 // Returns whether we currently should handle an IME event.
356 bool ShouldHandleImeEvent();
357
mfomitchev2600fd7c2016-02-17 20:53:39358 void SetPopupOriginAdjustmentsForEmulation(
359 RenderWidgetScreenMetricsEmulator* emulator);
[email protected]b2e4c70132013-10-03 02:07:51360
[email protected]2d6836f42014-07-02 17:25:31361 gfx::Rect AdjustValidationMessageAnchor(const gfx::Rect& anchor);
[email protected]b2e4c70132013-10-03 02:07:51362
jdduke491a3f0c2015-06-15 23:30:26363
364 void ScheduleComposite();
[email protected]7d08a9352013-10-15 08:24:56365 void ScheduleCompositeWithForcedRedraw();
366
[email protected]7a4e2532013-12-02 21:30:02367 // Checks if the selection bounds have been changed. If they are changed,
368 // the new value will be sent to the browser process.
369 void UpdateSelectionBounds();
370
[email protected]e5e438d62014-03-27 21:47:16371 virtual void GetSelectionBounds(gfx::Rect* start, gfx::Rect* end);
372
[email protected]a09d53ce2014-01-31 00:46:42373 void OnShowHostContextMenu(ContextMenuParams* params);
[email protected]7a4e2532013-12-02 21:30:02374
[email protected]7a4e2532013-12-02 21:30:02375 // Checks if the composition range or composition character bounds have been
376 // changed. If they are changed, the new value will be sent to the browser
yukawa5f21c6a2014-10-27 17:09:30377 // process. This method does nothing when the browser process is not able to
378 // handle composition range and composition character bounds.
nonafa291792016-08-10 02:36:18379 // If immediate_request is true, render sends the latest composition info to
380 // the browser even if the composition info is not changed.
381 void UpdateCompositionInfo(bool immediate_request);
[email protected]7a4e2532013-12-02 21:30:02382
avi40b5be7a2016-03-03 21:13:44383 // Change the device ICC color profile while running a layout test.
384 void SetDeviceColorProfileForTesting(const std::vector<char>& color_profile);
avi40b5be7a2016-03-03 21:13:44385
lfgb00fcad2016-07-14 14:16:33386 // Called when the Widget has changed size as a result of an auto-resize.
387 void DidAutoResize(const gfx::Size& new_size);
388
lfge0c2792ec2016-05-11 18:52:08389 // Indicates whether this widget has focus.
390 bool has_focus() const { return has_focus_; }
391
lfgbee1e0a2016-06-08 21:24:21392 MouseLockDispatcher* mouse_lock_dispatcher() {
393 return mouse_lock_dispatcher_.get();
394 }
395
ekaramad330ba4232016-09-23 17:57:47396 // TODO(ekaramad): The reference to the focused pepper plugin will be removed
397 // from RenderWidget. The purpose of having the reference here was to make IME
398 // work for OOPIF (https://crbug.com/643727).
ekaramad2a46d632016-07-19 13:33:09399 void set_focused_pepper_plugin(PepperPluginInstanceImpl* plugin) {
400 focused_pepper_plugin_ = plugin;
401 }
402
lfg1f9011c2016-08-17 21:18:42403 // When emulated, this returns original device scale factor.
404 float GetOriginalDeviceScaleFactor() const;
405
initial.commit09911bf2008-07-26 23:55:29406 protected:
[email protected]8085dbc82008-09-26 22:53:44407 // Friend RefCounted so that the dtor can be non-public. Using this class
408 // without ref-counting is an error.
409 friend class base::RefCounted<RenderWidget>;
fsamuele8326c742016-01-12 00:49:39410
[email protected]7339cd22010-10-27 00:11:20411 // For unit tests.
[email protected]e9ff79c2012-10-19 21:31:26412 friend class RenderWidgetTest;
[email protected]8085dbc82008-09-26 22:53:44413
[email protected]61e2b3cc2012-03-02 16:13:34414 enum ResizeAck {
415 SEND_RESIZE_ACK,
416 NO_RESIZE_ACK,
417 };
418
dcheng35d31c112015-07-22 00:17:36419 RenderWidget(CompositorDependencies* compositor_deps,
420 blink::WebPopupType popup_type,
ccameron2f451532016-09-07 21:49:27421 const ScreenInfo& screen_info,
[email protected]1ac10dca2013-08-20 20:47:04422 bool swapped_out,
[email protected]7912e822014-04-16 02:37:03423 bool hidden,
424 bool never_visible);
[email protected]ce2b28e2012-08-09 15:53:57425
dcheng6d18e402014-10-21 12:32:52426 ~RenderWidget() override;
initial.commit09911bf2008-07-26 23:55:29427
lfgcaab5142016-02-26 19:06:52428 static blink::WebFrameWidget* CreateWebFrameWidget(
429 RenderWidget* render_widget,
430 blink::WebLocalFrame* frame);
dchengda9b4bb2015-07-20 20:58:08431
432 // Creates a WebWidget based on the popup type.
433 static blink::WebWidget* CreateWebWidget(RenderWidget* render_widget);
434
pimanc4af3072015-10-02 03:45:59435 // Initializes this view with the given opener.
avi1023d012015-12-25 02:39:14436 bool Init(int32_t opener_id);
initial.commit09911bf2008-07-26 23:55:29437
[email protected]484955942010-08-19 16:13:18438 // Called by Init and subclasses to perform initialization.
avi1023d012015-12-25 02:39:14439 bool DoInit(int32_t opener_id,
[email protected]180ef242013-11-07 06:50:46440 blink::WebWidget* web_widget,
[email protected]484955942010-08-19 16:13:18441 IPC::SyncMessage* create_widget_message);
442
[email protected]992db4c2011-05-12 15:37:15443 // Sets whether this RenderWidget has been swapped out to be displayed by
444 // a RenderWidget in a different process. If so, no new IPC messages will be
445 // sent (only ACKs) and the process is free to exit when there are no other
446 // active RenderWidgets.
447 void SetSwappedOut(bool is_swapped_out);
448
[email protected]949b6592014-08-20 13:17:52449 // Allows the process to exit once the unload handler has finished, if there
450 // are no other active RenderWidgets.
451 void WasSwappedOut();
452
[email protected]2533ce12009-05-09 00:02:24453 void DoDeferredClose();
dgozmancf9039cd2015-04-06 12:01:31454 void NotifyOnClose();
dchengda9b4bb2015-07-20 20:58:08455
bokanc63441c2016-04-27 15:49:12456 gfx::Size GetSizeForWebWidget() const;
457 virtual void ResizeWebWidget();
458
dchengda9b4bb2015-07-20 20:58:08459 // Close the underlying WebWidget.
460 virtual void Close();
initial.commit09911bf2008-07-26 23:55:29461
[email protected]92650162013-10-30 03:31:02462 // Used to force the size of a window when running layout tests.
bokanc007c3a2015-02-03 07:15:56463 void SetWindowRectSynchronously(const gfx::Rect& new_window_rect);
haibinluc643d33c2016-06-03 02:22:34464#if defined(USE_EXTERNAL_POPUP_MENU)
[email protected]b2e4c70132013-10-03 02:07:51465 void SetExternalPopupOriginAdjustmentsForEmulation(
mfomitchev2600fd7c2016-02-17 20:53:39466 ExternalPopupMenu* popup,
467 RenderWidgetScreenMetricsEmulator* emulator);
[email protected]53907862014-03-25 15:42:40468#endif
[email protected]61e2b3cc2012-03-02 16:13:34469
initial.commit09911bf2008-07-26 23:55:29470 // RenderWidget IPC message handlers
[email protected]180ef242013-11-07 06:50:46471 void OnHandleInputEvent(const blink::WebInputEvent* event,
dtapuska0bd451a2016-02-18 17:08:10472 const ui::LatencyInfo& latency_info,
473 InputEventDispatchType dispatch_type);
[email protected]34202de2013-05-06 23:36:22474 void OnCursorVisibilityChange(bool is_visible);
[email protected]c084330e02013-04-27 01:08:15475 void OnMouseCaptureLost();
alexmos56567492016-09-13 00:52:46476 void OnSetEditCommandsForNextKeyEvent(const EditCommands& edit_commands);
[email protected]c084330e02013-04-27 01:08:15477 virtual void OnSetFocus(bool enable);
naskoc288745f2015-05-01 22:54:21478 void OnClose();
[email protected]fc4404d2012-11-07 19:53:30479 void OnCreatingNewAck();
fsamuel664e8b62016-01-20 19:54:01480 virtual void OnResize(const ResizeParams& params);
dgozman9260b0a12015-03-16 13:45:20481 void OnEnableDeviceEmulation(const blink::WebDeviceEmulationParams& params);
482 void OnDisableDeviceEmulation();
[email protected]b5913d72012-02-07 22:26:54483 void OnChangeResizeRect(const gfx::Rect& resizer_rect);
[email protected]941e4552010-02-01 21:23:43484 virtual void OnWasHidden();
[email protected]3399dd822014-08-09 11:14:24485 virtual void OnWasShown(bool needs_repainting,
486 const ui::LatencyInfo& latency_info);
avi1023d012015-12-25 02:39:14487 void OnCreateVideoAck(int32_t video_id);
488 void OnUpdateVideoAck(int32_t video_id);
[email protected]2533ce12009-05-09 00:02:24489 void OnRequestMoveAck();
[email protected]56ea1a62011-05-30 07:05:57490 virtual void OnImeSetComposition(
[email protected]fcf75d42013-12-03 20:11:26491 const base::string16& text,
[email protected]180ef242013-11-07 06:50:46492 const std::vector<blink::WebCompositionUnderline>& underlines,
chongz7eb752802016-01-27 21:28:07493 const gfx::Range& replacement_range,
[email protected]fa7b1dc2010-06-23 17:53:04494 int selection_start,
495 int selection_end);
aelias87b8f7c2016-09-14 03:19:29496 virtual void OnImeCommitText(const base::string16& text,
497 const gfx::Range& replacement_range,
498 int relative_cursor_pos);
499 virtual void OnImeFinishComposingText(bool keep_selection);
500
oshimad5279032015-12-16 18:22:33501 // Called when the device scale factor is changed, or the layer tree is
502 // initialized.
503 virtual void OnDeviceScaleFactorChanged();
504
[email protected]0bc1f572013-04-17 01:46:31505 void OnRepaint(gfx::Size size_to_paint);
[email protected]79fa22e2013-08-23 15:18:12506 void OnSyntheticGestureCompleted();
[email protected]180ef242013-11-07 06:50:46507 void OnSetTextDirection(blink::WebTextDirection direction);
[email protected]872ae5b2011-05-26 20:20:50508 void OnGetFPS();
[email protected]80ad8622012-11-07 16:33:03509 void OnUpdateScreenRects(const gfx::Rect& view_screen_rect,
510 const gfx::Rect& window_screen_rect);
lfgdb5c4ed2016-03-04 23:09:07511 void OnUpdateWindowScreenRect(const gfx::Rect& window_screen_rect);
[email protected]2384b6c2013-02-28 23:58:51512 void OnShowImeIfNeeded();
fsamuele0f705b2016-10-01 14:07:14513 void OnSetFrameSinkId(const cc::FrameSinkId& frame_sink_id);
dtrainor5ef644e2015-11-19 00:12:47514 void OnHandleCompositorProto(const std::vector<uint8_t>& proto);
[email protected]0d1ebed12013-08-05 22:01:13515
[email protected]adb362312014-06-28 06:04:24516#if defined(OS_ANDROID)
changwan3a841162015-08-11 02:53:37517 // Called when we send IME event that expects an ACK.
518 void OnImeEventSentForAck(const blink::WebTextInputInfo& info);
[email protected]0d1ebed12013-08-05 22:01:13519
520 // Called by the browser process for every required IME acknowledgement.
521 void OnImeEventAck();
changwan8c342742016-02-26 00:53:39522
523 // Called by the browser process to update text input state.
524 void OnRequestTextInputStateUpdate();
changwan46620072016-09-21 03:05:41525
526 // Called by the browser process to begin (when |begin| is set) or end batch
527 // edit mode. Note that text input state will not be updated in this mode.
528 void OnImeBatchEdit(bool begin);
[email protected]105dffb42013-02-20 03:46:21529#endif
[email protected]0d1ebed12013-08-05 22:01:13530
nonafa291792016-08-10 02:36:18531 // Called by the browser process to update the cursor and composition
532 // information.
533 void OnRequestCompositionUpdate(bool immediate_request, bool monitor_request);
534
[email protected]847a2582013-03-09 02:29:51535 // Notify the compositor about a change in viewport size. This should be
536 // used only with auto resize mode WebWidgets, as normal WebWidgets should
537 // go through OnResize.
[email protected]97e1bf72013-03-06 14:06:05538 void AutoResizeCompositor();
539
wjmaclean8a795f32016-08-11 23:49:58540 virtual void OnSetDeviceScaleFactor(float device_scale_factor);
avi40b5be7a2016-03-03 21:13:44541 bool SetDeviceColorProfile(const std::vector<char>& color_profile);
[email protected]468ac582012-11-20 00:53:19542
[email protected]fcdc5642014-05-09 14:32:24543 virtual void OnOrientationChange();
544
[email protected]29ed96a2012-02-04 18:12:16545 // Override points to notify derived classes that a paint has happened.
[email protected]0704ac32013-10-03 15:24:22546 // DidInitiatePaint happens when that has completed, and subsequent rendering
547 // won't affect the painted content. DidFlushPaint happens once we've received
548 // the ACK that the screen has been updated. For a given paint operation,
549 // these overrides will always be called in the order DidInitiatePaint,
550 // DidFlushPaint.
lfge0c2792ec2016-05-11 18:52:08551 virtual void DidInitiatePaint() {}
avib9dbd972016-03-08 18:19:32552 virtual void DidFlushPaint();
[email protected]a2f6bc112009-06-27 16:27:25553
[email protected]ed7defa2013-03-12 21:29:59554 virtual GURL GetURLForGraphicsContext3D();
[email protected]65225772011-05-12 21:10:24555
[email protected]bee16aab2009-08-26 15:55:03556 // Sets the "hidden" state of this widget. All accesses to is_hidden_ should
557 // use this method so that we can properly inform the RenderThread of our
558 // state.
559 void SetHidden(bool hidden);
560
[email protected]2b624c562011-10-27 22:58:26561 void DidToggleFullscreen();
562
[email protected]674741932009-02-04 23:44:46563 bool next_paint_is_resize_ack() const;
[email protected]674741932009-02-04 23:44:46564 void set_next_paint_is_resize_ack();
[email protected]674741932009-02-04 23:44:46565 void set_next_paint_is_repaint_ack();
[email protected]ec7dc112008-08-06 05:30:12566
[email protected]586871b2014-07-22 17:05:11567 // QueueMessage implementation extracted into a static method for easy
568 // testing.
dchengcedca5612016-04-09 01:40:15569 static std::unique_ptr<cc::SwapPromise> QueueMessageImpl(
[email protected]586871b2014-07-22 17:05:11570 IPC::Message* msg,
571 MessageDeliveryPolicy policy,
572 FrameSwapMessageQueue* frame_swap_message_queue,
573 scoped_refptr<IPC::SyncMessageFilter> sync_message_filter,
[email protected]586871b2014-07-22 17:05:11574 int source_frame_number);
575
[email protected]58b48a0d2012-06-13 07:01:35576 // Override point to obtain that the current composition character bounds.
577 // In the case of surrogate pairs, the character is treated as two characters:
578 // the bounds for first character is actual one, and the bounds for second
579 // character is zero width rectangle.
580 virtual void GetCompositionCharacterBounds(
581 std::vector<gfx::Rect>* character_bounds);
582
[email protected]88dbe32f2013-06-20 23:31:36583 // Returns the range of the text that is being composed or the selection if
584 // the composition does not exist.
[email protected]db4fc1e2013-09-06 20:01:51585 virtual void GetCompositionRange(gfx::Range* range);
[email protected]88dbe32f2013-06-20 23:31:36586
[email protected]58b48a0d2012-06-13 07:01:35587 // Returns true if the composition range or composition character bounds
588 // should be sent to the browser process.
589 bool ShouldUpdateCompositionInfo(
[email protected]db4fc1e2013-09-06 20:01:51590 const gfx::Range& range,
[email protected]58b48a0d2012-06-13 07:01:35591 const std::vector<gfx::Rect>& bounds);
592
[email protected]ad26ef42011-06-17 07:59:45593 // Override point to obtain that the current input method state about
594 // composition text.
595 virtual bool CanComposeInline();
[email protected]56ea1a62011-05-30 07:05:57596
[email protected]2533ce12009-05-09 00:02:24597 // Set the pending window rect.
598 // Because the real render_widget is hosted in another process, there is
599 // a time period where we may have set a new window rect which has not yet
600 // been processed by the browser. So we maintain a pending window rect
601 // size. If JS code sets the WindowRect, and then immediately calls
602 // GetWindowRect() we'll use this pending window rect as the size.
[email protected]180ef242013-11-07 06:50:46603 void SetPendingWindowRect(const blink::WebRect& r);
[email protected]2533ce12009-05-09 00:02:24604
[email protected]ce6689f2013-03-29 12:52:55605 // Check whether the WebWidget has any touch event handlers registered.
avi5c77d212015-09-25 20:08:25606 void hasTouchEventHandlers(bool has_handlers) override;
[email protected]ce6689f2013-03-29 12:52:55607
[email protected]5d0bbdfa92013-12-10 00:35:51608 // Tell the browser about the actions permitted for a new touch point.
avi5c77d212015-09-25 20:08:25609 void setTouchAction(blink::WebTouchAction touch_action) override;
[email protected]5d0bbdfa92013-12-10 00:35:51610
[email protected]90f24152014-04-09 12:41:36611 // Called when value of focused text field gets dirty, e.g. value is modified
612 // by script, not by user input.
avi5c77d212015-09-25 20:08:25613 void didUpdateTextOfFocusedElementByNonUserInput() override;
[email protected]90f24152014-04-09 12:41:36614
lfg43e08e62016-02-03 18:51:37615 // Sends an ACK to the browser process during the next compositor frame.
616 void OnWaitNextFrameForTests(int routing_id);
617
initial.commit09911bf2008-07-26 23:55:29618 // Routing ID that allows us to communicate to the parent browser process
619 // RenderWidgetHost. When MSG_ROUTING_NONE, no messages may be sent.
avi1023d012015-12-25 02:39:14620 int32_t routing_id_;
initial.commit09911bf2008-07-26 23:55:29621
danakj6e3bf8012014-12-16 18:27:53622 // Dependencies for initializing a compositor, including flags for optional
623 // features.
dcheng35d31c112015-07-22 00:17:36624 CompositorDependencies* const compositor_deps_;
danakj6e3bf8012014-12-16 18:27:53625
lfg8ff33912016-09-13 20:59:21626 // Use GetWebWidget() instead of using webwidget_internal_ directly.
[email protected]c5b3b5e2009-02-13 06:41:11627 // We are responsible for destroying this object via its Close method.
[email protected]4ee64622014-03-21 22:34:15628 // May be NULL when the window is closing.
lfg8ff33912016-09-13 20:59:21629 blink::WebWidget* webwidget_internal_;
initial.commit09911bf2008-07-26 23:55:29630
avi40b5be7a2016-03-03 21:13:44631 // The delegate of the owner of this object.
632 RenderWidgetOwnerDelegate* owner_delegate_;
633
[email protected]8926c602013-01-23 05:32:06634 // This is lazily constructed and must not outlive webwidget_.
dchengcedca5612016-04-09 01:40:15635 std::unique_ptr<RenderWidgetCompositor> compositor_;
[email protected]8926c602013-01-23 05:32:06636
initial.commit09911bf2008-07-26 23:55:29637 // Set to the ID of the view that initiated creating this view, if any. When
638 // the view was initiated by the browser (the common case), this will be
639 // MSG_ROUTING_NONE. This is used in determining ownership when opening
640 // child tabs. See RenderWidget::createWebViewWithRequest.
641 //
642 // This ID may refer to an invalid view if that view is closed before this
643 // view is.
avi1023d012015-12-25 02:39:14644 int32_t opener_id_;
initial.commit09911bf2008-07-26 23:55:29645
bokanc007c3a2015-02-03 07:15:56646 // The rect where this view should be initially shown.
647 gfx::Rect initial_rect_;
initial.commit09911bf2008-07-26 23:55:29648
initial.commit09911bf2008-07-26 23:55:29649 // We store the current cursor object so we can avoid spamming SetCursor
650 // messages.
651 WebCursor current_cursor_;
[email protected]88efb7ec2009-07-14 16:32:59652
initial.commit09911bf2008-07-26 23:55:29653 // The size of the RenderWidget.
654 gfx::Size size_;
655
[email protected]60d47ac2013-03-01 23:42:44656 // The size of the view's backing surface in non-DPI-adjusted pixels.
657 gfx::Size physical_backing_size_;
658
[email protected]bb6378fe2014-04-28 21:19:44659 // The size of the visible viewport in DPI-adjusted pixels.
660 gfx::Size visible_viewport_size_;
661
[email protected]f21c613a2009-02-12 14:46:17662 // The area that must be reserved for drawing the resize corner.
663 gfx::Rect resizer_rect_;
664
[email protected]53d3f302009-12-21 04:42:05665 // Flags for the next ViewHostMsg_UpdateRect message.
initial.commit09911bf2008-07-26 23:55:29666 int next_paint_flags_;
667
[email protected]847a2582013-03-09 02:29:51668 // Whether the WebWidget is in auto resize mode, which is used for example
669 // by extension popups.
670 bool auto_resize_mode_;
671
[email protected]ea3ee0a2012-05-15 03:43:09672 // True if we need to send an UpdateRect message to notify the browser about
673 // an already-completed auto-resize.
674 bool need_update_rect_for_auto_resize_;
675
initial.commit09911bf2008-07-26 23:55:29676 // Set to true if we should ignore RenderWidget::Show calls.
677 bool did_show_;
678
679 // Indicates that we shouldn't bother generated paint events.
680 bool is_hidden_;
681
[email protected]7912e822014-04-16 02:37:03682 // Indicates that we are never visible, so never produce graphical output.
sievers71c62dd52015-10-07 01:44:39683 const bool compositor_never_visible_;
[email protected]7912e822014-04-16 02:37:03684
mikhail.pozdnyakovf2c902a2015-04-14 08:09:12685 // Indicates whether tab-initiated fullscreen was granted.
686 bool is_fullscreen_granted_;
[email protected]ee41e7d22011-10-14 19:34:09687
mikhail.pozdnyakovc0e251b2015-04-15 06:51:12688 // Indicates the display mode.
689 blink::WebDisplayMode display_mode_;
690
changwanf2a707b2015-10-30 08:22:16691 // It is possible that one ImeEventGuard is nested inside another
692 // ImeEventGuard. We keep track of the outermost one, and update it as needed.
693 ImeEventGuard* ime_event_guard_;
[email protected]e8f775f2013-02-14 21:00:50694
changwan46620072016-09-21 03:05:41695 // Whether IME is in batch edit mode, in which case we do not update text
696 // input state.
697 bool ime_in_batch_edit_;
698
initial.commit09911bf2008-07-26 23:55:29699 // True if we have requested this widget be closed. No more messages will
700 // be sent, except for a Close.
701 bool closing_;
702
[email protected]aeeedad2014-08-22 18:16:22703 // True if it is known that the host is in the process of being shut down.
704 bool host_closing_;
705
[email protected]992db4c2011-05-12 15:37:15706 // Whether this RenderWidget is currently swapped out, such that the view is
707 // being rendered by another process. If all RenderWidgets in a process are
708 // swapped out, the process can exit.
709 bool is_swapped_out_;
710
simonhong628f9812015-04-27 23:13:20711 // Whether this RenderWidget is for an out-of-process iframe or not.
712 bool for_oopif_;
713
[email protected]5b739cb2012-08-21 20:35:21714 // Stores information about the current text input.
[email protected]180ef242013-11-07 06:50:46715 blink::WebTextInputInfo text_input_info_;
[email protected]5b739cb2012-08-21 20:35:21716
[email protected]b256eca2013-07-11 10:57:40717 // Stores the current text input mode of |webwidget_|.
718 ui::TextInputMode text_input_mode_;
719
shuchen82ce8c52014-10-23 01:55:20720 // Stores the current text input flags of |webwidget_|.
721 int text_input_flags_;
722
[email protected]86ba5fcb2013-09-04 00:36:53723 // Stores the current type of composition text rendering of |webwidget_|.
724 bool can_compose_inline_;
725
[email protected]e99ef6f2011-10-16 01:13:00726 // Stores the current selection bounds.
[email protected]7c8873e2013-02-05 08:03:01727 gfx::Rect selection_focus_rect_;
728 gfx::Rect selection_anchor_rect_;
initial.commit09911bf2008-07-26 23:55:29729
[email protected]58b48a0d2012-06-13 07:01:35730 // Stores the current composition character bounds.
731 std::vector<gfx::Rect> composition_character_bounds_;
732
733 // Stores the current composition range.
[email protected]db4fc1e2013-09-06 20:01:51734 gfx::Range composition_range_;
[email protected]58b48a0d2012-06-13 07:01:35735
[email protected]3e2b375b2010-04-07 17:03:12736 // The kind of popup this widget represents, NONE if not a popup.
[email protected]180ef242013-11-07 06:50:46737 blink::WebPopupType popup_type_;
[email protected]0ebf3872008-11-07 21:35:03738
[email protected]80ad8622012-11-07 16:33:03739 // While we are waiting for the browser to update window sizes, we track the
740 // pending size temporarily.
[email protected]2533ce12009-05-09 00:02:24741 int pending_window_rect_count_;
lfg0140a452016-07-19 19:15:05742 gfx::Rect pending_window_rect_;
[email protected]2533ce12009-05-09 00:02:24743
[email protected]80ad8622012-11-07 16:33:03744 // The screen rects of the view and the window that contains it.
745 gfx::Rect view_screen_rect_;
746 gfx::Rect window_screen_rect_;
747
dchengcedca5612016-04-09 01:40:15748 std::unique_ptr<RenderWidgetInputHandler> input_handler_;
[email protected]12fbad812009-09-01 18:21:24749
[email protected]fd847792013-10-24 17:12:35750 // The time spent in input handlers this frame. Used to throttle input acks.
751 base::TimeDelta total_input_handling_time_this_frame_;
752
[email protected]842f10652012-06-06 01:54:04753 // Properties of the screen hosting this RenderWidget instance.
ccameron2f451532016-09-07 21:49:27754 ScreenInfo screen_info_;
[email protected]842f10652012-06-06 01:54:04755
[email protected]f1cccb32012-06-06 18:29:59756 // The device scale factor. This value is computed from the DPI entries in
757 // |screen_info_| on some platforms, and defaults to 1 on other platforms.
[email protected]faec7b12012-06-19 14:42:13758 float device_scale_factor_;
[email protected]f1cccb32012-06-06 18:29:59759
[email protected]28ed6b32014-06-08 02:16:27760 // The device color profile on supported platforms.
761 std::vector<char> device_color_profile_;
762
[email protected]9017d7852013-11-21 17:47:35763 // State associated with synthetic gestures. Synthetic gestures are processed
764 // in-order, so a queue is sufficient to identify the correct state for a
765 // completed gesture.
766 std::queue<SyntheticGestureCompletionCallback>
767 pending_synthetic_gesture_callbacks_;
[email protected]0e241b4b2012-08-18 09:06:27768
[email protected]0d1ebed12013-08-05 22:01:13769#if defined(OS_ANDROID)
[email protected]90f24152014-04-09 12:41:36770 // Indicates value in the focused text field is in dirty state, i.e. modified
771 // by script etc., not by user input.
772 bool text_field_is_dirty_;
773
changwan3a841162015-08-11 02:53:37774 // Stores the history of text input infos from the last ACK'ed one from the
775 // current one. The size is the number of pending ACKs plus one, since we
776 // intentionally keep the last ack'd value to know what the browser is
777 // currently aware of.
778 std::deque<blink::WebTextInputInfo> text_input_info_history_;
[email protected]0d1ebed12013-08-05 22:01:13779#endif
780
nonafa291792016-08-10 02:36:18781 // True if the IME requests updated composition info.
782 bool monitor_composition_info_;
783
dchengcedca5612016-04-09 01:40:15784 std::unique_ptr<RenderWidgetScreenMetricsEmulator> screen_metrics_emulator_;
[email protected]b2e4c70132013-10-03 02:07:51785
786 // Popups may be displaced when screen metrics emulation is enabled.
787 // These values are used to properly adjust popup position.
danakj2ef31b82015-10-21 18:18:02788 gfx::Point popup_view_origin_for_emulation_;
789 gfx::Point popup_screen_origin_for_emulation_;
[email protected]b2e4c70132013-10-03 02:07:51790 float popup_origin_scale_for_emulation_;
791
[email protected]586871b2014-07-22 17:05:11792 scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue_;
dchengcedca5612016-04-09 01:40:15793 std::unique_ptr<ResizingModeSelector> resizing_mode_selector_;
[email protected]5b45ad42013-10-25 00:42:04794
[email protected]e3244ed2014-06-20 20:04:27795 // Lists of RenderFrameProxy objects that need to be notified of
796 // compositing-related events (e.g. DidCommitCompositorFrame).
brettw236d3172015-06-03 16:31:43797 base::ObserverList<RenderFrameProxy> render_frame_proxies_;
[email protected]bffc8302014-01-23 20:52:16798
[email protected]de3c5d82014-05-28 22:12:59799 // A list of RenderFrames associated with this RenderWidget. Notifications
800 // are sent to each frame in the list for events such as changing
801 // visibility state for example.
brettw236d3172015-06-03 16:31:43802 base::ObserverList<RenderFrameImpl> render_frames_;
[email protected]de3c5d82014-05-28 22:12:59803
[email protected]be1af0662014-07-29 19:55:51804 bool has_host_context_menu_location_;
805 gfx::Point host_context_menu_location_;
[email protected]a09d53ce2014-01-31 00:46:42806
skyostil529caa292016-08-10 17:44:51807 std::unique_ptr<blink::scheduler::RenderWidgetSchedulingState>
alexclarke7fa93942015-10-21 15:37:11808 render_widget_scheduling_state_;
809
lfgbee1e0a2016-06-08 21:24:21810 // Mouse Lock dispatcher attached to this view.
811 std::unique_ptr<RenderWidgetMouseLockDispatcher> mouse_lock_dispatcher_;
812
813 // Wraps the |webwidget_| as a MouseLockDispatcher::LockTarget interface.
814 std::unique_ptr<MouseLockDispatcher::LockTarget> webwidget_mouse_lock_target_;
815
oshima50872a72016-03-04 13:26:18816 private:
lfge0c2792ec2016-05-11 18:52:08817 // Indicates whether this widget has focus.
818 bool has_focus_;
819
ekaramad330ba4232016-09-23 17:57:47820#if defined(OS_MACOSX)
821 // Responds to IPCs from TextInputClientMac regarding getting string at given
822 // position or range as well as finding character index at a given position.
823 std::unique_ptr<TextInputClientObserver> text_input_client_observer_;
824#endif
825
ekaramad2a46d632016-07-19 13:33:09826 // This reference is set by the RenderFrame and is used to query the IME-
827 // related state from the plugin to later send to the browser.
828 PepperPluginInstanceImpl* focused_pepper_plugin_;
829
alexmos56567492016-09-13 00:52:46830 // Stores edit commands associated to the next key event.
831 // Will be cleared as soon as the next key event is processed.
832 EditCommands edit_commands_;
833
[email protected]05d478752009-04-08 23:38:16834 DISALLOW_COPY_AND_ASSIGN(RenderWidget);
initial.commit09911bf2008-07-26 23:55:29835};
836
[email protected]e9ff79c2012-10-19 21:31:26837} // namespace content
838
[email protected]2cff0052011-03-18 16:51:44839#endif // CONTENT_RENDERER_RENDER_WIDGET_H_