示例#1
0
String InputElement::sanitizeValueForTextField(const InputElement* inputElement, const String& proposedValue)
{
#if ENABLE(WCSS)
    InputElementData data = const_cast<InputElement*>(inputElement)->data();
    if (!isConformToInputMask(data, proposedValue)) {
        if (isConformToInputMask(data, data.value()))
            return data.value();
        return String();
    }
#endif
    return replaceEOLAndLimitLength(inputElement, proposedValue, s_maximumLength);
}
示例#2
0
void InputElement::updateValueIfNeeded(InputElementData& data, InputElement* inputElement)
{
    String oldValue = data.value();
    String newValue = inputElement->sanitizeValue(oldValue);
    if (newValue != oldValue)
        inputElement->setValue(newValue);
}
示例#3
0
void InputElement::updateValueIfNeeded(InputElementData& data)
{
    String oldValue = data.value();
    String newValue = data.inputElement()->constrainValue(oldValue);
    if (newValue != oldValue)
        data.inputElement()->setValue(newValue);
}