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

Unified 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: Addressing Comments and Fixing Compile Errors 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/render_widget_host_view_base.h
diff --git a/content/browser/renderer_host/render_widget_host_view_base.h b/content/browser/renderer_host/render_widget_host_view_base.h
index 9a2e25bcc2b04abc937a4dd588c51b04d152236b..4dcd91cbe7e5f205835ee4eeb9b03fead88bc120 100644
--- a/content/browser/renderer_host/render_widget_host_view_base.h
+++ b/content/browser/renderer_host/render_widget_host_view_base.h
@@ -62,6 +62,7 @@ class LatencyInfo;
namespace content {
class BrowserAccessibilityDelegate;
class BrowserAccessibilityManager;
+class RenderFrameHostImpl;
class SyntheticGesture;
class SyntheticGestureTarget;
class WebCursor;
@@ -69,6 +70,8 @@ struct DidOverscrollParams;
struct NativeWebKeyboardEvent;
struct WebPluginGeometry;
+using TextInputState = ViewHostMsg_TextInputState_Params;
Charlie Reis 2016/02/17 06:22:14 In cases that params are used widely, we tend to g
EhsanK 2016/02/18 05:48:01 Done. Hopefully I got it right.
+
// Basic implementation shared by concrete RenderWidgetHostView subclasses.
class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView,
public IPC::Listener {
@@ -124,6 +127,12 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView,
// changed since the last time.
bool HasDisplayPropertyChanged(gfx::NativeView view);
+ // The current cached text input state which might be different from
+ // text_input_state_ if the view is for a main frame.
Charlie Reis 2016/02/17 06:22:14 I'm confused. Why would these two differ for the
EhsanK 2016/02/18 05:48:01 |text_input_state_| : the text input state corresp
+ const TextInputState* current_text_input_state() const {
+ return cached_text_input_state_;
+ }
+
base::WeakPtr<RenderWidgetHostViewBase> GetWeakPtr();
//----------------------------------------------------------------------------
@@ -178,7 +187,7 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView,
virtual gfx::AcceleratedWidget AccessibilityGetAcceleratedWidget();
virtual gfx::NativeViewAccessible AccessibilityGetNativeViewAccessible();
- // Informs that the focused DOM node has changed.
+ // Informs that the DOM node has changed.
Charlie Reis 2016/02/17 06:22:14 This doesn't seem like a good change to the commen
EhsanK 2016/02/18 05:48:01 Hmmm. I do not have any recollection of changing t
virtual void FocusedNodeChanged(bool is_editable_node) {}
virtual void OnSwapCompositorFrame(uint32_t output_surface_id,
@@ -231,6 +240,21 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView,
cc::SurfaceId original_surface,
gfx::Point* transformed_point);
+ // This method is excusively called by the owner RenderWidgetHost to inform
+ // the view about a change in the input state which originated in the
+ // corresponding RenderWidget. This state is stored at the RWHV.
+ // Also, this change does not necessarily reflect the current state the input
Charlie Reis 2016/02/17 06:22:14 Typo? (the current state the input state)
EhsanK 2016/02/18 05:48:01 Done.
+ // state could be due to a change in the focused child-frame's (in OOPIF) or
+ // out of process content managed by BrowserPlugin.
+ // TODO(ekaramad): Make this non-virtual if possible.
+ virtual void TextInputStateChanged(
+ const ViewHostMsg_TextInputState_Params& params);
+
+ // Notifies the top level RenderWidgetHostView or the corresponding
+ // ui::InputMethod of a change in text input state in either this RWHV or one
+ // of the child frame's RWHV.
+ virtual void UpdateTextInputState();
+
//----------------------------------------------------------------------------
// The following static methods are implemented by each platform.
@@ -261,10 +285,6 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView,
// Indicates whether the page has finished loading.
virtual void SetIsLoading(bool is_loading) = 0;
- // Updates the state of the input method attached to the view.
- virtual void TextInputStateChanged(
- const ViewHostMsg_TextInputState_Params& params) = 0;
-
// Cancel the ongoing composition of the input method attached to the view.
virtual void ImeCancelComposition() = 0;
@@ -434,7 +454,6 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView,
// The current selection range relative to the start of the web page.
gfx::Range selection_range_;
- protected:
// The scale factor of the display the renderer is currently on.
float current_device_scale_factor_;
@@ -448,12 +467,23 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView,
private:
void FlushInput();
+ // Returns the current text input state from all text input elements in this
+ // view or one of the child frame views.
+ const TextInputState* FindCurrentTextInputState();
+
gfx::Rect current_display_area_;
uint32_t renderer_frame_number_;
base::OneShotTimer flush_input_timer_;
+ // The last reported input state from the RenderWidgetHost.
+ scoped_ptr<TextInputState> text_input_state_;
+
+ // The current cached value of input state which could be obtained from
+ // another RWHV.
+ const TextInputState* cached_text_input_state_;
+
base::WeakPtrFactory<RenderWidgetHostViewBase> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewBase);

Powered by Google App Engine
This is Rietveld 408576698