Fixes not being able to send UTF8 characters anymore

This commit is contained in:
Heilig Benedek 2016-07-31 05:10:14 +02:00
parent 015516497c
commit af80b9a7df
2 changed files with 6 additions and 4 deletions

View file

@ -159,7 +159,8 @@ ui::KeyboardCode KeyboardCodeFromKeyIdentifier(const std::string& s,
return ui::VKEY_UNKNOWN; return ui::VKEY_UNKNOWN;
} }
} else { } else {
LOG(WARNING) << "Invalid accelerator token: " << str; if (str.size() > 2)
LOG(WARNING) << "Invalid accelerator token: " << str;
return ui::VKEY_UNKNOWN; return ui::VKEY_UNKNOWN;
} }
} }

View file

@ -176,9 +176,10 @@ bool Converter<blink::WebKeyboardEvent>::FromV8(
out->setKeyIdentifierFromWindowsKeyCode(); out->setKeyIdentifierFromWindowsKeyCode();
if ((out->type == blink::WebInputEvent::Char || if ((out->type == blink::WebInputEvent::Char ||
out->type == blink::WebInputEvent::RawKeyDown) && out->type == blink::WebInputEvent::RawKeyDown) &&
str.size() == 1) { str.size() <= 2) {
out->text[0] = str[0]; base::string16 code = base::UTF8ToUTF16(str);
out->unmodifiedText[0] = str[0]; out->text[0] = code[0];
out->unmodifiedText[0] = code[0];
} }
return true; return true;
} }