Bug 1850293 - Make editable states not intrinsic. r=smaug,masayuki

This one is tricky because form controls, though I think I got it right...

This fixes a pre-existing bug where we're not following the spec for readonly
inside content-editable.

I filed this as bug 1850390 but other browsers match the spec so add a test and
fix it while at it. This allows cheaper checks for readonlyness in a couple
places.

Differential Revision: https://phabricator.services.mozilla.com/D186896
This commit is contained in:
Emilio Cobos Álvarez
2023-08-30 09:18:31 +00:00
parent a429e38b7d
commit 3e9e56e2c8
21 changed files with 113 additions and 150 deletions

View File

@@ -1883,11 +1883,8 @@ nsresult TextControlState::PrepareEditor(const nsAString* aValue) {
editorFlags = newTextEditor->Flags();
// Check if the readonly attribute is set.
//
// TODO: Should probably call IsDisabled(), as it is cheaper.
if (mTextCtrlElement->HasAttr(nsGkAtoms::readonly) ||
mTextCtrlElement->HasAttr(nsGkAtoms::disabled)) {
// Check if the readonly/disabled attributes are set.
if (mTextCtrlElement->IsDisabledOrReadOnly()) {
editorFlags |= nsIEditor::eEditorReadonlyMask;
}