Bug 1682706 - Use SelectionBatcher in SetRangeText r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D100705
This commit is contained in:
@@ -2307,6 +2307,11 @@ void TextControlState::SetRangeText(const nsAString& aReplacement,
|
||||
selectionEnd = *aSelectionEnd;
|
||||
}
|
||||
|
||||
// Batch selectionchanges from SetValueFromSetRangeText and SetSelectionRange
|
||||
Selection* selection =
|
||||
mSelCon ? mSelCon->GetSelection(SelectionType::eNormal) : nullptr;
|
||||
SelectionBatcher selectionBatcher(selection); // no-op if nullptr
|
||||
|
||||
MOZ_ASSERT(aStart <= aEnd);
|
||||
value.Replace(aStart, aEnd - aStart, aReplacement);
|
||||
nsresult rv =
|
||||
|
||||
@@ -100,6 +100,15 @@
|
||||
assert_equals(collector.events.length, 1);
|
||||
}, `Calling select() on ${name}`);
|
||||
|
||||
promise_test(async () => {
|
||||
await data.initialize();
|
||||
|
||||
target.setRangeText("newmiddle", 2, 3, "select");
|
||||
|
||||
await data.assert_empty_spin();
|
||||
assert_equals(collector.events.length, 1);
|
||||
}, `Calling setRangeText() on ${name}`);
|
||||
|
||||
promise_test(async () => {
|
||||
await data.initialize();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user