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

Unified Diff: third_party/WebKit/Source/platform/text/Character.h

Issue 2288653002: Make custom element name checks faster and fewer (Closed)
Patch Set: Fresh start. No ExceptionState pointers. Created 4 years, 3 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: third_party/WebKit/Source/platform/text/Character.h
diff --git a/third_party/WebKit/Source/platform/text/Character.h b/third_party/WebKit/Source/platform/text/Character.h
index 1bef1a6713bfa6b0ebe72430d5ece69e1dd9587b..54dc9ce70892cd810dedf40fde689a206afe6475 100644
--- a/third_party/WebKit/Source/platform/text/Character.h
+++ b/third_party/WebKit/Source/platform/text/Character.h
@@ -81,6 +81,18 @@ public:
static bool isUprightInMixedVertical(UChar32 character);
// https://html.spec.whatwg.org/multipage/scripting.html#prod-potentialcustomelementname
+ static bool isPotentialCustomElementNameStartChar(UChar ch)
+ {
+ return 'a' <= ch && ch <= 'z';
esprehn 2016/09/02 00:53:20 what about upper case? You can just call isASCIILo
+ }
+ static bool isPotentialCustomElementName8BitChar(UChar ch)
esprehn 2016/09/02 00:53:20 LChar? or template<typename CharType>. Widening th
+ {
+ DCHECK_LE(ch, 0xff);
+ return ('a' <= ch && ch <= 'z')
+ || ('0' <= ch && ch <= '9')
+ || ch == '-' || ch == '.' || ch == '_' || ch == 0xb7
+ || (0xc0 <= ch && ch != 0xd7 && ch != 0xf7);
esprehn 2016/09/02 00:53:20 btw I don't know why this is in platform/, can we
+ }
static bool isPotentialCustomElementNameChar(UChar32 character);
static bool treatAsSpace(UChar32 c)

Powered by Google App Engine
This is Rietveld 408576698