Esempio n. 1
0
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();
}
Esempio n. 2
0
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();
}
Esempio n. 3
0
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();
}
Esempio n. 4
0
bool HTMLTextAreaElement::isValidValue(const String& candidate) const
{
    return !valueMissing(candidate) && !tooLong(candidate, IgnoreDirtyFlag);
}
Esempio n. 5
0
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;
}
Esempio n. 7
0
bool HTMLTextAreaElement::valueMissing() const {
  // We should not call value() for performance.
  return willValidate() && valueMissing(nullptr);
}
Esempio n. 8
0
bool ValidityState::valid() const
{
    bool someError = typeMismatch() || stepMismatch() || rangeUnderflow() || rangeOverflow()
                     || tooLong() || patternMismatch() || valueMissing() || customError();
    return !someError;
}