Diff
Modified: trunk/Source/WebCore/ChangeLog (285398 => 285399)
--- trunk/Source/WebCore/ChangeLog 2021-11-08 12:48:52 UTC (rev 285398)
+++ trunk/Source/WebCore/ChangeLog 2021-11-08 13:56:36 UTC (rev 285399)
@@ -1,3 +1,39 @@
+2021-11-08 Andres Gonzalez <[email protected]>
+
+ WTR::AccessibilityController::focusedElement() cannot get the focused object via WKAccessibilityFocusedObject in isolated tree mode.
+ https://bugs.webkit.org/show_bug.cgi?id=232756
+ <rdar://problem/85069882>
+
+ Reviewed by Chris Fleizach.
+
+ WTR::AccessibilityController::focusedElement() was getting the focused
+ object from WKAccessibilityFocusedObject, which has to run on the main
+ thread. WKAccessibilityFocusedObject was in turn calling AXObjectCache::
+ focusedUIElementForPage that tried to return the isolated focused
+ object. The problem with this is that the isolated focused object can
+ only be retrieved on the secondary thread.
+ The solution in this patch is to retrieve the focused object from the
+ root object as an AT client would do.
+
+ * accessibility/AXObjectCache.cpp:
+ (WebCore::AXObjectCache::focusedObjectForPage):
+ (WebCore::AXObjectCache::isolatedTreeFocusedObject): Deleted, not needed any more.
+ (WebCore::AXObjectCache::focusedUIElementForPage): Deleted, using focusedObjectForPage instead.
+ * accessibility/AXObjectCache.h:
+ Moved the following inlines out of the class declaration.
+ (WebCore::AXObjectCache::accessibilityEnhancedUserInterfaceEnabled):
+ (WebCore::AXObjectCache::~AXObjectCache):
+ (WebCore::AXObjectCache::focusedObjectForPage):
+ (WebCore::AXObjectCache::enableAccessibility):
+ (WebCore::AXObjectCache::disableAccessibility):
+ (WebCore::AXObjectCache::setEnhancedUserInterfaceAccessibility):
+ (WebCore::AXObjectCache::accessibilityEnabled):
+ (WebCore::AXObjectCache::focusedUIElementForPage): Deleted.
+ * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
+ (-[WebAccessibilityObjectWrapper accessibilityFocusedUIElement]): Code cleanup.
+ * accessibility/win/AXObjectCacheWin.cpp:
+ (WebCore::AXObjectCache::platformHandleFocusedUIElementChanged):
+
2021-11-08 Antoine Quint <[email protected]>
[Web Animations] Add support for composite operations for software animations
Modified: trunk/Source/WebCore/accessibility/AXObjectCache.cpp (285398 => 285399)
--- trunk/Source/WebCore/accessibility/AXObjectCache.cpp 2021-11-08 12:48:52 UTC (rev 285398)
+++ trunk/Source/WebCore/accessibility/AXObjectCache.cpp 2021-11-08 13:56:36 UTC (rev 285399)
@@ -374,7 +374,7 @@
return nullptr;
}
-AXCoreObject* AXObjectCache::focusedObjectForPage(const Page* page)
+AccessibilityObject* AXObjectCache::focusedObjectForPage(const Page* page)
{
ASSERT(isMainThread());
@@ -392,11 +392,7 @@
if (is<HTMLAreaElement>(focusedElement))
return focusedImageMapUIElement(downcast<HTMLAreaElement>(focusedElement));
- auto* axObjectCache = document->axObjectCache();
- if (!axObjectCache)
- return nullptr;
-
- AXCoreObject* focus = axObjectCache->getOrCreate(focusedElement ? focusedElement : static_cast<Node*>(document));
+ auto* focus = getOrCreate(focusedElement ? focusedElement : static_cast<Node*>(document));
if (!focus)
return nullptr;
@@ -407,22 +403,12 @@
// the HTML element, for example, is focusable but has an AX object that is ignored
if (focus->accessibilityIsIgnored())
- focus = focus->parentObjectUnignored();
+ focus = downcast<AccessibilityObject>(focus->parentObjectUnignored());
return focus;
}
#if ENABLE(ACCESSIBILITY_ISOLATED_TREE)
-AXCoreObject* AXObjectCache::isolatedTreeFocusedObject()
-{
- if (auto tree = getOrCreateIsolatedTree())
- return tree->focusedNode().get();
-
- // Should not get here, couldn't create the IsolatedTree.
- ASSERT_NOT_REACHED();
- return nullptr;
-}
-
void AXObjectCache::setIsolatedTreeFocusedObject(Node* focusedNode)
{
ASSERT(isMainThread());
@@ -436,16 +422,6 @@
}
#endif
-AXCoreObject* AXObjectCache::focusedUIElementForPage(const Page* page)
-{
-#if ENABLE(ACCESSIBILITY_ISOLATED_TREE)
- if (isIsolatedTreeEnabled())
- return isolatedTreeFocusedObject();
-#endif
-
- return focusedObjectForPage(page);
-}
-
AccessibilityObject* AXObjectCache::get(Widget* widget)
{
if (!widget)
Modified: trunk/Source/WebCore/accessibility/AXObjectCache.h (285398 => 285399)
--- trunk/Source/WebCore/accessibility/AXObjectCache.h 2021-11-08 12:48:52 UTC (rev 285398)
+++ trunk/Source/WebCore/accessibility/AXObjectCache.h 2021-11-08 13:56:36 UTC (rev 285399)
@@ -148,8 +148,6 @@
explicit AXObjectCache(Document&);
~AXObjectCache();
- WEBCORE_EXPORT AXCoreObject* focusedUIElementForPage(const Page*);
-
// Returns the root object for the entire document.
WEBCORE_EXPORT AXCoreObject* rootObject();
// Returns the root object for a specific frame.
@@ -201,26 +199,17 @@
void recomputeIsIgnored(RenderObject*);
void recomputeIsIgnored(Node*);
-#if ENABLE(ACCESSIBILITY)
WEBCORE_EXPORT static void enableAccessibility();
WEBCORE_EXPORT static void disableAccessibility();
- static AXCoreObject* focusedObjectForPage(const Page*);
+ WEBCORE_EXPORT AccessibilityObject* focusedObjectForPage(const Page*);
// Enhanced user interface accessibility can be toggled by the assistive technology.
WEBCORE_EXPORT static void setEnhancedUserInterfaceAccessibility(bool flag);
-
+
// Note: these may be called from a non-main thread concurrently as other readers.
static bool accessibilityEnabled() { return gAccessibilityEnabled; }
static bool accessibilityEnhancedUserInterfaceEnabled() { return gAccessibilityEnhancedUserInterfaceEnabled; }
-#else
- static AXCoreObject* focusedObjectForPage(const Page*) { return nullptr; }
- static void enableAccessibility() { }
- static void disableAccessibility() { }
- static void setEnhancedUserInterfaceAccessibility(bool) { }
- static bool accessibilityEnabled() { return false; }
- static bool accessibilityEnhancedUserInterfaceEnabled() { return false; }
-#endif
const Element* rootAXEditableElement(const Node*);
bool nodeIsTextControl(const Node*);
@@ -383,7 +372,6 @@
private:
static bool clientSupportsIsolatedTree();
AXCoreObject* isolatedTreeRootObject();
- AXCoreObject* isolatedTreeFocusedObject();
void setIsolatedTreeFocusedObject(Node*);
RefPtr<AXIsolatedTree> getOrCreateIsolatedTree() const;
void updateIsolatedTree(AXCoreObject&, AXNotification);
@@ -559,7 +547,6 @@
inline void AXComputedObjectAttributeCache::setIgnored(AXID, AccessibilityObjectInclusion) { }
inline AXObjectCache::AXObjectCache(Document& document) : m_document(document), m_notificationPostTimer(*this, &AXObjectCache::notificationPostTimerFired), m_passwordNotificationPostTimer(*this, &AXObjectCache::passwordNotificationPostTimerFired), m_liveRegionChangedPostTimer(*this, &AXObjectCache::liveRegionChangedNotificationPostTimerFired), m_focusModalNodeTimer(*this, &AXObjectCache::focusModalNodeTimerFired), m_performCacheUpdateTimer(*this, &AXObjectCache::performCacheUpdateTimerFired) { }
inline AXObjectCache::~AXObjectCache() { }
-inline AXCoreObject* AXObjectCache::focusedUIElementForPage(const Page*) { return nullptr; }
inline AccessibilityObject* AXObjectCache::get(RenderObject*) { return nullptr; }
inline AccessibilityObject* AXObjectCache::get(Node*) { return nullptr; }
inline AccessibilityObject* AXObjectCache::get(Widget*) { return nullptr; }
@@ -569,6 +556,12 @@
inline AccessibilityObject* AXObjectCache::getOrCreate(Widget*) { return nullptr; }
inline AXCoreObject* AXObjectCache::rootObject() { return nullptr; }
inline AccessibilityObject* AXObjectCache::rootObjectForFrame(Frame*) { return nullptr; }
+inline AccessibilityObject* AXObjectCache::focusedObjectForPage(const Page*) { return nullptr; }
+inline static void AXObjectCache::enableAccessibility() { }
+inline static void AXObjectCache::disableAccessibility() { }
+inline static void AXObjectCache::setEnhancedUserInterfaceAccessibility(bool) { }
+inline static bool AXObjectCache::accessibilityEnabled() { return false; }
+inline static bool AXObjectCache::accessibilityEnhancedUserInterfaceEnabled() { return false; }
inline bool nodeHasRole(Node*, const String&) { return false; }
inline void AXObjectCache::startCachingComputedObjectAttributesUntilTreeMutates() { }
inline void AXObjectCache::stopCachingComputedObjectAttributes() { }
Modified: trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm (285398 => 285399)
--- trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm 2021-11-08 12:48:52 UTC (rev 285398)
+++ trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm 2021-11-08 13:56:36 UTC (rev 285399)
@@ -1767,13 +1767,9 @@
{
if (![self _prepareAccessibilityCall])
return nil;
-
- AccessibilityObject* focusedObj = downcast<AccessibilityObject>(self.axBackingObject->focusedUIElement());
-
- if (!focusedObj)
- return nil;
-
- return focusedObj->wrapper();
+
+ auto* focus = self.axBackingObject->focusedUIElement();
+ return focus ? focus->wrapper() : nil;
}
- (id)_accessibilityWebDocumentView
Modified: trunk/Source/WebCore/accessibility/win/AXObjectCacheWin.cpp (285398 => 285399)
--- trunk/Source/WebCore/accessibility/win/AXObjectCacheWin.cpp 2021-11-08 12:48:52 UTC (rev 285398)
+++ trunk/Source/WebCore/accessibility/win/AXObjectCacheWin.cpp 2021-11-08 13:56:36 UTC (rev 285399)
@@ -174,7 +174,7 @@
if (!page || !page->chrome().platformPageClient())
return;
- AXCoreObject* focusedObject = focusedUIElementForPage(page);
+ auto* focusedObject = focusedObjectForPage(page);
if (!focusedObject)
return;
Modified: trunk/Source/WebKit/ChangeLog (285398 => 285399)
--- trunk/Source/WebKit/ChangeLog 2021-11-08 12:48:52 UTC (rev 285398)
+++ trunk/Source/WebKit/ChangeLog 2021-11-08 13:56:36 UTC (rev 285399)
@@ -1,3 +1,24 @@
+2021-11-08 Andres Gonzalez <[email protected]>
+
+ WTR::AccessibilityController::focusedElement() cannot get the focused object via WKAccessibilityFocusedObject in isolated tree mode.
+ https://bugs.webkit.org/show_bug.cgi?id=232756
+ <rdar://problem/85069882>
+
+ Reviewed by Chris Fleizach.
+
+ WTR::AccessibilityController::focusedElement() was getting the focused
+ object from WKAccessibilityFocusedObject, which has to run on the main
+ thread. WKAccessibilityFocusedObject was in turn calling AXObjectCache::
+ focusedUIElementForPage that tried to return the isolated focused
+ object. The problem with this is that the isolated focused object can
+ only be retrieved on the secondary thread.
+ The solution in this patch is to retrieve the focused object from the
+ root object as an AT client would do.
+
+ * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
+ (WKAccessibilityFocusedObject):
+ Now uses AXObjectCache::focusedObejctForPage().
+
2021-11-08 Philippe Normand <[email protected]>
[GStreamer] fast/mediastream/media-stream-video-track-interrupted.html is failing since added in 242093@main
Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp (285398 => 285399)
--- trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp 2021-11-08 12:48:52 UTC (rev 285398)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp 2021-11-08 13:56:36 UTC (rev 285399)
@@ -273,7 +273,7 @@
#if ENABLE(ACCESSIBILITY)
if (!pageRef)
return 0;
-
+
WebCore::Page* page = WebKit::toImpl(pageRef)->corePage();
if (!page)
return 0;
@@ -288,11 +288,8 @@
if (!axObjectCache)
return 0;
- auto* focusedObject = axObjectCache->focusedUIElementForPage(page);
- if (!focusedObject)
- return 0;
-
- return focusedObject->wrapper();
+ auto* focus = axObjectCache->focusedObjectForPage(page);
+ return focus ? focus->wrapper() : 0;
#else
UNUSED_PARAM(pageRef);
return 0;
Modified: trunk/Tools/ChangeLog (285398 => 285399)
--- trunk/Tools/ChangeLog 2021-11-08 12:48:52 UTC (rev 285398)
+++ trunk/Tools/ChangeLog 2021-11-08 13:56:36 UTC (rev 285399)
@@ -1,3 +1,32 @@
+2021-11-08 Andres Gonzalez <[email protected]>
+
+ WTR::AccessibilityController::focusedElement() cannot get the focused object via WKAccessibilityFocusedObject in isolated tree mode.
+ https://bugs.webkit.org/show_bug.cgi?id=232756
+ <rdar://problem/85069882>
+
+ Reviewed by Chris Fleizach.
+
+ WTR::AccessibilityController::focusedElement() was getting the focused
+ object from WKAccessibilityFocusedObject, which has to run on the main
+ thread. WKAccessibilityFocusedObject was in turn calling AXObjectCache::
+ focusedUIElementForPage that tried to return the isolated focused
+ object. The problem with this is that the isolated focused object can
+ only be retrieved on the secondary thread.
+ The solution in this patch is to retrieve the focused object from the
+ root object as an AT client would do.
+ Added AccessibilityUIElement::focusedElement in order to retrieve the
+ focused object from the root object.
+
+ * WebKitTestRunner/InjectedBundle/AccessibilityController.cpp:
+ (WTR::AccessibilityController::focusedElement):
+ * WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp:
+ (WTR::AccessibilityUIElement::focusedElement const):
+ * WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h:
+ * WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm:
+ (WTR::AccessibilityUIElement::focusedElement const):
+ * WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:
+ (WTR::AccessibilityUIElement::focusedElement const):
+
2021-11-07 Simon Fraser <[email protected]>
Implement UIScriptController.sendEventStream() on macOS for wheel events
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityController.cpp (285398 => 285399)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityController.cpp 2021-11-08 12:48:52 UTC (rev 285398)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityController.cpp 2021-11-08 13:56:36 UTC (rev 285399)
@@ -93,8 +93,11 @@
Ref<AccessibilityUIElement> AccessibilityController::focusedElement()
{
auto page = InjectedBundle::singleton().page()->page();
- PlatformUIElement focusedElement = static_cast<PlatformUIElement>(WKAccessibilityFocusedObject(page));
- return AccessibilityUIElement::create(focusedElement);
+ auto root = static_cast<PlatformUIElement>(WKAccessibilityRootObject(page));
+ auto rootElement = AccessibilityUIElement::create(root);
+ if (auto focusedElement = rootElement->focusedElement())
+ return *focusedElement;
+ return AccessibilityUIElement::create(nullptr);
}
void AccessibilityController::executeOnAXThreadAndWait(Function<void()>&& function)
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp (285398 => 285399)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp 2021-11-08 12:48:52 UTC (rev 285398)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp 2021-11-08 13:56:36 UTC (rev 285399)
@@ -114,6 +114,7 @@
#endif
#if !PLATFORM(COCOA) || !HAVE(ACCESSIBILITY)
+RefPtr<AccessibilityUIElement> AccessibilityUIElement::focusedElement() const { return nullptr; }
JSRetainPtr<JSStringRef> AccessibilityUIElement::domIdentifier() const { return nullptr; }
JSRetainPtr<JSStringRef> AccessibilityUIElement::currentStateValue() const { return nullptr; }
JSRetainPtr<JSStringRef> AccessibilityUIElement::sortDirection() const { return nullptr; }
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h (285398 => 285399)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h 2021-11-08 12:48:52 UTC (rev 285398)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h 2021-11-08 13:56:36 UTC (rev 285399)
@@ -169,7 +169,8 @@
JSRetainPtr<JSStringRef> selectedTextRange();
bool isEnabled();
bool isRequired() const;
-
+
+ RefPtr<AccessibilityUIElement> focusedElement() const;
bool isFocused() const;
bool isFocusable() const;
bool isSelected() const;
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm (285398 => 285399)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm 2021-11-08 12:48:52 UTC (rev 285398)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm 2021-11-08 13:56:36 UTC (rev 285399)
@@ -42,6 +42,7 @@
typedef void (*AXPostedNotificationCallback)(id element, NSString* notification, void* context);
@interface NSObject (UIAccessibilityHidden)
+- (id)accessibilityFocusedUIElement;
- (id)accessibilityHitTest:(CGPoint)point;
- (id)accessibilityLinkedElement;
- (id)accessibilityTitleElement;
@@ -630,6 +631,11 @@
return false;
}
+RefPtr<AccessibilityUIElement> AccessibilityUIElement::focusedElement() const
+{
+ return AccessibilityUIElement::create([m_element accessibilityFocusedUIElement]);
+}
+
bool AccessibilityUIElement::isFocused() const
{
return false;
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm (285398 => 285399)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm 2021-11-08 12:48:52 UTC (rev 285398)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm 2021-11-08 13:56:36 UTC (rev 285399)
@@ -156,6 +156,8 @@
value = [element accessibilityRole];
else if ([attribute isEqual:NSAccessibilityValueAttribute] && [element respondsToSelector:@selector(accessibilityValue)])
value = [element accessibilityValue];
+ else if ([attribute isEqual:NSAccessibilityFocusedUIElementAttribute] && [element respondsToSelector:@selector(accessibilityFocusedUIElement)])
+ value = [element accessibilityFocusedUIElement];
else
value = [element accessibilityAttributeValue:attribute];
});
@@ -970,6 +972,16 @@
return false;
}
+RefPtr<AccessibilityUIElement> AccessibilityUIElement::focusedElement() const
+{
+ BEGIN_AX_OBJC_EXCEPTIONS
+ if (auto focus = attributeValue(NSAccessibilityFocusedUIElementAttribute))
+ return AccessibilityUIElement::create(focus.get());
+ END_AX_OBJC_EXCEPTIONS
+
+ return nullptr;
+}
+
bool AccessibilityUIElement::isFocused() const
{
BEGIN_AX_OBJC_EXCEPTIONS