Commit 1bd7abc4 authored by Antonio Gomes's avatar Antonio Gomes Committed by Commit Bot

Add entries for content editable and date/time field in Mojo's text input state

Both chrome --mash and chrome --mus --use-ime-service use
InputMethodMus for IME. In such cases, pages with 'content editable'
elements simply hang with the following error and stack trace:

  [ERROR:validation_errors.cc(90)] Invalid message: VALIDATION_ERROR_UNKNOWN_ENUM_VALUE

  #1 0x56228f4e5a9e mojo::internal::ReportValidationError()
  #2 0x56228c7ee648 mojo::internal::TextInputState_Data::Validate()
  #3 0x56228c7e2da9 ui::mojom::internal::WindowTree_SetImeVisibility_Params_Data::Validate()
  #4 0x56228c9dfbe2 ui::mojom::WindowTreeRequestValidator::Accept()
  #5 0x56228f4d423c mojo::FilterChain::Accept()
  #6 0x56228f4d5755 mojo::InterfaceEndpointClient::HandleIncomingMessage()
  #7 0x56228f4dc84c mojo::internal::MultiplexRouter::ProcessIncomingMessage()
  #8 0x56228f4dc03f mojo::internal::MultiplexRouter::Accept()
  #9 0x56228f4d4256 mojo::FilterChain::Accept()
  (...)

This happens because in InputMethodMus::UpdateTextInputType,
ui::TextInputType::TEXT_INPUT_TYPE_CONTENT_EDITABLE is the value
(correctly) used to construct the mojo::TextInputState instance
to be sent to Mus.
Down the road, WindowTreeClient::SetImeVisibility calls out to Mus
passing the mojo::TextInputState instance created previously.

At the mojo validation step, it fails (see stack above) because
text_input_state.mojom does not declare CONTENT_EDITABLE
(see IsKnownValue impl in <out>/gen/ui/platform_window/mojo/text_input_state.mojom-shared-internal.h).

Patch fixes this by syncing up ui::TextInputType, blink::WebTextInputType
and mojo::TextInputType.

PS: For the sake of completeness, DATE_TIME_FIELD enum item was added,
    and mojo::TextInputType::LAST is renamed to ::MAX in order to be able to
    compile assert it against ui::TEXT_INPUT_TYPE_MAX.

TEST=load any page with 'contenteditable' attr, in chrome --mash.

BUG=718105,742491

Change-Id: Icbea847e7fc655ca3c04243fefb8d67abaaa9239
Reviewed-on: https://chromium-review.googlesource.com/570056
Commit-Queue: Antonio Gomes <tonikitoo@igalia.com>
Reviewed-by: default avatarTom Sepez <tsepez@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#487025}
parent d482b4bc
per-file *_type_converter*.*=set noparent per-file *_type_converter*.*=set noparent
per-file *_type_converter*.*=file://ipc/SECURITY_OWNERS per-file *_type_converter*.*=file://ipc/SECURITY_OWNERS
per-file *.mojom=set noparent
per-file *.mojom=file://ipc/SECURITY_OWNERS
...@@ -29,6 +29,9 @@ TEXT_INPUT_TYPE_ASSERT(MONTH); ...@@ -29,6 +29,9 @@ TEXT_INPUT_TYPE_ASSERT(MONTH);
TEXT_INPUT_TYPE_ASSERT(TIME); TEXT_INPUT_TYPE_ASSERT(TIME);
TEXT_INPUT_TYPE_ASSERT(WEEK); TEXT_INPUT_TYPE_ASSERT(WEEK);
TEXT_INPUT_TYPE_ASSERT(TEXT_AREA); TEXT_INPUT_TYPE_ASSERT(TEXT_AREA);
TEXT_INPUT_TYPE_ASSERT(CONTENT_EDITABLE);
TEXT_INPUT_TYPE_ASSERT(DATE_TIME_FIELD);
TEXT_INPUT_TYPE_ASSERT(MAX);
#define TEXT_INPUT_FLAG_ASSERT(NAME) \ #define TEXT_INPUT_FLAG_ASSERT(NAME) \
static_assert(static_cast<int32_t>(TextInputFlag::NAME) == \ static_assert(static_cast<int32_t>(TextInputFlag::NAME) == \
......
...@@ -21,7 +21,9 @@ enum TextInputType { ...@@ -21,7 +21,9 @@ enum TextInputType {
TIME, TIME,
WEEK, WEEK,
TEXT_AREA, TEXT_AREA,
LAST = TEXT_AREA, CONTENT_EDITABLE,
DATE_TIME_FIELD,
MAX = DATE_TIME_FIELD,
}; };
// Text input flag which is based on blink::WebTextInputFlags. // Text input flag which is based on blink::WebTextInputFlags.
......
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