Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(955)

Unified Diff: Source/core/html/BaseTextInputType.cpp

Issue 13896017: Switch RegularExpression from YARR to V8 (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Review from adamk and abarth Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/html/BaseTextInputType.cpp
diff --git a/Source/core/html/BaseTextInputType.cpp b/Source/core/html/BaseTextInputType.cpp
index 9a9540f70035465b5eab3d57c83b1dd8526df30b..fd9c9e5b748ad7c458ac641039637b4bacb9c57b 100644
--- a/Source/core/html/BaseTextInputType.cpp
+++ b/Source/core/html/BaseTextInputType.cpp
@@ -44,9 +44,12 @@ bool BaseTextInputType::patternMismatch(const String& value) const
if (rawPattern.isNull() || value.isEmpty())
return false;
String pattern = "^(" + rawPattern + ")$";
+ RegularExpression regex(pattern, TextCaseSensitive);
+ if (!regex.isValid())
adamk 2013/04/22 17:48:03 There are other uses of RegularExpression; is ther
+ return false;
int matchLength = 0;
int valueLength = value.length();
- int matchOffset = RegularExpression(pattern, TextCaseSensitive).match(value, 0, &matchLength);
+ int matchOffset = regex.match(value, 0, &matchLength);
return matchOffset || matchLength != valueLength;
}

Powered by Google App Engine
This is Rietveld 408576698