зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1679460 - Call Get/SetSelectionRange even when cached r=masayuki
No need to special case here as both already use cached selection. This makes it consistent with SetSelectionStart etc. Differential Revision: https://phabricator.services.mozilla.com/D98185
This commit is contained in:
Родитель
a2aec71886
Коммит
aa1ea75c3a
|
@ -2212,11 +2212,6 @@ void TextControlState::SetSelectionDirection(const nsAString& aDirection,
|
||||||
nsITextControlFrame::SelectionDirection dir =
|
nsITextControlFrame::SelectionDirection dir =
|
||||||
DirectionStringToSelectionDirection(aDirection);
|
DirectionStringToSelectionDirection(aDirection);
|
||||||
|
|
||||||
if (IsSelectionCached()) {
|
|
||||||
GetSelectionProperties().SetDirection(dir);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t start, end;
|
uint32_t start, end;
|
||||||
GetSelectionRange(&start, &end, aRv);
|
GetSelectionRange(&start, &end, aRv);
|
||||||
if (aRv.Failed()) {
|
if (aRv.Failed()) {
|
||||||
|
|
|
@ -43,7 +43,7 @@ const actions = [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "setRangeText()",
|
label: "setRangeText()",
|
||||||
action: el => el.setRangeText("newmiddle")
|
action: el => el.setRangeText("newmiddle", el.selectionStart, el.selectionEnd, "select")
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -79,6 +79,19 @@ els.forEach((el) => {
|
||||||
}, 200);
|
}, 200);
|
||||||
});
|
});
|
||||||
}, `${elLabel}: ${action.label} a second time (must not fire select)`);
|
}, `${elLabel}: ${action.label} a second time (must not fire select)`);
|
||||||
|
|
||||||
|
promise_test(async t => {
|
||||||
|
const element = el.cloneNode(true);
|
||||||
|
|
||||||
|
element.onselect = e => {
|
||||||
|
element.onselect = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
action.action(element);
|
||||||
|
|
||||||
|
// step_wait properly timeouts before the whole test collapses
|
||||||
|
await t.step_wait(() => !element.onselect, "event didn't fire", 200, 10);
|
||||||
|
}, `${elLabel}: ${action.label} disconnected node`);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
Загрузка…
Ссылка в новой задаче