Title: [293138] trunk/Source/WebCore
Revision
293138
Author
cdu...@apple.com
Date
2022-04-20 19:08:23 -0700 (Wed, 20 Apr 2022)

Log Message

Unreviewed follow-up to r293123 to address review feedback from Sam & Darin

* css/SelectorFilter.cpp:
(WebCore::localNameIsKnownToBeLowercase):
(WebCore::SelectorFilter::collectElementIdentifierHashes):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (293137 => 293138)


--- trunk/Source/WebCore/ChangeLog	2022-04-21 01:51:03 UTC (rev 293137)
+++ trunk/Source/WebCore/ChangeLog	2022-04-21 02:08:23 UTC (rev 293138)
@@ -1,3 +1,11 @@
+2022-04-20  Chris Dumez  <cdu...@apple.com>
+
+        Unreviewed follow-up to r293123 to address review feedback from Sam & Darin
+
+        * css/SelectorFilter.cpp:
+        (WebCore::localNameIsKnownToBeLowercase):
+        (WebCore::SelectorFilter::collectElementIdentifierHashes):
+
 2022-04-20  Wenson Hsieh  <wenson_hs...@apple.com>
 
         Avoid falling back to snapshots for transparent images when triggering batch text recognition

Modified: trunk/Source/WebCore/css/SelectorFilter.cpp (293137 => 293138)


--- trunk/Source/WebCore/css/SelectorFilter.cpp	2022-04-21 01:51:03 UTC (rev 293137)
+++ trunk/Source/WebCore/css/SelectorFilter.cpp	2022-04-21 02:08:23 UTC (rev 293138)
@@ -45,9 +45,16 @@
     return name == HTMLNames::classAttr->localName() || name == HTMLNames::idAttr->localName() || name == HTMLNames::styleAttr->localName();
 }
 
+static inline bool localNameIsKnownToBeLowercase(const Element& element)
+{
+    // Known HTML element always return a localName() that is defined inside HTMLNames.h. All known HTML
+    // tags are lowercase.
+    return element.isHTMLElement() && !element.isUnknownElement();
+}
+
 void SelectorFilter::collectElementIdentifierHashes(const Element& element, Vector<unsigned, 4>& identifierHashes)
 {
-    AtomString tagLowercaseLocalName = LIKELY(element.isHTMLElement() && !element.isUnknownElement()) ? element.localName() : element.localName().convertToASCIILowercase();
+    AtomString tagLowercaseLocalName = LIKELY(localNameIsKnownToBeLowercase(element)) ? element.localName() : element.localName().convertToASCIILowercase();
     ASSERT(tagLowercaseLocalName == tagLowercaseLocalName.convertToASCIILowercase());
     identifierHashes.append(tagLowercaseLocalName.impl()->existingHash() * TagNameSalt);
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to