Commit c70d0f06 authored by Shu Chen's avatar Shu Chen Committed by Commit Bot

Don't compare the key event directly, instead using the FromVK property.

Bug: 937001
Change-Id: If0026c566270327f5b7d90ffa311d90a6e0bfa4d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1498252Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Shu Chen <shuchen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#637565}
parent 9e1d04b5
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include "ui/aura/window.h" #include "ui/aura/window.h"
#include "ui/aura/window_tree_host.h" #include "ui/aura/window_tree_host.h"
#include "ui/base/ime/composition_text.h" #include "ui/base/ime/composition_text.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/text_input_flags.h" #include "ui/base/ime/text_input_flags.h"
#include "ui/events/event.h" #include "ui/events/event.h"
...@@ -151,7 +152,6 @@ InputMethodEngineBase::InputMethodEngineBase() ...@@ -151,7 +152,6 @@ InputMethodEngineBase::InputMethodEngineBase()
next_context_id_(1), next_context_id_(1),
composition_text_(new ui::CompositionText()), composition_text_(new ui::CompositionText()),
composition_cursor_(0), composition_cursor_(0),
sent_key_event_(nullptr),
profile_(nullptr), profile_(nullptr),
next_request_id_(1), next_request_id_(1),
composition_changed_(false), composition_changed_(false),
...@@ -361,11 +361,10 @@ void InputMethodEngineBase::ProcessKeyEvent(const ui::KeyEvent& key_event, ...@@ -361,11 +361,10 @@ void InputMethodEngineBase::ProcessKeyEvent(const ui::KeyEvent& key_event,
KeyboardEvent ext_event; KeyboardEvent ext_event;
GetExtensionKeyboardEventFromKeyEvent(key_event, &ext_event); GetExtensionKeyboardEventFromKeyEvent(key_event, &ext_event);
// If the given key event is equal to the key event sent by // If the given key event is from VK, it means the key event was simulated.
// SendKeyEvents, this engine ID is propagated to the extension IME. // Sets the |extension_id| value so that the IME extension can ignore it.
// Note, this check relies on that ui::KeyEvent is propagated as auto* properties = key_event.properties();
// reference without copying. if (properties && properties->find(ui::kPropertyFromVK) != properties->end())
if (&key_event == sent_key_event_)
ext_event.extension_id = extension_id_; ext_event.extension_id = extension_id_;
// Should not pass key event in password field. // Should not pass key event in password field.
...@@ -453,8 +452,6 @@ bool InputMethodEngineBase::SendKeyEvents( ...@@ -453,8 +452,6 @@ bool InputMethodEngineBase::SendKeyEvents(
type, key_code, ui::KeycodeConverter::CodeStringToDomCode(event.code), type, key_code, ui::KeycodeConverter::CodeStringToDomCode(event.code),
flags, ui::KeycodeConverter::KeyStringToDomKey(event.key), flags, ui::KeycodeConverter::KeyStringToDomKey(event.key),
ui::EventTimeForNow()); ui::EventTimeForNow());
base::AutoReset<const ui::KeyEvent*> reset_sent_key(&sent_key_event_,
&ui_event);
if (!SendKeyEvent(&ui_event, event.code)) if (!SendKeyEvent(&ui_event, event.code))
return false; return false;
} }
......
...@@ -220,10 +220,6 @@ class InputMethodEngineBase : virtual public ui::IMEEngineHandlerInterface { ...@@ -220,10 +220,6 @@ class InputMethodEngineBase : virtual public ui::IMEEngineHandlerInterface {
std::unique_ptr<ui::CompositionText> composition_text_; std::unique_ptr<ui::CompositionText> composition_text_;
int composition_cursor_; int composition_cursor_;
// Used with SendKeyEvents and ProcessKeyEvent to check if the key event
// sent to ProcessKeyEvent is sent by SendKeyEvents.
const ui::KeyEvent* sent_key_event_;
Profile* profile_; Profile* profile_;
using RequestMap = using RequestMap =
......
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