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

Unified Diff: content/browser/renderer_host/render_widget_host_impl.cc

Issue 2755723002: Fixed an IME bug due to a race in TextInputStateChanged
Patch Set: Using BrowserPlugingEmbedder for determinning focused guests Created 3 years, 9 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_impl.cc
diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc
index 9914db5ce83b44decb9fab14cf8324256ae85c9c..f1d9828f380c01262626466c5b250351084b6c1f 100644
--- a/content/browser/renderer_host/render_widget_host_impl.cc
+++ b/content/browser/renderer_host/render_widget_host_impl.cc
@@ -52,6 +52,7 @@
#include "content/browser/renderer_host/render_widget_host_input_event_router.h"
#include "content/browser/renderer_host/render_widget_host_owner_delegate.h"
#include "content/browser/renderer_host/render_widget_host_view_base.h"
+#include "content/browser/renderer_host/text_input_manager.h"
#include "content/browser/service_worker/service_worker_context_wrapper.h"
#include "content/common/content_constants_internal.h"
#include "content/common/content_switches_internal.h"
@@ -2041,6 +2042,23 @@ void RenderWidgetHostImpl::SetTouchEventEmulationEnabled(
void RenderWidgetHostImpl::OnTextInputStateChanged(
const TextInputState& params) {
+ // TODO(ekaramad): Remove this with BrowserPlugin (https://crbug.com/533069).
+ if (delegate_ && delegate_->GetTextInputManager() &&
+ delegate_->GetTextInputManager()->GetTextInputState() &&
+ delegate_->GetTextInputManager()->GetTextInputState()->type !=
+ ui::TEXT_INPUT_TYPE_NONE &&
+ delegate_->HasFocusedGuests()) {
+ // There is a focused BrowserPlugin-based guest on the page, therefore do
+ // not forward any update to the |view_|. We reach here because focus has
+ // recently been passed on BrowserPlugin but at the same time, RenderWidget
+ // needed to update TextInputState (e.g., an <input> blurred before the
+ // plugin received focus). Since there is no guarantee on the order of the
+ // update IPCs received from the guest process and the embedder process,
+ // this update may be overwriting the correct update from the guest (
+ // https://crbug.com/546645).
+ return;
+ }
+
if (view_)
view_->TextInputStateChanged(params);
}
« no previous file with comments | « content/browser/renderer_host/render_widget_host_delegate.cc ('k') | content/browser/web_contents/web_contents_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698