Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(619)

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_base.h

Issue 1652483002: Browser Side Text Input State Tracking for OOPIF. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Small Fixes. Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_BASE_H_ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_BASE_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_BASE_H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_BASE_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 21 matching lines...) Expand all
32 #include "ui/gfx/display.h" 32 #include "ui/gfx/display.h"
33 #include "ui/gfx/geometry/rect.h" 33 #include "ui/gfx/geometry/rect.h"
34 #include "ui/gfx/native_widget_types.h" 34 #include "ui/gfx/native_widget_types.h"
35 #include "ui/gfx/range/range.h" 35 #include "ui/gfx/range/range.h"
36 #include "ui/surface/transport_dib.h" 36 #include "ui/surface/transport_dib.h"
37 37
38 class SkBitmap; 38 class SkBitmap;
39 39
40 struct AccessibilityHostMsg_EventParams; 40 struct AccessibilityHostMsg_EventParams;
41 struct ViewHostMsg_SelectionBounds_Params; 41 struct ViewHostMsg_SelectionBounds_Params;
42 struct ViewHostMsg_TextInputState_Params; 42 struct TextInputState;
43 43
44 namespace media { 44 namespace media {
45 class VideoFrame; 45 class VideoFrame;
46 } 46 }
47 47
48 namespace blink { 48 namespace blink {
49 struct WebScreenInfo; 49 struct WebScreenInfo;
50 class WebMouseEvent; 50 class WebMouseEvent;
51 class WebMouseWheelEvent; 51 class WebMouseWheelEvent;
52 } 52 }
53 53
54 namespace cc { 54 namespace cc {
55 class SurfaceHittestDelegate; 55 class SurfaceHittestDelegate;
56 } 56 }
57 57
58 namespace ui { 58 namespace ui {
59 class LatencyInfo; 59 class LatencyInfo;
60 } 60 }
61 61
62 namespace content { 62 namespace content {
63 class BrowserAccessibilityDelegate; 63 class BrowserAccessibilityDelegate;
64 class BrowserAccessibilityManager; 64 class BrowserAccessibilityManager;
65 class SyntheticGesture; 65 class SyntheticGesture;
66 class SyntheticGestureTarget; 66 class SyntheticGestureTarget;
67 class WebCursor; 67 class WebCursor;
68 struct DidOverscrollParams; 68 struct DidOverscrollParams;
69 struct NativeWebKeyboardEvent; 69 struct NativeWebKeyboardEvent;
70 struct TextInputState;
70 struct WebPluginGeometry; 71 struct WebPluginGeometry;
71 72
72 // Basic implementation shared by concrete RenderWidgetHostView subclasses. 73 // Basic implementation shared by concrete RenderWidgetHostView subclasses.
73 class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView, 74 class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView,
74 public IPC::Listener { 75 public IPC::Listener {
75 public: 76 public:
76 ~RenderWidgetHostViewBase() override; 77 ~RenderWidgetHostViewBase() override;
77 78
78 float current_device_scale_factor() const { 79 float current_device_scale_factor() const {
79 return current_device_scale_factor_; 80 return current_device_scale_factor_;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 // the renderer. 118 // the renderer.
118 void DidReceiveRendererFrame(); 119 void DidReceiveRendererFrame();
119 120
120 // Notification that a resize or move session ended on the native widget. 121 // Notification that a resize or move session ended on the native widget.
121 void UpdateScreenInfo(gfx::NativeView view); 122 void UpdateScreenInfo(gfx::NativeView view);
122 123
123 // Tells if the display property (work area/scale factor) has 124 // Tells if the display property (work area/scale factor) has
124 // changed since the last time. 125 // changed since the last time.
125 bool HasDisplayPropertyChanged(gfx::NativeView view); 126 bool HasDisplayPropertyChanged(gfx::NativeView view);
126 127
128 // The last updated value of text input state for this frame. This is in
129 // general
130 // different from that of |text_input_state_| as the current text input state
131 // could be
132 // obtained from a focused child frame.
133 const TextInputState* current_text_input_state() const {
134 return cached_text_input_state_;
135 }
136
127 base::WeakPtr<RenderWidgetHostViewBase> GetWeakPtr(); 137 base::WeakPtr<RenderWidgetHostViewBase> GetWeakPtr();
128 138
129 //---------------------------------------------------------------------------- 139 //----------------------------------------------------------------------------
130 // The following methods can be overridden by derived classes. 140 // The following methods can be overridden by derived classes.
131 141
132 // Notifies the View that the renderer text selection has changed. 142 // Notifies the View that the renderer text selection has changed.
133 virtual void SelectionChanged(const base::string16& text, 143 virtual void SelectionChanged(const base::string16& text,
134 size_t offset, 144 size_t offset,
135 const gfx::Range& range); 145 const gfx::Range& range);
136 146
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 // embedded within the RenderWidgetHostViewBase's Surface to the 234 // embedded within the RenderWidgetHostViewBase's Surface to the
225 // coordinate space of the embedding Surface. Typically this means that a 235 // coordinate space of the embedding Surface. Typically this means that a
226 // point was received from an out-of-process iframe's RenderWidget and needs 236 // point was received from an out-of-process iframe's RenderWidget and needs
227 // to be translated to viewport coordinates for the root RWHV, in which case 237 // to be translated to viewport coordinates for the root RWHV, in which case
228 // this method is called on the root RWHV with the out-of-process iframe's 238 // this method is called on the root RWHV with the out-of-process iframe's
229 // SurfaceId. 239 // SurfaceId.
230 virtual void TransformPointToLocalCoordSpace(const gfx::Point& point, 240 virtual void TransformPointToLocalCoordSpace(const gfx::Point& point,
231 cc::SurfaceId original_surface, 241 cc::SurfaceId original_surface,
232 gfx::Point* transformed_point); 242 gfx::Point* transformed_point);
233 243
244 // This method is excusively called by the owner RenderWidgetHost to inform
245 // the view about a change in the input state which originated in the
246 // corresponding RenderWidget. This state is stored at the RWHV.
247 // Also, this change does not necessarily reflect the current state of the
248 // input since the text input could be due to a change in the focused
249 // child-frame's (in OOPIF) or the out of process content managed by
250 // BrowserPlugin.
251 // TODO(ekaramad): Make this non-virtual if possible.
252 virtual void TextInputStateChanged(const TextInputState& params);
253
254 // Notifies the top level RenderWidgetHostView or the corresponding
255 // ui::InputMethod of a change in text input state in either this RWHV or one
256 // of the child frame's RWHV.
257 virtual void UpdateTextInputState();
258
234 //---------------------------------------------------------------------------- 259 //----------------------------------------------------------------------------
235 // The following static methods are implemented by each platform. 260 // The following static methods are implemented by each platform.
236 261
237 static void GetDefaultScreenInfo(blink::WebScreenInfo* results); 262 static void GetDefaultScreenInfo(blink::WebScreenInfo* results);
238 263
239 //---------------------------------------------------------------------------- 264 //----------------------------------------------------------------------------
240 // The following pure virtual methods are implemented by derived classes. 265 // The following pure virtual methods are implemented by derived classes.
241 266
242 // Perform all the initialization steps necessary for this object to represent 267 // Perform all the initialization steps necessary for this object to represent
243 // a popup (such as a <select> dropdown), then shows the popup at |pos|. 268 // a popup (such as a <select> dropdown), then shows the popup at |pos|.
(...skipping 10 matching lines...) Expand all
254 // |scroll_offset| is the scroll offset of the render view. 279 // |scroll_offset| is the scroll offset of the render view.
255 virtual void MovePluginWindows( 280 virtual void MovePluginWindows(
256 const std::vector<WebPluginGeometry>& moves) = 0; 281 const std::vector<WebPluginGeometry>& moves) = 0;
257 282
258 // Sets the cursor to the one associated with the specified cursor_type 283 // Sets the cursor to the one associated with the specified cursor_type
259 virtual void UpdateCursor(const WebCursor& cursor) = 0; 284 virtual void UpdateCursor(const WebCursor& cursor) = 0;
260 285
261 // Indicates whether the page has finished loading. 286 // Indicates whether the page has finished loading.
262 virtual void SetIsLoading(bool is_loading) = 0; 287 virtual void SetIsLoading(bool is_loading) = 0;
263 288
264 // Updates the state of the input method attached to the view.
265 virtual void TextInputStateChanged(
266 const ViewHostMsg_TextInputState_Params& params) = 0;
267
268 // Cancel the ongoing composition of the input method attached to the view. 289 // Cancel the ongoing composition of the input method attached to the view.
269 virtual void ImeCancelComposition() = 0; 290 virtual void ImeCancelComposition() = 0;
270 291
271 // Notifies the View that the renderer has ceased to exist. 292 // Notifies the View that the renderer has ceased to exist.
272 virtual void RenderProcessGone(base::TerminationStatus status, 293 virtual void RenderProcessGone(base::TerminationStatus status,
273 int error_code) = 0; 294 int error_code) = 0;
274 295
275 // Tells the View to destroy itself. 296 // Tells the View to destroy itself.
276 virtual void Destroy() = 0; 297 virtual void Destroy() = 0;
277 298
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 // A buffer containing the text inside and around the current selection range. 448 // A buffer containing the text inside and around the current selection range.
428 base::string16 selection_text_; 449 base::string16 selection_text_;
429 450
430 // The offset of the text stored in |selection_text_| relative to the start of 451 // The offset of the text stored in |selection_text_| relative to the start of
431 // the web page. 452 // the web page.
432 size_t selection_text_offset_; 453 size_t selection_text_offset_;
433 454
434 // The current selection range relative to the start of the web page. 455 // The current selection range relative to the start of the web page.
435 gfx::Range selection_range_; 456 gfx::Range selection_range_;
436 457
437 protected:
438 // The scale factor of the display the renderer is currently on. 458 // The scale factor of the display the renderer is currently on.
439 float current_device_scale_factor_; 459 float current_device_scale_factor_;
440 460
441 // The orientation of the display the renderer is currently on. 461 // The orientation of the display the renderer is currently on.
442 gfx::Display::Rotation current_display_rotation_; 462 gfx::Display::Rotation current_display_rotation_;
443 463
444 // Whether pinch-to-zoom should be enabled and pinch events forwarded to the 464 // Whether pinch-to-zoom should be enabled and pinch events forwarded to the
445 // renderer. 465 // renderer.
446 bool pinch_zoom_enabled_; 466 bool pinch_zoom_enabled_;
447 467
448 private: 468 private:
449 void FlushInput(); 469 void FlushInput();
450 470
471 // Returns the current text input state from all text input elements in this
472 // view or one of the child frame views.
473 const TextInputState* FindCurrentTextInputState();
474
451 gfx::Rect current_display_area_; 475 gfx::Rect current_display_area_;
452 476
453 uint32_t renderer_frame_number_; 477 uint32_t renderer_frame_number_;
454 478
455 base::OneShotTimer flush_input_timer_; 479 base::OneShotTimer flush_input_timer_;
456 480
481 // The last reported input state from the RenderWidgetHost.
482 scoped_ptr<TextInputState> text_input_state_;
483
484 // The current cached value of input state which could be obtained from
485 // another RWHV.
486 const TextInputState* cached_text_input_state_;
487
457 base::WeakPtrFactory<RenderWidgetHostViewBase> weak_factory_; 488 base::WeakPtrFactory<RenderWidgetHostViewBase> weak_factory_;
458 489
459 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewBase); 490 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewBase);
460 }; 491 };
461 492
462 } // namespace content 493 } // namespace content
463 494
464 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_BASE_H_ 495 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_BASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698