Index: content/browser/web_contents/web_contents_impl.cc |
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc |
index 2d463287de60180ff5c1c2e3e3f41c96ae7d9f7b..dd34edf211b0d08216315ff7b391274b0dd06f59 100644 |
--- a/content/browser/web_contents/web_contents_impl.cc |
+++ b/content/browser/web_contents/web_contents_impl.cc |
@@ -361,6 +361,7 @@ WebContentsImpl::WebContentsImpl(BrowserContext* browser_context) |
bluetooth_device_connected_(false), |
virtual_keyboard_requested_(false), |
page_scale_factor_is_one_(true), |
+ view_with_active_text_input_(nullptr), |
loading_weak_factory_(this), |
weak_factory_(this) { |
frame_tree_.SetFrameRemoveListener( |
@@ -2240,6 +2241,38 @@ void WebContentsImpl::SendScreenRects() { |
browser_plugin_embedder_->DidSendScreenRects(); |
} |
+TextInputState WebContentsImpl::GetTextInputState() { |
+ if (GetOuterWebContents()) |
+ return GetOuterWebContents()->GetTextInputState(); |
+ return text_input_state_; |
+} |
+ |
+void WebContentsImpl::UpdateTextInputState(RenderWidgetHostViewBase* rwhv, |
+ bool text_input_state_changed) { |
+ // If there is an outer WebContents, let it process this update. |
+ if (GetOuterWebContents()) { |
+ return GetOuterWebContents()->UpdateTextInputState( |
+ rwhv, text_input_state_changed); |
+ } |
+ |
+ // If this RWHV has a text input type of NONE, then there is nothing to |
+ // report to the tab RWHV. |
+ if (view_with_active_text_input_ != rwhv && |
Charlie Reis
2016/03/30 21:52:47
Is this comparison the only reason we need view_wi
EhsanK
2016/03/30 23:36:33
This makes a lot of sense...thanks! Following our
|
+ rwhv->text_input_state()->type == ui::TEXT_INPUT_TYPE_NONE) |
+ return; |
+ |
+ view_with_active_text_input_ = |
+ (rwhv->text_input_state()->type != ui::TEXT_INPUT_TYPE_NONE) ? rwhv |
+ : nullptr; |
+ text_input_state_ = *rwhv->text_input_state(); |
+ |
+ // The top level RWHV should know about the change. |
+ RenderWidgetHostViewBase* tab_rwhv = |
+ static_cast<RenderWidgetHostViewBase*>(GetRenderWidgetHostView()); |
+ if (tab_rwhv) |
+ tab_rwhv->UpdateInputMethodIfNecessary(text_input_state_changed); |
+} |
+ |
BrowserAccessibilityManager* |
WebContentsImpl::GetRootBrowserAccessibilityManager() { |
RenderFrameHostImpl* rfh = GetMainFrame(); |