Title: [131403] trunk/Source/WebCore
Revision
131403
Author
msab...@apple.com
Date
2012-10-15 20:29:18 -0700 (Mon, 15 Oct 2012)

Log Message

Add 8 bit patch to Document::isValidName() for the non ASCII case
https://bugs.webkit.org/show_bug.cgi?id=99402

Reviewed by Darin Adler.

Added 8 bit path to complete the processing of an 8 bit names without up-converting.

* dom/Document.cpp:
(WebCore::isValidNameNonASCII):
(WebCore::Document::isValidName):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (131402 => 131403)


--- trunk/Source/WebCore/ChangeLog	2012-10-16 03:26:49 UTC (rev 131402)
+++ trunk/Source/WebCore/ChangeLog	2012-10-16 03:29:18 UTC (rev 131403)
@@ -1,3 +1,16 @@
+2012-10-15  Michael Saboff  <msab...@apple.com>
+
+        Add 8 bit patch to Document::isValidName() for the non ASCII case
+        https://bugs.webkit.org/show_bug.cgi?id=99402
+
+        Reviewed by Darin Adler.
+
+        Added 8 bit path to complete the processing of an 8 bit names without up-converting.
+
+        * dom/Document.cpp:
+        (WebCore::isValidNameNonASCII):
+        (WebCore::Document::isValidName):
+
 2012-10-15  Vlad Grecescu  <igrec...@adobe.com>, Douglas Stockwell  <dstockw...@chromium.org>
 
         Support for background-clip:content-box and padding-box with border-radius

Modified: trunk/Source/WebCore/dom/Document.cpp (131402 => 131403)


--- trunk/Source/WebCore/dom/Document.cpp	2012-10-16 03:26:49 UTC (rev 131402)
+++ trunk/Source/WebCore/dom/Document.cpp	2012-10-16 03:29:18 UTC (rev 131403)
@@ -3923,6 +3923,19 @@
     return String::format("%02d/%02d/%04d %02d:%02d:%02d", date.month() + 1, date.monthDay(), date.fullYear(), date.hour(), date.minute(), date.second());
 }
 
+static bool isValidNameNonASCII(const LChar* characters, unsigned length)
+{
+    if (!isValidNameStart(characters[0]))
+        return false;
+
+    for (unsigned i = 1; i < length; ++i) {
+        if (!isValidNamePart(characters[i]))
+            return false;
+    }
+
+    return true;
+}
+
 static bool isValidNameNonASCII(const UChar* characters, unsigned length)
 {
     unsigned i = 0;
@@ -3963,16 +3976,20 @@
     if (!length)
         return false;
 
-    const UChar* characters;
     if (name.is8Bit()) {
-        if (isValidNameASCII(name.characters8(), length))
-            return true;
-        characters = name.characters();
-    } else {
-        characters = name.characters16();
+        const LChar* characters = name.characters8();
+
         if (isValidNameASCII(characters, length))
             return true;
+
+        return isValidNameNonASCII(characters, length);
     }
+
+    const UChar* characters = name.characters16();
+
+    if (isValidNameASCII(characters, length))
+        return true;
+
     return isValidNameNonASCII(characters, length);
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to