This source file includes following definitions.
- isTextType
- patternMismatch
- supportsPlaceholder
- supportsSelectionAPI
#include "config.h"
#include "core/html/forms/BaseTextInputType.h"
#include "HTMLNames.h"
#include "bindings/v8/ScriptRegexp.h"
#include "core/html/HTMLInputElement.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() || !ScriptRegexp(rawPattern, TextCaseSensitive).isValid())
return false;
String pattern = "^(?:" + rawPattern + ")$";
int matchLength = 0;
int valueLength = value.length();
int matchOffset = ScriptRegexp(pattern, TextCaseSensitive).match(value, 0, &matchLength);
return matchOffset || matchLength != valueLength;
}
bool BaseTextInputType::supportsPlaceholder() const
{
return true;
}
bool BaseTextInputType::supportsSelectionAPI() const
{
return true;
}
}