blob: a551d2700423ee8a61b1ff27e23996ec52fdc46b [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]0e241b4b2012-08-18 09:06:2711#include <map>
dchengcedca5612016-04-09 01:40:1512#include <memory>
xlai180af792016-08-26 22:07:4213#include <queue>
pwnallef669312017-01-07 01:17:2914#include <string>
15#include <vector>
[email protected]010ea08a2009-10-11 20:21:3216
[email protected]586871b2014-07-22 17:05:1117#include "base/callback.h"
Fady Samuel1ee6fb5c2018-02-16 03:27:4618#include "base/cancelable_callback.h"
[email protected]f3112a52011-09-30 23:47:4919#include "base/compiler_specific.h"
avi1023d012015-12-25 02:39:1420#include "base/macros.h"
[email protected]3b63f8f42011-03-28 01:54:1521#include "base/memory/ref_counted.h"
wjmaclean1d970622017-01-21 22:28:2422#include "base/memory/weak_ptr.h"
[email protected]bffc8302014-01-23 20:52:1623#include "base/observer_list.h"
Gabriel Charette14520232018-04-30 23:27:2224#include "base/single_thread_task_runner.h"
[email protected]abb522162013-06-28 01:54:1625#include "base/time/time.h"
avi1023d012015-12-25 02:39:1426#include "build/build_config.h"
Sandra Sunac5cdd832017-12-11 03:27:1327#include "cc/input/overscroll_behavior.h"
xidachenfa0199e72017-05-11 11:34:2628#include "cc/input/touch_action.h"
danakj4b347212018-07-04 17:55:1729#include "cc/trees/layer_tree_settings.h"
30#include "cc/trees/managed_memory_policy.h"
Fady Samuel644df1d2017-07-13 01:13:0231#include "components/viz/common/surfaces/local_surface_id.h"
Scott Violetc78fef732018-03-06 17:42:5332#include "content/common/buildflags.h"
[email protected]f3112a52011-09-30 23:47:4933#include "content/common/content_export.h"
[email protected]c2809346d2014-03-20 00:11:0334#include "content/common/cursors/webcursor.h"
paulmeyer6ef5a792016-11-08 20:33:5835#include "content/common/drag_event_source_info.h"
alexmos56567492016-09-13 00:52:4636#include "content/common/edit_command.h"
Dave Tapuska1bdf1832017-07-07 18:07:1937#include "content/common/widget.mojom.h"
paulmeyer90f6c31d2016-11-12 00:17:5938#include "content/public/common/drop_data.h"
ccameron2f451532016-09-07 21:49:2739#include "content/public/common/screen_info.h"
Sadrul Habib Chowdhury31c98712018-12-11 04:15:1340#include "content/renderer/compositor/layer_tree_view_delegate.h"
mfomitchev2600fd7c2016-02-17 20:53:3941#include "content/renderer/devtools/render_widget_screen_metrics_emulator_delegate.h"
dtapuska9ec1a912017-04-21 15:18:3142#include "content/renderer/input/main_thread_event_queue.h"
fsamuel72464894f2015-12-15 06:59:3143#include "content/renderer/input/render_widget_input_handler.h"
44#include "content/renderer/input/render_widget_input_handler_delegate.h"
lfgbee1e0a2016-06-08 21:24:2145#include "content/renderer/mouse_lock_dispatcher.h"
Albert J. Wong7bbf22d2018-12-20 00:27:2746#include "content/renderer/render_widget_delegate.h"
lfgbee1e0a2016-06-08 21:24:2147#include "content/renderer/render_widget_mouse_lock_dispatcher.h"
[email protected]4f86bdb2012-11-10 19:11:1948#include "ipc/ipc_listener.h"
nick4df698d82016-11-11 20:39:2349#include "ipc/ipc_message.h"
[email protected]4f86bdb2012-11-10 19:11:1950#include "ipc/ipc_sender.h"
Dave Tapuska1bdf1832017-07-07 18:07:1951#include "mojo/public/cpp/bindings/binding.h"
Scott Violet02e38b92018-03-27 23:42:1452#include "ppapi/buildflags/buildflags.h"
Richard Li49fe04d2018-10-21 09:07:1953#include "services/network/public/mojom/referrer_policy.mojom.h"
Dmitry Gozman88ca5a992018-05-18 00:13:3354#include "third_party/blink/public/common/manifest/web_display_mode.h"
Blink Reformata30d4232018-04-07 15:31:0655#include "third_party/blink/public/platform/web_input_event.h"
56#include "third_party/blink/public/platform/web_rect.h"
Blink Reformata30d4232018-04-07 15:31:0657#include "third_party/blink/public/platform/web_text_input_info.h"
58#include "third_party/blink/public/web/web_ime_text_span.h"
Blink Reformata30d4232018-04-07 15:31:0659#include "third_party/blink/public/web/web_text_direction.h"
60#include "third_party/blink/public/web/web_widget.h"
61#include "third_party/blink/public/web/web_widget_client.h"
[email protected]b256eca2013-07-11 10:57:4062#include "ui/base/ime/text_input_mode.h"
[email protected]ad26ef42011-06-17 07:59:4563#include "ui/base/ime/text_input_type.h"
[email protected]a09d53ce2014-01-31 00:46:4264#include "ui/base/ui_base_types.h"
tfarina93bfa912014-12-05 14:23:1565#include "ui/gfx/geometry/rect.h"
tfarina93bfa912014-12-05 14:23:1566#include "ui/gfx/geometry/vector2d_f.h"
[email protected]08397d52011-02-05 01:53:3867#include "ui/gfx/native_widget_types.h"
[email protected]db4fc1e2013-09-06 20:01:5168#include "ui/gfx/range/range.h"
[email protected]d353541f2012-05-03 22:45:4169#include "ui/surface/transport_dib.h"
initial.commit09911bf2008-07-26 23:55:2970
[email protected]484955942010-08-19 16:13:1871namespace IPC {
[email protected]586871b2014-07-22 17:05:1172class SyncMessageFilter;
[email protected]484955942010-08-19 16:13:1873}
74
[email protected]180ef242013-11-07 06:50:4675namespace blink {
skyostil529caa292016-08-10 17:44:5176namespace scheduler {
Yuta Kitamura39219b42018-04-06 10:28:1477class WebRenderWidgetSchedulingState;
skyostil529caa292016-08-10 17:44:5178}
[email protected]19193682014-04-03 15:01:4379struct WebDeviceEmulationParams;
paulmeyer6ef5a792016-11-08 20:33:5880class WebDragData;
lfgcaab5142016-02-26 19:06:5281class WebFrameWidget;
[email protected]41d86852012-11-07 12:23:2482class WebGestureEvent;
ekaramad2daaf672016-11-10 20:29:0183class WebInputMethodController;
kenrba7199832015-01-22 23:44:5984class WebLocalFrame;
[email protected]6a8ddba52010-09-05 04:38:0685class WebMouseEvent;
danakj19f3e512018-12-14 21:02:0586class WebPagePopup;
pwnallef669312017-01-07 01:17:2987} // namespace blink
[email protected]526476902011-10-06 20:34:0688
[email protected]586871b2014-07-22 17:05:1189namespace cc {
David Bokanc8e38d02018-10-08 21:56:0190struct ApplyViewportChangesArgs;
[email protected]586871b2014-07-22 17:05:1191class SwapPromise;
92}
[email protected]ba91a792013-02-06 09:48:2893
[email protected]db4fc1e2013-09-06 20:01:5194namespace gfx {
danakja2c9d0a92018-07-25 20:01:1895class ColorSpace;
[email protected]4de6d1692011-10-12 08:45:4496class Range;
97}
98
chongza8ba91fc2016-08-16 21:39:1799namespace ui {
100struct DidOverscrollParams;
101}
102
[email protected]e9ff79c2012-10-19 21:31:26103namespace content {
Saman Samid189e5dfd2017-12-20 22:55:31104class BrowserPlugin;
danakj6e3bf8012014-12-16 18:27:53105class CompositorDependencies;
[email protected]b2e4c70132013-10-03 02:07:51106class ExternalPopupMenu;
[email protected]586871b2014-07-22 17:05:11107class FrameSwapMessageQueue;
changwanf2a707b2015-10-30 08:22:16108class ImeEventGuard;
danakja6c10012018-07-06 14:25:36109class LayerTreeView;
dtapuska9ec1a912017-04-21 15:18:31110class MainThreadEventQueue;
ekaramad2a46d632016-07-19 13:33:09111class PepperPluginInstanceImpl;
[email protected]bffc8302014-01-23 20:52:16112class RenderFrameImpl;
[email protected]e3244ed2014-06-20 20:04:27113class RenderFrameProxy;
nickf7b38222016-11-22 21:59:35114class RenderViewImpl;
Albert J. Wong7bbf22d2018-12-20 00:27:27115class RenderWidgetDelegate;
mfomitchev2600fd7c2016-02-17 20:53:39116class RenderWidgetScreenMetricsEmulator;
ekaramad330ba4232016-09-23 17:57:47117class TextInputClientObserver;
Dave Tapuska9db80842017-07-24 17:24:26118class WidgetInputHandlerManager;
[email protected]b2e4c70132013-10-03 02:07:51119struct ContextMenuParams;
Fady Samuel799e72192018-04-25 21:16:57120struct VisualProperties;
[email protected]e9ff79c2012-10-19 21:31:26121
initial.commit09911bf2008-07-26 23:55:29122// RenderWidget provides a communication bridge between a WebWidget and
123// a RenderWidgetHost, the latter of which lives in a different process.
dchengd96a27a2015-07-24 20:17:32124//
125// RenderWidget is used to implement:
126// - RenderViewImpl (deprecated)
127// - Fullscreen mode (RenderWidgetFullScreen)
128// - Popup "menus" (like the color chooser and date picker)
danakjbc6ba9d22018-11-17 04:03:41129// - Widgets for frames (the main frame, and subframes due to out-of-process
130// iframe support)
131//
132// Because the main frame RenderWidget is used to implement RenderViewImpl
133// (deprecated) it has a shared lifetime. But the RenderViewImpl may have
134// a proxy main frame which does not use a RenderWidget. Thus a RenderWidget
135// can be frozen, during the time in which we wish we could delete it but we
136// can't, and it should be (relatively.. it's a work in progress) unused during
137// that time. This does not apply to subframes, whose lifetimes are not tied to
138// the RenderViewImpl.
[email protected]f3112a52011-09-30 23:47:49139class CONTENT_EXPORT RenderWidget
[email protected]c47317e2012-06-20 22:35:31140 : public IPC::Listener,
141 public IPC::Sender,
danakj9a8a9cf2018-07-17 23:52:12142 public blink::WebWidgetClient,
Dave Tapuska1bdf1832017-07-07 18:07:19143 public mojom::Widget,
danakja6c10012018-07-06 14:25:36144 public LayerTreeViewDelegate,
fsamuel72464894f2015-12-15 06:59:31145 public RenderWidgetInputHandlerDelegate,
mfomitchev2600fd7c2016-02-17 20:53:39146 public RenderWidgetScreenMetricsEmulatorDelegate,
dtapuska9ec1a912017-04-21 15:18:31147 public base::RefCounted<RenderWidget>,
148 public MainThreadEventQueueClient {
initial.commit09911bf2008-07-26 23:55:29149 public:
danakjdf1ceb72018-07-18 20:02:25150 using ShowCallback =
151 base::OnceCallback<void(RenderWidget* widget_to_show,
152 blink::WebNavigationPolicy policy,
153 const gfx::Rect& initial_rect)>;
154
danakj53802692018-07-25 21:46:44155 // Time-To-First-Active-Paint(TTFAP) type
156 enum {
157 TTFAP_AFTER_PURGED,
158 TTFAP_5MIN_AFTER_BACKGROUNDED,
159 };
160
Albert J. Wong2727e8a82019-02-15 16:56:11161 // Convenience type for creation method taken by InstallCreateForFrameHook().
162 // The method signature matches the RenderWidget constructor.
163 using CreateRenderWidgetFunction =
164 scoped_refptr<RenderWidget> (*)(int32_t,
165 CompositorDependencies*,
166 const ScreenInfo&,
167 blink::WebDisplayMode display_mode,
168 bool,
169 bool,
170 bool,
171 mojom::WidgetRequest widget_request);
172 // Overrides the implementation of CreateForFrame() function below. Used by
173 // web tests to return a partial fake of RenderWidget.
174 static void InstallCreateForFrameHook(
175 CreateRenderWidgetFunction create_widget);
176
177 // Creates a RenderWidget that is meant to be associated with a RenderFrame.
178 // Testing infrastructure, such as test_runner, can override this function
179 // by calling InstallCreateForFrameHook().
180 static scoped_refptr<RenderWidget> CreateForFrame(
181 int32_t widget_routing_id,
182 CompositorDependencies* compositor_deps,
183 const ScreenInfo& screen_info,
184 blink::WebDisplayMode display_mode,
185 bool is_frozen,
186 bool hidden,
187 bool never_visible,
188 mojom::WidgetRequest widget_request);
189
190 // Creates a RenderWidget for a popup. This is separate from CreateForFrame()
191 // because popups do not not need to be faked out.
192 static scoped_refptr<RenderWidget> CreateForPopup(
193 int32_t widget_routing_id,
194 CompositorDependencies* compositor_deps,
195 const ScreenInfo& screen_info,
196 blink::WebDisplayMode display_mode,
197 bool is_frozen,
198 bool hidden,
199 bool never_visible,
200 mojom::WidgetRequest widget_request);
danakj6a816592018-09-25 18:30:56201
danakj25ec6e2b2018-09-26 17:01:31202 // Initialize a new RenderWidget for a popup. The |show_callback| is called
203 // when RenderWidget::Show() happens. This method increments the reference
Albert J. Wong2727e8a82019-02-15 16:56:11204 // count on the RenderWidget, making it self-referencing, which is then
205 // release when a WidgetMsg_Close IPC is received.
danakj25ec6e2b2018-09-26 17:01:31206 void InitForPopup(ShowCallback show_callback,
207 blink::WebPagePopup* web_page_popup);
initial.commit09911bf2008-07-26 23:55:29208
danakj6a816592018-09-25 18:30:56209 // Initialize a new RenderWidget that will be attached to a RenderFrame (via
210 // the WebFrameWidget), for a frame that is a local root, but not the main
211 // frame. This method increments the reference count on the RenderWidget,
212 // making it self-referencing, which can be released by calling Close().
213 void InitForChildLocalRoot(blink::WebFrameWidget* web_frame_widget);
lfg1568d112016-08-30 16:06:29214
Albert J. Wong7bbf22d2018-12-20 00:27:27215 // Sets a delegate to handle certain RenderWidget operations that need an
216 // escape to the RenderView. Also take ownership until RenderWidget lifetime
217 // has been reassociated with the RenderFrame. This is only set on Widgets
218 // that are associated with the RenderView.
219 // TODO(ajwong): Do not have RenderWidget own the delegate.
220 void set_delegate(std::unique_ptr<RenderWidgetDelegate> delegate) {
221 DCHECK(!delegate_);
222 delegate_ = std::move(delegate);
danakj53802692018-07-25 21:46:44223 }
Albert J. Wong7bbf22d2018-12-20 00:27:27224
225 RenderWidgetDelegate* delegate() const { return delegate_.get(); }
danakj53802692018-07-25 21:46:44226
Albert J. Wongcb004632018-07-10 22:58:25227 // Returns the RenderWidget for the given routing ID.
228 static RenderWidget* FromRoutingID(int32_t routing_id);
229
dchengda9b4bb2015-07-20 20:58:08230 // Closes a RenderWidget that was created by |CreateForFrame|.
danakja2c9d0a92018-07-25 20:01:18231 void CloseForFrame();
[email protected]484955942010-08-19 16:13:18232
nick8331f8ad2016-11-15 20:42:45233 int32_t routing_id() const { return routing_id_; }
fsamuele8326c742016-01-12 00:49:39234
danakj6e3bf8012014-12-16 18:27:53235 CompositorDependencies* compositor_deps() const { return compositor_deps_; }
Ken Buchananed449bb2018-02-01 21:02:05236
237 // This can return nullptr while the RenderWidget is closing.
danakja2c9d0a92018-07-25 20:01:18238 blink::WebWidget* GetWebWidget() const;
ekaramad2daaf672016-11-10 20:29:01239
240 // Returns the current instance of WebInputMethodController which is to be
241 // used for IME related tasks. This instance corresponds to the one from
242 // focused frame and can be nullptr.
243 blink::WebInputMethodController* GetInputMethodController() const;
244
mfomitchev2600fd7c2016-02-17 20:53:39245 const gfx::Size& size() const { return size_; }
mikhail.pozdnyakovf2c902a2015-04-14 08:09:12246 bool is_fullscreen_granted() const { return is_fullscreen_granted_; }
mikhail.pozdnyakovc0e251b2015-04-15 06:51:12247 blink::WebDisplayMode display_mode() const { return display_mode_; }
[email protected]204f1df2012-01-04 20:21:13248 bool is_hidden() const { return is_hidden_; }
[email protected]4ee64622014-03-21 22:34:15249 // Temporary for debugging purposes...
250 bool closing() const { return closing_; }
pwnallef669312017-01-07 01:17:29251 bool has_host_context_menu_location() const {
[email protected]be1af0662014-07-29 19:55:51252 return has_host_context_menu_location_;
253 }
pwnallef669312017-01-07 01:17:29254 gfx::Point host_context_menu_location() const {
[email protected]be1af0662014-07-29 19:55:51255 return host_context_menu_location_;
[email protected]4ee64622014-03-21 22:34:15256 }
Ken Buchananb2c9e262018-03-10 16:53:31257 const gfx::Size& visible_viewport_size() const {
258 return visible_viewport_size_;
259 }
[email protected]589621b2010-09-23 22:01:07260
danakj53802692018-07-25 21:46:44261 ScreenInfo screen_info() const { return screen_info_; }
262 void set_screen_info(const ScreenInfo& info) { screen_info_ = info; }
avi40b5be7a2016-03-03 21:13:44263
danakj6dcbc5962018-11-16 16:45:42264 // Sets whether this RenderWidget should be moved into or out of a frozen
265 // state. This state is used for the RenderWidget attached to a RenderViewImpl
266 // for its main frame, when there is no local main frame present.
267 // In this case, the RenderWidget can't be deleted currently but should
268 // otherwise act as if it is dead. Only whitelisted new IPC messages will be
269 // sent, and it does no compositing. The process is free to exit when there
270 // are no other unfrozen (thawed) RenderWidgets.
271 void SetIsFrozen(bool is_frozen);
272 bool is_frozen() const { return is_frozen_; }
alexmos78c9c0d2016-10-14 18:57:03273
danakjf87460792018-12-04 20:14:22274 // When a RenderWidget is created, even if frozen, if we expect to unfreeze
275 // and use the RenderWidget imminently, then we want to pre-emptively start
276 // the process of getting the resources needed for the compositor. This helps
277 // to parallelize the critical path to first pixels with the loading process.
278 // This should only be called when the RenderWidget is frozen, otherwise it
279 // would be redundant at best. Non-frozen RenderWidgets will start to warmup
280 // immediately on their own.
281 void WarmupCompositor();
282 // If after calling WarmupCompositor() we can determine that the RenderWidget
283 // does not expect to be used shortly after all, call this to cancel the
284 // warmup process and release any unused resources that had been created by
285 // it.
286 void AbortWarmupCompositor();
287
danakj678f0252018-11-09 21:46:34288 // This is true once a Close IPC has been received. The actual action of
289 // closing must be done on another stack frame, in case the IPC receipt
290 // is in a nested message loop and will unwind back up to javascript (from
291 // plugins). So this will be true between those two things, to avoid work
292 // when the RenderWidget will be closed.
293 // Additionally, as an optimization, this is true after we know the renderer
294 // has asked the browser to close this RenderWidget.
295 //
296 // TODO(crbug.com/545684): Once RenderViewImpl and RenderWidget are split,
297 // attempt to combine two states so the shutdown logic is cleaner.
298 bool is_closing() const { return host_will_close_this_ || closing_; }
299
alexmos56567492016-09-13 00:52:46300 // Manage edit commands to be used for the next keyboard event.
301 const EditCommands& edit_commands() const { return edit_commands_; }
302 void SetEditCommandForNextKeyEvent(const std::string& name,
303 const std::string& value);
304 void ClearEditCommands();
305
[email protected]bffc8302014-01-23 20:52:16306 // Functions to track out-of-process frames for special notifications.
[email protected]e3244ed2014-06-20 20:04:27307 void RegisterRenderFrameProxy(RenderFrameProxy* proxy);
308 void UnregisterRenderFrameProxy(RenderFrameProxy* proxy);
[email protected]bffc8302014-01-23 20:52:16309
[email protected]de3c5d82014-05-28 22:12:59310 // Functions to track all RenderFrame objects associated with this
311 // RenderWidget.
312 void RegisterRenderFrame(RenderFrameImpl* frame);
313 void UnregisterRenderFrame(RenderFrameImpl* frame);
314
Saman Samid189e5dfd2017-12-20 22:55:31315 // BrowserPlugins embedded by this RenderWidget register themselves here.
316 // These plugins need to be notified about changes to ScreenInfo.
317 void RegisterBrowserPlugin(BrowserPlugin* browser_plugin);
318 void UnregisterBrowserPlugin(BrowserPlugin* browser_plugin);
319
[email protected]c47317e2012-06-20 22:35:31320 // IPC::Listener
dcheng6d18e402014-10-21 12:32:52321 bool OnMessageReceived(const IPC::Message& msg) override;
initial.commit09911bf2008-07-26 23:55:29322
[email protected]c47317e2012-06-20 22:35:31323 // IPC::Sender
dcheng6d18e402014-10-21 12:32:52324 bool Send(IPC::Message* msg) override;
initial.commit09911bf2008-07-26 23:55:29325
danakja6c10012018-07-06 14:25:36326 // LayerTreeViewDelegate
David Bokanc8e38d02018-10-08 21:56:01327 void ApplyViewportChanges(const cc::ApplyViewportChangesArgs& args) override;
sahel1b47fda72017-03-28 17:03:07328 void RecordWheelAndTouchScrollingCount(bool has_scrolled_by_wheel,
329 bool has_scrolled_by_touch) override;
Sahel Sharify676580c2019-01-10 21:49:49330 void SendOverscrollEventFromImplSide(
331 const gfx::Vector2dF& overscroll_delta,
332 cc::ElementId scroll_latched_element_id) override;
333 void SendScrollEndEventFromImplSide(
334 cc::ElementId scroll_latched_element_id) override;
Daniel Cheng224569ee2018-04-25 05:45:06335 void BeginMainFrame(base::TimeTicks frame_time) override;
Stefan Zager148248c2019-02-20 23:24:08336 void DidBeginMainFrame() override;
danakjc7afae52017-06-20 21:12:41337 void RequestNewLayerTreeFrameSink(
danakja6c10012018-07-06 14:25:36338 LayerTreeFrameSinkCallback callback) override;
fsamuel78f86e42016-01-20 04:10:23339 void DidCommitAndDrawCompositorFrame() override;
340 void DidCommitCompositorFrame() override;
341 void DidCompletePageScaleAnimation() override;
Stephen Chenneyd56b5382019-01-29 00:37:02342 void RecordStartOfFrameMetrics() override;
Stephen Chenney9879a5c2018-09-26 14:21:42343 void RecordEndOfFrameMetrics(base::TimeTicks frame_begin_time) override;
Stephen Chenneyd56b5382019-01-29 00:37:02344 void UpdateVisualState() override;
fsamuel78f86e42016-01-20 04:10:23345 void WillBeginCompositorFrame() override;
Kent Tamura21d1de62018-12-10 04:45:20346 std::unique_ptr<cc::SwapPromise> RequestCopyOfOutputForWebTest(
Fady Samueldfecb7d2017-07-26 11:41:04347 std::unique_ptr<viz::CopyOutputRequest> request) override;
fsamuel78f86e42016-01-20 04:10:23348
fsamuel72464894f2015-12-15 06:59:31349 // RenderWidgetInputHandlerDelegate
350 void FocusChangeComplete() override;
Sandra Sunac5cdd832017-12-11 03:27:13351 void ObserveGestureEventAndResult(
352 const blink::WebGestureEvent& gesture_event,
353 const gfx::Vector2dF& unused_delta,
354 const cc::OverscrollBehavior& overscroll_behavior,
355 bool event_processed) override;
dtapuska1827dd22016-03-11 15:24:59356
fsamuel72464894f2015-12-15 06:59:31357 void OnDidHandleKeyEvent() override;
chongza8ba91fc2016-08-16 21:39:17358 void OnDidOverscroll(const ui::DidOverscrollParams& params) override;
fsamuele8326c742016-01-12 00:49:39359 void SetInputHandler(RenderWidgetInputHandler* input_handler) override;
changwan75e3b2072017-01-16 02:55:00360 void ShowVirtualKeyboard() override;
361 void UpdateTextInputState() override;
changwan62f57292017-02-17 08:28:25362 void ClearTextInputState() override;
fsamuel72464894f2015-12-15 06:59:31363 bool WillHandleGestureEvent(const blink::WebGestureEvent& event) override;
364 bool WillHandleMouseEvent(const blink::WebMouseEvent& event) override;
365
Scott Violet1098538e2017-10-05 19:23:33366 // RenderWidgetScreenMetricsEmulatorDelegate
Fady Samuel799e72192018-04-25 21:16:57367 void SynchronizeVisualProperties(
368 const VisualProperties& resize_params) override;
mfomitchev2600fd7c2016-02-17 20:53:39369 void SetScreenMetricsEmulationParameters(
370 bool enabled,
371 const blink::WebDeviceEmulationParams& params) override;
Albert J. Wong3c93c182018-09-27 17:29:43372 void SetScreenRects(const gfx::Rect& widget_screen_rect,
mfomitchev2600fd7c2016-02-17 20:53:39373 const gfx::Rect& window_screen_rect) override;
374
[email protected]180ef242013-11-07 06:50:46375 // blink::WebWidgetClient
danakj26b99912019-02-08 18:58:19376 void SetRootLayer(scoped_refptr<cc::Layer> layer) override;
danakj53f46b82018-12-11 20:55:55377 void ScheduleAnimation() override;
danakjefcb8432019-01-16 18:47:14378 void SetShowFPSCounter(bool show) override;
danakje691e852019-01-16 22:49:04379 void SetShowPaintRects(bool) override;
380 void SetShowDebugBorders(bool) override;
381 void SetShowScrollBottleneckRects(bool) override;
382 void SetShowHitTestBorders(bool) override;
Chris Harrelsond7ab99b2018-01-24 17:51:36383 void IntrinsicSizingInfoChanged(
384 const blink::WebIntrinsicSizingInfo&) override;
Blink Reformat1c4d759e2017-04-09 16:34:54385 void DidMeaningfulLayout(blink::WebMeaningfulLayout layout_type) override;
386 void DidChangeCursor(const blink::WebCursorInfo&) override;
aelias5971e47d2017-06-16 02:39:38387 void AutoscrollStart(const blink::WebFloatPoint& point) override;
388 void AutoscrollFling(const blink::WebFloatSize& velocity) override;
389 void AutoscrollEnd() override;
Blink Reformat1c4d759e2017-04-09 16:34:54390 void CloseWidgetSoon() override;
391 void Show(blink::WebNavigationPolicy) override;
392 blink::WebRect WindowRect() override;
393 blink::WebRect ViewRect() override;
394 void SetToolTipText(const blink::WebString& text,
avi5c77d212015-09-25 20:08:25395 blink::WebTextDirection hint) override;
Blink Reformat1c4d759e2017-04-09 16:34:54396 void SetWindowRect(const blink::WebRect&) override;
Blink Reformat1c4d759e2017-04-09 16:34:54397 void DidHandleGestureEvent(const blink::WebGestureEvent& event,
avi5c77d212015-09-25 20:08:25398 bool event_cancelled) override;
Blink Reformat1c4d759e2017-04-09 16:34:54399 void DidOverscroll(const blink::WebFloatSize& overscrollDelta,
bokane53a10f2016-04-13 23:48:31400 const blink::WebFloatSize& accumulatedOverscroll,
avi5c77d212015-09-25 20:08:25401 const blink::WebFloatPoint& position,
sunyunjiabbea8a92017-08-31 11:18:54402 const blink::WebFloatSize& velocity,
danakje819b622018-05-01 20:27:14403 const cc::OverscrollBehavior& behavior) override;
Blink Reformat1c4d759e2017-04-09 16:34:54404 void ShowVirtualKeyboardOnElementFocus() override;
405 void ConvertViewportToWindow(blink::WebRect* rect) override;
406 void ConvertWindowToViewport(blink::WebFloatRect* rect) override;
407 bool RequestPointerLock() override;
408 void RequestPointerUnlock() override;
409 bool IsPointerLocked() override;
Richard Li49fe04d2018-10-21 09:07:19410 void StartDragging(network::mojom::ReferrerPolicy policy,
paulmeyer6ef5a792016-11-08 20:33:58411 const blink::WebDragData& data,
412 blink::WebDragOperationsMask mask,
danakj0c75ad82018-07-10 19:50:12413 const SkBitmap& drag_image,
danakjef1735a2018-11-13 19:34:44414 const gfx::Point& image_offset) override;
danakj53802692018-07-25 21:46:44415 void SetTouchAction(cc::TouchAction touch_action) override;
416 void RequestUnbufferedInputEvents() override;
Navid Zolghadr8fdb6114e2018-08-29 19:00:54417 void HasPointerRawMoveEventHandlers(bool has_handlers) override;
danakj53802692018-07-25 21:46:44418 void HasTouchEventHandlers(bool has_handlers) override;
419 void SetNeedsLowLatencyInput(bool) override;
Pavel Feldman6708eefa2019-01-17 03:14:32420 void SetNeedsUnbufferedInputForDebugger(bool) override;
W. James MacLeand973a55b2018-11-29 21:39:13421 void AnimateDoubleTapZoomInMainFrame(const blink::WebPoint& point,
422 const blink::WebRect& bounds) override;
W. James MacLean5372eb72018-12-19 12:56:36423 void ZoomToFindInPageRectInMainFrame(
424 const blink::WebRect& rect_to_zoom) override;
[email protected]4873c7d2009-07-16 06:36:28425
fsamuel72464894f2015-12-15 06:59:31426 // Override point to obtain that the current input method state and caret
427 // position.
danakja2c9d0a92018-07-25 20:01:18428 ui::TextInputType GetTextInputType();
fsamuel72464894f2015-12-15 06:59:31429
danakj4b347212018-07-04 17:55:17430 static cc::LayerTreeSettings GenerateLayerTreeSettings(
431 CompositorDependencies* compositor_deps,
432 bool is_for_subframe,
433 const gfx::Size& initial_screen_size,
434 float initial_device_scale_factor);
danakj4b347212018-07-04 17:55:17435 static cc::ManagedMemoryPolicy GetGpuMemoryPolicy(
436 const cc::ManagedMemoryPolicy& policy,
437 const gfx::Size& initial_screen_size,
438 float initial_device_scale_factor);
439
danakja6c10012018-07-06 14:25:36440 LayerTreeView* layer_tree_view() const { return layer_tree_view_.get(); }
Dave Tapuska9db80842017-07-24 17:24:26441 WidgetInputHandlerManager* widget_input_handler_manager() {
442 return widget_input_handler_manager_.get();
443 }
fsamuel72464894f2015-12-15 06:59:31444 const RenderWidgetInputHandler& input_handler() const {
fsamuele8326c742016-01-12 00:49:39445 return *input_handler_;
fsamuel72464894f2015-12-15 06:59:31446 }
447
danakj53802692018-07-25 21:46:44448 void SetHandlingInputEvent(bool handling_input_event);
449
danakj2c1589f2019-01-25 23:35:07450 // Queues the IPC |message| to be sent to the browser, delaying sending until
451 // the next compositor frame submission. At that time they will be sent before
452 // any message from the compositor as part of submitting its frame. This is
453 // used for messages that need synchronization with the compositor, but in
454 // general you should use Send().
455 //
[email protected]586871b2014-07-22 17:05:11456 // This mechanism is not a drop-in replacement for IPC: messages sent this way
457 // will not be automatically available to BrowserMessageFilter, for example.
Sadrul Habib Chowdhury4e0335cf2018-07-31 20:08:49458 // FIFO ordering is preserved between messages enqueued.
[email protected]586871b2014-07-22 17:05:11459 //
460 // |msg| message to send, ownership of |msg| is transferred.
Sadrul Habib Chowdhury4e0335cf2018-07-31 20:08:49461 void QueueMessage(IPC::Message* msg);
[email protected]586871b2014-07-22 17:05:11462
changwanf2a707b2015-10-30 08:22:16463 // Handle start and finish of IME event guard.
464 void OnImeEventGuardStart(ImeEventGuard* guard);
465 void OnImeEventGuardFinish(ImeEventGuard* guard);
[email protected]66fca5bc2013-05-23 06:58:29466
danakj53802692018-07-25 21:46:44467 void ApplyEmulatedScreenMetricsForPopupWidget(RenderWidget* origin_widget);
[email protected]b2e4c70132013-10-03 02:07:51468
[email protected]2d6836f42014-07-02 17:25:31469 gfx::Rect AdjustValidationMessageAnchor(const gfx::Rect& anchor);
[email protected]b2e4c70132013-10-03 02:07:51470
[email protected]7a4e2532013-12-02 21:30:02471 // Checks if the selection bounds have been changed. If they are changed,
472 // the new value will be sent to the browser process.
473 void UpdateSelectionBounds();
474
danakja2c9d0a92018-07-25 20:01:18475 void GetSelectionBounds(gfx::Rect* start, gfx::Rect* end);
[email protected]e5e438d62014-03-27 21:47:16476
[email protected]a09d53ce2014-01-31 00:46:42477 void OnShowHostContextMenu(ContextMenuParams* params);
[email protected]7a4e2532013-12-02 21:30:02478
[email protected]7a4e2532013-12-02 21:30:02479 // Checks if the composition range or composition character bounds have been
480 // changed. If they are changed, the new value will be sent to the browser
yukawa5f21c6a2014-10-27 17:09:30481 // process. This method does nothing when the browser process is not able to
482 // handle composition range and composition character bounds.
nonafa291792016-08-10 02:36:18483 // If immediate_request is true, render sends the latest composition info to
484 // the browser even if the composition info is not changed.
485 void UpdateCompositionInfo(bool immediate_request);
[email protected]7a4e2532013-12-02 21:30:02486
danakja2c9d0a92018-07-25 20:01:18487 // Override point to obtain that the current composition character bounds.
488 // In the case of surrogate pairs, the character is treated as two characters:
489 // the bounds for first character is actual one, and the bounds for second
490 // character is zero width rectangle.
491 void GetCompositionCharacterBounds(std::vector<gfx::Rect>* character_bounds);
492
lfgb00fcad2016-07-14 14:16:33493 // Called when the Widget has changed size as a result of an auto-resize.
494 void DidAutoResize(const gfx::Size& new_size);
495
Albert J. Wongcb004632018-07-10 22:58:25496 void DidPresentForceDrawFrame(int snapshot_id,
497 const gfx::PresentationFeedback& feedback);
498
lfge0c2792ec2016-05-11 18:52:08499 // Indicates whether this widget has focus.
500 bool has_focus() const { return has_focus_; }
501
pwnallef669312017-01-07 01:17:29502 MouseLockDispatcher* mouse_lock_dispatcher() const {
lfgbee1e0a2016-06-08 21:24:21503 return mouse_lock_dispatcher_.get();
504 }
505
Fady Samuela863f152018-03-09 16:10:03506 // Returns the ScreenInfo exposed to Blink. In device emulation, this
507 // may not match the compositor ScreenInfo.
508 const ScreenInfo& GetWebScreenInfo() const;
Christopher Camerone9a30c12018-03-07 08:23:38509
Fady Samuela863f152018-03-09 16:10:03510 // When emulated, this returns the original (non-emulated) ScreenInfo.
511 const ScreenInfo& GetOriginalScreenInfo() const;
lfg1f9011c2016-08-17 21:18:42512
paulmeyer90f6c31d2016-11-12 00:17:59513 // Helper to convert |point| using ConvertWindowToViewport().
Ella Ge80a52dce2017-11-15 18:01:52514 gfx::PointF ConvertWindowPointToViewport(const gfx::PointF& point);
paulmeyer90f6c31d2016-11-12 00:17:59515 gfx::Point ConvertWindowPointToViewport(const gfx::Point& point);
kenrb5d78b842017-03-06 21:06:01516 uint32_t GetContentSourceId();
Saman Samif7731342018-01-24 22:18:44517 void DidNavigate();
kenrb5d78b842017-03-06 21:06:01518
Fady Samuele62be402018-03-29 03:19:53519 bool auto_resize_mode() const { return auto_resize_mode_; }
520
Fady Samuele62be402018-03-29 03:19:53521 const gfx::Size& min_size_for_auto_resize() const {
522 return min_size_for_auto_resize_;
523 }
524
525 const gfx::Size& max_size_for_auto_resize() const {
526 return max_size_for_auto_resize_;
527 }
Vladimir Levin98d76dad2018-04-21 00:21:29528
529 uint32_t capture_sequence_number() const {
530 return last_capture_sequence_number_;
531 }
532
dtapuska9ec1a912017-04-21 15:18:31533 // MainThreadEventQueueClient overrides.
danakj327a4fe2019-01-26 00:00:35534 bool HandleInputEvent(const blink::WebCoalescedInputEvent& input_event,
535 const ui::LatencyInfo& latency_info,
536 HandledEventCallback callback) override;
dtapuska9ec1a912017-04-21 15:18:31537 void SetNeedsMainFrame() override;
538
Xianzhu Wangf02017ac2018-10-17 01:47:33539 viz::FrameSinkId GetFrameSinkIdAtPoint(const gfx::PointF& point,
Ken Buchanan44d7e2f2018-08-23 14:18:05540 gfx::PointF* local_point);
Navid Zolghadr0d86e5f2017-10-23 18:09:22541
danakj327a4fe2019-01-26 00:00:35542 // Widget mojom overrides.
Dave Tapuska139a72f2017-09-06 21:57:03543 void SetupWidgetInputHandler(mojom::WidgetInputHandlerRequest request,
544 mojom::WidgetInputHandlerHostPtr host) override;
dtapuska9ec1a912017-04-21 15:18:31545
dtapuska9d46ef7d2017-05-26 19:06:06546 scoped_refptr<MainThreadEventQueue> GetInputEventQueue();
547
Albert J. Wongcb004632018-07-10 22:58:25548 void OnSetActive(bool active);
danakja2c9d0a92018-07-25 20:01:18549 void OnSetFocus(bool enable);
Dave Tapuska9db80842017-07-24 17:24:26550 void OnMouseCaptureLost();
551 void OnCursorVisibilityChange(bool is_visible);
552 void OnSetEditCommandsForNextKeyEvent(const EditCommands& edit_commands);
553 void OnImeSetComposition(
554 const base::string16& text,
Ryan Landay9e42fd742017-08-12 01:59:11555 const std::vector<blink::WebImeTextSpan>& ime_text_spans,
Dave Tapuska9db80842017-07-24 17:24:26556 const gfx::Range& replacement_range,
557 int selection_start,
558 int selection_end);
Ryan Landay9e42fd742017-08-12 01:59:11559 void OnImeCommitText(const base::string16& text,
560 const std::vector<blink::WebImeTextSpan>& ime_text_spans,
561 const gfx::Range& replacement_range,
562 int relative_cursor_pos);
Dave Tapuska9db80842017-07-24 17:24:26563 void OnImeFinishComposingText(bool keep_selection);
564
danakja2c9d0a92018-07-25 20:01:18565 // This does the actual focus change, but is called in more situations than
566 // just as an IPC message.
567 void SetFocus(bool enable);
568
Dave Tapuska9db80842017-07-24 17:24:26569 // Called by the browser process to update text input state.
570 void OnRequestTextInputStateUpdate();
571
572 // Called by the browser process to update the cursor and composition
Dave Tapuska04bc5ee92018-04-17 19:03:31573 // information by sending WidgetInputHandlerHost::ImeCompositionRangeChanged.
574 // If |immediate_request| is true, an IPC is sent back with current state.
Dave Tapuska9db80842017-07-24 17:24:26575 // When |monitor_update| is true, then RenderWidget will send the updates
576 // in each compositor frame when there are changes. Outside of compositor
577 // frame updates, a change in text selection might also lead to an update for
578 // composition info (when in monitor mode).
579 void OnRequestCompositionUpdates(bool immediate_request,
580 bool monitor_updates);
Dave Tapuska485aca92017-08-08 00:47:58581 void SetWidgetBinding(mojom::WidgetRequest request);
Dave Tapuska9db80842017-07-24 17:24:26582
Ken Buchanan94c0beb62018-06-22 19:56:24583 void SetMouseCapture(bool capture);
584
Fady Samuelca9ecb72018-05-05 05:59:27585 bool IsSurfaceSynchronizationEnabled() const;
586
W. James MacLean2a90bff2018-11-05 20:52:47587 void PageScaleFactorChanged(float page_scale_factor);
588
danakj53802692018-07-25 21:46:44589 void UseSynchronousResizeModeForTesting(bool enable);
danakja2c9d0a92018-07-25 20:01:18590 void SetDeviceScaleFactorForTesting(float factor);
591 void SetDeviceColorSpaceForTesting(const gfx::ColorSpace& color_space);
592 void SetWindowRectSynchronouslyForTesting(const gfx::Rect& new_window_rect);
593 void EnableAutoResizeForTesting(const gfx::Size& min_size,
594 const gfx::Size& max_size);
595 void DisableAutoResizeForTesting(const gfx::Size& new_size);
596
Albert J. Wong7bbf22d2018-12-20 00:27:27597 // Update the WebView's device scale factor.
598 // TODO(ajwong): This should be moved into RenderView.
599 void UpdateWebViewWithDeviceScaleFactor();
Saman Sami50d1e0c2018-03-13 20:03:49600
Albert J. Wong7bbf22d2018-12-20 00:27:27601 // RenderWidget IPC message handler that can be overridden by subclasses.
602 virtual void OnSynchronizeVisualProperties(const VisualProperties& params);
initial.commit09911bf2008-07-26 23:55:29603
nick4df698d82016-11-11 20:39:23604 // Called by Create() functions and subclasses to finish initialization.
danakj53802692018-07-25 21:46:44605 // |show_callback| will be invoked once WebWidgetClient::Show() occurs, and
606 // should be null if Show() won't be triggered for this widget.
Scott Violetae08f332018-07-27 17:37:23607 void Init(ShowCallback show_callback, blink::WebWidget* web_widget);
[email protected]484955942010-08-19 16:13:18608
Albert J. Wong7bbf22d2018-12-20 00:27:27609 base::WeakPtr<RenderWidget> AsWeakPtr();
610
611 protected:
Albert J. Wong2727e8a82019-02-15 16:56:11612 // An Init*() method must be called after creating a RenderWidget, which will
613 // make the RenderWidget self-referencing. Then it can be deleted by calling
614 // by calling OnClose().
615 RenderWidget(int32_t widget_routing_id,
616 CompositorDependencies* compositor_deps,
617 const ScreenInfo& screen_info,
618 blink::WebDisplayMode display_mode,
619 bool is_frozen,
620 bool hidden,
621 bool never_visible,
622 mojom::WidgetRequest widget_request);
Albert J. Wong7bbf22d2018-12-20 00:27:27623 ~RenderWidget() override;
danakj53802692018-07-25 21:46:44624
625 // Close the underlying WebWidget and stop the compositor.
626 virtual void Close();
627
628 // Notify subclasses that we initiated the paint operation.
629 virtual void DidInitiatePaint() {}
630
danakj53802692018-07-25 21:46:44631 private:
632 // Friend RefCounted so that the dtor can be non-public. Using this class
633 // without ref-counting is an error.
634 friend class base::RefCounted<RenderWidget>;
635
636 // TODO(nasko): Temporarily friend RenderFrameImpl for WasSwappedOut(),
637 // while we move frame specific code away from RenderViewImpl/RenderWidget.
638 friend class RenderFrameImpl;
639
640 // For unit tests.
641 friend class InteractiveRenderWidget;
642 friend class PopupRenderWidget;
643 friend class QueueMessageSwapPromiseTest;
644 friend class RenderWidgetTest;
Albert J. Wong7bbf22d2018-12-20 00:27:27645 friend class RenderViewImplTest; // TODO(ajwong): Can this be removed?
danakj53802692018-07-25 21:46:44646 FRIEND_TEST_ALL_PREFIXES(RenderWidgetPopupUnittest, EmulatingPopupRect);
danakja2c9d0a92018-07-25 20:01:18647
Hajime Hoshi315a61f2018-08-14 17:27:28648 static scoped_refptr<base::SingleThreadTaskRunner> GetCleanupTaskRunner();
649
danakjde8b7482018-11-15 23:45:02650 // Creates the compositor, but leaves it in a stopped state, where it will
651 // not set up IPC channels or begin trying to produce frames until started
danakj953af052019-02-06 19:13:18652 // via StartStopCompositor().
danakj17216f4d2018-10-16 22:57:32653 LayerTreeView* InitializeLayerTreeView();
654
danakj953af052019-02-06 19:13:18655 // If appropriate, initiates the compositor to set up IPC channels and begin
656 // its scheduler. Otherwise, pauses the scheduler and tears down its IPC
657 // channels.
658 void StartStopCompositor();
danakjde8b7482018-11-15 23:45:02659
danakj953af052019-02-06 19:13:18660 // Request the window to close from the renderer by sending the request to the
661 // browser.
[email protected]2533ce12009-05-09 00:02:24662 void DoDeferredClose();
dchengda9b4bb2015-07-20 20:58:08663
bokanc63441c2016-04-27 15:49:12664 gfx::Size GetSizeForWebWidget() const;
danakja2c9d0a92018-07-25 20:01:18665 void ResizeWebWidget();
bokanc63441c2016-04-27 15:49:12666
danakj0d963bd2019-02-20 18:00:46667 // Helper method to get the device_viewport_size() from the compositor, which
668 // is always in physical pixels.
669 gfx::Size CompositorViewportSize() const;
670
Ken Buchananed449bb2018-02-01 21:02:05671 // Just Close the WebWidget, in cases where the Close() will be deferred.
672 // It is safe to call this multiple times, which happens in the case of
673 // frame widgets beings closed, since subsequent calls are ignored.
674 void CloseWebWidget();
675
thakis18e426412017-03-15 12:06:37676#if BUILDFLAG(USE_EXTERNAL_POPUP_MENU)
Albert J. Wong7bbf22d2018-12-20 00:27:27677 void SetExternalPopupOriginAdjustmentsForEmulation(ExternalPopupMenu* popup);
[email protected]53907862014-03-25 15:42:40678#endif
[email protected]61e2b3cc2012-03-02 16:13:34679
danakj53802692018-07-25 21:46:44680 // RenderWidget IPC message handlers.
nzolghadr5d8596502017-01-23 22:59:35681 void OnHandleInputEvent(
682 const blink::WebInputEvent* event,
683 const std::vector<const blink::WebInputEvent*>& coalesced_events,
684 const ui::LatencyInfo& latency_info,
685 InputEventDispatchType dispatch_type);
naskoc288745f2015-05-01 22:54:21686 void OnClose();
[email protected]fc4404d2012-11-07 19:53:30687 void OnCreatingNewAck();
dgozman9260b0a12015-03-16 13:45:20688 void OnEnableDeviceEmulation(const blink::WebDeviceEmulationParams& params);
689 void OnDisableDeviceEmulation();
danakja2c9d0a92018-07-25 20:01:18690 void OnWasHidden();
Saman Samie61e5c032018-11-05 22:11:44691 void OnWasShown(base::TimeTicks show_request_timestamp, bool was_evicted);
avi1023d012015-12-25 02:39:14692 void OnCreateVideoAck(int32_t video_id);
693 void OnUpdateVideoAck(int32_t video_id);
Avi Drissman014dec72018-06-07 02:34:01694 void OnRequestSetBoundsAck();
Albert J. Wongcb004632018-07-10 22:58:25695 void OnForceRedraw(int snapshot_id);
danakja2c9d0a92018-07-25 20:01:18696 void OnShowContextMenu(ui::MenuSourceType source_type,
697 const gfx::Point& location);
oshimad5279032015-12-16 18:22:33698
[email protected]180ef242013-11-07 06:50:46699 void OnSetTextDirection(blink::WebTextDirection direction);
[email protected]872ae5b2011-05-26 20:20:50700 void OnGetFPS();
Albert J. Wong3c93c182018-09-27 17:29:43701 void OnUpdateScreenRects(const gfx::Rect& widget_screen_rect,
[email protected]80ad8622012-11-07 16:33:03702 const gfx::Rect& window_screen_rect);
Ken Buchananb2c9e262018-03-10 16:53:31703 void OnSetViewportIntersection(const gfx::Rect& viewport_intersection,
Stefan Zager54e25832018-08-14 22:15:31704 const gfx::Rect& compositor_visible_rect,
705 bool occluded_or_obscured);
kenrb04323782017-06-23 01:23:32706 void OnSetIsInert(bool);
sunxd540a9962018-05-24 22:51:06707 void OnSetInheritedEffectiveTouchAction(cc::TouchAction touch_action);
Ken Buchanan8a319fb2017-11-15 18:37:12708 void OnUpdateRenderThrottlingStatus(bool is_throttled,
709 bool subtree_throttled);
paulmeyer90f6c31d2016-11-12 00:17:59710 void OnDragTargetDragEnter(
711 const std::vector<DropData::Metadata>& drop_meta_data,
Ella Ge80a52dce2017-11-15 18:01:52712 const gfx::PointF& client_pt,
713 const gfx::PointF& screen_pt,
paulmeyer90f6c31d2016-11-12 00:17:59714 blink::WebDragOperationsMask operations_allowed,
715 int key_modifiers);
Ella Ge80a52dce2017-11-15 18:01:52716 void OnDragTargetDragOver(const gfx::PointF& client_pt,
717 const gfx::PointF& screen_pt,
paulmeyer90f6c31d2016-11-12 00:17:59718 blink::WebDragOperationsMask operations_allowed,
719 int key_modifiers);
Ella Ge80a52dce2017-11-15 18:01:52720 void OnDragTargetDragLeave(const gfx::PointF& client_point,
721 const gfx::PointF& screen_point);
paulmeyer90f6c31d2016-11-12 00:17:59722 void OnDragTargetDrop(const DropData& drop_data,
Ella Ge80a52dce2017-11-15 18:01:52723 const gfx::PointF& client_pt,
724 const gfx::PointF& screen_pt,
paulmeyer90f6c31d2016-11-12 00:17:59725 int key_modifiers);
Ella Ge80a52dce2017-11-15 18:01:52726 void OnDragSourceEnded(const gfx::PointF& client_point,
727 const gfx::PointF& screen_point,
paulmeyer8fc8ea92016-11-15 05:12:21728 blink::WebDragOperation drag_operation);
729 void OnDragSourceSystemDragEnded();
lfg8d649cc2017-04-28 18:04:30730 void OnOrientationChange();
danakj53802692018-07-25 21:46:44731 void OnWaitNextFrameForTests(int routing_id);
[email protected]65225772011-05-12 21:10:24732
danakj14e00a8322019-02-07 17:12:06733 // Sets the "hidden" state of this widget. All modification of is_hidden_
734 // should use this method so that we can properly inform the RenderThread of
735 // our state.
[email protected]bee16aab2009-08-26 15:55:03736 void SetHidden(bool hidden);
737
danakjf9284772019-01-23 18:29:14738 // Sets the fullscreen state for the WebView.
739 // TODO(danakj): This is currently located on RenderWidget but is a page/view
740 // state, and should move to RenderView.
741 void SetIsFullscreen(bool fullscreen);
[email protected]2b624c562011-10-27 22:58:26742
Ken Buchananb2c9e262018-03-10 16:53:31743 // Returns a rect that the compositor needs to raster. For a main frame this
Darwin Huang2c485f8e2018-10-12 21:06:00744 // is always the entire viewport, but for out-of-process iframes this can be
Ken Buchananb2c9e262018-03-10 16:53:31745 // constrained to limit overdraw.
746 gfx::Rect ViewportVisibleRect();
747
[email protected]586871b2014-07-22 17:05:11748 // QueueMessage implementation extracted into a static method for easy
749 // testing.
dchengcedca5612016-04-09 01:40:15750 static std::unique_ptr<cc::SwapPromise> QueueMessageImpl(
[email protected]586871b2014-07-22 17:05:11751 IPC::Message* msg,
[email protected]586871b2014-07-22 17:05:11752 FrameSwapMessageQueue* frame_swap_message_queue,
753 scoped_refptr<IPC::SyncMessageFilter> sync_message_filter,
[email protected]586871b2014-07-22 17:05:11754 int source_frame_number);
755
[email protected]88dbe32f2013-06-20 23:31:36756 // Returns the range of the text that is being composed or the selection if
757 // the composition does not exist.
danakja2c9d0a92018-07-25 20:01:18758 void GetCompositionRange(gfx::Range* range);
[email protected]88dbe32f2013-06-20 23:31:36759
[email protected]58b48a0d2012-06-13 07:01:35760 // Returns true if the composition range or composition character bounds
761 // should be sent to the browser process.
762 bool ShouldUpdateCompositionInfo(
[email protected]db4fc1e2013-09-06 20:01:51763 const gfx::Range& range,
[email protected]58b48a0d2012-06-13 07:01:35764 const std::vector<gfx::Rect>& bounds);
765
[email protected]ad26ef42011-06-17 07:59:45766 // Override point to obtain that the current input method state about
767 // composition text.
danakja2c9d0a92018-07-25 20:01:18768 bool CanComposeInline();
[email protected]56ea1a62011-05-30 07:05:57769
[email protected]2533ce12009-05-09 00:02:24770 // Set the pending window rect.
771 // Because the real render_widget is hosted in another process, there is
772 // a time period where we may have set a new window rect which has not yet
773 // been processed by the browser. So we maintain a pending window rect
774 // size. If JS code sets the WindowRect, and then immediately calls
775 // GetWindowRect() we'll use this pending window rect as the size.
[email protected]180ef242013-11-07 06:50:46776 void SetPendingWindowRect(const blink::WebRect& r);
[email protected]2533ce12009-05-09 00:02:24777
danakj53802692018-07-25 21:46:44778 // TODO(ekaramad): This method should not be confused with its RenderView
779 // variant, GetWebFrameWidget(). Currently Cast and AndroidWebview's
780 // ContentRendererClients are the only users of the public variant. The public
781 // method will eventually be removed from RenderView and uses of the method
782 // will obtain WebFrameWidget from WebLocalFrame.
783 // Returns the WebFrameWidget associated with this RenderWidget if any.
784 // Returns nullptr if GetWebWidget() returns nullptr or returns a WebWidget
785 // that is not a WebFrameWidget. A WebFrameWidget only makes sense when there
786 // a local root associated with it. RenderWidgetFullscreenPepper and a swapped
787 // out RenderWidgets are amongst the cases where this method returns nullptr.
788 blink::WebFrameWidget* GetFrameWidget() const;
[email protected]ce6689f2013-03-29 12:52:55789
danakj53802692018-07-25 21:46:44790 // Applies/Removes the DevTools device emulation transformation to/from a
791 // window rect.
792 void ScreenRectToEmulatedIfNeeded(blink::WebRect* window_rect) const;
793 void EmulatedToScreenRectIfNeeded(blink::WebRect* window_rect) const;
Dave Tapuskadfe486c12017-06-09 16:53:13794
danakj53802692018-07-25 21:46:44795 void UpdateSurfaceAndScreenInfo(
Fady Samuel1c1ad3692018-11-06 23:28:40796 const viz::LocalSurfaceIdAllocation& new_local_surface_id_allocation,
danakj9c4e7b812019-02-19 22:04:27797 const gfx::Size& compositor_viewport_pixel_size,
danakj53802692018-07-25 21:46:44798 const ScreenInfo& new_screen_info);
[email protected]5d0bbdfa92013-12-10 00:35:51799
Kent Tamura21d1de62018-12-10 04:45:20800 // Used to force the size of a window when running web tests.
danakj53802692018-07-25 21:46:44801 void SetWindowRectSynchronously(const gfx::Rect& new_window_rect);
802
803 void UpdateCaptureSequenceNumber(uint32_t capture_sequence_number);
804
805 // A variant of Send but is fatal if it fails. The browser may
806 // be waiting for this IPC Message and if the send fails the browser will
807 // be left in a state waiting for something that never comes. And if it
808 // never comes then it may later determine this is a hung renderer; so
809 // instead fail right away.
810 void SendOrCrash(IPC::Message* msg);
811
812 // Determines whether or not RenderWidget should process IME events from the
813 // browser. It always returns true unless there is no WebFrameWidget to
814 // handle the event, or there is no page focus.
815 bool ShouldHandleImeEvents() const;
816
817 void UpdateTextInputStateInternal(bool show_virtual_keyboard,
818 bool reply_to_request);
819
820 gfx::ColorSpace GetRasterColorSpace() const;
821
danakj53802692018-07-25 21:46:44822 void UpdateZoom(double zoom_level);
823
824#if BUILDFLAG(ENABLE_PLUGINS)
825 // Returns the focused pepper plugin, if any, inside the WebWidget. That is
826 // the pepper plugin which is focused inside a frame which belongs to the
827 // local root associated with this RenderWidget.
828 PepperPluginInstanceImpl* GetFocusedPepperPluginInsideWidget();
829#endif
830 void RecordTimeToFirstActivePaint();
831
danakj53802692018-07-25 21:46:44832 // This method returns the WebLocalFrame which is currently focused and
833 // belongs to the frame tree associated with this RenderWidget.
834 blink::WebLocalFrame* GetFocusedWebLocalFrameInWidget() const;
lfg43e08e62016-02-03 18:51:37835
danakjf87460792018-12-04 20:14:22836 // Called with the resulting frame sink from WarmupCompositor() since frame
837 // sink creation can be asynchronous.
838 void OnReplyForWarmupCompositor(std::unique_ptr<cc::LayerTreeFrameSink> sink);
839
840 // Common code shared to execute the creation of a LayerTreeFrameSink, shared
841 // by the warmup and standard request paths. Callers should verify they really
842 // want to do this before calling it as this method does no verification.
843 void DoRequestNewLayerTreeFrameSink(LayerTreeFrameSinkCallback callback);
844
danakj89ae4532018-12-12 22:52:55845 // Whether this widget is for a frame. This excludes widgets that are not for
846 // a frame (eg popups, pepper), but includes both the main frame
Albert J. Wong7bbf22d2018-12-20 00:27:27847 // (via delegate_) and subframes (via for_child_local_root_frame_).
848 bool for_frame() const { return delegate_ || for_child_local_root_frame_; }
danakj89ae4532018-12-12 22:52:55849
initial.commit09911bf2008-07-26 23:55:29850 // Routing ID that allows us to communicate to the parent browser process
nick8331f8ad2016-11-15 20:42:45851 // RenderWidgetHost.
852 const int32_t routing_id_;
initial.commit09911bf2008-07-26 23:55:29853
danakj6e3bf8012014-12-16 18:27:53854 // Dependencies for initializing a compositor, including flags for optional
855 // features.
dcheng35d31c112015-07-22 00:17:36856 CompositorDependencies* const compositor_deps_;
danakj6e3bf8012014-12-16 18:27:53857
lfg8ff33912016-09-13 20:59:21858 // Use GetWebWidget() instead of using webwidget_internal_ directly.
[email protected]c5b3b5e2009-02-13 06:41:11859 // We are responsible for destroying this object via its Close method.
[email protected]4ee64622014-03-21 22:34:15860 // May be NULL when the window is closing.
lfg8ff33912016-09-13 20:59:21861 blink::WebWidget* webwidget_internal_;
initial.commit09911bf2008-07-26 23:55:29862
Albert J. Wong7bbf22d2018-12-20 00:27:27863 // The delegate for this object which is just a RenderViewImpl.
864 std::unique_ptr<RenderWidgetDelegate> delegate_;
avi40b5be7a2016-03-03 21:13:44865
[email protected]8926c602013-01-23 05:32:06866 // This is lazily constructed and must not outlive webwidget_.
danakja6c10012018-07-06 14:25:36867 std::unique_ptr<LayerTreeView> layer_tree_view_;
[email protected]8926c602013-01-23 05:32:06868
bokanc007c3a2015-02-03 07:15:56869 // The rect where this view should be initially shown.
870 gfx::Rect initial_rect_;
initial.commit09911bf2008-07-26 23:55:29871
danakjb4cec102019-01-30 19:22:13872 // Web tests override the device scale factor in the renderer with this. We
873 // store it to keep the override if the browser passes along VisualProperties
874 // with the real device scale factor. A value of 0.f means this is ignored.
875 float device_scale_factor_for_testing_ = 0.f;
danakja2c9d0a92018-07-25 20:01:18876
danakj9c4e7b812019-02-19 22:04:27877 // The size of the RenderWidget in DIPs. This may differ from the viewport
878 // set in the compositor, as the viewport can be a subset of the RenderWidget
879 // in such cases as:
880 // - When (hiding-on-scroll) top and bottom controls are present.
881 // - Rounding issues with OOPIFs (??).
initial.commit09911bf2008-07-26 23:55:29882 gfx::Size size_;
883
Christopher Cameronbe7ecea2018-02-27 00:47:19884 // The size of the visible viewport in pixels.
[email protected]bb6378fe2014-04-28 21:19:44885 gfx::Size visible_viewport_size_;
886
[email protected]847a2582013-03-09 02:29:51887 // Whether the WebWidget is in auto resize mode, which is used for example
888 // by extension popups.
889 bool auto_resize_mode_;
890
Fady Samuele62be402018-03-29 03:19:53891 // The minimum size to use for auto-resize.
892 gfx::Size min_size_for_auto_resize_;
893
894 // The maximum size to use for auto-resize.
895 gfx::Size max_size_for_auto_resize_;
896
initial.commit09911bf2008-07-26 23:55:29897 // Indicates that we shouldn't bother generated paint events.
898 bool is_hidden_;
899
[email protected]7912e822014-04-16 02:37:03900 // Indicates that we are never visible, so never produce graphical output.
sievers71c62dd52015-10-07 01:44:39901 const bool compositor_never_visible_;
[email protected]7912e822014-04-16 02:37:03902
mikhail.pozdnyakovf2c902a2015-04-14 08:09:12903 // Indicates whether tab-initiated fullscreen was granted.
904 bool is_fullscreen_granted_;
[email protected]ee41e7d22011-10-14 19:34:09905
mikhail.pozdnyakovc0e251b2015-04-15 06:51:12906 // Indicates the display mode.
907 blink::WebDisplayMode display_mode_;
908
changwanf2a707b2015-10-30 08:22:16909 // It is possible that one ImeEventGuard is nested inside another
910 // ImeEventGuard. We keep track of the outermost one, and update it as needed.
911 ImeEventGuard* ime_event_guard_;
[email protected]e8f775f2013-02-14 21:00:50912
initial.commit09911bf2008-07-26 23:55:29913 // True if we have requested this widget be closed. No more messages will
914 // be sent, except for a Close.
915 bool closing_;
916
[email protected]aeeedad2014-08-22 18:16:22917 // True if it is known that the host is in the process of being shut down.
danakj5c5269b2018-11-06 00:39:11918 bool host_will_close_this_;
[email protected]aeeedad2014-08-22 18:16:22919
danakj6dcbc5962018-11-16 16:45:42920 // A RenderWidget is frozen if it is the RenderWidget attached to the
921 // RenderViewImpl for its main frame, but there is a proxy main frame in
922 // RenderViewImpl's frame tree. Since proxy frames do not have content they
923 // do not need a RenderWidget.
danakjbc6ba9d22018-11-17 04:03:41924 // This flag should never be used for RenderWidgets attached to subframes, as
925 // those RenderWidgets are able to be created/deleted along with the frames,
926 // unlike the main frame RenderWidget (for now).
danakj6dcbc5962018-11-16 16:45:42927 // TODO(419087): In this case the RenderWidget should not exist at all as
928 // it has nothing to display, but since we can't destroy it without destroying
929 // the RenderViewImpl, we freeze it instead.
930 bool is_frozen_;
[email protected]992db4c2011-05-12 15:37:15931
danakj7602f4f2019-01-31 18:03:23932 // In web tests, synchronous resizing mode may be used. Normally each widget's
933 // size is controlled by IPC from the browser. In synchronous resize mode the
934 // renderer controls the size directly, and IPCs from the browser must be
935 // ignored. This was deprecated but then later undeprecated, so it is now
936 // called unfortunate instead. See https://crbug.com/309760. When this is
937 // enabled the various size properties will be controlled directly when
938 // SetWindowRect() is called instead of needing a round trip through the
939 // browser.
940 // Note that SetWindowRectSynchronouslyForTesting() provides a secondary way
941 // to control the size of the RenderWidget independently from the renderer
942 // process, without the use of this mode, however it would be overridden by
943 // the browser if they disagree.
944 bool synchronous_resize_mode_for_testing_ = false;
945
[email protected]5b739cb2012-08-21 20:35:21946 // Stores information about the current text input.
[email protected]180ef242013-11-07 06:50:46947 blink::WebTextInputInfo text_input_info_;
[email protected]5b739cb2012-08-21 20:35:21948
dglazkov97b6c2b2016-10-25 17:35:55949 // Stores the current text input type of |webwidget_|.
950 ui::TextInputType text_input_type_;
951
[email protected]b256eca2013-07-11 10:57:40952 // Stores the current text input mode of |webwidget_|.
953 ui::TextInputMode text_input_mode_;
954
shuchen82ce8c52014-10-23 01:55:20955 // Stores the current text input flags of |webwidget_|.
956 int text_input_flags_;
957
AJITH KUMAR V041c0b02017-08-08 10:39:20958 // Indicates whether currently focused input field has next/previous focusable
959 // form input field.
960 int next_previous_flags_;
961
[email protected]86ba5fcb2013-09-04 00:36:53962 // Stores the current type of composition text rendering of |webwidget_|.
963 bool can_compose_inline_;
964
[email protected]e99ef6f2011-10-16 01:13:00965 // Stores the current selection bounds.
[email protected]7c8873e2013-02-05 08:03:01966 gfx::Rect selection_focus_rect_;
967 gfx::Rect selection_anchor_rect_;
initial.commit09911bf2008-07-26 23:55:29968
[email protected]58b48a0d2012-06-13 07:01:35969 // Stores the current composition character bounds.
970 std::vector<gfx::Rect> composition_character_bounds_;
971
972 // Stores the current composition range.
[email protected]db4fc1e2013-09-06 20:01:51973 gfx::Range composition_range_;
[email protected]58b48a0d2012-06-13 07:01:35974
[email protected]80ad8622012-11-07 16:33:03975 // While we are waiting for the browser to update window sizes, we track the
976 // pending size temporarily.
[email protected]2533ce12009-05-09 00:02:24977 int pending_window_rect_count_;
lfg0140a452016-07-19 19:15:05978 gfx::Rect pending_window_rect_;
[email protected]2533ce12009-05-09 00:02:24979
[email protected]80ad8622012-11-07 16:33:03980 // The screen rects of the view and the window that contains it.
Albert J. Wong3c93c182018-09-27 17:29:43981 gfx::Rect widget_screen_rect_;
[email protected]80ad8622012-11-07 16:33:03982 gfx::Rect window_screen_rect_;
983
Dave Tapuska9db80842017-07-24 17:24:26984 scoped_refptr<WidgetInputHandlerManager> widget_input_handler_manager_;
985
dchengcedca5612016-04-09 01:40:15986 std::unique_ptr<RenderWidgetInputHandler> input_handler_;
[email protected]12fbad812009-09-01 18:21:24987
[email protected]fd847792013-10-24 17:12:35988 // The time spent in input handlers this frame. Used to throttle input acks.
989 base::TimeDelta total_input_handling_time_this_frame_;
990
[email protected]842f10652012-06-06 01:54:04991 // Properties of the screen hosting this RenderWidget instance.
ccameron2f451532016-09-07 21:49:27992 ScreenInfo screen_info_;
[email protected]842f10652012-06-06 01:54:04993
nonafa291792016-08-10 02:36:18994 // True if the IME requests updated composition info.
995 bool monitor_composition_info_;
996
dchengcedca5612016-04-09 01:40:15997 std::unique_ptr<RenderWidgetScreenMetricsEmulator> screen_metrics_emulator_;
[email protected]b2e4c70132013-10-03 02:07:51998
999 // Popups may be displaced when screen metrics emulation is enabled.
1000 // These values are used to properly adjust popup position.
danakj2ef31b82015-10-21 18:18:021001 gfx::Point popup_view_origin_for_emulation_;
1002 gfx::Point popup_screen_origin_for_emulation_;
[email protected]b2e4c70132013-10-03 02:07:511003 float popup_origin_scale_for_emulation_;
1004
[email protected]586871b2014-07-22 17:05:111005 scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue_;
[email protected]5b45ad42013-10-25 00:42:041006
[email protected]e3244ed2014-06-20 20:04:271007 // Lists of RenderFrameProxy objects that need to be notified of
1008 // compositing-related events (e.g. DidCommitCompositorFrame).
Trent Apteda250ec3ab2018-08-19 08:52:191009 base::ObserverList<RenderFrameProxy>::Unchecked render_frame_proxies_;
[email protected]bffc8302014-01-23 20:52:161010
[email protected]de3c5d82014-05-28 22:12:591011 // A list of RenderFrames associated with this RenderWidget. Notifications
1012 // are sent to each frame in the list for events such as changing
1013 // visibility state for example.
Trent Apteda250ec3ab2018-08-19 08:52:191014 base::ObserverList<RenderFrameImpl>::Unchecked render_frames_;
[email protected]de3c5d82014-05-28 22:12:591015
Trent Apteda250ec3ab2018-08-19 08:52:191016 base::ObserverList<BrowserPlugin>::Unchecked browser_plugins_;
Saman Samid189e5dfd2017-12-20 22:55:311017
[email protected]be1af0662014-07-29 19:55:511018 bool has_host_context_menu_location_;
1019 gfx::Point host_context_menu_location_;
[email protected]a09d53ce2014-01-31 00:46:421020
Yuta Kitamura39219b42018-04-06 10:28:141021 std::unique_ptr<blink::scheduler::WebRenderWidgetSchedulingState>
alexclarke7fa93942015-10-21 15:37:111022 render_widget_scheduling_state_;
1023
lfgbee1e0a2016-06-08 21:24:211024 // Mouse Lock dispatcher attached to this view.
1025 std::unique_ptr<RenderWidgetMouseLockDispatcher> mouse_lock_dispatcher_;
1026
1027 // Wraps the |webwidget_| as a MouseLockDispatcher::LockTarget interface.
1028 std::unique_ptr<MouseLockDispatcher::LockTarget> webwidget_mouse_lock_target_;
1029
danakjf87460792018-12-04 20:14:221030 // Set to true while a warmup is in progress. Set to false if the warmup is
1031 // completed or aborted. If aborted, the reply callback is also cancelled by
1032 // invalidating the |warmup_weak_ptr_factory_|.
1033 bool warmup_frame_sink_request_pending_ = false;
1034 // Set after warmup completes without being aborted. This frame sink will be
1035 // returned on the next request for a frame sink instead of creating a new
1036 // one.
1037 std::unique_ptr<cc::LayerTreeFrameSink> warmup_frame_sink_;
1038 // Set if a request for a frame sink arrives while a warmup is in progress.
1039 // Then this stores the request to be satisfied once the warmup completes.
1040 LayerTreeFrameSinkCallback after_warmup_callback_;
1041
Fady Samuel1c1ad3692018-11-06 23:28:401042 viz::LocalSurfaceIdAllocation local_surface_id_allocation_from_parent_;
Fady Samuelda839bb2018-03-26 17:34:481043
lfge0c2792ec2016-05-11 18:52:081044 // Indicates whether this widget has focus.
1045 bool has_focus_;
1046
danakj6dcbc5962018-11-16 16:45:421047 // Whether this widget is for a child local root frame. This excludes widgets
1048 // that are not for a frame (eg popups) and excludes the widget for the main
1049 // frame (which is attached to the RenderViewImpl).
1050 bool for_child_local_root_frame_;
Nicolas Pena75a35d662018-04-05 20:13:441051
nickf7b38222016-11-22 21:59:351052 // A callback into the creator/opener of this widget, to be executed when
danakjdf1ceb72018-07-18 20:02:251053 // WebWidgetClient::Show() occurs.
nickf7b38222016-11-22 21:59:351054 ShowCallback show_callback_;
1055
ekaramad330ba4232016-09-23 17:57:471056#if defined(OS_MACOSX)
1057 // Responds to IPCs from TextInputClientMac regarding getting string at given
1058 // position or range as well as finding character index at a given position.
1059 std::unique_ptr<TextInputClientObserver> text_input_client_observer_;
1060#endif
1061
alexmos56567492016-09-13 00:52:461062 // Stores edit commands associated to the next key event.
1063 // Will be cleared as soon as the next key event is processed.
1064 EditCommands edit_commands_;
1065
paulmeyer6ef5a792016-11-08 20:33:581066 // This field stores drag/drop related info for the event that is currently
1067 // being handled. If the current event results in starting a drag/drop
1068 // session, this info is sent to the browser along with other drag/drop info.
1069 DragEventSourceInfo possible_drag_event_info_;
1070
Takashi SAKAMOTO870f6262017-08-22 04:08:271071 bool first_update_visual_state_after_hidden_;
tasakb95dbb50c2017-02-08 18:07:501072 base::TimeTicks was_shown_time_;
1073
danakja2c9d0a92018-07-25 20:01:181074 // Whether or not Blink's viewport size should be shrunk by the height of the
1075 // URL-bar.
1076 bool browser_controls_shrink_blink_size_ = false;
1077 // The height of the browser top controls.
1078 float top_controls_height_ = 0.f;
1079 // The height of the browser bottom controls.
1080 float bottom_controls_height_ = 0.f;
1081
danakj0246bba02019-01-23 23:12:271082 // The last seen page scale factor, which comes from the main frame and is
1083 // propagated through the RenderWidget tree. This value is passed to any new
1084 // child RenderWidget.
W. James MacLean2a90bff2018-11-05 20:52:471085 float page_scale_factor_from_mainframe_ = 1.f;
1086
kenrb5d78b842017-03-06 21:06:011087 // This is initialized to zero and is incremented on each non-same-page
1088 // navigation commit by RenderFrameImpl. At that time it is sent to the
1089 // compositor so that it can tag compositor frames, and RenderFrameImpl is
1090 // responsible for sending it to the browser process to be used to match
1091 // each compositor frame to the most recent page navigation before it was
1092 // generated.
1093 // This only applies to main frames, and is not touched for subframe
1094 // RenderWidgets, where there is no concern around displaying unloaded
1095 // content.
1096 // TODO(kenrb, fsamuel): This should be removed when SurfaceIDs can be used
1097 // to replace it. See https://crbug.com/695579.
1098 uint32_t current_content_source_id_;
1099
dtapuska9ec1a912017-04-21 15:18:311100 scoped_refptr<MainThreadEventQueue> input_event_queue_;
1101
Dave Tapuska1bdf1832017-07-07 18:07:191102 mojo::Binding<mojom::Widget> widget_binding_;
Hajime Hoshiabb3c8f2017-12-04 18:41:391103
Ken Buchananb2c9e262018-03-10 16:53:311104 gfx::Rect compositor_visible_rect_;
1105
W. James MacLean662d5382018-03-29 18:33:081106 // Different consumers in the browser process makes different assumptions, so
1107 // must always send the first IPC regardless of value.
1108 base::Optional<bool> has_touch_handlers_;
1109
Vladimir Levin98d76dad2018-04-21 00:21:291110 uint32_t last_capture_sequence_number_ = 0u;
1111
danakjf87460792018-12-04 20:14:221112 // Used to generate a callback for the reply when making the warmup frame
1113 // sink, and to cancel that callback if the warmup is aborted.
1114 base::WeakPtrFactory<RenderWidget> warmup_weak_ptr_factory_;
1115
wjmaclean1d970622017-01-21 22:28:241116 base::WeakPtrFactory<RenderWidget> weak_ptr_factory_;
1117
[email protected]05d478752009-04-08 23:38:161118 DISALLOW_COPY_AND_ASSIGN(RenderWidget);
initial.commit09911bf2008-07-26 23:55:291119};
1120
[email protected]e9ff79c2012-10-19 21:31:261121} // namespace content
1122
[email protected]2cff0052011-03-18 16:51:441123#endif // CONTENT_RENDERER_RENDER_WIDGET_H_