Skip to content
Permalink
Browse files
AXCoreObject::childrenIDs can be simplified and more efficient by usi…
…ng 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.



Canonical link: https://commits.webkit.org/246242@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@288334 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
twilco committed Jan 21, 2022
1 parent 7950d3d commit 6ca4f3529f1ecd37a04f5dfad134ed87a461fc4b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
@@ -1,3 +1,20 @@
2022-01-20 Tyler Wilcock <tyler_w@apple.com>

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 <zalan@apple.com>

[LFC][IFC] Add LineContent::inlineBaseDirection to support line based inline direction
@@ -1609,12 +1609,9 @@ inline void AXCoreObject::detachWrapper(AccessibilityDetachmentType detachmentTy

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 {

0 comments on commit 6ca4f35

Please sign in to comment.