Title: [149093] trunk
Revision
149093
Author
[email protected]
Date
2013-04-24 23:42:03 -0700 (Wed, 24 Apr 2013)

Log Message

Back references don't work in pattern attribute
https://bugs.webkit.org/show_bug.cgi?id=105875

Reviewed by Geoffrey Garen.

Source/WebCore:

This imports a part of Blink r148951.

Tests: Update fast/forms/ValidityState-patternMismatch.html

* html/BaseTextInputType.cpp:
(WebCore::BaseTextInputType::patternMismatch):
Don't use capturing parentheses. They affected back references in
pattern attribute values.

LayoutTests:

* fast/forms/ValidityState-patternMismatch-expected.txt:
* fast/forms/ValidityState-patternMismatch.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (149092 => 149093)


--- trunk/LayoutTests/ChangeLog	2013-04-25 05:41:07 UTC (rev 149092)
+++ trunk/LayoutTests/ChangeLog	2013-04-25 06:42:03 UTC (rev 149093)
@@ -1,3 +1,13 @@
+2013-04-24  Kent Tamura  <[email protected]>
+
+        Back references don't work in pattern attribute
+        https://bugs.webkit.org/show_bug.cgi?id=105875
+
+        Reviewed by Geoffrey Garen.
+
+        * fast/forms/ValidityState-patternMismatch-expected.txt:
+        * fast/forms/ValidityState-patternMismatch.html:
+
 2013-04-24  Roger Fong  <[email protected]>
 
         Roll out AppleWin re-baselines from r149088.

Modified: trunk/LayoutTests/fast/forms/ValidityState-patternMismatch-expected.txt (149092 => 149093)


--- trunk/LayoutTests/fast/forms/ValidityState-patternMismatch-expected.txt	2013-04-25 05:41:07 UTC (rev 149092)
+++ trunk/LayoutTests/fast/forms/ValidityState-patternMismatch-expected.txt	2013-04-25 06:42:03 UTC (rev 149093)
@@ -27,6 +27,7 @@
 PASS patternMismatchFor("match-17") is false
 PASS patternMismatchFor("match-18") is false
 PASS patternMismatchFor("match-19") is false
+PASS patternMismatchFor("match-20") is false
 PASS patternMismatchFor("wrong-gray-or-grey") is true
 PASS patternMismatchFor("gray") is false
 PASS patternMismatchFor("grey") is false
@@ -51,6 +52,7 @@
 PASS patternMismatchFor("mismatch-18") is true
 PASS patternMismatchFor("mismatch-19") is true
 PASS patternMismatchFor("mismatch-20") is true
+PASS patternMismatchFor("mismatch-21") is true
 PASS patternMismatchFor("empty-pattern-match") is false
 PASS patternMismatchFor("empty-pattern-mismatch") is true
 PASS patternMismatchFor("disabled") is false

Modified: trunk/LayoutTests/fast/forms/ValidityState-patternMismatch.html (149092 => 149093)


--- trunk/LayoutTests/fast/forms/ValidityState-patternMismatch.html	2013-04-25 05:41:07 UTC (rev 149092)
+++ trunk/LayoutTests/fast/forms/ValidityState-patternMismatch.html	2013-04-25 06:42:03 UTC (rev 149093)
@@ -31,6 +31,7 @@
 /><input id="match-17" type="text" pattern="foobar" value="" />
 <input id="match-18" type="text" pattern="[0-9]|10|11|12" value="10" />
 <input id="match-19" type="text" pattern="10|11|12|[0-9]" value="12" />
+<input id="match-20" type="text" pattern="f(o|e)\1" value="foo" />
 <input id="empty-pattern-match" type="text" pattern="" value="" />
 <input id="wrong-gray-or-grey" type="text" pattern="gr[ae]y" value="Wrong!"
 /><input id="gray" type="text" pattern="gr[ae]y" value="gray"
@@ -56,6 +57,7 @@
 /><input id="mismatch-18" type="text" pattern="foo\\" value="food"
 /><input id="mismatch-19" type="text" pattern="^" value="wrong"
 /><input id="mismatch-20" type="text" pattern="$" value="wrong"
+/><input id="mismatch-21" type="text" pattern="f(o|e)\1" value="foe"
 /><input id="empty-pattern-mismatch" type="text" pattern="" value="Lorem Ipsum"
 /><input id="disabled" pattern="[0-9][A-Z]{3}" value="00AA" disabled /></div>
 <script language="_javascript_" type="text/_javascript_">
@@ -90,6 +92,7 @@
 shouldBeFalse('patternMismatchFor("match-17")');
 shouldBeFalse('patternMismatchFor("match-18")');
 shouldBeFalse('patternMismatchFor("match-19")');
+shouldBeFalse('patternMismatchFor("match-20")');
 
 shouldBeTrue('patternMismatchFor("wrong-gray-or-grey")');
 shouldBeFalse('patternMismatchFor("gray")');
@@ -116,6 +119,7 @@
 shouldBeTrue('patternMismatchFor("mismatch-18")');
 shouldBeTrue('patternMismatchFor("mismatch-19")');
 shouldBeTrue('patternMismatchFor("mismatch-20")');
+shouldBeTrue('patternMismatchFor("mismatch-21")');
 
 shouldBeFalse('patternMismatchFor("empty-pattern-match")');
 shouldBeTrue('patternMismatchFor("empty-pattern-mismatch")');

Modified: trunk/Source/WebCore/ChangeLog (149092 => 149093)


--- trunk/Source/WebCore/ChangeLog	2013-04-25 05:41:07 UTC (rev 149092)
+++ trunk/Source/WebCore/ChangeLog	2013-04-25 06:42:03 UTC (rev 149093)
@@ -1,3 +1,19 @@
+2013-04-24  Kent Tamura  <[email protected]>
+
+        Back references don't work in pattern attribute
+        https://bugs.webkit.org/show_bug.cgi?id=105875
+
+        Reviewed by Geoffrey Garen.
+
+        This imports a part of Blink r148951.
+
+        Tests: Update fast/forms/ValidityState-patternMismatch.html
+
+        * html/BaseTextInputType.cpp:
+        (WebCore::BaseTextInputType::patternMismatch):
+        Don't use capturing parentheses. They affected back references in
+        pattern attribute values.
+
 2013-04-24  Tim Horton  <[email protected]>
 
         PDFPlugin: Cursor should become an i-beam when over selectable text

Modified: trunk/Source/WebCore/html/BaseTextInputType.cpp (149092 => 149093)


--- trunk/Source/WebCore/html/BaseTextInputType.cpp	2013-04-25 05:41:07 UTC (rev 149092)
+++ trunk/Source/WebCore/html/BaseTextInputType.cpp	2013-04-25 06:42:03 UTC (rev 149093)
@@ -43,7 +43,7 @@
     // Empty values can't be mismatched
     if (rawPattern.isNull() || value.isEmpty())
         return false;
-    String pattern = "^(" + rawPattern + ")$";
+    String pattern = "^(?:" + rawPattern + ")$";
     int matchLength = 0;
     int valueLength = value.length();
     int matchOffset = RegularExpression(pattern, TextCaseSensitive).match(value, 0, &matchLength);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to