Title: [288334] trunk/Source/WebCore
Revision
288334
Author
[email protected]
Date
2022-01-20 17:01:42 -0800 (Thu, 20 Jan 2022)

Log Message

AXCoreObject::childrenIDs can be simplified and more efficient by using map
https://bugs.webkit.org/show_bug.cgi?id=235418

Reviewed by Darin Adler.

Follow-up to address Darin's comment at
https://bugs.webkit.org/show_bug.cgi?id=235384#c8.

No tests added because there's no behavior change.

* accessibility/AccessibilityObjectInterface.h:
(WebCore::AXCoreObject::childrenIDs):
Use map instead of for-loop for simplicity and efficiency through
map's use of uncheckedAppend and reserveInitialCapacity.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (288333 => 288334)


--- trunk/Source/WebCore/ChangeLog	2022-01-21 00:34:40 UTC (rev 288333)
+++ trunk/Source/WebCore/ChangeLog	2022-01-21 01:01:42 UTC (rev 288334)
@@ -1,3 +1,20 @@
+2022-01-20  Tyler Wilcock  <[email protected]>
+
+        AXCoreObject::childrenIDs can be simplified and more efficient by using map
+        https://bugs.webkit.org/show_bug.cgi?id=235418
+
+        Reviewed by Darin Adler.
+
+        Follow-up to address Darin's comment at
+        https://bugs.webkit.org/show_bug.cgi?id=235384#c8.
+
+        No tests added because there's no behavior change.
+
+        * accessibility/AccessibilityObjectInterface.h:
+        (WebCore::AXCoreObject::childrenIDs):
+        Use map instead of for-loop for simplicity and efficiency through
+        map's use of uncheckedAppend and reserveInitialCapacity.
+
 2022-01-20  Alan Bujtas  <[email protected]>
 
         [LFC][IFC] Add LineContent::inlineBaseDirection to support line based inline direction

Modified: trunk/Source/WebCore/accessibility/AccessibilityObjectInterface.h (288333 => 288334)


--- trunk/Source/WebCore/accessibility/AccessibilityObjectInterface.h	2022-01-21 00:34:40 UTC (rev 288333)
+++ trunk/Source/WebCore/accessibility/AccessibilityObjectInterface.h	2022-01-21 01:01:42 UTC (rev 288334)
@@ -1609,12 +1609,9 @@
 
 inline Vector<AXID> AXCoreObject::childrenIDs(bool updateChildrenIfNecessary)
 {
-    auto& kids = children(updateChildrenIfNecessary);
-    Vector<AXID> childrenIDs;
-    childrenIDs.reserveCapacity(kids.size());
-    for (const auto& child : kids)
-        childrenIDs.append(child->objectID());
-    return childrenIDs;
+    return children(updateChildrenIfNecessary).map([] (auto& axObject) -> AXID {
+        return axObject->objectID();
+    });
 }
 
 namespace Accessibility {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to