Bug 1681240 - Make TextControlState::SetValueFlags an enum class r=saschanaz

Using integer as a bit field may cause simple mistake and may not be easy
to read, and we have `EnumSet` class which can treat an `enum class` as
a bit flags so that we should make it an `enum class` and use it with the
`EnumSet` class.

Differential Revision: https://phabricator.services.mozilla.com/D99172
This commit is contained in:
Masayuki Nakano
2020-12-09 23:34:28 +00:00
parent 29715b8fd2
commit fbba4fb0ed
9 changed files with 198 additions and 148 deletions

View File

@@ -39,6 +39,8 @@ class HTMLTextAreaElement final : public TextControlElement,
public nsIConstraintValidation {
public:
using nsIConstraintValidation::GetValidationMessage;
using ValueSetterOption = TextControlState::ValueSetterOption;
using ValueSetterOptions = TextControlState::ValueSetterOptions;
explicit HTMLTextAreaElement(
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
@@ -335,10 +337,10 @@ class HTMLTextAreaElement final : public TextControlElement,
* Setting the value.
*
* @param aValue String to set.
* @param aFlags See TextControlState::SetValueFlags.
* @param aOptions See TextControlState::ValueSetterOption.
*/
MOZ_CAN_RUN_SCRIPT
nsresult SetValueInternal(const nsAString& aValue, uint32_t aFlags);
MOZ_CAN_RUN_SCRIPT nsresult
SetValueInternal(const nsAString& aValue, const ValueSetterOptions& aOptions);
/**
* Common method to call from the various mutation observer methods.