Commit 7ed5037b authored by Keren Zhu's avatar Keren Zhu Committed by Chromium LUCI CQ

win: Fix unexpected insert after delete of composition

This CL fixes crbug/1161831 by partially reverting crrev.com/c/2580971

Issue: ResetCompositionState() sets |selection_| to client's composition
end. This is problematic when the user deletes the composition, in which
case |ResetCompositionState| is called in OnEndEdit(), before the
composition in Blink is updated.

This CL fixes the issue by restricting ResetCompositionState() to cases
initiated by the browser. i.e. remove ResetCompositionState() from
OnEndEdit().

TEST=manually verify crbug 1161831

Bug: 1161831
Change-Id: I1791e25faf737915aa5c491defa6e766f84507c0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2618292Reviewed-by: default avatarSiye Liu <siliu@microsoft.com>
Reviewed-by: default avatarYohei Yukawa <yukawa@chromium.org>
Commit-Queue: Keren Zhu <kerenzhu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#841865}
parent 6b463e81
......@@ -972,8 +972,15 @@ HRESULT TSFTextStore::OnEndEdit(ITfContext* context,
}
composition_start_ = selection_.start();
if (has_composition_range_)
ResetCompositionState();
if (has_composition_range_) {
has_composition_range_ = false;
composition_range_.set_start(0);
composition_range_.set_end(0);
previous_composition_string_.clear();
previous_composition_start_ = 0;
previous_composition_selection_range_ = gfx::Range::InvalidRange();
previous_text_spans_.clear();
}
return S_OK;
}
......
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