Bug 1352686 - Prevent range value from being changed when wheel over it in anonymous content. draft
authorRay Lin <ralin@mozilla.com>
Tue, 16 May 2017 14:50:20 +0800
changeset 578631 c1ca73fd05e6bfc121eaf960b80cb055be02d001
parent 578175 3e166b6838931b3933ca274331f9e0e115af5cc0
child 628779 722f9d17d6338f80e2b4f33c1b2ad1318269a5a0
push id58995
push userbmo:ralin@mozilla.com
push dateTue, 16 May 2017 08:32:35 +0000
bugs1352686
milestone55.0a1
Bug 1352686 - Prevent range value from being changed when wheel over it in anonymous content. MozReview-Commit-ID: B3ZY3gjRy9M
dom/html/HTMLInputElement.cpp
--- a/dom/html/HTMLInputElement.cpp
+++ b/dom/html/HTMLInputElement.cpp
@@ -4893,17 +4893,18 @@ HTMLInputElement::PostHandleEvent(EventC
                 do_QueryFrame(GetPrimaryFrame());
               if (numberControlFrame && numberControlFrame->IsFocused()) {
                 StepNumberControlForUserEvent(wheelEvent->mDeltaY > 0 ? -1 : 1);
                 FireChangeEventIfNeeded();
                 aVisitor.mEvent->PreventDefault();
               }
             } else if (mType == NS_FORM_INPUT_RANGE &&
                        nsContentUtils::IsFocusedContent(this) &&
-                       GetMinimum() < GetMaximum()) {
+                       GetMinimum() < GetMaximum() &&
+                       (!IsInNativeAnonymousSubtree() || IsInChromeDocument())) {
               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);