Bug 253870 - Make disabled form controls selectable. r=masayuki,MarcoZ

This rejiggers a bit the way selection focus is handled so that focusing a
disabled form control with the mouse handles selection properly, and hides the
document selection and so on.

This matches the behavior of other browsers as far as I can tell.

Given now readonly and disabled editors behave the same, we can simplify a bit
the surrounding editor code.

Differential Revision: https://phabricator.services.mozilla.com/D66464
This commit is contained in:
Emilio Cobos Álvarez
2020-03-16 17:41:07 +00:00
parent 75da6b0075
commit b99995f100
32 changed files with 340 additions and 311 deletions

View File

@@ -6639,18 +6639,13 @@ void HTMLInputElement::OnValueChanged(ValueChangeKind aKind) {
}
bool HTMLInputElement::HasCachedSelection() {
bool isCached = false;
TextControlState* state = GetEditorState();
if (state) {
isCached = state->IsSelectionCached() &&
state->HasNeverInitializedBefore() &&
state->GetSelectionProperties().GetStart() !=
state->GetSelectionProperties().GetEnd();
if (isCached) {
state->WillInitEagerly();
}
if (!state) {
return false;
}
return isCached;
return state->IsSelectionCached() && state->HasNeverInitializedBefore() &&
state->GetSelectionProperties().GetStart() !=
state->GetSelectionProperties().GetEnd();
}
void HTMLInputElement::FieldSetDisabledChanged(bool aNotify) {