-
Notifications
You must be signed in to change notification settings - Fork 1.6k
AX: Add the ability to dump the accessibility tree via notifyutil #47299
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AX: Add the ability to dump the accessibility tree via notifyutil #47299
Conversation
EWS run on previous version of this PR (hash 19c7c72) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love it!
@@ -1053,4 +1053,6 @@ bool isVisibilityHidden(const RenderStyle&); | |||
|
|||
WTF::TextStream& operator<<(WTF::TextStream&, AXNotification); | |||
|
|||
void showAccessibilityTree(Document&); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about dumpAccessibilityTreeToStderr or something more specific? Show makes it sound like it will be visual
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah agreed. The reason I chose this name is to follow the pattern of the other notifyutil
tree dump functions, e.g.:
But I don't think we really need to follow the pattern in this case, so I'll change it.
continue; | ||
if (document->frame()) { | ||
if (document->frame()->isRootFrame()) | ||
WTFLogAlways("Accessibility tree for root document %p %s", document.ptr(), document->url().string().utf8().data()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does WTFLogAlways do the same as fprintf to stderr, with the same buffering and everything? I think it'd be best if all of the code that logs uses the same mechanism
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WTFLogAlways is a thin-wrapper over this:
// Assertions.cpp
void WTFLogAlwaysV(const char* format, va_list args)
{
vprintf_stderr_with_trailing_newline(nullptr, format, args);
}
So seems like it's always stderr?
I mostly chose WTFLogAlways
to follow the pattern of the several other similar "dump tree" methods, e.g.:
printLayerTreeForLiveDocuments
printRenderTreeForLiveDocuments
printPaintOrderTreeForLiveDocuments
...and a few others
Would you prefer we explicitly fprintf(stderr, "");
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If they're both directly printing to stderr then it's fine. I've just been bitten by, e.g. mixing cerr and stderr because they have separate buffering.
19c7c72
to
dca0422
Compare
EWS run on current version of this PR (hash dca0422) |
https://bugs.webkit.org/show_bug.cgi?id=295101 rdar://154490712 Reviewed by Joshua Hoffman. After this commit, with a build of WebKit that has ENABLE(TREE_DEBUGGING), one can run: notifyutil -p com.apple.WebKit.showAccessibilityTree To dump the accessibility tree on-demand. Also, when ENABLE(INCLUDE_IGNORED_IN_CORE_AX_TREE), this commit changes streamAXCoreObject to print the parent object (including ignored), and streamSubtree to print ignored children. * Source/WebCore/accessibility/AXCoreObject.h: (WebCore::AXCoreObject::parentInCoreTree const): * Source/WebCore/accessibility/AXLogger.cpp: (WebCore::streamSubtree): * Source/WebCore/accessibility/AXObjectCache.cpp: (WebCore::showAccessibilityTree): * Source/WebCore/accessibility/AXObjectCache.h: * Source/WebCore/accessibility/AccessibilityObject.h: (WebCore::AccessibilityObject::parentInCoreTree const): Deleted. * Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp: (WebCore::AXIsolatedTree::updateNode): * Source/WebCore/page/cocoa/PageCocoa.mm: (WebCore::Page::platformInitialize): * Source/WebCore/rendering/RenderObject.cpp: (WebCore::printAccessibilityTreeForLiveDocuments): * Source/WebCore/rendering/RenderObject.h: * Source/WebKit/Resources/cocoa/NotificationAllowList/ForwardedNotifications.def: Canonical link: https://commits.webkit.org/296746@main
dca0422
to
3bcec6c
Compare
Committed 296746@main (3bcec6c): https://commits.webkit.org/296746@main Reviewed commits have been landed. Closing PR #47299 and removing active labels. |
3bcec6c
dca0422
🧪 api-gtk