Bug 1676785 - Simplify XUL special code-path for <input> value setter. r=masayuki

This allows us to remove nsISelectionController.selectAll() and related
code too, and should not change behavior.

Differential Revision: https://phabricator.services.mozilla.com/D97011
This commit is contained in:
Emilio Cobos Álvarez
2020-12-02 10:44:25 +00:00
parent f3028fdda7
commit 04a3587f2a
10 changed files with 56 additions and 108 deletions

View File

@@ -2641,10 +2641,14 @@ nsresult HTMLInputElement::SetValueInternal(const nsAString& aValue,
// We want to remember if the SetValueInternal() call is being made for a XUL
// element. We do that by looking at the parent node here, and if that node
// is a XUL node, we consider our control a XUL control.
nsIContent* parent = GetParent();
if (parent && parent->IsXULElement()) {
aFlags |= TextControlState::eSetValue_ForXUL;
// is a XUL node, we consider our control a XUL control. XUL controls preserve
// edit history across value setters.
//
// TODO(emilio): Rather than doing this maybe add an attribute instead and
// read it only on chrome docs or something? That'd allow front-end code to
// move away from xul without weird side-effects.
if (mParent && mParent->IsXULElement()) {
aFlags |= TextControlState::eSetValue_PreserveHistory;
}
switch (GetValueMode()) {