Commit a43013cb authored by Darren Shen's avatar Darren Shen Committed by Commit Bot

imf: Remove InputMethodBase::sending_key_event.

sending_key_event was used to determine whether a key event is being
sent from the IME extension. However, we already have a property on the
event called kPropertyFromVK that stores this, so we can just remove
sending_key_event.

Bug: 1005619
Change-Id: I5978c16efe83652f6202e80cf0dd6d1b40c76a53
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1814586Reviewed-by: default avatarShu Chen <shuchen@chromium.org>
Commit-Queue: Darren Shen <shend@chromium.org>
Cr-Commit-Position: refs/heads/master@{#698450}
parent 80fdd0ca
...@@ -271,13 +271,11 @@ SurroundingTextInfo InputMethodBase::GetSurroundingTextInfo() { ...@@ -271,13 +271,11 @@ SurroundingTextInfo InputMethodBase::GetSurroundingTextInfo() {
} }
void InputMethodBase::SendKeyEvent(KeyEvent* event) { void InputMethodBase::SendKeyEvent(KeyEvent* event) {
sending_key_event_ = true;
if (track_key_events_for_testing_) { if (track_key_events_for_testing_) {
key_events_for_testing_.push_back(std::make_unique<KeyEvent>(*event)); key_events_for_testing_.push_back(std::make_unique<KeyEvent>(*event));
} }
ui::EventDispatchDetails details = DispatchKeyEvent(event); ui::EventDispatchDetails details = DispatchKeyEvent(event);
DCHECK(!details.dispatcher_destroyed); DCHECK(!details.dispatcher_destroyed);
sending_key_event_ = false;
} }
InputMethod* InputMethodBase::GetInputMethod() { InputMethod* InputMethodBase::GetInputMethod() {
......
...@@ -131,16 +131,11 @@ class COMPONENT_EXPORT(UI_BASE_IME) InputMethodBase ...@@ -131,16 +131,11 @@ class COMPONENT_EXPORT(UI_BASE_IME) InputMethodBase
// Gets the bounds of the composition text or cursor in |client|. // Gets the bounds of the composition text or cursor in |client|.
std::vector<gfx::Rect> GetCompositionBounds(const TextInputClient* client); std::vector<gfx::Rect> GetCompositionBounds(const TextInputClient* client);
bool sending_key_event() const { return sending_key_event_; }
internal::InputMethodDelegate* delegate() const { return delegate_; } internal::InputMethodDelegate* delegate() const { return delegate_; }
static IMEEngineHandlerInterface* GetEngine(); static IMEEngineHandlerInterface* GetEngine();
private: private:
// Indicates whether the IME extension is currently sending a fake key event.
// This is used in SendKeyEvent.
bool sending_key_event_ = false;
internal::InputMethodDelegate* delegate_; internal::InputMethodDelegate* delegate_;
// InputMethod: // InputMethod:
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "base/auto_reset.h" #include "base/auto_reset.h"
#include "base/bind.h" #include "base/bind.h"
#include "base/environment.h" #include "base/environment.h"
#include "ui/base/ime/constants.h"
#include "ui/base/ime/ime_bridge.h" #include "ui/base/ime/ime_bridge.h"
#include "ui/base/ime/ime_engine_handler_interface.h" #include "ui/base/ime/ime_engine_handler_interface.h"
#include "ui/base/ime/linux/linux_input_method_context_factory.h" #include "ui/base/ime/linux/linux_input_method_context_factory.h"
...@@ -56,7 +57,9 @@ ui::EventDispatchDetails InputMethodAuraLinux::DispatchKeyEvent( ...@@ -56,7 +57,9 @@ ui::EventDispatchDetails InputMethodAuraLinux::DispatchKeyEvent(
if (!GetTextInputClient()) if (!GetTextInputClient())
return DispatchKeyEventPostIME(event); return DispatchKeyEventPostIME(event);
if (!event->HasNativeEvent() && sending_key_event()) { auto* properties = event->properties();
if (!event->HasNativeEvent() && properties &&
properties->find(ui::kPropertyFromVK) != properties->end()) {
// Faked key events that are sent from input.ime.sendKeyEvents. // Faked key events that are sent from input.ime.sendKeyEvents.
ui::EventDispatchDetails details = DispatchKeyEventPostIME(event); ui::EventDispatchDetails details = DispatchKeyEventPostIME(event);
if (details.dispatcher_destroyed || details.target_destroyed || if (details.dispatcher_destroyed || details.target_destroyed ||
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment