BaseTextInputType.cpp [plain text]
#include "config.h"
#include "BaseTextInputType.h"
#include "HTMLInputElement.h"
#include "HTMLNames.h"
#include "RegularExpression.h"
namespace WebCore {
using namespace HTMLNames;
bool BaseTextInputType::isTextType() const
{
return true;
}
bool BaseTextInputType::patternMismatch(const String& value) const
{
const AtomicString& rawPattern = element()->fastGetAttribute(patternAttr);
if (rawPattern.isNull() || value.isEmpty() || !RegularExpression(rawPattern, TextCaseSensitive).isValid())
return false;
String pattern = "^(?:" + rawPattern + ")$";
int matchLength = 0;
int valueLength = value.length();
int matchOffset = RegularExpression(pattern, TextCaseSensitive).match(value, 0, &matchLength);
return matchOffset || matchLength != valueLength;
}
bool BaseTextInputType::supportsPlaceholder() const
{
return true;
}
bool BaseTextInputType::supportsSelectionAPI() const
{
return true;
}
}