String HTMLTextAreaElement::validationMessage() const { if (!willValidate()) return String(); if (customError()) return customValidationMessage(); if (valueMissing()) return validationMessageValueMissingText(); if (tooLong()) return validationMessageTooLongText(computeLengthForSubmission(value()), maxLength()); return String(); }
String HTMLTextAreaElement::validationMessage() const { if (!willValidate()) return String(); if (customError()) return customValidationMessage(); if (valueMissing()) return locale().queryString(WebLocalizedString::ValidationValueMissing); if (tooLong()) return locale().validationMessageTooLongText(value().length(), maxLength()); if (tooShort()) return locale().validationMessageTooShortText(value().length(), minLength()); return String(); }
String InputType::validationMessage() const { String value = element().value(); // The order of the following checks is meaningful. e.g. We'd like to show the // badInput message even if the control has other validation errors. if (hasBadInput()) return badInputText(); if (valueMissing(value)) return valueMissingText(); if (typeMismatch()) return typeMismatchText(); if (patternMismatch(value)) return validationMessagePatternMismatchText(); if (element().tooLong()) return validationMessageTooLongText(numGraphemeClusters(value), element().maxLength()); if (!isSteppable()) return emptyString(); const Decimal numericValue = parseToNumberOrNaN(value); if (!numericValue.isFinite()) return emptyString(); StepRange stepRange(createStepRange(RejectAny)); if (numericValue < stepRange.minimum()) return validationMessageRangeUnderflowText(serialize(stepRange.minimum())); if (numericValue > stepRange.maximum()) return validationMessageRangeOverflowText(serialize(stepRange.maximum())); if (stepRange.stepMismatch(numericValue)) { const String stepString = stepRange.hasStep() ? serializeForNumberType(stepRange.step() / stepRange.stepScaleFactor()) : emptyString(); return validationMessageStepMismatchText(serialize(stepRange.stepBase()), stepString); } return emptyString(); }
bool HTMLTextAreaElement::isValidValue(const String& candidate) const { return !valueMissing(candidate) && !tooLong(candidate, IgnoreDirtyFlag); }
bool HTMLTextAreaElement::valueMissing() const { return willValidate() && valueMissing(value()); }
bool FormAssociatedElement::valid() const { bool someError = typeMismatch() || stepMismatch() || rangeUnderflow() || rangeOverflow() || tooLong() || patternMismatch() || valueMissing() || hasBadInput() || customError(); return !someError; }
bool HTMLTextAreaElement::valueMissing() const { // We should not call value() for performance. return willValidate() && valueMissing(nullptr); }
bool ValidityState::valid() const { bool someError = typeMismatch() || stepMismatch() || rangeUnderflow() || rangeOverflow() || tooLong() || patternMismatch() || valueMissing() || customError(); return !someError; }