Bug 1385478 - Part 1: Use IsRequired/Required() to get the current required state. r=bz

IsRequired() helper function returns the current 'required' state of the
element, that is, whether its required attribute is set or not. This will be
used only for input elements that @required applies.
This commit is contained in:
Jessica Jong
2017-08-03 01:23:00 -04:00
parent f1faaf0e7d
commit 2cc9e3beb6
13 changed files with 46 additions and 21 deletions

View File

@@ -958,7 +958,7 @@ HTMLTextAreaElement::IntrinsicState() const
{
EventStates state = nsGenericHTMLFormElementWithState::IntrinsicState();
if (HasAttr(kNameSpaceID_None, nsGkAtoms::required)) {
if (Required()) {
state |= NS_EVENT_STATE_REQUIRED;
} else {
state |= NS_EVENT_STATE_OPTIONAL;
@@ -1218,7 +1218,7 @@ HTMLTextAreaElement::IsTooShort()
bool
HTMLTextAreaElement::IsValueMissing() const
{
if (!HasAttr(kNameSpaceID_None, nsGkAtoms::required) || !IsMutable()) {
if (!Required() || !IsMutable()) {
return false;
}