Bug 1893532 - Improve error message of HTMLInputElement.stepUp/stepDown. r=dom-core,sefeng
Differential Revision: https://phabricator.services.mozilla.com/D208671
This commit is contained in:
@@ -663,9 +663,8 @@ class HTMLInputElement final : public TextControlElement,
|
||||
SetUnsignedIntAttr(nsGkAtoms::width, aValue, 0, aRv);
|
||||
}
|
||||
|
||||
void StepUp(int32_t aN, ErrorResult& aRv) { aRv = ApplyStep(aN); }
|
||||
|
||||
void StepDown(int32_t aN, ErrorResult& aRv) { aRv = ApplyStep(-aN); }
|
||||
void StepUp(int32_t aN, ErrorResult& aRv) { ApplyStep(aN, aRv); }
|
||||
void StepDown(int32_t aN, ErrorResult& aRv) { ApplyStep(-aN, aRv); }
|
||||
|
||||
/**
|
||||
* Returns the current step value.
|
||||
@@ -1311,22 +1310,17 @@ class HTMLInputElement final : public TextControlElement,
|
||||
*/
|
||||
Decimal GetDefaultStep() const;
|
||||
|
||||
enum StepCallerType { CALLED_FOR_USER_EVENT, CALLED_FOR_SCRIPT };
|
||||
enum class StepCallerType { ForUserEvent, ForScript };
|
||||
|
||||
/**
|
||||
* Sets the aValue outparam to the value that this input would take if
|
||||
* someone tries to step aStep steps and this input's value would change as
|
||||
* a result. Leaves aValue untouched if this inputs value would not change
|
||||
* (e.g. already at max, and asking for the next step up).
|
||||
* Returns the value that this input would take if someone tries to step
|
||||
* aStepCount steps and this input's value would change as a result, or
|
||||
* Decimal::nan() otherwise (e.g., if this inputs value would not change due
|
||||
* to it being already at max, and asking for the next step up).
|
||||
*
|
||||
* Negative aStep means step down, positive means step up.
|
||||
*
|
||||
* Returns NS_OK or else the error values that should be thrown if this call
|
||||
* was initiated by a stepUp()/stepDown() call from script under conditions
|
||||
* that such a call should throw.
|
||||
*/
|
||||
nsresult GetValueIfStepped(int32_t aStepCount, StepCallerType aCallerType,
|
||||
Decimal* aNextStep);
|
||||
Decimal GetValueIfStepped(int32_t aStepCount, StepCallerType, ErrorResult&);
|
||||
|
||||
/**
|
||||
* Apply a step change from stepUp or stepDown by multiplying aStep by the
|
||||
@@ -1334,7 +1328,7 @@ class HTMLInputElement final : public TextControlElement,
|
||||
*
|
||||
* @param aStep The value used to be multiplied against the step value.
|
||||
*/
|
||||
nsresult ApplyStep(int32_t aStep);
|
||||
void ApplyStep(int32_t aStep, ErrorResult&);
|
||||
|
||||
/**
|
||||
* Returns if the current type is an experimental mobile type.
|
||||
|
||||
Reference in New Issue
Block a user