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

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: 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 RenderFrameHostImpl;
65 class SyntheticGesture; 66 class SyntheticGesture;
66 class SyntheticGestureTarget; 67 class SyntheticGestureTarget;
67 class WebCursor; 68 class WebCursor;
68 struct DidOverscrollParams; 69 struct DidOverscrollParams;
69 struct NativeWebKeyboardEvent; 70 struct NativeWebKeyboardEvent;
70 struct WebPluginGeometry; 71 struct WebPluginGeometry;
71 72
73 using TextInputState = ViewHostMsg_TextInputState_Params;
74
72 // Basic implementation shared by concrete RenderWidgetHostView subclasses. 75 // Basic implementation shared by concrete RenderWidgetHostView subclasses.
73 class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView, 76 class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView,
74 public IPC::Listener { 77 public IPC::Listener {
75 public: 78 public:
76 ~RenderWidgetHostViewBase() override; 79 ~RenderWidgetHostViewBase() override;
77 80
78 float current_device_scale_factor() const { 81 float current_device_scale_factor() const {
79 return current_device_scale_factor_; 82 return current_device_scale_factor_;
80 } 83 }
81 84
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 // the renderer. 120 // the renderer.
118 void DidReceiveRendererFrame(); 121 void DidReceiveRendererFrame();
119 122
120 // Notification that a resize or move session ended on the native widget. 123 // Notification that a resize or move session ended on the native widget.
121 void UpdateScreenInfo(gfx::NativeView view); 124 void UpdateScreenInfo(gfx::NativeView view);
122 125
123 // Tells if the display property (work area/scale factor) has 126 // Tells if the display property (work area/scale factor) has
124 // changed since the last time. 127 // changed since the last time.
125 bool HasDisplayPropertyChanged(gfx::NativeView view); 128 bool HasDisplayPropertyChanged(gfx::NativeView view);
126 129
130 // Notifies the top level page RWHVBase about a change in text input state in
kenrb 2016/02/01 20:12:43 It suffices to say RenderWidgetHostView instead of
EhsanK 2016/02/12 15:46:59 Done.
131 // RWHVBase corresponding to out of process content represented by
132 // BrowserPlugin.
133 // TODO(ekaramad): Remove this API when BrowserPlugin is removed.
134 void NotifyGuestTextInputStateChanged(RenderWidgetHostViewBase* guest_rwhv);
135
136 // The current cached text input state which might be different from
137 // text_input_state_ if the view is for a main frame.
138 const TextInputState* current_text_input_state() const {
139 return cached_text_input_state_;
140 }
141
127 base::WeakPtr<RenderWidgetHostViewBase> GetWeakPtr(); 142 base::WeakPtr<RenderWidgetHostViewBase> GetWeakPtr();
128 143
129 //---------------------------------------------------------------------------- 144 //----------------------------------------------------------------------------
130 // The following methods can be overridden by derived classes. 145 // The following methods can be overridden by derived classes.
131 146
132 // Notifies the View that the renderer text selection has changed. 147 // Notifies the View that the renderer text selection has changed.
133 virtual void SelectionChanged(const base::string16& text, 148 virtual void SelectionChanged(const base::string16& text,
134 size_t offset, 149 size_t offset,
135 const gfx::Range& range); 150 const gfx::Range& range);
136 151
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 // embedded within the RenderWidgetHostViewBase's Surface to the 239 // embedded within the RenderWidgetHostViewBase's Surface to the
225 // coordinate space of the embedding Surface. Typically this means that a 240 // 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 241 // 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 242 // 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 243 // this method is called on the root RWHV with the out-of-process iframe's
229 // SurfaceId. 244 // SurfaceId.
230 virtual void TransformPointToLocalCoordSpace(const gfx::Point& point, 245 virtual void TransformPointToLocalCoordSpace(const gfx::Point& point,
231 cc::SurfaceId original_surface, 246 cc::SurfaceId original_surface,
232 gfx::Point* transformed_point); 247 gfx::Point* transformed_point);
233 248
249 // Updates the state of the input method attached to the view.
kenrb 2016/02/01 20:12:43 These comments need to be expanded. It appears tha
EhsanK 2016/02/12 15:46:59 Done.
250 // TODO(ekaramad): Make this non-virtual if possible.
251 virtual void TextInputStateChanged(
252 const ViewHostMsg_TextInputState_Params& 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 NotifyTextInputStateChanged();
258
259 // Returns true if this RenderWidgetHostViewBase is for a main frame.
260 virtual bool ShouldObtainTextInputStateFromSubFrameViews() const;
261
234 //---------------------------------------------------------------------------- 262 //----------------------------------------------------------------------------
235 // The following static methods are implemented by each platform. 263 // The following static methods are implemented by each platform.
236 264
237 static void GetDefaultScreenInfo(blink::WebScreenInfo* results); 265 static void GetDefaultScreenInfo(blink::WebScreenInfo* results);
238 266
239 //---------------------------------------------------------------------------- 267 //----------------------------------------------------------------------------
240 // The following pure virtual methods are implemented by derived classes. 268 // The following pure virtual methods are implemented by derived classes.
241 269
242 // Perform all the initialization steps necessary for this object to represent 270 // 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|. 271 // 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. 282 // |scroll_offset| is the scroll offset of the render view.
255 virtual void MovePluginWindows( 283 virtual void MovePluginWindows(
256 const std::vector<WebPluginGeometry>& moves) = 0; 284 const std::vector<WebPluginGeometry>& moves) = 0;
257 285
258 // Sets the cursor to the one associated with the specified cursor_type 286 // Sets the cursor to the one associated with the specified cursor_type
259 virtual void UpdateCursor(const WebCursor& cursor) = 0; 287 virtual void UpdateCursor(const WebCursor& cursor) = 0;
260 288
261 // Indicates whether the page has finished loading. 289 // Indicates whether the page has finished loading.
262 virtual void SetIsLoading(bool is_loading) = 0; 290 virtual void SetIsLoading(bool is_loading) = 0;
263 291
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. 292 // Cancel the ongoing composition of the input method attached to the view.
269 virtual void ImeCancelComposition() = 0; 293 virtual void ImeCancelComposition() = 0;
270 294
271 // Notifies the View that the renderer has ceased to exist. 295 // Notifies the View that the renderer has ceased to exist.
272 virtual void RenderProcessGone(base::TerminationStatus status, 296 virtual void RenderProcessGone(base::TerminationStatus status,
273 int error_code) = 0; 297 int error_code) = 0;
274 298
275 // Tells the View to destroy itself. 299 // Tells the View to destroy itself.
276 virtual void Destroy() = 0; 300 virtual void Destroy() = 0;
277 301
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 409
386 // The callback that DetachPluginsHelper calls for each child window. Call 410 // The callback that DetachPluginsHelper calls for each child window. Call
387 // this directly if you want to do custom filtering on plugin windows first. 411 // this directly if you want to do custom filtering on plugin windows first.
388 static void DetachPluginWindowsCallback(HWND window); 412 static void DetachPluginWindowsCallback(HWND window);
389 #endif 413 #endif
390 414
391 protected: 415 protected:
392 // Interface class only, do not construct. 416 // Interface class only, do not construct.
393 RenderWidgetHostViewBase(); 417 RenderWidgetHostViewBase();
394 418
419 // The frame currently focused in the frame tree containing this.
420 RenderFrameHostImpl* GetFocusedFrame() const;
421
395 #if defined(OS_WIN) 422 #if defined(OS_WIN)
396 // Shared implementation of MovePluginWindows for use by win and aura/wina. 423 // Shared implementation of MovePluginWindows for use by win and aura/wina.
397 static void MovePluginWindowsHelper( 424 static void MovePluginWindowsHelper(
398 HWND parent, 425 HWND parent,
399 const std::vector<WebPluginGeometry>& moves); 426 const std::vector<WebPluginGeometry>& moves);
400 427
401 static void PaintPluginWindowsHelper( 428 static void PaintPluginWindowsHelper(
402 HWND parent, 429 HWND parent,
403 const gfx::Rect& damaged_screen_rect); 430 const gfx::Rect& damaged_screen_rect);
404 431
(...skipping 22 matching lines...) Expand all
427 // A buffer containing the text inside and around the current selection range. 454 // A buffer containing the text inside and around the current selection range.
428 base::string16 selection_text_; 455 base::string16 selection_text_;
429 456
430 // The offset of the text stored in |selection_text_| relative to the start of 457 // The offset of the text stored in |selection_text_| relative to the start of
431 // the web page. 458 // the web page.
432 size_t selection_text_offset_; 459 size_t selection_text_offset_;
433 460
434 // The current selection range relative to the start of the web page. 461 // The current selection range relative to the start of the web page.
435 gfx::Range selection_range_; 462 gfx::Range selection_range_;
436 463
437 protected:
438 // The scale factor of the display the renderer is currently on. 464 // The scale factor of the display the renderer is currently on.
439 float current_device_scale_factor_; 465 float current_device_scale_factor_;
440 466
441 // The orientation of the display the renderer is currently on. 467 // The orientation of the display the renderer is currently on.
442 gfx::Display::Rotation current_display_rotation_; 468 gfx::Display::Rotation current_display_rotation_;
443 469
444 // Whether pinch-to-zoom should be enabled and pinch events forwarded to the 470 // Whether pinch-to-zoom should be enabled and pinch events forwarded to the
445 // renderer. 471 // renderer.
446 bool pinch_zoom_enabled_; 472 bool pinch_zoom_enabled_;
447 473
448 private: 474 private:
449 void FlushInput(); 475 void FlushInput();
450 476
477 // Returns the current text input state from all text input elements in this
478 // view or one of the child frame views.
479 const TextInputState* FindCurrentTextInputState();
480
451 gfx::Rect current_display_area_; 481 gfx::Rect current_display_area_;
452 482
453 uint32_t renderer_frame_number_; 483 uint32_t renderer_frame_number_;
454 484
455 base::OneShotTimer flush_input_timer_; 485 base::OneShotTimer flush_input_timer_;
456 486
487 scoped_ptr<TextInputState> text_input_state_;
488
489 const TextInputState* cached_text_input_state_;
490
491 const RenderWidgetHostViewBase* focused_guest_rwhv_;
492
457 base::WeakPtrFactory<RenderWidgetHostViewBase> weak_factory_; 493 base::WeakPtrFactory<RenderWidgetHostViewBase> weak_factory_;
458 494
459 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewBase); 495 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewBase);
460 }; 496 };
461 497
462 } // namespace content 498 } // namespace content
463 499
464 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_BASE_H_ 500 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_BASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698