diff --git a/dom/events/EventStateManager.cpp b/dom/events/EventStateManager.cpp index a7f47917a85..895e1b0893d 100644 --- a/dom/events/EventStateManager.cpp +++ b/dom/events/EventStateManager.cpp @@ -1510,7 +1510,7 @@ EventStateManager::FireContextClick() nsCOMPtr formCtrl(do_QueryInterface(mGestureDownContent)); if (formCtrl) { - allowedToDispatch = formCtrl->IsTextControl(false) || + allowedToDispatch = formCtrl->IsTextOrNumberControl(/*aExcludePassword*/ false) || formCtrl->GetType() == NS_FORM_INPUT_FILE; } else if (mGestureDownContent->IsAnyOfHTMLElements(nsGkAtoms::applet, diff --git a/dom/html/nsGenericHTMLElement.cpp b/dom/html/nsGenericHTMLElement.cpp index 99c897d8ac7..eb1098a76fa 100644 --- a/dom/html/nsGenericHTMLElement.cpp +++ b/dom/html/nsGenericHTMLElement.cpp @@ -2371,7 +2371,7 @@ nsGenericHTMLFormElement::IntrinsicState() const // Make the text controls read-write if (!state.HasState(NS_EVENT_STATE_MOZ_READWRITE) && - IsTextControl(false)) { + IsTextOrNumberControl(/*aExcludePassword*/ false)) { bool roState = GetBoolAttr(nsGkAtoms::readonly); if (!roState) { diff --git a/dom/html/nsIFormControl.h b/dom/html/nsIFormControl.h index 4c151506147..f64e193b057 100644 --- a/dom/html/nsIFormControl.h +++ b/dom/html/nsIFormControl.h @@ -176,7 +176,14 @@ public: * @param aExcludePassword to have NS_FORM_INPUT_PASSWORD returning false. * @return whether this is a text control. */ - inline bool IsTextControl(bool aExcludePassword) const ; + inline bool IsTextControl(bool aExcludePassword) const; + + /** + * Returns true if this is a text control or a number control. + * @param aExcludePassword to have NS_FORM_INPUT_PASSWORD returning false. + * @return true if this is a text control or a number control. + */ + inline bool IsTextOrNumberControl(bool aExcludePassword) const; /** * Returns whether this is a single line text control. @@ -235,6 +242,12 @@ nsIFormControl::IsTextControl(bool aExcludePassword) const IsSingleLineTextControl(aExcludePassword, type); } +bool +nsIFormControl::IsTextOrNumberControl(bool aExcludePassword) const +{ + return IsTextControl(aExcludePassword) || GetType() == NS_FORM_INPUT_NUMBER; +} + bool nsIFormControl::IsSingleLineTextControl(bool aExcludePassword) const { diff --git a/layout/reftests/forms/input/number/pseudo-classes.html b/layout/reftests/forms/input/number/pseudo-classes.html new file mode 100644 index 00000000000..a0c62f72113 --- /dev/null +++ b/layout/reftests/forms/input/number/pseudo-classes.html @@ -0,0 +1,37 @@ + + + + + Test pseudo-classes on number controls + + + + + + + + + + + + + + diff --git a/layout/reftests/forms/input/number/reftest.list b/layout/reftests/forms/input/number/reftest.list index ca7ee72901d..dbc5381bc4b 100644 --- a/layout/reftests/forms/input/number/reftest.list +++ b/layout/reftests/forms/input/number/reftest.list @@ -51,3 +51,4 @@ skip-if(B2G||Mulet) fuzzy-if(skiaContent,2,5) needs-focus == focus-handling.html # bevel which gets slightly different antialiasing after invalidation): fuzzy(128,4) == number-reframe-anon-text-field.html number-reframe-anon-text-field-ref.html +== pseudo-classes.html about:blank