We walk up the parent tree way too many times in accessibilityIsIgnored. we should figure out a way to consolidate
A few ideas:
1. Walk up the parent chain once at the beginning of the function, store it in a list/vector. Then just access that list/vector every other time it's needed. This would probably only provide a modest speedup, though - at most a small constant factor.
2. Add a bitfield to every AccessibilityObject that's updated when it's first created / inserted in the tree, keeping track of things to look for in its parent chain, like if it's a descendant of a math block, or of a canvas, or of a table. I'm pretty sure those won't every change once an AccessibilityObject is created. This could provide
3. I'm assuming that any properties that change in the parent change would trigger a layout. Perhaps we can compute a bunch of properties for each object and save the document's layout count, then recompute whenever the layout count has changed. The only thing that might not work for is ARIA-only changes, like if something in the parent chain changes aria-hidden - so maybe we'd have to explicitly mark all descendants as dirty in that case.
4. Chromium often walks the entire tree rooted at a single node. For that specific case it'd be possible to pass information about the parent chain along when exploring each child. Not sure if that'd help much with Mac.