• Darren Shen's avatar
    ime: Fix SetCompositionRange(before, after) to have correct default span · e292c96c
    Darren Shen authored
    When calling SetCompositionRange(before, after) without custom underline
    behaviour, we create a default underline across the new composition
    range.
    
    Unfortunately, there is a mistake in the calculation when there is
    selected text. Although the before/after values correctly takes into
    account text selection, the default span doesn't, which causes incorrect
    underlining.
    
    The current code for creating the default span is in the extensions
    bindings, but that part of the code doesn't have access to the text selection.
    So move the default span logic to InputMethodChromeOS, where we have access
    to the text selection.
    
    Bug: b/174631364, b/168070907
    Test: Add unit test for InputMethodChromeOS.
    Change-Id: I5726c8b106904988051079264b4638afcb43f69b
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2626612Reviewed-by: default avatarKeith Lee <keithlee@chromium.org>
    Commit-Queue: Darren Shen <shend@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#844414}
    e292c96c
input_method_chromeos.cc 31.3 KB