blob: 83e08e2447ee01a6d98c5c22fa2b8e96e1cabbd1 [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 {
77class OutputSurface;
78class SwapPromise;
79}
[email protected]ba91a792013-02-06 09:48:2880
[email protected]db4fc1e2013-09-06 20:01:5181namespace gfx {
[email protected]4de6d1692011-10-12 08:45:4482class Range;
83}
84
chongza8ba91fc2016-08-16 21:39:1785namespace ui {
86struct DidOverscrollParams;
87}
88
[email protected]e9ff79c2012-10-19 21:31:2689namespace content {
danakj6e3bf8012014-12-16 18:27:5390class CompositorDependencies;
[email protected]b2e4c70132013-10-03 02:07:5191class ExternalPopupMenu;
[email protected]586871b2014-07-22 17:05:1192class FrameSwapMessageQueue;
changwanf2a707b2015-10-30 08:22:1693class ImeEventGuard;
ekaramad2a46d632016-07-19 13:33:0994class PepperPluginInstanceImpl;
[email protected]bffc8302014-01-23 20:52:1695class RenderFrameImpl;
[email protected]e3244ed2014-06-20 20:04:2796class RenderFrameProxy;
[email protected]ba91a792013-02-06 09:48:2897class RenderWidgetCompositor;
avi40b5be7a2016-03-03 21:13:4498class RenderWidgetOwnerDelegate;
mfomitchev2600fd7c2016-02-17 20:53:3999class RenderWidgetScreenMetricsEmulator;
[email protected]5b45ad42013-10-25 00:42:04100class ResizingModeSelector;
[email protected]b2e4c70132013-10-03 02:07:51101struct ContextMenuParams;
fsamuel664e8b62016-01-20 19:54:01102struct ResizeParams;
[email protected]e9ff79c2012-10-19 21:31:26103
initial.commit09911bf2008-07-26 23:55:29104// RenderWidget provides a communication bridge between a WebWidget and
105// a RenderWidgetHost, the latter of which lives in a different process.
dchengd96a27a2015-07-24 20:17:32106//
107// RenderWidget is used to implement:
108// - RenderViewImpl (deprecated)
109// - Fullscreen mode (RenderWidgetFullScreen)
110// - Popup "menus" (like the color chooser and date picker)
111// - Widgets for frames (for out-of-process iframe support)
[email protected]f3112a52011-09-30 23:47:49112class CONTENT_EXPORT RenderWidget
[email protected]c47317e2012-06-20 22:35:31113 : public IPC::Listener,
114 public IPC::Sender,
[email protected]180ef242013-11-07 06:50:46115 NON_EXPORTED_BASE(virtual public blink::WebWidgetClient),
fsamuel78f86e42016-01-20 04:10:23116 public RenderWidgetCompositorDelegate,
fsamuel72464894f2015-12-15 06:59:31117 public RenderWidgetInputHandlerDelegate,
mfomitchev2600fd7c2016-02-17 20:53:39118 public RenderWidgetScreenMetricsEmulatorDelegate,
[email protected]f3112a52011-09-30 23:47:49119 public base::RefCounted<RenderWidget> {
initial.commit09911bf2008-07-26 23:55:29120 public:
121 // Creates a new RenderWidget. The opener_id is the routing ID of the
[email protected]380244092011-10-07 17:26:27122 // RenderView that this widget lives inside.
avi1023d012015-12-25 02:39:14123 static RenderWidget* Create(int32_t opener_id,
danakj6e3bf8012014-12-16 18:27:53124 CompositorDependencies* compositor_deps,
[email protected]180ef242013-11-07 06:50:46125 blink::WebPopupType popup_type,
ccameron2f451532016-09-07 21:49:27126 const ScreenInfo& screen_info);
initial.commit09911bf2008-07-26 23:55:29127
kenrba7199832015-01-22 23:44:59128 // Creates a new RenderWidget that will be attached to a RenderFrame.
129 static RenderWidget* CreateForFrame(int routing_id,
kenrba7199832015-01-22 23:44:59130 bool hidden,
ccameron2f451532016-09-07 21:49:27131 const ScreenInfo& screen_info,
kenrba7199832015-01-22 23:44:59132 CompositorDependencies* compositor_deps,
133 blink::WebLocalFrame* frame);
134
lfg1568d112016-08-30 16:06:29135 // Used by content_layouttest_support to hook into the creation of
136 // RenderWidgets.
137 using CreateRenderWidgetFunction =
138 RenderWidget* (*)(CompositorDependencies*,
139 blink::WebPopupType,
ccameron2f451532016-09-07 21:49:27140 const ScreenInfo&,
lfg1568d112016-08-30 16:06:29141 bool,
142 bool,
143 bool);
144 using RenderWidgetInitializedCallback = void (*)(RenderWidget*);
145 static void InstallCreateHook(
146 CreateRenderWidgetFunction create_render_widget,
147 RenderWidgetInitializedCallback render_widget_initialized_callback);
148
dchengda9b4bb2015-07-20 20:58:08149 // Closes a RenderWidget that was created by |CreateForFrame|.
dcheng3ce04b62015-10-26 23:30:55150 // TODO(avi): De-virtualize this once RenderViewImpl has-a RenderWidget.
151 // https://crbug.com/545684
152 virtual void CloseForFrame();
[email protected]484955942010-08-19 16:13:18153
avi1023d012015-12-25 02:39:14154 int32_t routing_id() const { return routing_id_; }
fsamuele8326c742016-01-12 00:49:39155 void SetRoutingID(int32_t routing_id);
156
danakj6e3bf8012014-12-16 18:27:53157 CompositorDependencies* compositor_deps() const { return compositor_deps_; }
lfg8ff33912016-09-13 20:59:21158 virtual blink::WebWidget* GetWebWidget() const;
mfomitchev2600fd7c2016-02-17 20:53:39159 const gfx::Size& size() const { return size_; }
mikhail.pozdnyakovf2c902a2015-04-14 08:09:12160 bool is_fullscreen_granted() const { return is_fullscreen_granted_; }
mikhail.pozdnyakovc0e251b2015-04-15 06:51:12161 blink::WebDisplayMode display_mode() const { return display_mode_; }
[email protected]204f1df2012-01-04 20:21:13162 bool is_hidden() const { return is_hidden_; }
[email protected]4ee64622014-03-21 22:34:15163 // Temporary for debugging purposes...
164 bool closing() const { return closing_; }
165 bool is_swapped_out() { return is_swapped_out_; }
[email protected]be1af0662014-07-29 19:55:51166 bool has_host_context_menu_location() {
167 return has_host_context_menu_location_;
168 }
169 gfx::Point host_context_menu_location() {
170 return host_context_menu_location_;
[email protected]4ee64622014-03-21 22:34:15171 }
[email protected]589621b2010-09-23 22:01:07172
avi40b5be7a2016-03-03 21:13:44173 void set_owner_delegate(RenderWidgetOwnerDelegate* owner_delegate) {
174 DCHECK(!owner_delegate_);
175 owner_delegate_ = owner_delegate;
176 }
177
178 RenderWidgetOwnerDelegate* owner_delegate() { return owner_delegate_; }
179
kenrba7199832015-01-22 23:44:59180 // ScreenInfo exposed so it can be passed to subframe RenderWidgets.
ccameron2f451532016-09-07 21:49:27181 ScreenInfo screen_info() const { return screen_info_; }
kenrba7199832015-01-22 23:44:59182
alexmos56567492016-09-13 00:52:46183 // Manage edit commands to be used for the next keyboard event.
184 const EditCommands& edit_commands() const { return edit_commands_; }
185 void SetEditCommandForNextKeyEvent(const std::string& name,
186 const std::string& value);
187 void ClearEditCommands();
188
[email protected]bffc8302014-01-23 20:52:16189 // Functions to track out-of-process frames for special notifications.
[email protected]e3244ed2014-06-20 20:04:27190 void RegisterRenderFrameProxy(RenderFrameProxy* proxy);
191 void UnregisterRenderFrameProxy(RenderFrameProxy* proxy);
[email protected]bffc8302014-01-23 20:52:16192
[email protected]de3c5d82014-05-28 22:12:59193 // Functions to track all RenderFrame objects associated with this
194 // RenderWidget.
195 void RegisterRenderFrame(RenderFrameImpl* frame);
196 void UnregisterRenderFrame(RenderFrameImpl* frame);
197
[email protected]a017938b2014-05-27 21:17:17198#if defined(VIDEO_HOLE)
199 void RegisterVideoHoleFrame(RenderFrameImpl* frame);
200 void UnregisterVideoHoleFrame(RenderFrameImpl* frame);
201#endif // defined(VIDEO_HOLE)
202
[email protected]c47317e2012-06-20 22:35:31203 // IPC::Listener
dcheng6d18e402014-10-21 12:32:52204 bool OnMessageReceived(const IPC::Message& msg) override;
initial.commit09911bf2008-07-26 23:55:29205
[email protected]c47317e2012-06-20 22:35:31206 // IPC::Sender
dcheng6d18e402014-10-21 12:32:52207 bool Send(IPC::Message* msg) override;
initial.commit09911bf2008-07-26 23:55:29208
dtapuska3d5624d32016-08-30 04:34:00209 // Requests a BeginMainFrame callback from the compositor.
210 void SetNeedsMainFrame();
211
fsamuel78f86e42016-01-20 04:10:23212 // RenderWidgetCompositorDelegate
213 void ApplyViewportDeltas(const gfx::Vector2dF& inner_delta,
214 const gfx::Vector2dF& outer_delta,
215 const gfx::Vector2dF& elastic_overscroll_delta,
216 float page_scale,
217 float top_controls_delta) override;
218 void BeginMainFrame(double frame_time_sec) override;
dchengcedca5612016-04-09 01:40:15219 std::unique_ptr<cc::OutputSurface> CreateOutputSurface(
220 bool fallback) override;
fsamuel78f86e42016-01-20 04:10:23221 void DidCommitAndDrawCompositorFrame() override;
222 void DidCommitCompositorFrame() override;
223 void DidCompletePageScaleAnimation() override;
224 void DidCompleteSwapBuffers() override;
fsamuel78f86e42016-01-20 04:10:23225 void ForwardCompositorProto(const std::vector<uint8_t>& proto) override;
226 bool IsClosing() const override;
227 void OnSwapBuffersAborted() override;
228 void OnSwapBuffersComplete() override;
229 void OnSwapBuffersPosted() override;
danakj53eccbc2016-03-02 22:51:07230 void RequestScheduleAnimation() override;
fsamuel78f86e42016-01-20 04:10:23231 void UpdateVisualState() override;
232 void WillBeginCompositorFrame() override;
jbroman6ccbc7d472016-07-27 04:45:41233 std::unique_ptr<cc::SwapPromise> RequestCopyOfOutputForLayoutTest(
234 std::unique_ptr<cc::CopyOutputRequest> request) override;
fsamuel78f86e42016-01-20 04:10:23235
fsamuel72464894f2015-12-15 06:59:31236 // RenderWidgetInputHandlerDelegate
237 void FocusChangeComplete() override;
238 bool HasTouchEventHandlersAt(const gfx::Point& point) const override;
dtapuska1827dd22016-03-11 15:24:59239 void ObserveGestureEventAndResult(const blink::WebGestureEvent& gesture_event,
240 const gfx::Vector2dF& unused_delta,
241 bool event_processed) override;
242
fsamuel72464894f2015-12-15 06:59:31243 void OnDidHandleKeyEvent() override;
chongza8ba91fc2016-08-16 21:39:17244 void OnDidOverscroll(const ui::DidOverscrollParams& params) override;
dchengcedca5612016-04-09 01:40:15245 void OnInputEventAck(std::unique_ptr<InputEventAck> input_event_ack) override;
dtapuskab08721e62016-06-29 03:35:07246 void NotifyInputEventHandled(blink::WebInputEvent::Type handled_type,
247 InputEventAckState ack_result) override;
fsamuele8326c742016-01-12 00:49:39248 void SetInputHandler(RenderWidgetInputHandler* input_handler) override;
fsamuel72464894f2015-12-15 06:59:31249 void UpdateTextInputState(ShowIme show_ime,
250 ChangeSource change_source) override;
251 bool WillHandleGestureEvent(const blink::WebGestureEvent& event) override;
252 bool WillHandleMouseEvent(const blink::WebMouseEvent& event) override;
253
mfomitchev2600fd7c2016-02-17 20:53:39254 // RenderWidgetScreenMetricsDelegate
255 void Redraw() override;
256 void Resize(const ResizeParams& resize_params) override;
257 void SetScreenMetricsEmulationParameters(
258 bool enabled,
259 const blink::WebDeviceEmulationParams& params) override;
260 void SetScreenRects(const gfx::Rect& view_screen_rect,
261 const gfx::Rect& window_screen_rect) override;
262
[email protected]180ef242013-11-07 06:50:46263 // blink::WebWidgetClient
avi5c77d212015-09-25 20:08:25264 void initializeLayerTreeView() override;
265 blink::WebLayerTreeView* layerTreeView() override;
dglazkovf0e1d6d2015-10-10 02:13:48266 void didMeaningfulLayout(blink::WebMeaningfulLayout layout_type) override;
avi5c77d212015-09-25 20:08:25267 void didChangeCursor(const blink::WebCursorInfo&) override;
268 void closeWidgetSoon() override;
269 void show(blink::WebNavigationPolicy) override;
270 blink::WebRect windowRect() override;
271 void setToolTipText(const blink::WebString& text,
272 blink::WebTextDirection hint) override;
273 void setWindowRect(const blink::WebRect&) override;
274 blink::WebRect windowResizerRect() override;
avi5c77d212015-09-25 20:08:25275 blink::WebScreenInfo screenInfo() override;
avi5c77d212015-09-25 20:08:25276 void resetInputMethod() override;
277 void didHandleGestureEvent(const blink::WebGestureEvent& event,
278 bool event_cancelled) override;
bokane53a10f2016-04-13 23:48:31279 void didOverscroll(const blink::WebFloatSize& overscrollDelta,
280 const blink::WebFloatSize& accumulatedOverscroll,
avi5c77d212015-09-25 20:08:25281 const blink::WebFloatPoint& position,
282 const blink::WebFloatSize& velocity) override;
283 void showImeIfNeeded() override;
oshima581cf3f62015-12-16 20:08:01284 void convertViewportToWindow(blink::WebRect* rect) override;
oshimaa6985b62016-01-27 08:58:30285 void convertWindowToViewport(blink::WebFloatRect* rect) override;
lfgbee1e0a2016-06-08 21:24:21286 bool requestPointerLock() override;
287 void requestPointerUnlock() override;
288 bool isPointerLocked() override;
[email protected]4873c7d2009-07-16 06:36:28289
fsamuel72464894f2015-12-15 06:59:31290 // Override point to obtain that the current input method state and caret
291 // position.
292 virtual ui::TextInputType GetTextInputType();
293 virtual ui::TextInputType WebKitToUiTextInputType(
294 blink::WebTextInputType type);
295
donnda070f3c2015-01-16 19:54:11296#if defined(OS_ANDROID)
297 // Notifies that a tap was not consumed, so showing a UI for the unhandled
298 // tap may be needed.
donnd57e54f52015-02-26 19:03:37299 // Performs various checks on the given WebNode to apply heuristics to
300 // determine if triggering is appropriate.
avi5c77d212015-09-25 20:08:25301 void showUnhandledTapUIIfNeeded(const blink::WebPoint& tapped_position,
302 const blink::WebNode& tapped_node,
303 bool page_changed) override;
donnda070f3c2015-01-16 19:54:11304#endif
305
[email protected]7912e822014-04-16 02:37:03306 // Begins the compositor's scheduler to start producing frames.
307 void StartCompositor();
308
[email protected]aeeedad2014-08-22 18:16:22309 // Stop compositing.
ennef3c58142014-12-09 21:44:38310 void WillCloseLayerTreeView();
[email protected]aeeedad2014-08-22 18:16:22311
[email protected]24ed0432013-04-24 07:50:31312 RenderWidgetCompositor* compositor() const;
313
fsamuel72464894f2015-12-15 06:59:31314 const RenderWidgetInputHandler& input_handler() const {
fsamuele8326c742016-01-12 00:49:39315 return *input_handler_;
fsamuel72464894f2015-12-15 06:59:31316 }
317
318 void SetHandlingInputEventForTesting(bool handling_input_event);
319
320 // When paused in debugger, we send ack for mouse event early. This ensures
321 // that we continue receiving mouse moves and pass them to debugger. Returns
322 // whether we are paused in mouse move event and have sent the ack.
323 bool SendAckForMouseMoveFromDebugger();
324
325 // When resumed from pause in debugger while handling mouse move,
326 // we should not send an extra ack (see SendAckForMouseMoveFromDebugger).
327 void IgnoreAckForMouseMoveFromDebugger();
328
[email protected]79fa22e2013-08-23 15:18:12329 // Callback for use with synthetic gestures (e.g. BeginSmoothScroll).
330 typedef base::Callback<void()> SyntheticGestureCompletionCallback;
[email protected]0e241b4b2012-08-18 09:06:27331
[email protected]9017d7852013-11-21 17:47:35332 // Send a synthetic gesture to the browser to be queued to the synthetic
333 // gesture controller.
334 void QueueSyntheticGesture(
dchengcedca5612016-04-09 01:40:15335 std::unique_ptr<SyntheticGestureParams> gesture_params,
[email protected]9017d7852013-11-21 17:47:35336 const SyntheticGestureCompletionCallback& callback);
[email protected]1e1dd182013-09-12 01:51:15337
[email protected]586871b2014-07-22 17:05:11338 // Deliveres |message| together with compositor state change updates. The
339 // exact behavior depends on |policy|.
340 // This mechanism is not a drop-in replacement for IPC: messages sent this way
341 // will not be automatically available to BrowserMessageFilter, for example.
342 // FIFO ordering is preserved between messages enqueued with the same
343 // |policy|, the ordering between messages enqueued for different policies is
344 // undefined.
345 //
346 // |msg| message to send, ownership of |msg| is transferred.
347 // |policy| see the comment on MessageDeliveryPolicy.
348 void QueueMessage(IPC::Message* msg, MessageDeliveryPolicy policy);
349
changwan8c342742016-02-26 00:53:39350 // Check whether IME thread is being used or not.
351 bool IsUsingImeThread();
352
changwanf2a707b2015-10-30 08:22:16353 // Handle start and finish of IME event guard.
354 void OnImeEventGuardStart(ImeEventGuard* guard);
355 void OnImeEventGuardFinish(ImeEventGuard* guard);
[email protected]66fca5bc2013-05-23 06:58:29356
[email protected]4ee64622014-03-21 22:34:15357 // Returns whether we currently should handle an IME event.
358 bool ShouldHandleImeEvent();
359
mfomitchev2600fd7c2016-02-17 20:53:39360 void SetPopupOriginAdjustmentsForEmulation(
361 RenderWidgetScreenMetricsEmulator* emulator);
[email protected]b2e4c70132013-10-03 02:07:51362
[email protected]2d6836f42014-07-02 17:25:31363 gfx::Rect AdjustValidationMessageAnchor(const gfx::Rect& anchor);
[email protected]b2e4c70132013-10-03 02:07:51364
jdduke491a3f0c2015-06-15 23:30:26365
366 void ScheduleComposite();
[email protected]7d08a9352013-10-15 08:24:56367 void ScheduleCompositeWithForcedRedraw();
368
[email protected]7a4e2532013-12-02 21:30:02369 // Checks if the selection bounds have been changed. If they are changed,
370 // the new value will be sent to the browser process.
371 void UpdateSelectionBounds();
372
[email protected]e5e438d62014-03-27 21:47:16373 virtual void GetSelectionBounds(gfx::Rect* start, gfx::Rect* end);
374
[email protected]a09d53ce2014-01-31 00:46:42375 void OnShowHostContextMenu(ContextMenuParams* params);
[email protected]7a4e2532013-12-02 21:30:02376
[email protected]7a4e2532013-12-02 21:30:02377 // Checks if the composition range or composition character bounds have been
378 // changed. If they are changed, the new value will be sent to the browser
yukawa5f21c6a2014-10-27 17:09:30379 // process. This method does nothing when the browser process is not able to
380 // handle composition range and composition character bounds.
nonafa291792016-08-10 02:36:18381 // If immediate_request is true, render sends the latest composition info to
382 // the browser even if the composition info is not changed.
383 void UpdateCompositionInfo(bool immediate_request);
[email protected]7a4e2532013-12-02 21:30:02384
avi40b5be7a2016-03-03 21:13:44385 // Change the device ICC color profile while running a layout test.
386 void SetDeviceColorProfileForTesting(const std::vector<char>& color_profile);
avi40b5be7a2016-03-03 21:13:44387
lfgb00fcad2016-07-14 14:16:33388 // Called when the Widget has changed size as a result of an auto-resize.
389 void DidAutoResize(const gfx::Size& new_size);
390
lfg0140a452016-07-19 19:15:05391 // Called to get the position of the root window containing the widget in
392 // screen coordinates.
393 gfx::Rect RootWindowRect();
394
lfge0c2792ec2016-05-11 18:52:08395 // Indicates whether this widget has focus.
396 bool has_focus() const { return has_focus_; }
397
lfgbee1e0a2016-06-08 21:24:21398 MouseLockDispatcher* mouse_lock_dispatcher() {
399 return mouse_lock_dispatcher_.get();
400 }
401
ekaramad2a46d632016-07-19 13:33:09402 void set_focused_pepper_plugin(PepperPluginInstanceImpl* plugin) {
403 focused_pepper_plugin_ = plugin;
404 }
405
lfg1f9011c2016-08-17 21:18:42406 // When emulated, this returns original device scale factor.
407 float GetOriginalDeviceScaleFactor() const;
408
initial.commit09911bf2008-07-26 23:55:29409 protected:
[email protected]8085dbc82008-09-26 22:53:44410 // Friend RefCounted so that the dtor can be non-public. Using this class
411 // without ref-counting is an error.
412 friend class base::RefCounted<RenderWidget>;
fsamuele8326c742016-01-12 00:49:39413
[email protected]7339cd22010-10-27 00:11:20414 // For unit tests.
[email protected]e9ff79c2012-10-19 21:31:26415 friend class RenderWidgetTest;
[email protected]8085dbc82008-09-26 22:53:44416
[email protected]61e2b3cc2012-03-02 16:13:34417 enum ResizeAck {
418 SEND_RESIZE_ACK,
419 NO_RESIZE_ACK,
420 };
421
dcheng35d31c112015-07-22 00:17:36422 RenderWidget(CompositorDependencies* compositor_deps,
423 blink::WebPopupType popup_type,
ccameron2f451532016-09-07 21:49:27424 const ScreenInfo& screen_info,
[email protected]1ac10dca2013-08-20 20:47:04425 bool swapped_out,
[email protected]7912e822014-04-16 02:37:03426 bool hidden,
427 bool never_visible);
[email protected]ce2b28e2012-08-09 15:53:57428
dcheng6d18e402014-10-21 12:32:52429 ~RenderWidget() override;
initial.commit09911bf2008-07-26 23:55:29430
lfgcaab5142016-02-26 19:06:52431 static blink::WebFrameWidget* CreateWebFrameWidget(
432 RenderWidget* render_widget,
433 blink::WebLocalFrame* frame);
dchengda9b4bb2015-07-20 20:58:08434
435 // Creates a WebWidget based on the popup type.
436 static blink::WebWidget* CreateWebWidget(RenderWidget* render_widget);
437
pimanc4af3072015-10-02 03:45:59438 // Initializes this view with the given opener.
avi1023d012015-12-25 02:39:14439 bool Init(int32_t opener_id);
initial.commit09911bf2008-07-26 23:55:29440
[email protected]484955942010-08-19 16:13:18441 // Called by Init and subclasses to perform initialization.
avi1023d012015-12-25 02:39:14442 bool DoInit(int32_t opener_id,
[email protected]180ef242013-11-07 06:50:46443 blink::WebWidget* web_widget,
[email protected]484955942010-08-19 16:13:18444 IPC::SyncMessage* create_widget_message);
445
[email protected]992db4c2011-05-12 15:37:15446 // Sets whether this RenderWidget has been swapped out to be displayed by
447 // a RenderWidget in a different process. If so, no new IPC messages will be
448 // sent (only ACKs) and the process is free to exit when there are no other
449 // active RenderWidgets.
450 void SetSwappedOut(bool is_swapped_out);
451
[email protected]949b6592014-08-20 13:17:52452 // Allows the process to exit once the unload handler has finished, if there
453 // are no other active RenderWidgets.
454 void WasSwappedOut();
455
[email protected]2533ce12009-05-09 00:02:24456 void DoDeferredClose();
dgozmancf9039cd2015-04-06 12:01:31457 void NotifyOnClose();
dchengda9b4bb2015-07-20 20:58:08458
bokanc63441c2016-04-27 15:49:12459 gfx::Size GetSizeForWebWidget() const;
460 virtual void ResizeWebWidget();
461
dchengda9b4bb2015-07-20 20:58:08462 // Close the underlying WebWidget.
463 virtual void Close();
initial.commit09911bf2008-07-26 23:55:29464
[email protected]92650162013-10-30 03:31:02465 // Used to force the size of a window when running layout tests.
bokanc007c3a2015-02-03 07:15:56466 void SetWindowRectSynchronously(const gfx::Rect& new_window_rect);
haibinluc643d33c2016-06-03 02:22:34467#if defined(USE_EXTERNAL_POPUP_MENU)
[email protected]b2e4c70132013-10-03 02:07:51468 void SetExternalPopupOriginAdjustmentsForEmulation(
mfomitchev2600fd7c2016-02-17 20:53:39469 ExternalPopupMenu* popup,
470 RenderWidgetScreenMetricsEmulator* emulator);
[email protected]53907862014-03-25 15:42:40471#endif
[email protected]61e2b3cc2012-03-02 16:13:34472
initial.commit09911bf2008-07-26 23:55:29473 // RenderWidget IPC message handlers
[email protected]180ef242013-11-07 06:50:46474 void OnHandleInputEvent(const blink::WebInputEvent* event,
dtapuska0bd451a2016-02-18 17:08:10475 const ui::LatencyInfo& latency_info,
476 InputEventDispatchType dispatch_type);
[email protected]34202de2013-05-06 23:36:22477 void OnCursorVisibilityChange(bool is_visible);
[email protected]c084330e02013-04-27 01:08:15478 void OnMouseCaptureLost();
alexmos56567492016-09-13 00:52:46479 void OnSetEditCommandsForNextKeyEvent(const EditCommands& edit_commands);
[email protected]c084330e02013-04-27 01:08:15480 virtual void OnSetFocus(bool enable);
naskoc288745f2015-05-01 22:54:21481 void OnClose();
[email protected]fc4404d2012-11-07 19:53:30482 void OnCreatingNewAck();
fsamuel664e8b62016-01-20 19:54:01483 virtual void OnResize(const ResizeParams& params);
dgozman9260b0a12015-03-16 13:45:20484 void OnEnableDeviceEmulation(const blink::WebDeviceEmulationParams& params);
485 void OnDisableDeviceEmulation();
[email protected]b5913d72012-02-07 22:26:54486 void OnChangeResizeRect(const gfx::Rect& resizer_rect);
[email protected]941e4552010-02-01 21:23:43487 virtual void OnWasHidden();
[email protected]3399dd822014-08-09 11:14:24488 virtual void OnWasShown(bool needs_repainting,
489 const ui::LatencyInfo& latency_info);
avi1023d012015-12-25 02:39:14490 void OnCreateVideoAck(int32_t video_id);
491 void OnUpdateVideoAck(int32_t video_id);
[email protected]2533ce12009-05-09 00:02:24492 void OnRequestMoveAck();
[email protected]56ea1a62011-05-30 07:05:57493 virtual void OnImeSetComposition(
[email protected]fcf75d42013-12-03 20:11:26494 const base::string16& text,
[email protected]180ef242013-11-07 06:50:46495 const std::vector<blink::WebCompositionUnderline>& underlines,
chongz7eb752802016-01-27 21:28:07496 const gfx::Range& replacement_range,
[email protected]fa7b1dc2010-06-23 17:53:04497 int selection_start,
498 int selection_end);
[email protected]fcf75d42013-12-03 20:11:26499 virtual void OnImeConfirmComposition(const base::string16& text,
[email protected]db4fc1e2013-09-06 20:01:51500 const gfx::Range& replacement_range,
[email protected]0e45bd02013-07-12 20:20:02501 bool keep_selection);
oshimad5279032015-12-16 18:22:33502 // Called when the device scale factor is changed, or the layer tree is
503 // initialized.
504 virtual void OnDeviceScaleFactorChanged();
505
[email protected]0bc1f572013-04-17 01:46:31506 void OnRepaint(gfx::Size size_to_paint);
[email protected]79fa22e2013-08-23 15:18:12507 void OnSyntheticGestureCompleted();
[email protected]180ef242013-11-07 06:50:46508 void OnSetTextDirection(blink::WebTextDirection direction);
[email protected]872ae5b2011-05-26 20:20:50509 void OnGetFPS();
[email protected]80ad8622012-11-07 16:33:03510 void OnUpdateScreenRects(const gfx::Rect& view_screen_rect,
511 const gfx::Rect& window_screen_rect);
lfgdb5c4ed2016-03-04 23:09:07512 void OnUpdateWindowScreenRect(const gfx::Rect& window_screen_rect);
[email protected]2384b6c2013-02-28 23:58:51513 void OnShowImeIfNeeded();
fsamuel278664272016-07-13 04:06:59514 void OnSetSurfaceClientId(uint32_t surface_id_namespace);
dtrainor5ef644e2015-11-19 00:12:47515 void OnHandleCompositorProto(const std::vector<uint8_t>& proto);
[email protected]0d1ebed12013-08-05 22:01:13516
[email protected]adb362312014-06-28 06:04:24517#if defined(OS_ANDROID)
changwan3a841162015-08-11 02:53:37518 // Called when we send IME event that expects an ACK.
519 void OnImeEventSentForAck(const blink::WebTextInputInfo& info);
[email protected]0d1ebed12013-08-05 22:01:13520
521 // Called by the browser process for every required IME acknowledgement.
522 void OnImeEventAck();
changwan8c342742016-02-26 00:53:39523
524 // Called by the browser process to update text input state.
525 void OnRequestTextInputStateUpdate();
[email protected]105dffb42013-02-20 03:46:21526#endif
[email protected]0d1ebed12013-08-05 22:01:13527
nonafa291792016-08-10 02:36:18528 // Called by the browser process to update the cursor and composition
529 // information.
530 void OnRequestCompositionUpdate(bool immediate_request, bool monitor_request);
531
[email protected]847a2582013-03-09 02:29:51532 // Notify the compositor about a change in viewport size. This should be
533 // used only with auto resize mode WebWidgets, as normal WebWidgets should
534 // go through OnResize.
[email protected]97e1bf72013-03-06 14:06:05535 void AutoResizeCompositor();
536
wjmaclean8a795f32016-08-11 23:49:58537 virtual void OnSetDeviceScaleFactor(float device_scale_factor);
avi40b5be7a2016-03-03 21:13:44538 bool SetDeviceColorProfile(const std::vector<char>& color_profile);
[email protected]468ac582012-11-20 00:53:19539
[email protected]fcdc5642014-05-09 14:32:24540 virtual void OnOrientationChange();
541
[email protected]29ed96a2012-02-04 18:12:16542 // Override points to notify derived classes that a paint has happened.
[email protected]0704ac32013-10-03 15:24:22543 // DidInitiatePaint happens when that has completed, and subsequent rendering
544 // won't affect the painted content. DidFlushPaint happens once we've received
545 // the ACK that the screen has been updated. For a given paint operation,
546 // these overrides will always be called in the order DidInitiatePaint,
547 // DidFlushPaint.
lfge0c2792ec2016-05-11 18:52:08548 virtual void DidInitiatePaint() {}
avib9dbd972016-03-08 18:19:32549 virtual void DidFlushPaint();
[email protected]a2f6bc112009-06-27 16:27:25550
[email protected]ed7defa2013-03-12 21:29:59551 virtual GURL GetURLForGraphicsContext3D();
[email protected]65225772011-05-12 21:10:24552
[email protected]bee16aab2009-08-26 15:55:03553 // Sets the "hidden" state of this widget. All accesses to is_hidden_ should
554 // use this method so that we can properly inform the RenderThread of our
555 // state.
556 void SetHidden(bool hidden);
557
[email protected]2b624c562011-10-27 22:58:26558 void DidToggleFullscreen();
559
[email protected]674741932009-02-04 23:44:46560 bool next_paint_is_resize_ack() const;
[email protected]674741932009-02-04 23:44:46561 void set_next_paint_is_resize_ack();
[email protected]674741932009-02-04 23:44:46562 void set_next_paint_is_repaint_ack();
[email protected]ec7dc112008-08-06 05:30:12563
[email protected]586871b2014-07-22 17:05:11564 // QueueMessage implementation extracted into a static method for easy
565 // testing.
dchengcedca5612016-04-09 01:40:15566 static std::unique_ptr<cc::SwapPromise> QueueMessageImpl(
[email protected]586871b2014-07-22 17:05:11567 IPC::Message* msg,
568 MessageDeliveryPolicy policy,
569 FrameSwapMessageQueue* frame_swap_message_queue,
570 scoped_refptr<IPC::SyncMessageFilter> sync_message_filter,
[email protected]586871b2014-07-22 17:05:11571 int source_frame_number);
572
[email protected]58b48a0d2012-06-13 07:01:35573 // Override point to obtain that the current composition character bounds.
574 // In the case of surrogate pairs, the character is treated as two characters:
575 // the bounds for first character is actual one, and the bounds for second
576 // character is zero width rectangle.
577 virtual void GetCompositionCharacterBounds(
578 std::vector<gfx::Rect>* character_bounds);
579
[email protected]88dbe32f2013-06-20 23:31:36580 // Returns the range of the text that is being composed or the selection if
581 // the composition does not exist.
[email protected]db4fc1e2013-09-06 20:01:51582 virtual void GetCompositionRange(gfx::Range* range);
[email protected]88dbe32f2013-06-20 23:31:36583
[email protected]58b48a0d2012-06-13 07:01:35584 // Returns true if the composition range or composition character bounds
585 // should be sent to the browser process.
586 bool ShouldUpdateCompositionInfo(
[email protected]db4fc1e2013-09-06 20:01:51587 const gfx::Range& range,
[email protected]58b48a0d2012-06-13 07:01:35588 const std::vector<gfx::Rect>& bounds);
589
[email protected]ad26ef42011-06-17 07:59:45590 // Override point to obtain that the current input method state about
591 // composition text.
592 virtual bool CanComposeInline();
[email protected]56ea1a62011-05-30 07:05:57593
[email protected]2533ce12009-05-09 00:02:24594 // Set the pending window rect.
595 // Because the real render_widget is hosted in another process, there is
596 // a time period where we may have set a new window rect which has not yet
597 // been processed by the browser. So we maintain a pending window rect
598 // size. If JS code sets the WindowRect, and then immediately calls
599 // GetWindowRect() we'll use this pending window rect as the size.
[email protected]180ef242013-11-07 06:50:46600 void SetPendingWindowRect(const blink::WebRect& r);
[email protected]2533ce12009-05-09 00:02:24601
[email protected]ce6689f2013-03-29 12:52:55602 // Check whether the WebWidget has any touch event handlers registered.
avi5c77d212015-09-25 20:08:25603 void hasTouchEventHandlers(bool has_handlers) override;
[email protected]ce6689f2013-03-29 12:52:55604
[email protected]5d0bbdfa92013-12-10 00:35:51605 // Tell the browser about the actions permitted for a new touch point.
avi5c77d212015-09-25 20:08:25606 void setTouchAction(blink::WebTouchAction touch_action) override;
[email protected]5d0bbdfa92013-12-10 00:35:51607
[email protected]90f24152014-04-09 12:41:36608 // Called when value of focused text field gets dirty, e.g. value is modified
609 // by script, not by user input.
avi5c77d212015-09-25 20:08:25610 void didUpdateTextOfFocusedElementByNonUserInput() override;
[email protected]90f24152014-04-09 12:41:36611
lfg43e08e62016-02-03 18:51:37612 // Sends an ACK to the browser process during the next compositor frame.
613 void OnWaitNextFrameForTests(int routing_id);
614
initial.commit09911bf2008-07-26 23:55:29615 // Routing ID that allows us to communicate to the parent browser process
616 // RenderWidgetHost. When MSG_ROUTING_NONE, no messages may be sent.
avi1023d012015-12-25 02:39:14617 int32_t routing_id_;
initial.commit09911bf2008-07-26 23:55:29618
danakj6e3bf8012014-12-16 18:27:53619 // Dependencies for initializing a compositor, including flags for optional
620 // features.
dcheng35d31c112015-07-22 00:17:36621 CompositorDependencies* const compositor_deps_;
danakj6e3bf8012014-12-16 18:27:53622
lfg8ff33912016-09-13 20:59:21623 // Use GetWebWidget() instead of using webwidget_internal_ directly.
[email protected]c5b3b5e2009-02-13 06:41:11624 // We are responsible for destroying this object via its Close method.
[email protected]4ee64622014-03-21 22:34:15625 // May be NULL when the window is closing.
lfg8ff33912016-09-13 20:59:21626 blink::WebWidget* webwidget_internal_;
initial.commit09911bf2008-07-26 23:55:29627
avi40b5be7a2016-03-03 21:13:44628 // The delegate of the owner of this object.
629 RenderWidgetOwnerDelegate* owner_delegate_;
630
[email protected]8926c602013-01-23 05:32:06631 // This is lazily constructed and must not outlive webwidget_.
dchengcedca5612016-04-09 01:40:15632 std::unique_ptr<RenderWidgetCompositor> compositor_;
[email protected]8926c602013-01-23 05:32:06633
initial.commit09911bf2008-07-26 23:55:29634 // Set to the ID of the view that initiated creating this view, if any. When
635 // the view was initiated by the browser (the common case), this will be
636 // MSG_ROUTING_NONE. This is used in determining ownership when opening
637 // child tabs. See RenderWidget::createWebViewWithRequest.
638 //
639 // This ID may refer to an invalid view if that view is closed before this
640 // view is.
avi1023d012015-12-25 02:39:14641 int32_t opener_id_;
initial.commit09911bf2008-07-26 23:55:29642
bokanc007c3a2015-02-03 07:15:56643 // The rect where this view should be initially shown.
644 gfx::Rect initial_rect_;
initial.commit09911bf2008-07-26 23:55:29645
initial.commit09911bf2008-07-26 23:55:29646 // We store the current cursor object so we can avoid spamming SetCursor
647 // messages.
648 WebCursor current_cursor_;
[email protected]88efb7ec2009-07-14 16:32:59649
initial.commit09911bf2008-07-26 23:55:29650 // The size of the RenderWidget.
651 gfx::Size size_;
652
[email protected]60d47ac2013-03-01 23:42:44653 // The size of the view's backing surface in non-DPI-adjusted pixels.
654 gfx::Size physical_backing_size_;
655
[email protected]bb6378fe2014-04-28 21:19:44656 // The size of the visible viewport in DPI-adjusted pixels.
657 gfx::Size visible_viewport_size_;
658
[email protected]f21c613a2009-02-12 14:46:17659 // The area that must be reserved for drawing the resize corner.
660 gfx::Rect resizer_rect_;
661
[email protected]53d3f302009-12-21 04:42:05662 // Flags for the next ViewHostMsg_UpdateRect message.
initial.commit09911bf2008-07-26 23:55:29663 int next_paint_flags_;
664
[email protected]847a2582013-03-09 02:29:51665 // Whether the WebWidget is in auto resize mode, which is used for example
666 // by extension popups.
667 bool auto_resize_mode_;
668
[email protected]ea3ee0a2012-05-15 03:43:09669 // True if we need to send an UpdateRect message to notify the browser about
670 // an already-completed auto-resize.
671 bool need_update_rect_for_auto_resize_;
672
initial.commit09911bf2008-07-26 23:55:29673 // Set to true if we should ignore RenderWidget::Show calls.
674 bool did_show_;
675
676 // Indicates that we shouldn't bother generated paint events.
677 bool is_hidden_;
678
[email protected]7912e822014-04-16 02:37:03679 // Indicates that we are never visible, so never produce graphical output.
sievers71c62dd52015-10-07 01:44:39680 const bool compositor_never_visible_;
[email protected]7912e822014-04-16 02:37:03681
mikhail.pozdnyakovf2c902a2015-04-14 08:09:12682 // Indicates whether tab-initiated fullscreen was granted.
683 bool is_fullscreen_granted_;
[email protected]ee41e7d22011-10-14 19:34:09684
mikhail.pozdnyakovc0e251b2015-04-15 06:51:12685 // Indicates the display mode.
686 blink::WebDisplayMode display_mode_;
687
changwanf2a707b2015-10-30 08:22:16688 // It is possible that one ImeEventGuard is nested inside another
689 // ImeEventGuard. We keep track of the outermost one, and update it as needed.
690 ImeEventGuard* ime_event_guard_;
[email protected]e8f775f2013-02-14 21:00:50691
initial.commit09911bf2008-07-26 23:55:29692 // True if we have requested this widget be closed. No more messages will
693 // be sent, except for a Close.
694 bool closing_;
695
[email protected]aeeedad2014-08-22 18:16:22696 // True if it is known that the host is in the process of being shut down.
697 bool host_closing_;
698
[email protected]992db4c2011-05-12 15:37:15699 // Whether this RenderWidget is currently swapped out, such that the view is
700 // being rendered by another process. If all RenderWidgets in a process are
701 // swapped out, the process can exit.
702 bool is_swapped_out_;
703
simonhong628f9812015-04-27 23:13:20704 // Whether this RenderWidget is for an out-of-process iframe or not.
705 bool for_oopif_;
706
[email protected]5b739cb2012-08-21 20:35:21707 // Stores information about the current text input.
[email protected]180ef242013-11-07 06:50:46708 blink::WebTextInputInfo text_input_info_;
[email protected]5b739cb2012-08-21 20:35:21709
[email protected]b256eca2013-07-11 10:57:40710 // Stores the current text input mode of |webwidget_|.
711 ui::TextInputMode text_input_mode_;
712
shuchen82ce8c52014-10-23 01:55:20713 // Stores the current text input flags of |webwidget_|.
714 int text_input_flags_;
715
[email protected]86ba5fcb2013-09-04 00:36:53716 // Stores the current type of composition text rendering of |webwidget_|.
717 bool can_compose_inline_;
718
[email protected]e99ef6f2011-10-16 01:13:00719 // Stores the current selection bounds.
[email protected]7c8873e2013-02-05 08:03:01720 gfx::Rect selection_focus_rect_;
721 gfx::Rect selection_anchor_rect_;
initial.commit09911bf2008-07-26 23:55:29722
[email protected]58b48a0d2012-06-13 07:01:35723 // Stores the current composition character bounds.
724 std::vector<gfx::Rect> composition_character_bounds_;
725
726 // Stores the current composition range.
[email protected]db4fc1e2013-09-06 20:01:51727 gfx::Range composition_range_;
[email protected]58b48a0d2012-06-13 07:01:35728
[email protected]3e2b375b2010-04-07 17:03:12729 // The kind of popup this widget represents, NONE if not a popup.
[email protected]180ef242013-11-07 06:50:46730 blink::WebPopupType popup_type_;
[email protected]0ebf3872008-11-07 21:35:03731
[email protected]80ad8622012-11-07 16:33:03732 // While we are waiting for the browser to update window sizes, we track the
733 // pending size temporarily.
[email protected]2533ce12009-05-09 00:02:24734 int pending_window_rect_count_;
lfg0140a452016-07-19 19:15:05735 gfx::Rect pending_window_rect_;
[email protected]2533ce12009-05-09 00:02:24736
[email protected]80ad8622012-11-07 16:33:03737 // The screen rects of the view and the window that contains it.
738 gfx::Rect view_screen_rect_;
739 gfx::Rect window_screen_rect_;
740
dchengcedca5612016-04-09 01:40:15741 std::unique_ptr<RenderWidgetInputHandler> input_handler_;
[email protected]12fbad812009-09-01 18:21:24742
[email protected]fd847792013-10-24 17:12:35743 // The time spent in input handlers this frame. Used to throttle input acks.
744 base::TimeDelta total_input_handling_time_this_frame_;
745
[email protected]842f10652012-06-06 01:54:04746 // Properties of the screen hosting this RenderWidget instance.
ccameron2f451532016-09-07 21:49:27747 ScreenInfo screen_info_;
[email protected]842f10652012-06-06 01:54:04748
[email protected]f1cccb32012-06-06 18:29:59749 // The device scale factor. This value is computed from the DPI entries in
750 // |screen_info_| on some platforms, and defaults to 1 on other platforms.
[email protected]faec7b12012-06-19 14:42:13751 float device_scale_factor_;
[email protected]f1cccb32012-06-06 18:29:59752
[email protected]28ed6b32014-06-08 02:16:27753 // The device color profile on supported platforms.
754 std::vector<char> device_color_profile_;
755
[email protected]9017d7852013-11-21 17:47:35756 // State associated with synthetic gestures. Synthetic gestures are processed
757 // in-order, so a queue is sufficient to identify the correct state for a
758 // completed gesture.
759 std::queue<SyntheticGestureCompletionCallback>
760 pending_synthetic_gesture_callbacks_;
[email protected]0e241b4b2012-08-18 09:06:27761
[email protected]0d1ebed12013-08-05 22:01:13762#if defined(OS_ANDROID)
[email protected]90f24152014-04-09 12:41:36763 // Indicates value in the focused text field is in dirty state, i.e. modified
764 // by script etc., not by user input.
765 bool text_field_is_dirty_;
766
changwan3a841162015-08-11 02:53:37767 // Stores the history of text input infos from the last ACK'ed one from the
768 // current one. The size is the number of pending ACKs plus one, since we
769 // intentionally keep the last ack'd value to know what the browser is
770 // currently aware of.
771 std::deque<blink::WebTextInputInfo> text_input_info_history_;
[email protected]0d1ebed12013-08-05 22:01:13772#endif
773
nonafa291792016-08-10 02:36:18774 // True if the IME requests updated composition info.
775 bool monitor_composition_info_;
776
dchengcedca5612016-04-09 01:40:15777 std::unique_ptr<RenderWidgetScreenMetricsEmulator> screen_metrics_emulator_;
[email protected]b2e4c70132013-10-03 02:07:51778
779 // Popups may be displaced when screen metrics emulation is enabled.
780 // These values are used to properly adjust popup position.
danakj2ef31b82015-10-21 18:18:02781 gfx::Point popup_view_origin_for_emulation_;
782 gfx::Point popup_screen_origin_for_emulation_;
[email protected]b2e4c70132013-10-03 02:07:51783 float popup_origin_scale_for_emulation_;
784
[email protected]586871b2014-07-22 17:05:11785 scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue_;
dchengcedca5612016-04-09 01:40:15786 std::unique_ptr<ResizingModeSelector> resizing_mode_selector_;
[email protected]5b45ad42013-10-25 00:42:04787
[email protected]e3244ed2014-06-20 20:04:27788 // Lists of RenderFrameProxy objects that need to be notified of
789 // compositing-related events (e.g. DidCommitCompositorFrame).
brettw236d3172015-06-03 16:31:43790 base::ObserverList<RenderFrameProxy> render_frame_proxies_;
[email protected]a017938b2014-05-27 21:17:17791#if defined(VIDEO_HOLE)
brettw236d3172015-06-03 16:31:43792 base::ObserverList<RenderFrameImpl> video_hole_frames_;
[email protected]a017938b2014-05-27 21:17:17793#endif // defined(VIDEO_HOLE)
[email protected]bffc8302014-01-23 20:52:16794
[email protected]de3c5d82014-05-28 22:12:59795 // A list of RenderFrames associated with this RenderWidget. Notifications
796 // are sent to each frame in the list for events such as changing
797 // visibility state for example.
brettw236d3172015-06-03 16:31:43798 base::ObserverList<RenderFrameImpl> render_frames_;
[email protected]de3c5d82014-05-28 22:12:59799
[email protected]be1af0662014-07-29 19:55:51800 bool has_host_context_menu_location_;
801 gfx::Point host_context_menu_location_;
[email protected]a09d53ce2014-01-31 00:46:42802
skyostil529caa292016-08-10 17:44:51803 std::unique_ptr<blink::scheduler::RenderWidgetSchedulingState>
alexclarke7fa93942015-10-21 15:37:11804 render_widget_scheduling_state_;
805
lfgbee1e0a2016-06-08 21:24:21806 // Mouse Lock dispatcher attached to this view.
807 std::unique_ptr<RenderWidgetMouseLockDispatcher> mouse_lock_dispatcher_;
808
809 // Wraps the |webwidget_| as a MouseLockDispatcher::LockTarget interface.
810 std::unique_ptr<MouseLockDispatcher::LockTarget> webwidget_mouse_lock_target_;
811
oshima50872a72016-03-04 13:26:18812 private:
lfge0c2792ec2016-05-11 18:52:08813 // Indicates whether this widget has focus.
814 bool has_focus_;
815
ekaramad2a46d632016-07-19 13:33:09816 // This reference is set by the RenderFrame and is used to query the IME-
817 // related state from the plugin to later send to the browser.
818 PepperPluginInstanceImpl* focused_pepper_plugin_;
819
alexmos56567492016-09-13 00:52:46820 // Stores edit commands associated to the next key event.
821 // Will be cleared as soon as the next key event is processed.
822 EditCommands edit_commands_;
823
[email protected]05d478752009-04-08 23:38:16824 DISALLOW_COPY_AND_ASSIGN(RenderWidget);
initial.commit09911bf2008-07-26 23:55:29825};
826
[email protected]e9ff79c2012-10-19 21:31:26827} // namespace content
828
[email protected]2cff0052011-03-18 16:51:44829#endif // CONTENT_RENDERER_RENDER_WIDGET_H_