nsresult HTMLTextAreaElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName, const nsAttrValue* aValue, bool aNotify) { if (aNameSpaceID == kNameSpaceID_None) { if (aName == nsGkAtoms::required || aName == nsGkAtoms::disabled || aName == nsGkAtoms::readonly) { UpdateValueMissingValidityState(); // This *has* to be called *after* validity has changed. if (aName == nsGkAtoms::readonly || aName == nsGkAtoms::disabled) { UpdateBarredFromConstraintValidation(); } } else if (aName == nsGkAtoms::maxlength) { UpdateTooLongValidityState(); } else if (aName == nsGkAtoms::minlength) { UpdateTooShortValidityState(); } UpdateState(aNotify); } return nsGenericHTMLFormElementWithState::AfterSetAttr(aNameSpaceID, aName, aValue, aNotify); }
HTMLTextAreaElement::OnValueChanged(bool aNotify) { // Update the validity state bool validBefore = IsValid(); UpdateTooLongValidityState(); UpdateValueMissingValidityState(); if (validBefore != IsValid()) { UpdateState(aNotify); } }
HTMLTextAreaElement::OnValueChanged(bool aNotify, bool aWasInteractiveUserChange) { mLastValueChangeWasInteractive = aWasInteractiveUserChange; // Update the validity state bool validBefore = IsValid(); UpdateTooLongValidityState(); UpdateTooShortValidityState(); UpdateValueMissingValidityState(); if (validBefore != IsValid() || HasAttr(kNameSpaceID_None, nsGkAtoms::placeholder)) { UpdateState(aNotify); } }
HTMLTextAreaElement::OnValueChanged(bool aNotify, ValueChangeKind aKind) { if (aKind != ValueChangeKind::Internal) { mLastValueChangeWasInteractive = aKind == ValueChangeKind::UserInteraction; } // Update the validity state bool validBefore = IsValid(); UpdateTooLongValidityState(); UpdateTooShortValidityState(); UpdateValueMissingValidityState(); if (validBefore != IsValid() || HasAttr(kNameSpaceID_None, nsGkAtoms::placeholder)) { UpdateState(aNotify); } }
nsresult HTMLTextAreaElement::AfterSetAttr(int32_t aNameSpaceID, nsAtom* aName, const nsAttrValue* aValue, const nsAttrValue* aOldValue, nsIPrincipal* aSubjectPrincipal, bool aNotify) { if (aNameSpaceID == kNameSpaceID_None) { if (aName == nsGkAtoms::required || aName == nsGkAtoms::disabled || aName == nsGkAtoms::readonly) { if (aName == nsGkAtoms::disabled) { // This *has* to be called *before* validity state check because // UpdateBarredFromConstraintValidation and // UpdateValueMissingValidityState depend on our disabled state. UpdateDisabledState(aNotify); } if (aName == nsGkAtoms::required) { // This *has* to be called *before* UpdateValueMissingValidityState // because UpdateValueMissingValidityState depends on our required // state. UpdateRequiredState(!!aValue, aNotify); } UpdateValueMissingValidityState(); // This *has* to be called *after* validity has changed. if (aName == nsGkAtoms::readonly || aName == nsGkAtoms::disabled) { UpdateBarredFromConstraintValidation(); } } else if (aName == nsGkAtoms::autocomplete) { // Clear the cached @autocomplete attribute state. mAutocompleteAttrState = nsContentUtils::eAutocompleteAttrState_Unknown; } else if (aName == nsGkAtoms::maxlength) { UpdateTooLongValidityState(); } else if (aName == nsGkAtoms::minlength) { UpdateTooShortValidityState(); } } return nsGenericHTMLFormElementWithState::AfterSetAttr( aNameSpaceID, aName, aValue, aOldValue, aSubjectPrincipal, aNotify); }