Diff
Modified: trunk/Source/WebCore/ChangeLog (292263 => 292264)
--- trunk/Source/WebCore/ChangeLog 2022-04-02 10:57:15 UTC (rev 292263)
+++ trunk/Source/WebCore/ChangeLog 2022-04-02 13:35:04 UTC (rev 292264)
@@ -1,3 +1,19 @@
+2022-04-02 Andres Gonzalez <[email protected]>
+
+ Expose AXObjectCache::treeData to the UI process.
+ https://bugs.webkit.org/show_bug.cgi?id=238563
+ <rdar://problem/91057915>
+
+ Reviewed by Chris Fleizach.
+
+ Added Page::accessibilityTreeData so that it can be invoked from the UI
+ process. This will be used to log a textual representation of the AX
+ trees from the browser process.
+
+ * page/Page.cpp:
+ (WebCore::Page::accessibilityTreeData const):
+ * page/Page.h:
+
2022-04-02 Youenn Fablet <[email protected]>
Remove notifications from notification list when notification gets closed
Modified: trunk/Source/WebCore/page/Page.cpp (292263 => 292264)
--- trunk/Source/WebCore/page/Page.cpp 2022-04-02 10:57:15 UTC (rev 292263)
+++ trunk/Source/WebCore/page/Page.cpp 2022-04-02 13:35:04 UTC (rev 292264)
@@ -590,6 +590,17 @@
#endif
}
+std::optional<AXTreeData> Page::accessibilityTreeData() const
+{
+ auto* document = mainFrame().document();
+ if (!document)
+ return std::nullopt;
+
+ if (auto* cache = document->existingAXObjectCache())
+ return { cache->treeData() };
+ return std::nullopt;
+}
+
void Page::progressEstimateChanged(Frame& frameWithProgressUpdate) const
{
if (auto* document = frameWithProgressUpdate.document()) {
Modified: trunk/Source/WebCore/page/Page.h (292263 => 292264)
--- trunk/Source/WebCore/page/Page.h 2022-04-02 10:57:15 UTC (rev 292263)
+++ trunk/Source/WebCore/page/Page.h 2022-04-02 13:35:04 UTC (rev 292264)
@@ -174,6 +174,7 @@
class WheelEventDeltaFilter;
class WheelEventTestMonitor;
+struct AXTreeData;
struct ApplePayAMSUIRequest;
struct SimpleRange;
struct TextRecognitionResult;
@@ -944,6 +945,7 @@
AttachmentElementClient* attachmentElementClient() { return m_attachmentElementClient.get(); }
#endif
+ WEBCORE_EXPORT std::optional<AXTreeData> accessibilityTreeData() const;
#if USE(ATSPI)
AccessibilityRootAtspi* accessibilityRootObject() const { return m_accessibilityRootObject; }
void setAccessibilityRootObject(AccessibilityRootAtspi* rootObject) { m_accessibilityRootObject = rootObject; }
Modified: trunk/Source/WebKit/ChangeLog (292263 => 292264)
--- trunk/Source/WebKit/ChangeLog 2022-04-02 10:57:15 UTC (rev 292263)
+++ trunk/Source/WebKit/ChangeLog 2022-04-02 13:35:04 UTC (rev 292264)
@@ -1,3 +1,26 @@
+2022-04-02 Andres Gonzalez <[email protected]>
+
+ Expose AXObjectCache::treeData to the UI process.
+ https://bugs.webkit.org/show_bug.cgi?id=238563
+ <rdar://problem/91057915>
+
+ Reviewed by Chris Fleizach.
+
+ Exposed Page::accessibilityTreeData so that it can be invoked from the UI
+ process. This will be used to log a textual representation of the AX
+ trees from the browser process.
+
+ * UIProcess/API/Cocoa/WKWebView.h:
+ * UIProcess/API/Cocoa/WKWebView.mm:
+ (-[WKWebView retrieveAccessibilityTreeData:]):
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::getAccessibilityTreeData):
+ * UIProcess/WebPageProxy.h:
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::getAccessibilityTreeData):
+ * WebProcess/WebPage/WebPage.h:
+ * WebProcess/WebPage/WebPage.messages.in:
+
2022-04-02 Adrian Perez de Castro <[email protected]>
[GTK] Replace gtk-doc with gi-docgen
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.h (292263 => 292264)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.h 2022-04-02 10:57:15 UTC (rev 292263)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.h 2022-04-02 13:35:04 UTC (rev 292264)
@@ -445,6 +445,8 @@
*/
- (void)createWebArchiveDataWithCompletionHandler:(void (^)(NSData *, NSError *))completionHandler NS_REFINED_FOR_SWIFT WK_API_AVAILABLE(macos(11.0), ios(14.0));
+- (void)retrieveAccessibilityTreeData:(void (^)(NSData *, NSError *))completionHandler;
+
/*! @abstract A Boolean value indicating whether horizontal swipe gestures
will trigger back-forward list navigations.
@discussion The default value is NO.
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm (292263 => 292264)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm 2022-04-02 10:57:15 UTC (rev 292263)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm 2022-04-02 13:35:04 UTC (rev 292264)
@@ -1704,6 +1704,14 @@
});
}
+- (void)retrieveAccessibilityTreeData:(void (^)(NSData *, NSError *))completionHandler
+{
+ THROW_IF_SUSPENDED;
+ _page->getAccessibilityTreeData([completionHandler = makeBlockPtr(completionHandler)] (API::Data* data) {
+ completionHandler(wrapper(data), nil);
+ });
+}
+
static NSDictionary *dictionaryRepresentationForEditorState(const WebKit::EditorState& state)
{
if (state.isMissingPostLayoutData)
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (292263 => 292264)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2022-04-02 10:57:15 UTC (rev 292263)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2022-04-02 13:35:04 UTC (rev 292264)
@@ -4550,6 +4550,11 @@
sendWithAsyncReply(Messages::WebPage::GetWebArchiveOfFrame(frame->frameID()), toAPIDataCallback(WTFMove(callback)));
}
+void WebPageProxy::getAccessibilityTreeData(CompletionHandler<void(API::Data*)>&& callback)
+{
+ sendWithAsyncReply(Messages::WebPage::GetAccessibilityTreeData(), toAPIDataCallback(WTFMove(callback)));
+}
+
void WebPageProxy::forceRepaint(CompletionHandler<void()>&& callback)
{
if (!hasRunningProcess())
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (292263 => 292264)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.h 2022-04-02 10:57:15 UTC (rev 292263)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h 2022-04-02 13:35:04 UTC (rev 292264)
@@ -1259,6 +1259,7 @@
void getWebArchiveOfFrame(WebFrameProxy*, CompletionHandler<void(API::Data*)>&&);
void runJavaScriptInMainFrame(WebCore::RunJavaScriptParameters&&, CompletionHandler<void(Expected<RefPtr<API::SerializedScriptValue>, WebCore::ExceptionDetails>&&)>&&);
void runJavaScriptInFrameInScriptWorld(WebCore::RunJavaScriptParameters&&, std::optional<WebCore::FrameIdentifier>, API::ContentWorld&, CompletionHandler<void(Expected<RefPtr<API::SerializedScriptValue>, WebCore::ExceptionDetails>&&)>&&);
+ void getAccessibilityTreeData(CompletionHandler<void(API::Data*)>&&);
void forceRepaint(CompletionHandler<void()>&&);
float headerHeightForPrinting(WebFrameProxy&);
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (292263 => 292264)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2022-04-02 10:57:15 UTC (rev 292263)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2022-04-02 13:35:04 UTC (rev 292264)
@@ -4028,6 +4028,31 @@
callback(dataBuffer);
}
+void WebPage::getAccessibilityTreeData(CompletionHandler<void(const std::optional<IPC::SharedBufferCopy>&)>&& callback)
+{
+ IPC::SharedBufferCopy dataBuffer;
+
+#if PLATFORM(COCOA)
+ RetainPtr<CFDataRef> data;
+
+ if (auto treeData = m_page->accessibilityTreeData()) {
+ auto stream = adoptCF(CFWriteStreamCreateWithAllocatedBuffers(0, 0));
+ CFWriteStreamOpen(stream.get());
+
+ CFWriteStreamWrite(stream.get(), treeData->liveTree.utf8().dataAsUInt8Ptr(), treeData->liveTree.utf8().length());
+ CFWriteStreamWrite(stream.get(), treeData->isolatedTree.utf8().dataAsUInt8Ptr(), treeData->isolatedTree.utf8().length());
+
+ data = "" kCFStreamPropertyDataWritten)));
+ CFWriteStreamClose(stream.get());
+ }
+
+ if (data)
+ dataBuffer = IPC::SharedBufferCopy(SharedBuffer::create(data.get()));
+#endif
+
+ callback(dataBuffer);
+}
+
void WebPage::forceRepaintWithoutCallback()
{
m_drawingArea->forceRepaint();
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.h (292263 => 292264)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.h 2022-04-02 10:57:15 UTC (rev 292263)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.h 2022-04-02 13:35:04 UTC (rev 292264)
@@ -1731,6 +1731,7 @@
void getWebArchiveOfFrame(WebCore::FrameIdentifier, CompletionHandler<void(const std::optional<IPC::SharedBufferCopy>&)>&&);
void runJavaScript(WebFrame*, WebCore::RunJavaScriptParameters&&, ContentWorldIdentifier, CompletionHandler<void(const IPC::DataReference&, const std::optional<WebCore::ExceptionDetails>&)>&&);
void runJavaScriptInFrameInScriptWorld(WebCore::RunJavaScriptParameters&&, std::optional<WebCore::FrameIdentifier>, const std::pair<ContentWorldIdentifier, String>& worldData, CompletionHandler<void(const IPC::DataReference&, const std::optional<WebCore::ExceptionDetails>&)>&&);
+ void getAccessibilityTreeData(CompletionHandler<void(const std::optional<IPC::SharedBufferCopy>&)>&&);
void forceRepaint(CompletionHandler<void()>&&);
void takeSnapshot(WebCore::IntRect snapshotRect, WebCore::IntSize bitmapSize, uint32_t options, CompletionHandler<void(const WebKit::ShareableBitmap::Handle&)>&&);
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in (292263 => 292264)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in 2022-04-02 10:57:15 UTC (rev 292263)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in 2022-04-02 13:35:04 UTC (rev 292264)
@@ -235,6 +235,7 @@
RunJavaScriptInFrameInScriptWorld(struct WebCore::RunJavaScriptParameters parameters, std::optional<WebCore::FrameIdentifier> frameID, std::pair<WebKit::ContentWorldIdentifier, String> world) -> (IPC::DataReference resultData, std::optional<WebCore::ExceptionDetails> details)
+ GetAccessibilityTreeData() -> (std::optional<IPC::SharedBufferCopy> dataReference)
ForceRepaint() -> ()
SelectAll()
ScheduleFullEditorStateUpdate()