1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CONTENT_RENDERER_RENDER_WIDGET_H_
6 #define CONTENT_RENDERER_RENDER_WIDGET_H_
11 #include "base/basictypes.h"
12 #include "base/compiler_specific.h"
13 #include "base/memory/ref_counted.h"
14 #include "base/memory/scoped_ptr.h"
15 #include "base/observer_list.h"
16 #include "base/time/time.h"
17 #include "base/timer/timer.h"
18 #include "cc/debug/rendering_stats_instrumentation.h"
19 #include "content/common/content_export.h"
20 #include "content/common/cursors/webcursor.h"
21 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h"
22 #include "content/common/input/synthetic_gesture_params.h"
23 #include "ipc/ipc_listener.h"
24 #include "ipc/ipc_sender.h"
25 #include "third_party/WebKit/public/platform/WebRect.h"
26 #include "third_party/WebKit/public/web/WebCompositionUnderline.h"
27 #include "third_party/WebKit/public/web/WebPopupType.h"
28 #include "third_party/WebKit/public/web/WebTextDirection.h"
29 #include "third_party/WebKit/public/web/WebTextInputInfo.h"
30 #include "third_party/WebKit/public/web/WebTouchAction.h"
31 #include "third_party/WebKit/public/web/WebWidget.h"
32 #include "third_party/WebKit/public/web/WebWidgetClient.h"
33 #include "third_party/skia/include/core/SkBitmap.h"
34 #include "ui/base/ime/text_input_mode.h"
35 #include "ui/base/ime/text_input_type.h"
36 #include "ui/base/ui_base_types.h"
37 #include "ui/gfx/native_widget_types.h"
38 #include "ui/gfx/range/range.h"
39 #include "ui/gfx/rect.h"
40 #include "ui/gfx/vector2d.h"
41 #include "ui/gfx/vector2d_f.h"
42 #include "ui/surface/transport_dib.h"
44 struct ViewHostMsg_UpdateRect_Params
;
45 struct ViewMsg_Resize_Params
;
46 class ViewHostMsg_UpdateRect
;
53 struct WebDeviceEmulationParams
;
54 class WebGestureEvent
;
56 class WebKeyboardEvent
;
61 namespace cc
{ class OutputSurface
; }
68 class ExternalPopupMenu
;
69 class PepperPluginInstanceImpl
;
70 class RenderFrameImpl
;
71 class RenderWidgetCompositor
;
72 class RenderWidgetTest
;
73 class ResizingModeSelector
;
74 struct ContextMenuParams
;
75 struct WebPluginGeometry
;
77 // RenderWidget provides a communication bridge between a WebWidget and
78 // a RenderWidgetHost, the latter of which lives in a different process.
79 class CONTENT_EXPORT RenderWidget
80 : public IPC::Listener
,
82 NON_EXPORTED_BASE(virtual public blink::WebWidgetClient
),
83 public base::RefCounted
<RenderWidget
> {
85 // Creates a new RenderWidget. The opener_id is the routing ID of the
86 // RenderView that this widget lives inside.
87 static RenderWidget
* Create(int32 opener_id
,
88 blink::WebPopupType popup_type
,
89 const blink::WebScreenInfo
& screen_info
);
91 // Creates a WebWidget based on the popup type.
92 static blink::WebWidget
* CreateWebWidget(RenderWidget
* render_widget
);
94 int32
routing_id() const { return routing_id_
; }
95 int32
surface_id() const { return surface_id_
; }
96 blink::WebWidget
* webwidget() const { return webwidget_
; }
97 gfx::Size
size() const { return size_
; }
98 bool has_focus() const { return has_focus_
; }
99 bool is_fullscreen() const { return is_fullscreen_
; }
100 bool is_hidden() const { return is_hidden_
; }
101 bool handling_input_event() const { return handling_input_event_
; }
102 // Temporary for debugging purposes...
103 bool closing() const { return closing_
; }
104 bool is_swapped_out() { return is_swapped_out_
; }
105 ui::MenuSourceType
context_menu_source_type() {
106 return context_menu_source_type_
; }
107 gfx::Point
touch_editing_context_menu_location() {
108 return touch_editing_context_menu_location_
;
111 // Functions to track out-of-process frames for special notifications.
112 void RegisterSwappedOutChildFrame(RenderFrameImpl
* frame
);
113 void UnregisterSwappedOutChildFrame(RenderFrameImpl
* frame
);
116 virtual bool OnMessageReceived(const IPC::Message
& msg
) OVERRIDE
;
119 virtual bool Send(IPC::Message
* msg
) OVERRIDE
;
121 // blink::WebWidgetClient
122 virtual void suppressCompositorScheduling(bool enable
);
123 virtual void willBeginCompositorFrame();
124 virtual void didInvalidateRect(const blink::WebRect
&);
125 virtual void didScrollRect(int dx
, int dy
,
126 const blink::WebRect
& clipRect
);
127 virtual void didAutoResize(const blink::WebSize
& new_size
);
128 virtual void didActivateCompositor() OVERRIDE
;
129 virtual void didDeactivateCompositor();
130 virtual void initializeLayerTreeView();
131 virtual blink::WebLayerTreeView
* layerTreeView();
132 virtual void didBecomeReadyForAdditionalInput();
133 virtual void didCommitAndDrawCompositorFrame();
134 virtual void didCompleteSwapBuffers();
135 virtual void scheduleComposite();
136 virtual void scheduleAnimation();
137 virtual void didFocus();
138 virtual void didBlur();
139 virtual void didChangeCursor(const blink::WebCursorInfo
&);
140 virtual void closeWidgetSoon();
141 virtual void show(blink::WebNavigationPolicy
);
142 virtual void runModal() {}
143 virtual blink::WebRect
windowRect();
144 virtual void setToolTipText(const blink::WebString
& text
,
145 blink::WebTextDirection hint
);
146 virtual void setWindowRect(const blink::WebRect
&);
147 virtual blink::WebRect
windowResizerRect();
148 virtual blink::WebRect
rootWindowRect();
149 virtual blink::WebScreenInfo
screenInfo();
150 virtual float deviceScaleFactor();
151 virtual void resetInputMethod();
152 virtual void didHandleGestureEvent(const blink::WebGestureEvent
& event
,
153 bool event_cancelled
);
155 // Begins the compositor's scheduler to start producing frames.
156 void StartCompositor();
158 // Called when a plugin is moved. These events are queued up and sent with
159 // the next paint or scroll message to the host.
160 void SchedulePluginMove(const WebPluginGeometry
& move
);
162 // Called when a plugin window has been destroyed, to make sure the currently
163 // pending moves don't try to reference it.
164 void CleanupWindowInPluginMoves(gfx::PluginWindowHandle window
);
166 RenderWidgetCompositor
* compositor() const;
168 virtual scoped_ptr
<cc::OutputSurface
> CreateOutputSurface(bool fallback
);
170 // Callback for use with synthetic gestures (e.g. BeginSmoothScroll).
171 typedef base::Callback
<void()> SyntheticGestureCompletionCallback
;
173 // Send a synthetic gesture to the browser to be queued to the synthetic
174 // gesture controller.
175 void QueueSyntheticGesture(
176 scoped_ptr
<SyntheticGestureParams
> gesture_params
,
177 const SyntheticGestureCompletionCallback
& callback
);
179 // Close the underlying WebWidget.
180 virtual void Close();
182 // Notifies about a compositor frame commit operation having finished.
183 virtual void DidCommitCompositorFrame();
185 // Handle common setup/teardown for handling IME events.
186 void StartHandlingImeEvent();
187 void FinishHandlingImeEvent();
189 // Returns whether we currently should handle an IME event.
190 bool ShouldHandleImeEvent();
192 virtual void InstrumentWillBeginFrame(int frame_id
) {}
193 virtual void InstrumentDidBeginFrame() {}
194 virtual void InstrumentDidCancelFrame() {}
195 virtual void InstrumentWillComposite() {}
197 bool UsingSynchronousRendererCompositor() const;
199 // ScreenMetricsEmulator class manages screen emulation inside a render
200 // widget. This includes resizing, placing view on the screen at desired
201 // position, changing device scale factor, and scaling down the whole
202 // widget if required to fit into the browser window.
203 class ScreenMetricsEmulator
;
205 // Emulates screen and widget metrics. Supplied values override everything
207 void EnableScreenMetricsEmulation(
208 const blink::WebDeviceEmulationParams
& params
);
209 void DisableScreenMetricsEmulation();
210 void SetPopupOriginAdjustmentsForEmulation(ScreenMetricsEmulator
* emulator
);
212 void ScheduleCompositeWithForcedRedraw();
214 // Called by the compositor in single-threaded mode when a swap is posted,
215 // completes or is aborted.
216 void OnSwapBuffersPosted();
217 void OnSwapBuffersComplete();
218 void OnSwapBuffersAborted();
220 // Checks if the text input state and compose inline mode have been changed.
221 // If they are changed, the new value will be sent to the browser process.
222 void UpdateTextInputType();
224 // Checks if the selection bounds have been changed. If they are changed,
225 // the new value will be sent to the browser process.
226 void UpdateSelectionBounds();
228 virtual void GetSelectionBounds(gfx::Rect
* start
, gfx::Rect
* end
);
230 void OnShowHostContextMenu(ContextMenuParams
* params
);
232 #if defined(OS_ANDROID) || defined(USE_AURA)
243 // |show_ime| should be SHOW_IME_IF_NEEDED iff the update may cause the ime to
244 // be displayed, e.g. after a tap on an input field on mobile.
245 // |change_source| should be FROM_NON_IME when the renderer has to wait for
246 // the browser to acknowledge the change before the renderer handles any more
247 // IME events. This is when the text change did not originate from the IME in
248 // the browser side, such as changes by JavaScript or autofill.
249 void UpdateTextInputState(ShowIme show_ime
, ChangeSource change_source
);
252 #if defined(OS_MACOSX) || defined(USE_AURA)
253 // Checks if the composition range or composition character bounds have been
254 // changed. If they are changed, the new value will be sent to the browser
256 void UpdateCompositionInfo(bool should_update_range
);
260 // Friend RefCounted so that the dtor can be non-public. Using this class
261 // without ref-counting is an error.
262 friend class base::RefCounted
<RenderWidget
>;
264 friend class RenderWidgetTest
;
271 RenderWidget(blink::WebPopupType popup_type
,
272 const blink::WebScreenInfo
& screen_info
,
277 virtual ~RenderWidget();
279 // Initializes this view with the given opener. CompleteInit must be called
281 bool Init(int32 opener_id
);
283 // Called by Init and subclasses to perform initialization.
284 bool DoInit(int32 opener_id
,
285 blink::WebWidget
* web_widget
,
286 IPC::SyncMessage
* create_widget_message
);
288 // Finishes creation of a pending view started with Init.
291 // Sets whether this RenderWidget has been swapped out to be displayed by
292 // a RenderWidget in a different process. If so, no new IPC messages will be
293 // sent (only ACKs) and the process is free to exit when there are no other
294 // active RenderWidgets.
295 void SetSwappedOut(bool is_swapped_out
);
297 // Paints the given rectangular region of the WebWidget into canvas (a
298 // shared memory segment returned by AllocPaintBuf on Windows). The caller
299 // must ensure that the given rect fits within the bounds of the WebWidget.
300 void PaintRect(const gfx::Rect
& rect
, const gfx::Point
& canvas_origin
,
303 // Paints a border at the given rect for debugging purposes.
304 void PaintDebugBorder(const gfx::Rect
& rect
, SkCanvas
* canvas
);
306 void AnimationCallback();
307 void InvalidationCallback();
308 void FlushPendingInputEventAck();
309 void DoDeferredUpdateAndSendInputAck();
310 void DoDeferredUpdate();
311 void DoDeferredClose();
312 void DoDeferredSetWindowRect(const blink::WebRect
& pos
);
314 // Set the background of the render widget to a bitmap. The bitmap will be
315 // tiled in both directions if it isn't big enough to fill the area. This is
316 // mainly intended to be used in conjuction with WebView::SetIsTransparent().
317 virtual void SetBackground(const SkBitmap
& bitmap
);
319 // Resizes the render widget.
320 void Resize(const gfx::Size
& new_size
,
321 const gfx::Size
& physical_backing_size
,
322 float overdraw_bottom_height
,
323 const gfx::Size
& visible_viewport_size
,
324 const gfx::Rect
& resizer_rect
,
326 ResizeAck resize_ack
);
327 // Used to force the size of a window when running layout tests.
328 void ResizeSynchronously(const gfx::Rect
& new_position
);
329 virtual void SetScreenMetricsEmulationParameters(
330 float device_scale_factor
,
331 const gfx::Point
& root_layer_offset
,
332 float root_layer_scale
);
333 #if defined(OS_MACOSX) || defined(OS_ANDROID)
334 void SetExternalPopupOriginAdjustmentsForEmulation(
335 ExternalPopupMenu
* popup
, ScreenMetricsEmulator
* emulator
);
338 // RenderWidget IPC message handlers
339 void OnHandleInputEvent(const blink::WebInputEvent
* event
,
340 const ui::LatencyInfo
& latency_info
,
341 bool keyboard_shortcut
);
342 void OnCursorVisibilityChange(bool is_visible
);
343 void OnMouseCaptureLost();
344 virtual void OnSetFocus(bool enable
);
346 void OnCreatingNewAck();
347 virtual void OnResize(const ViewMsg_Resize_Params
& params
);
348 void OnChangeResizeRect(const gfx::Rect
& resizer_rect
);
349 virtual void OnWasHidden();
350 virtual void OnWasShown(bool needs_repainting
);
351 virtual void OnWasSwappedOut();
352 void OnCreateVideoAck(int32 video_id
);
353 void OnUpdateVideoAck(int32 video_id
);
354 void OnRequestMoveAck();
355 void OnSetInputMethodActive(bool is_active
);
356 void OnCandidateWindowShown();
357 void OnCandidateWindowUpdated();
358 void OnCandidateWindowHidden();
359 virtual void OnImeSetComposition(
360 const base::string16
& text
,
361 const std::vector
<blink::WebCompositionUnderline
>& underlines
,
364 virtual void OnImeConfirmComposition(const base::string16
& text
,
365 const gfx::Range
& replacement_range
,
366 bool keep_selection
);
367 void OnRepaint(gfx::Size size_to_paint
);
368 void OnSyntheticGestureCompleted();
369 void OnSetTextDirection(blink::WebTextDirection direction
);
371 void OnUpdateScreenRects(const gfx::Rect
& view_screen_rect
,
372 const gfx::Rect
& window_screen_rect
);
373 #if defined(OS_ANDROID)
374 void OnShowImeIfNeeded();
376 // Whenever an IME event that needs an acknowledgement is sent to the browser,
377 // the number of outstanding IME events that needs acknowledgement should be
378 // incremented. All IME events will be dropped until we receive an ack from
380 void IncrementOutstandingImeEventAcks();
382 // Called by the browser process for every required IME acknowledgement.
383 void OnImeEventAck();
386 // Notify the compositor about a change in viewport size. This should be
387 // used only with auto resize mode WebWidgets, as normal WebWidgets should
388 // go through OnResize.
389 void AutoResizeCompositor();
391 virtual void SetDeviceScaleFactor(float device_scale_factor
);
393 // Override points to notify derived classes that a paint has happened.
394 // DidInitiatePaint happens when that has completed, and subsequent rendering
395 // won't affect the painted content. DidFlushPaint happens once we've received
396 // the ACK that the screen has been updated. For a given paint operation,
397 // these overrides will always be called in the order DidInitiatePaint,
399 virtual void DidInitiatePaint() {}
400 virtual void DidFlushPaint() {}
402 virtual GURL
GetURLForGraphicsContext3D();
404 virtual bool ForceCompositingModeEnabled();
406 // Gets the scroll offset of this widget, if this widget has a notion of
408 virtual gfx::Vector2d
GetScrollOffset();
410 // Sets the "hidden" state of this widget. All accesses to is_hidden_ should
411 // use this method so that we can properly inform the RenderThread of our
413 void SetHidden(bool hidden
);
415 void WillToggleFullscreen();
416 void DidToggleFullscreen();
418 bool next_paint_is_resize_ack() const;
419 bool next_paint_is_restore_ack() const;
420 void set_next_paint_is_resize_ack();
421 void set_next_paint_is_restore_ack();
422 void set_next_paint_is_repaint_ack();
424 // Override point to obtain that the current input method state and caret
426 virtual ui::TextInputType
GetTextInputType();
427 virtual ui::TextInputType
WebKitToUiTextInputType(
428 blink::WebTextInputType type
);
430 #if defined(OS_MACOSX) || defined(USE_AURA)
431 // Override point to obtain that the current composition character bounds.
432 // In the case of surrogate pairs, the character is treated as two characters:
433 // the bounds for first character is actual one, and the bounds for second
434 // character is zero width rectangle.
435 virtual void GetCompositionCharacterBounds(
436 std::vector
<gfx::Rect
>* character_bounds
);
438 // Returns the range of the text that is being composed or the selection if
439 // the composition does not exist.
440 virtual void GetCompositionRange(gfx::Range
* range
);
442 // Returns true if the composition range or composition character bounds
443 // should be sent to the browser process.
444 bool ShouldUpdateCompositionInfo(
445 const gfx::Range
& range
,
446 const std::vector
<gfx::Rect
>& bounds
);
449 // Override point to obtain that the current input method state about
451 virtual bool CanComposeInline();
453 // Tells the renderer it does not have focus. Used to prevent us from getting
454 // the focus on our own when the browser did not focus us.
457 // Set the pending window rect.
458 // Because the real render_widget is hosted in another process, there is
459 // a time period where we may have set a new window rect which has not yet
460 // been processed by the browser. So we maintain a pending window rect
461 // size. If JS code sets the WindowRect, and then immediately calls
462 // GetWindowRect() we'll use this pending window rect as the size.
463 void SetPendingWindowRect(const blink::WebRect
& r
);
465 // Called by OnHandleInputEvent() to notify subclasses that a key event was
467 virtual void DidHandleKeyEvent() {}
469 // Called by OnHandleInputEvent() to notify subclasses that a mouse event is
470 // about to be handled.
471 // Returns true if no further handling is needed. In that case, the event
472 // won't be sent to WebKit or trigger DidHandleMouseEvent().
473 virtual bool WillHandleMouseEvent(const blink::WebMouseEvent
& event
);
475 // Called by OnHandleInputEvent() to notify subclasses that a gesture event is
476 // about to be handled.
477 // Returns true if no further handling is needed. In that case, the event
478 // won't be sent to WebKit.
479 virtual bool WillHandleGestureEvent(const blink::WebGestureEvent
& event
);
481 // Called by OnHandleInputEvent() to notify subclasses that a mouse event was
483 virtual void DidHandleMouseEvent(const blink::WebMouseEvent
& event
) {}
485 // Called by OnHandleInputEvent() to notify subclasses that a touch event was
487 virtual void DidHandleTouchEvent(const blink::WebTouchEvent
& event
) {}
489 // Check whether the WebWidget has any touch event handlers registered
490 // at the given point.
491 virtual bool HasTouchEventHandlersAt(const gfx::Point
& point
) const;
493 // Check whether the WebWidget has any touch event handlers registered.
494 virtual void hasTouchEventHandlers(bool has_handlers
);
496 // Tell the browser about the actions permitted for a new touch point.
497 virtual void setTouchAction(blink::WebTouchAction touch_action
);
499 // Called when value of focused text field gets dirty, e.g. value is modified
500 // by script, not by user input.
501 virtual void didUpdateTextOfFocusedElementByNonUserInput();
503 #if defined(OS_ANDROID)
504 // Checks if the selection root bounds have changed. If they have changed, the
505 // new value will be sent to the browser process.
506 virtual void UpdateSelectionRootBounds();
509 // Creates a 3D context associated with this view.
510 scoped_ptr
<WebGraphicsContext3DCommandBufferImpl
> CreateGraphicsContext3D();
512 // Routing ID that allows us to communicate to the parent browser process
513 // RenderWidgetHost. When MSG_ROUTING_NONE, no messages may be sent.
518 // We are responsible for destroying this object via its Close method.
519 // May be NULL when the window is closing.
520 blink::WebWidget
* webwidget_
;
522 // This is lazily constructed and must not outlive webwidget_.
523 scoped_ptr
<RenderWidgetCompositor
> compositor_
;
525 // Set to the ID of the view that initiated creating this view, if any. When
526 // the view was initiated by the browser (the common case), this will be
527 // MSG_ROUTING_NONE. This is used in determining ownership when opening
528 // child tabs. See RenderWidget::createWebViewWithRequest.
530 // This ID may refer to an invalid view if that view is closed before this
534 // The position where this view should be initially shown.
535 gfx::Rect initial_pos_
;
539 // We store the current cursor object so we can avoid spamming SetCursor
541 WebCursor current_cursor_
;
543 // The size of the RenderWidget.
546 bool has_frame_pending_
;
548 // The size of the view's backing surface in non-DPI-adjusted pixels.
549 gfx::Size physical_backing_size_
;
551 // The height of the physical backing surface that is overdrawn opaquely in
552 // the browser, for example by an on-screen-keyboard (in DPI-adjusted pixels).
553 float overdraw_bottom_height_
;
555 // The size of the visible viewport in DPI-adjusted pixels.
556 gfx::Size visible_viewport_size_
;
558 // The area that must be reserved for drawing the resize corner.
559 gfx::Rect resizer_rect_
;
561 // Flags for the next ViewHostMsg_UpdateRect message.
562 int next_paint_flags_
;
564 // Whether the WebWidget is in auto resize mode, which is used for example
565 // by extension popups.
566 bool auto_resize_mode_
;
568 // True if we need to send an UpdateRect message to notify the browser about
569 // an already-completed auto-resize.
570 bool need_update_rect_for_auto_resize_
;
572 // Set to true if we should ignore RenderWidget::Show calls.
575 // Indicates that we shouldn't bother generated paint events.
578 // Indicates that we are never visible, so never produce graphical output.
581 // Indicates that we are in fullscreen mode.
584 // Indicates that we should be repainted when restored. This flag is set to
585 // true if we receive an invalidation / scroll event from webkit while our
586 // is_hidden_ flag is set to true. This is used to force a repaint once we
587 // restore to account for the fact that our host would not know about the
588 // invalidation / scroll event(s) from webkit while we are hidden.
589 bool needs_repainting_on_restore_
;
591 // Indicates whether we have been focused/unfocused by the browser.
594 // Are we currently handling an input event?
595 bool handling_input_event_
;
597 // Are we currently handling an ime event?
598 bool handling_ime_event_
;
600 // Are we currently handling a touchstart event?
601 bool handling_touchstart_event_
;
603 // True if we have requested this widget be closed. No more messages will
604 // be sent, except for a Close.
607 // Whether this RenderWidget is currently swapped out, such that the view is
608 // being rendered by another process. If all RenderWidgets in a process are
609 // swapped out, the process can exit.
610 bool is_swapped_out_
;
612 // Indicates if an input method is active in the browser process.
613 bool input_method_is_active_
;
615 // Stores information about the current text input.
616 blink::WebTextInputInfo text_input_info_
;
618 // Stores the current text input type of |webwidget_|.
619 ui::TextInputType text_input_type_
;
621 // Stores the current text input mode of |webwidget_|.
622 ui::TextInputMode text_input_mode_
;
624 // Stores the current type of composition text rendering of |webwidget_|.
625 bool can_compose_inline_
;
627 // Stores the current selection bounds.
628 gfx::Rect selection_focus_rect_
;
629 gfx::Rect selection_anchor_rect_
;
631 // Stores the current selection root bounds.
632 #if defined(OS_ANDROID)
633 gfx::Rect selection_root_rect_
;
636 // Stores the current composition character bounds.
637 std::vector
<gfx::Rect
> composition_character_bounds_
;
639 // Stores the current composition range.
640 gfx::Range composition_range_
;
642 // The kind of popup this widget represents, NONE if not a popup.
643 blink::WebPopupType popup_type_
;
645 // Holds all the needed plugin window moves for a scroll.
646 typedef std::vector
<WebPluginGeometry
> WebPluginGeometryVector
;
647 WebPluginGeometryVector plugin_window_moves_
;
649 // A custom background for the widget.
650 SkBitmap background_
;
652 // While we are waiting for the browser to update window sizes, we track the
653 // pending size temporarily.
654 int pending_window_rect_count_
;
655 blink::WebRect pending_window_rect_
;
657 // The screen rects of the view and the window that contains it.
658 gfx::Rect view_screen_rect_
;
659 gfx::Rect window_screen_rect_
;
661 scoped_ptr
<IPC::Message
> pending_input_event_ack_
;
663 // The time spent in input handlers this frame. Used to throttle input acks.
664 base::TimeDelta total_input_handling_time_this_frame_
;
666 // Indicates if the next sequence of Char events should be suppressed or not.
667 bool suppress_next_char_events_
;
669 // Set to true if painting to the window is handled by the accelerated
671 bool is_accelerated_compositing_active_
;
673 // Set to true if compositing has ever been active for this widget. Once a
674 // widget has used compositing, it will act as though force compositing mode
675 // is on for the remainder of the widget's lifetime.
676 bool was_accelerated_compositing_ever_active_
;
678 base::OneShotTimer
<RenderWidget
> animation_timer_
;
679 bool animation_update_pending_
;
680 bool invalidation_task_posted_
;
682 // Stats for legacy software mode
683 scoped_ptr
<cc::RenderingStatsInstrumentation
> legacy_software_mode_stats_
;
685 // Properties of the screen hosting this RenderWidget instance.
686 blink::WebScreenInfo screen_info_
;
688 // The device scale factor. This value is computed from the DPI entries in
689 // |screen_info_| on some platforms, and defaults to 1 on other platforms.
690 float device_scale_factor_
;
692 // State associated with synthetic gestures. Synthetic gestures are processed
693 // in-order, so a queue is sufficient to identify the correct state for a
694 // completed gesture.
695 std::queue
<SyntheticGestureCompletionCallback
>
696 pending_synthetic_gesture_callbacks_
;
698 // Specified whether the compositor will run in its own thread.
699 bool is_threaded_compositing_enabled_
;
701 uint32 next_output_surface_id_
;
703 #if defined(OS_ANDROID)
704 // Indicates value in the focused text field is in dirty state, i.e. modified
705 // by script etc., not by user input.
706 bool text_field_is_dirty_
;
708 // A counter for number of outstanding messages from the renderer to the
709 // browser regarding IME-type events that have not been acknowledged by the
710 // browser. If this value is not 0 IME events will be dropped.
711 int outstanding_ime_acks_
;
714 scoped_ptr
<ScreenMetricsEmulator
> screen_metrics_emulator_
;
716 // Popups may be displaced when screen metrics emulation is enabled.
717 // These values are used to properly adjust popup position.
718 gfx::Point popup_view_origin_for_emulation_
;
719 gfx::Point popup_screen_origin_for_emulation_
;
720 float popup_origin_scale_for_emulation_
;
722 scoped_ptr
<ResizingModeSelector
> resizing_mode_selector_
;
724 // A list of swapped out RenderFrames that need to be notified
725 // of compositing-related events (e.g. DidCommitCompositorFrame).
726 ObserverList
<RenderFrameImpl
> swapped_out_frames_
;
728 ui::MenuSourceType context_menu_source_type_
;
729 gfx::Point touch_editing_context_menu_location_
;
731 DISALLOW_COPY_AND_ASSIGN(RenderWidget
);
734 } // namespace content
736 #endif // CONTENT_RENDERER_RENDER_WIDGET_H_