Bug 1461706: Sync disabled state of number control regardless of appearance. r=jwatt

I noticed this bug while fixing bug 1478069, but it goes back way earlier.

Differential Revision: https://phabricator.services.mozilla.com/D3867
This commit is contained in:
Emilio Cobos Álvarez 2018-08-21 13:06:18 +02:00
Родитель a16730c92c
Коммит 27275d8181
3 изменённых файлов: 30 добавлений и 4 удалений

Просмотреть файл

@ -406,6 +406,8 @@ nsNumberControlFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
nsContentUtils::AddScriptRunner(focusJob);
}
SyncDisabledState(); // Sync disabled state of 'mTextField'.
if (StyleDisplay()->mAppearance == StyleAppearance::Textfield) {
// The author has elected to hide the spinner by setting this
// -moz-appearance. We will reframe if it changes.
@ -427,10 +429,6 @@ nsNumberControlFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
nsGkAtoms::div,
CSSPseudoElementType::mozNumberSpinDown);
// FIXME(emilio): doesn't this need to be done in the appearance: textfield
// case as well?
SyncDisabledState();
return NS_OK;
}

Просмотреть файл

@ -355604,6 +355604,12 @@
{}
]
],
"html/input/the-disabled-attribute/number-disabled.html": [
[
"/html/input/the-disabled-attribute/number-disabled.html",
{}
]
],
"html/obsolete/requirements-for-implementations/other-elements-attributes-and-apis/document-all.html": [
[
"/html/obsolete/requirements-for-implementations/other-elements-attributes-and-apis/document-all.html",
@ -596107,6 +596113,10 @@
"49c428c5bea12c200c155cdf70135f209b87c004",
"testharness"
],
"html/input/the-disabled-attribute/number-disabled.html": [
"2472e56c4ecfce73d92b653951275099500128b6",
"testharness"
],
"html/input/the-placeholder-attribute/multiline-cr.html": [
"4184ab2c5ce2a0b42ada8f97e1c32681fc37f052",
"reftest"

Просмотреть файл

@ -0,0 +1,18 @@
<!doctype html>
<title>disabled works properly for number inputs</title>
<link rel="help" href="https://html.spec.whatwg.org/#enabling-and-disabling-form-controls:-the-disabled-attribute">
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1461706">
<link rel="author" href="mailto:emilio@crisal.io" title="Emilio Cobos Álvarez">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<input type="number" disabled>
<input type="number" disabled style="-moz-appearance: textfield; -webkit-appearance: textfield">
<script>
test(function() {
for (const element of Array.from(document.querySelectorAll('input'))) {
element.focus();
assert_true(element.disabled);
assert_equals(document.activeElement, document.body);
}
}, "disabled works on number input regardless of appearance");
</script>