mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 12:51:06 +00:00
Backed out 2 changesets (bug 1741469) for causing failures at test_bug1261674-1.html. CLOSED TREE
Backed out changeset b007c139e65c (bug 1741469) Backed out changeset a75f2a426fa3 (bug 1741469)
This commit is contained in:
parent
8e534c20d8
commit
abffec9580
@ -3962,41 +3962,39 @@ nsresult HTMLInputElement::PostHandleEvent(EventChainPostVisitor& aVisitor) {
|
||||
}
|
||||
break;
|
||||
}
|
||||
#if !defined(ANDROID) && !defined(XP_MACOSX)
|
||||
case eWheel: {
|
||||
if (StaticPrefs::dom_input_scrollwheel_modifies_number_value()) {
|
||||
// Handle wheel events as increasing / decreasing the input
|
||||
// element's value when it's focused and it's type is number or
|
||||
// range.
|
||||
WidgetWheelEvent* wheelEvent = aVisitor.mEvent->AsWheelEvent();
|
||||
if (!aVisitor.mEvent->DefaultPrevented() &&
|
||||
aVisitor.mEvent->IsTrusted() && IsMutable() && wheelEvent &&
|
||||
wheelEvent->mDeltaY != 0 &&
|
||||
wheelEvent->mDeltaMode != WheelEvent_Binding::DOM_DELTA_PIXEL) {
|
||||
if (mType == FormControlType::InputNumber) {
|
||||
if (nsContentUtils::IsFocusedContent(this)) {
|
||||
StepNumberControlForUserEvent(wheelEvent->mDeltaY > 0 ? -1
|
||||
: 1);
|
||||
FireChangeEventIfNeeded();
|
||||
aVisitor.mEvent->PreventDefault();
|
||||
}
|
||||
} else if (mType == FormControlType::InputRange &&
|
||||
nsContentUtils::IsFocusedContent(this) &&
|
||||
GetMinimum() < GetMaximum()) {
|
||||
Decimal value = GetValueAsDecimal();
|
||||
Decimal step = GetStep();
|
||||
if (step == kStepAny) {
|
||||
step = GetDefaultStep();
|
||||
}
|
||||
MOZ_ASSERT(value.isFinite() && step.isFinite());
|
||||
SetValueOfRangeForUserEvent(
|
||||
wheelEvent->mDeltaY < 0 ? value + step : value - step);
|
||||
// Handle wheel events as increasing / decreasing the input element's
|
||||
// value when it's focused and it's type is number or range.
|
||||
WidgetWheelEvent* wheelEvent = aVisitor.mEvent->AsWheelEvent();
|
||||
if (!aVisitor.mEvent->DefaultPrevented() &&
|
||||
aVisitor.mEvent->IsTrusted() && IsMutable() && wheelEvent &&
|
||||
wheelEvent->mDeltaY != 0 &&
|
||||
wheelEvent->mDeltaMode != WheelEvent_Binding::DOM_DELTA_PIXEL) {
|
||||
if (mType == FormControlType::InputNumber) {
|
||||
if (nsContentUtils::IsFocusedContent(this)) {
|
||||
StepNumberControlForUserEvent(wheelEvent->mDeltaY > 0 ? -1 : 1);
|
||||
FireChangeEventIfNeeded();
|
||||
aVisitor.mEvent->PreventDefault();
|
||||
}
|
||||
} else if (mType == FormControlType::InputRange &&
|
||||
nsContentUtils::IsFocusedContent(this) &&
|
||||
GetMinimum() < GetMaximum()) {
|
||||
Decimal value = GetValueAsDecimal();
|
||||
Decimal step = GetStep();
|
||||
if (step == kStepAny) {
|
||||
step = GetDefaultStep();
|
||||
}
|
||||
MOZ_ASSERT(value.isFinite() && step.isFinite());
|
||||
SetValueOfRangeForUserEvent(
|
||||
wheelEvent->mDeltaY < 0 ? value + step : value - step);
|
||||
FireChangeEventIfNeeded();
|
||||
aVisitor.mEvent->PreventDefault();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
case eMouseClick: {
|
||||
if (!aVisitor.mEvent->DefaultPrevented() &&
|
||||
aVisitor.mEvent->IsTrusted() &&
|
||||
|
@ -562,6 +562,7 @@ skip-if =
|
||||
[test_bug1250401.html]
|
||||
[test_bug1260664.html]
|
||||
[test_bug1261673.html]
|
||||
skip-if = (os == 'android' || os == 'mac')
|
||||
[test_bug1261674-1.html]
|
||||
skip-if = (os == 'android' || os == 'mac')
|
||||
[test_bug1261674-2.html]
|
||||
|
@ -42,58 +42,26 @@ function runTests() {
|
||||
];
|
||||
|
||||
let testIdx = 0;
|
||||
let result = parseInt(input.value);
|
||||
let numberChange = 0;
|
||||
let expectChange = 0;
|
||||
|
||||
// The expected value of the number field; used in is() check below.
|
||||
// Initialized to the value that the field starts out with; subtests will
|
||||
// modify this if they expect to modify the value.
|
||||
let expectedValue = parseInt(input.value);
|
||||
|
||||
// Actual/expected number of mutations to the number field's value:
|
||||
let actualChangeCount = 0;
|
||||
let expectedChangeCount = 0;
|
||||
|
||||
const prefName = "dom.input.scrollwheel-modifies-number-value";
|
||||
let didFlipPref = false;
|
||||
let isPrefEnabled = SpecialPowers.getBoolPref(prefName);
|
||||
is(isPrefEnabled, false, "Expecting pref to be disabled by default");
|
||||
input.addEventListener("change", () => {
|
||||
++actualChangeCount;
|
||||
++numberChange;
|
||||
});
|
||||
|
||||
function runNext() {
|
||||
let p = params[testIdx];
|
||||
(p.focus) ? input.focus() : input.blur();
|
||||
if (isPrefEnabled && p.valueChanged != 0) {
|
||||
expectedChangeCount++;
|
||||
expectedValue += p.valueChanged;
|
||||
}
|
||||
|
||||
sendWheelAndPaint(input, 1, 1, { deltaY: p.deltaY, deltaMode: p.deltaMode },
|
||||
async () => {
|
||||
is(parseInt(input.value), expectedValue,
|
||||
"Handle wheel in number input test-" + testIdx +
|
||||
" with pref " + (isPrefEnabled ? "en" : "dis") + "abled");
|
||||
|
||||
is(actualChangeCount, expectedChangeCount,
|
||||
"UA should fire change event when input's value changed");
|
||||
if (++testIdx < params.length) {
|
||||
// More subtests remain; kick off the next one.
|
||||
runNext();
|
||||
} else if (!didFlipPref) {
|
||||
// Reached the end of the subtest list. Flip the pref
|
||||
// and restart our iteration over the subtests.
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [[prefName, !isPrefEnabled]],
|
||||
});
|
||||
isPrefEnabled = !isPrefEnabled;
|
||||
didFlipPref = true;
|
||||
testIdx = actualChangeCount = expectedChangeCount = 0;
|
||||
runNext();
|
||||
} else {
|
||||
// Reached the end of the subtest list, for both pref settings.
|
||||
// We're done!
|
||||
SimpleTest.finish();
|
||||
}
|
||||
expectChange = p.valueChanged == 0 ? expectChange : expectChange + 1;
|
||||
result += parseInt(p.valueChanged);
|
||||
sendWheelAndPaint(input, 1, 1, { deltaY: p.deltaY, deltaMode: p.deltaMode }, () => {
|
||||
ok(input.value == result,
|
||||
"Handle wheel in number input test-" + testIdx + " expect " + result +
|
||||
" get " + input.value);
|
||||
ok(numberChange == expectChange,
|
||||
"UA should fire change event when input's value changed, expect " + expectChange + " get " + numberChange);
|
||||
(++testIdx >= params.length) ? SimpleTest.finish() : runNext();
|
||||
});
|
||||
}
|
||||
runNext();
|
||||
|
@ -3036,13 +3036,6 @@
|
||||
value: true
|
||||
mirror: always
|
||||
|
||||
# Does mousewheel scrolling over a focused <input type="number"> field cause
|
||||
# the number value to increase/decrease (rather than scrolling the page)?
|
||||
- name: dom.input.scrollwheel-modifies-number-value
|
||||
type: RelaxedAtomicBool
|
||||
value: false
|
||||
mirror: always
|
||||
|
||||
# Whether to allow or disallow web apps to cancel `beforeinput` events caused
|
||||
# by MozEditableElement#setUserInput() which is used by autocomplete, autofill
|
||||
# and password manager.
|
||||
|
Loading…
Reference in New Issue
Block a user