Title: [276844] trunk/Source/WebCore
Revision
276844
Author
[email protected]
Date
2021-04-30 11:09:53 -0700 (Fri, 30 Apr 2021)

Log Message

Simplify shouldInvalidateNodeListCachesForAttr() template function
https://bugs.webkit.org/show_bug.cgi?id=225236

Reviewed by Geoffrey Garen.

Simplify shouldInvalidateNodeListCachesForAttr() template function by using if constexpr.

* dom/Node.cpp:
(WebCore::shouldInvalidateNodeListCachesForAttr):
(WebCore::shouldInvalidateNodeListCachesForAttr<numNodeListInvalidationTypes>): Deleted.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (276843 => 276844)


--- trunk/Source/WebCore/ChangeLog	2021-04-30 17:29:54 UTC (rev 276843)
+++ trunk/Source/WebCore/ChangeLog	2021-04-30 18:09:53 UTC (rev 276844)
@@ -1,3 +1,16 @@
+2021-04-30  Chris Dumez  <[email protected]>
+
+        Simplify shouldInvalidateNodeListCachesForAttr() template function
+        https://bugs.webkit.org/show_bug.cgi?id=225236
+
+        Reviewed by Geoffrey Garen.
+
+        Simplify shouldInvalidateNodeListCachesForAttr() template function by using if constexpr.
+
+        * dom/Node.cpp:
+        (WebCore::shouldInvalidateNodeListCachesForAttr):
+        (WebCore::shouldInvalidateNodeListCachesForAttr<numNodeListInvalidationTypes>): Deleted.
+
 2021-04-30  Rob Buis  <[email protected]>
 
         Move ShouldAllowCrossOriginScrolling to RenderLayer

Modified: trunk/Source/WebCore/dom/Node.cpp (276843 => 276844)


--- trunk/Source/WebCore/dom/Node.cpp	2021-04-30 17:29:54 UTC (rev 276843)
+++ trunk/Source/WebCore/dom/Node.cpp	2021-04-30 18:09:53 UTC (rev 276844)
@@ -909,17 +909,15 @@
 template<unsigned type>
 bool shouldInvalidateNodeListCachesForAttr(const unsigned nodeListCounts[], const QualifiedName& attrName)
 {
-    if (nodeListCounts[type] && shouldInvalidateTypeOnAttributeChange(static_cast<NodeListInvalidationType>(type), attrName))
-        return true;
-    return shouldInvalidateNodeListCachesForAttr<type + 1>(nodeListCounts, attrName);
+    if constexpr (type >= numNodeListInvalidationTypes)
+        return false;
+    else {
+        if (nodeListCounts[type] && shouldInvalidateTypeOnAttributeChange(static_cast<NodeListInvalidationType>(type), attrName))
+            return true;
+        return shouldInvalidateNodeListCachesForAttr<type + 1>(nodeListCounts, attrName);
+    }
 }
 
-template<>
-bool shouldInvalidateNodeListCachesForAttr<numNodeListInvalidationTypes>(const unsigned[], const QualifiedName&)
-{
-    return false;
-}
-
 inline bool Document::shouldInvalidateNodeListAndCollectionCaches() const
 {
     for (int type = 0; type < numNodeListInvalidationTypes; ++type) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to