• Antonio Gomes's avatar
    Add entries for content editable and date/time field in Mojo's text input state · 1bd7abc4
    Antonio Gomes authored
    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}
    1bd7abc4
text_input_state.mojom 1.7 KB