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 94fbbb63af8992c4c305c64a6f0bc751540dddac..1e5b02f99ff080c92894a8387bcc99c7f5dc7643 100644 |
--- a/content/browser/renderer_host/render_widget_host_view_base.h |
+++ b/content/browser/renderer_host/render_widget_host_view_base.h |
@@ -41,7 +41,7 @@ class SkBitmap; |
struct AccessibilityHostMsg_EventParams; |
struct ViewHostMsg_SelectionBounds_Params; |
-struct ViewHostMsg_TextInputState_Params; |
+struct TextInputState; |
namespace media { |
class VideoFrame; |
@@ -70,6 +70,7 @@ class SyntheticGestureTarget; |
class WebCursor; |
struct DidOverscrollParams; |
struct NativeWebKeyboardEvent; |
+struct TextInputState; |
struct WebPluginGeometry; |
// Basic implementation shared by concrete RenderWidgetHostView subclasses. |
@@ -127,6 +128,21 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView, |
// changed since the last time. |
bool HasDisplayPropertyChanged(gfx::NativeView view); |
+ // Text input state as last reported by the RenderWidget. |
+ const TextInputState* text_input_state() const { |
+ return text_input_state_.get(); |
+ } |
+ |
+ // Current (cached) value of text input state. It equals text_input_state() |
+ // if this is the RWHV of a child frame. If this is a root RWHV, this value |
+ // is the cached value of the last reported text input state by either the |
+ // root RenderWidget or the RenderWidget of one of the child frames. |
Charlie Reis
2016/03/09 00:09:33
This seems like a confusing method to use correctl
EhsanK
2016/03/14 19:58:08
Thanks for the suggestion. Your point is quite val
|
+ const TextInputState* current_text_input_state() const { |
+ return cached_text_input_state_; |
+ } |
+ |
+ bool ShouldProcessTextInputState(); |
+ |
base::WeakPtr<RenderWidgetHostViewBase> GetWeakPtr(); |
//---------------------------------------------------------------------------- |
@@ -234,6 +250,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 of the |
+ // input since the text input could be due to a change in the focused |
+ // child-frame's (in OOPIF) or the out of process content managed by |
+ // BrowserPlugin. |
+ // TODO(ekaramad): Make this non-virtual if possible. |
+ virtual void TextInputStateChanged(const TextInputState& 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. |
@@ -264,10 +295,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; |
@@ -421,6 +448,9 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView, |
static void DetachPluginsHelper(HWND parent); |
#endif |
+ // Returns the currently focused RWHV. |
Charlie Reis
2016/03/09 00:09:33
Maybe it's worth mentioning how this relates to cu
EhsanK
2016/03/14 19:58:08
It is removed now since the whole logic of getting
|
+ RenderWidgetHostViewBase* GetFocusedView(); |
+ |
// Whether this view is a popup and what kind of popup it is (select, |
// autofill...). |
blink::WebPopupType popup_type_; |
@@ -448,7 +478,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_; |
@@ -459,6 +488,10 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView, |
// renderer. |
bool pinch_zoom_enabled_; |
+ // A cached value for the text input state which is used to avoid successive |
+ // calls to GetFocusedView() whenever the text input state is required. |
Charlie Reis
2016/03/09 00:09:33
Maybe mention whether this is valid on anything bu
EhsanK
2016/03/14 19:58:08
I guess removing it will make it simpler.
|
+ const TextInputState* cached_text_input_state_; |
+ |
private: |
void FlushInput(); |
@@ -470,6 +503,13 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView, |
base::ObserverList<RenderWidgetHostViewBaseObserver> observers_; |
+ // The last reported input state by the RenderWidget. |
+ scoped_ptr<TextInputState> text_input_state_; |
+ |
+ // Whether there are changes in text input state which need further |
+ // processing. |
+ bool text_input_state_changed_; |
+ |
base::WeakPtrFactory<RenderWidgetHostViewBase> weak_factory_; |
DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewBase); |