New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 772565 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: Dec 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 3
Type: Bug



Sign in to add a comment

Android: Using virtual keyboard together with physical keyboard produces odd behavior

Project Member Reported by rlanday@chromium.org, Oct 6 2017

Issue description

Chrome Version: 63.0.3233.0 (Official Build) canary (32-bit)
OS: Android N

What steps will reproduce the problem?
(1) Set up an Android device with a physical keyboard.
(2) Set Gboard as the active keyboard and enable showing the virtual keyboard while the physical keyboard is active.
(3) Go to editpad.org and type a few letters on the physical keyboard, then hit enter on the physical keyboard.

What is the expected result?

The letters should remain after pressing enter.

What happens instead?

We delete the letters because the active composition range is on them.


Note: does not repro in an Android EditText widget.
 
I suspect this is related to  crbug.com/772584 .
Bisects to:

https://chromium.googlesource.com/chromium/src/+/ef5c846a3e5d3c994d962ddca7d40f4bc1476044

Introduce InsertIncrementalTextCommand to respect existing style for composition

In order to keep the previous text formatting when continuing typing on the word,
confirming the ongoing composition, or inserting new text, this CL introduces
InsertIncrementalTextCommand for insertion. The command detects  what was
there already, and restricts the write to the character(s) that actually changed.
Note that this CL doesn't change the behavior of events, i.e., it still sends
'beforeinput', 'input', and 'textInput' events with the entire text.

BUG= 620549 

Review-Url: https://codereview.chromium.org/2530843003
Cr-Commit-Position: refs/heads/master@{#438490}


I accidentally came up with a CL that fixes this while working on  https://crbug.com/737395 . Seems to be related to how we update the selection after applying IME commands.
I think the problem here is that for physical keyboard input, we should be replacing the selection instead of the composition range (I need to verify how this works for a native TextView though). My accidental "fix" is closing out typing (i.e. clearing the composition range) after setComposingText(), which is not the correct behavior.
Project Member

Comment 4 by bugdroid1@chromium.org, Dec 1 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/812d7fc095e9093848a6207eaa635772a7bb52f4

commit 812d7fc095e9093848a6207eaa635772a7bb52f4
Author: Ryan Landay <rlanday@chromium.org>
Date: Fri Dec 01 05:04:21 2017

Fix incorrect ending selection after InputMethodController::SetComposition()

InputMethodController::SetComposition() works as follows:

1. The current composition range is selected (we don't show this to users).
2. The selection is replaced with the new text, which is left selected.
3. The resulting selection is converted to a composition range, and we change
   the selection to whatever the IME requested be selected afterwards.

Step 2 causes the open TypingCommand's ending selection to be set to the
resulting composition range. We need to update it after step 3 to fix two
problems:

1. Pressing enter on a physical keyboard on Android with an open composition
   range causes the text in the composition range to be incorrectly deleted.

2. Pressing Ctrl-Z to undo causes each word to be selected in turn (see video on
   https://crbug.com/787598).

There's another problem with undo on Android, which is that the TypingCommand is
closed out after every call to SetComposition() when we select the composition,
which means undo only undoes one character at a time. I might fix this in a
separate CL.

Bug: 787598,  772565 ,  772584 
Change-Id: I29f09e3c0bd97c6c8e17e5455c5579b53aa34c1b
Reviewed-on: https://chromium-review.googlesource.com/783770
Commit-Queue: Ryan Landay <rlanday@chromium.org>
Reviewed-by: Changwan Ryu <changwan@chromium.org>
Reviewed-by: Xiaocheng Hu <xiaochengh@chromium.org>
Reviewed-by: Yoshifumi Inoue <yosin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#520857}
[modify] https://crrev.com/812d7fc095e9093848a6207eaa635772a7bb52f4/content/public/android/java/src/org/chromium/content/browser/input/ImeAdapter.java
[modify] https://crrev.com/812d7fc095e9093848a6207eaa635772a7bb52f4/content/public/android/java/src/org/chromium/content/browser/input/ThreadedInputConnection.java
[modify] https://crrev.com/812d7fc095e9093848a6207eaa635772a7bb52f4/third_party/WebKit/Source/core/editing/commands/TypingCommand.h
[modify] https://crrev.com/812d7fc095e9093848a6207eaa635772a7bb52f4/third_party/WebKit/Source/core/editing/ime/InputMethodController.cpp
[modify] https://crrev.com/812d7fc095e9093848a6207eaa635772a7bb52f4/third_party/WebKit/Source/core/editing/ime/InputMethodControllerTest.cpp

Status: Fixed (was: Assigned)
Will be fixed in M65
Components: Blink>Editing>IME

Sign in to add a comment