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); }
void HTMLTextAreaElement::FieldSetDisabledChanged(bool aNotify) { UpdateValueMissingValidityState(); UpdateBarredFromConstraintValidation(); nsGenericHTMLFormElementWithState::FieldSetDisabledChanged(aNotify); }
void HTMLTextAreaElement::UnbindFromTree(bool aDeep, bool aNullParent) { nsGenericHTMLFormElementWithState::UnbindFromTree(aDeep, aNullParent); // We might be no longer disabled because of parent chain changed. UpdateValueMissingValidityState(); UpdateBarredFromConstraintValidation(); // And now make sure our state is up to date UpdateState(false); }
void HTMLTextAreaElement::FieldSetDisabledChanged(bool aNotify) { // This *has* to be called before UpdateBarredFromConstraintValidation and // UpdateValueMissingValidityState because these two functions depend on our // disabled state. nsGenericHTMLFormElementWithState::FieldSetDisabledChanged(aNotify); UpdateValueMissingValidityState(); UpdateBarredFromConstraintValidation(); UpdateState(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::BindToTree(Document* aDocument, nsIContent* aParent, nsIContent* aBindingParent) { nsresult rv = nsGenericHTMLFormElementWithState::BindToTree( aDocument, aParent, aBindingParent); NS_ENSURE_SUCCESS(rv, rv); // If there is a disabled fieldset in the parent chain, the element is now // barred from constraint validation and can't suffer from value missing. UpdateValueMissingValidityState(); UpdateBarredFromConstraintValidation(); // And now make sure our state is up to date UpdateState(false); return rv; }
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); }