Title: [160778] trunk
Revision
160778
Author
[email protected]
Date
2013-12-18 10:50:47 -0800 (Wed, 18 Dec 2013)

Log Message

AX: WebKit not sending AXMenuClosed notification
https://bugs.webkit.org/show_bug.cgi?id=125783

Reviewed by Mario Sanchez Prada.

Source/WebCore: 

When an object with a role=menu is removed, we need to send out a notification informing that the menu has closed.
This means detecting the right kind of destruction event for an element, because we do not want to 
send this notification when the entire cache is being torn down.

Test: platform/mac/accessibility/aria-menu-closed-notification.html

* accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::~AXObjectCache):
(WebCore::AXObjectCache::remove):
* accessibility/AXObjectCache.h:
(WebCore::AXObjectCache::document):
* accessibility/AccessibilityNodeObject.cpp:
(WebCore::AccessibilityNodeObject::detach):
* accessibility/AccessibilityNodeObject.h:
* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::detach):
* accessibility/AccessibilityObject.h:
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::detach):
* accessibility/AccessibilityRenderObject.h:
* accessibility/AccessibilityScrollView.cpp:
(WebCore::AccessibilityScrollView::detach):
* accessibility/AccessibilityScrollView.h:
* accessibility/mac/AXObjectCacheMac.mm:
(WebCore::AXObjectCache::postPlatformNotification):

LayoutTests: 

* platform/mac/accessibility/aria-menu-closed-notification-expected.txt: Added.
* platform/mac/accessibility/aria-menu-closed-notification.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (160777 => 160778)


--- trunk/LayoutTests/ChangeLog	2013-12-18 18:32:55 UTC (rev 160777)
+++ trunk/LayoutTests/ChangeLog	2013-12-18 18:50:47 UTC (rev 160778)
@@ -1,3 +1,13 @@
+2013-12-18  Chris Fleizach  <[email protected]>
+
+        AX: WebKit not sending AXMenuClosed notification
+        https://bugs.webkit.org/show_bug.cgi?id=125783
+
+        Reviewed by Mario Sanchez Prada.
+
+        * platform/mac/accessibility/aria-menu-closed-notification-expected.txt: Added.
+        * platform/mac/accessibility/aria-menu-closed-notification.html: Added.
+
 2013-12-18  Tamas Gergely  <[email protected]>
 
         Fix ASSERTION FAILED in WebCore::SVGLengthContext::determineViewport

Added: trunk/LayoutTests/platform/mac/accessibility/aria-menu-closed-notification-expected.txt (0 => 160778)


--- trunk/LayoutTests/platform/mac/accessibility/aria-menu-closed-notification-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/aria-menu-closed-notification-expected.txt	2013-12-18 18:50:47 UTC (rev 160778)
@@ -0,0 +1,11 @@
+This tests that an AXMenuClosed notification gets fired when an ARIA menu popup closes.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS addedNotification is true
+Received menu closed notification: AXMenuClosed
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/platform/mac/accessibility/aria-menu-closed-notification.html (0 => 160778)


--- trunk/LayoutTests/platform/mac/accessibility/aria-menu-closed-notification.html	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/aria-menu-closed-notification.html	2013-12-18 18:50:47 UTC (rev 160778)
@@ -0,0 +1,49 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body id="body">
+
+<div id="menu" role="menu">
+    <div role="menuitem" id="item1" tabindex="0">Menu item 1</div>
+    <div role="menuitem" id="item2" tabindex="0">Menu item 2</div>
+</div>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+
+    description("This tests that an AXMenuClosed notification gets fired when an ARIA menu popup closes.");
+
+    function hideMenu() {
+        document.getElementById("menu").style.display = "none";
+    }
+
+    var webArea = 0;
+    function ariaCallback(notification) {
+        if (notification == "AXMenuClosed") {
+           debug("Received menu closed notification: " + notification);
+           webArea.removeNotificationListener();
+           finishJSTest();
+        }
+    }
+
+    if (window.accessibilityController) {
+        window.jsTestIsAsync = true;
+
+        webArea = accessibilityController.rootElement.childAtIndex(0);
+        var menu = accessibilityController.accessibleElementById("menu");
+
+        var addedNotification = webArea.addNotificationListener(ariaCallback);
+        shouldBe("addedNotification", "true");
+
+        hideMenu(); 
+    }
+
+</script>
+
+<script src=""
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (160777 => 160778)


--- trunk/Source/WebCore/ChangeLog	2013-12-18 18:32:55 UTC (rev 160777)
+++ trunk/Source/WebCore/ChangeLog	2013-12-18 18:50:47 UTC (rev 160778)
@@ -1,3 +1,36 @@
+2013-12-18  Chris Fleizach  <[email protected]>
+
+        AX: WebKit not sending AXMenuClosed notification
+        https://bugs.webkit.org/show_bug.cgi?id=125783
+
+        Reviewed by Mario Sanchez Prada.
+
+        When an object with a role=menu is removed, we need to send out a notification informing that the menu has closed.
+        This means detecting the right kind of destruction event for an element, because we do not want to 
+        send this notification when the entire cache is being torn down.
+
+        Test: platform/mac/accessibility/aria-menu-closed-notification.html
+
+        * accessibility/AXObjectCache.cpp:
+        (WebCore::AXObjectCache::~AXObjectCache):
+        (WebCore::AXObjectCache::remove):
+        * accessibility/AXObjectCache.h:
+        (WebCore::AXObjectCache::document):
+        * accessibility/AccessibilityNodeObject.cpp:
+        (WebCore::AccessibilityNodeObject::detach):
+        * accessibility/AccessibilityNodeObject.h:
+        * accessibility/AccessibilityObject.cpp:
+        (WebCore::AccessibilityObject::detach):
+        * accessibility/AccessibilityObject.h:
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore::AccessibilityRenderObject::detach):
+        * accessibility/AccessibilityRenderObject.h:
+        * accessibility/AccessibilityScrollView.cpp:
+        (WebCore::AccessibilityScrollView::detach):
+        * accessibility/AccessibilityScrollView.h:
+        * accessibility/mac/AXObjectCacheMac.mm:
+        (WebCore::AXObjectCache::postPlatformNotification):
+
 2013-12-18  Eric Carlson  <[email protected]>
 
         Do not create cue subtree just to delete it

Modified: trunk/Source/WebCore/accessibility/AXObjectCache.cpp (160777 => 160778)


--- trunk/Source/WebCore/accessibility/AXObjectCache.cpp	2013-12-18 18:32:55 UTC (rev 160777)
+++ trunk/Source/WebCore/accessibility/AXObjectCache.cpp	2013-12-18 18:50:47 UTC (rev 160778)
@@ -122,7 +122,7 @@
     for (HashMap<AXID, RefPtr<AccessibilityObject>>::iterator it = m_objects.begin(); it != end; ++it) {
         AccessibilityObject* obj = (*it).value.get();
         detachWrapper(obj);
-        obj->detach();
+        obj->detach(CacheDestroyed);
         removeAXID(obj);
     }
 }
@@ -494,7 +494,7 @@
         return;
     
     detachWrapper(obj);
-    obj->detach();
+    obj->detach(ElementDestroyed, this);
     removeAXID(obj);
     
     // finally remove the object

Modified: trunk/Source/WebCore/accessibility/AXObjectCache.h (160777 => 160778)


--- trunk/Source/WebCore/accessibility/AXObjectCache.h	2013-12-18 18:32:55 UTC (rev 160777)
+++ trunk/Source/WebCore/accessibility/AXObjectCache.h	2013-12-18 18:50:47 UTC (rev 160778)
@@ -169,6 +169,7 @@
         AXLiveRegionChanged,
         AXMenuListItemSelected,
         AXMenuListValueChanged,
+        AXMenuClosed,
         AXRowCountChanged,
         AXRowCollapsed,
         AXRowExpanded,
@@ -206,6 +207,8 @@
 
     AXComputedObjectAttributeCache* computedObjectAttributeCache() { return m_computedObjectAttributeCache.get(); }
 
+    Document& document() const { return m_document; }
+    
 protected:
     void postPlatformNotification(AccessibilityObject*, AXNotification);
     void nodeTextChangePlatformNotification(AccessibilityObject*, AXTextChange, unsigned offset, const String&);

Modified: trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp (160777 => 160778)


--- trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp	2013-12-18 18:32:55 UTC (rev 160777)
+++ trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp	2013-12-18 18:50:47 UTC (rev 160778)
@@ -120,10 +120,10 @@
     return adoptRef(new AccessibilityNodeObject(node));
 }
 
-void AccessibilityNodeObject::detach()
+void AccessibilityNodeObject::detach(AccessibilityDetachmentType detachmentType, AXObjectCache* cache)
 {
-    clearChildren();
-    AccessibilityObject::detach();
+    // AccessibilityObject calls clearChildren.
+    AccessibilityObject::detach(detachmentType, cache);
     m_node = 0;
 }
 

Modified: trunk/Source/WebCore/accessibility/AccessibilityNodeObject.h (160777 => 160778)


--- trunk/Source/WebCore/accessibility/AccessibilityNodeObject.h	2013-12-18 18:32:55 UTC (rev 160777)
+++ trunk/Source/WebCore/accessibility/AccessibilityNodeObject.h	2013-12-18 18:50:47 UTC (rev 160778)
@@ -144,7 +144,7 @@
     virtual AccessibilityObject* parentObject() const OVERRIDE;
     virtual AccessibilityObject* parentObjectIfExists() const OVERRIDE;
 
-    virtual void detach() OVERRIDE;
+    virtual void detach(AccessibilityDetachmentType, AXObjectCache*) OVERRIDE;
     virtual void childrenChanged() OVERRIDE;
     virtual void updateAccessibilityRole() OVERRIDE;
 

Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.cpp (160777 => 160778)


--- trunk/Source/WebCore/accessibility/AccessibilityObject.cpp	2013-12-18 18:32:55 UTC (rev 160777)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.cpp	2013-12-18 18:50:47 UTC (rev 160778)
@@ -88,8 +88,12 @@
     ASSERT(isDetached());
 }
 
-void AccessibilityObject::detach()
+void AccessibilityObject::detach(AccessibilityDetachmentType detachmentType, AXObjectCache* cache)
 {
+    // Menu close events need to notify the platform. No element is used in the notification because it's a destruction event.
+    if (detachmentType == ElementDestroyed && roleValue() == MenuRole && cache)
+        cache->postNotification(nullptr, &cache->document(), AXObjectCache::AXMenuClosed);
+    
     // Clear any children and call detachFromParent on them so that
     // no children are left with dangling pointers to their parent.
     clearChildren();

Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.h (160777 => 160778)


--- trunk/Source/WebCore/accessibility/AccessibilityObject.h	2013-12-18 18:32:55 UTC (rev 160777)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.h	2013-12-18 18:50:47 UTC (rev 160778)
@@ -351,6 +351,8 @@
     , visibleOnly(visibleOnly)
     { }
 };
+    
+enum AccessibilityDetachmentType { CacheDestroyed, ElementDestroyed };
 
 struct VisiblePositionRange {
 
@@ -400,7 +402,7 @@
 
     // When the corresponding WebCore object that this AccessibilityObject
     // wraps is deleted, it must be detached.
-    virtual void detach();
+    virtual void detach(AccessibilityDetachmentType, AXObjectCache* cache = nullptr);
     virtual bool isDetached() const;
 
     typedef Vector<RefPtr<AccessibilityObject>> AccessibilityChildrenVector;

Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (160777 => 160778)


--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2013-12-18 18:32:55 UTC (rev 160777)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2013-12-18 18:50:47 UTC (rev 160778)
@@ -131,9 +131,9 @@
     return adoptRef(new AccessibilityRenderObject(renderer));
 }
 
-void AccessibilityRenderObject::detach()
+void AccessibilityRenderObject::detach(AccessibilityDetachmentType detachmentType, AXObjectCache* cache)
 {
-    AccessibilityNodeObject::detach();
+    AccessibilityNodeObject::detach(detachmentType, cache);
     
     detachRemoteSVGRoot();
     

Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.h (160777 => 160778)


--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.h	2013-12-18 18:32:55 UTC (rev 160777)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.h	2013-12-18 18:50:47 UTC (rev 160778)
@@ -161,7 +161,7 @@
     virtual void setSelectedRows(AccessibilityChildrenVector&) OVERRIDE;
     virtual AccessibilityOrientation orientation() const OVERRIDE;
     
-    virtual void detach() OVERRIDE;
+    virtual void detach(AccessibilityDetachmentType, AXObjectCache*) OVERRIDE;
     virtual void textChanged() OVERRIDE;
     virtual void addChildren() OVERRIDE;
     virtual bool canHaveChildren() const OVERRIDE;

Modified: trunk/Source/WebCore/accessibility/AccessibilityScrollView.cpp (160777 => 160778)


--- trunk/Source/WebCore/accessibility/AccessibilityScrollView.cpp	2013-12-18 18:32:55 UTC (rev 160777)
+++ trunk/Source/WebCore/accessibility/AccessibilityScrollView.cpp	2013-12-18 18:50:47 UTC (rev 160778)
@@ -48,9 +48,9 @@
     ASSERT(isDetached());
 }
 
-void AccessibilityScrollView::detach()
+void AccessibilityScrollView::detach(AccessibilityDetachmentType detachmentType, AXObjectCache* cache)
 {
-    AccessibilityObject::detach();
+    AccessibilityObject::detach(detachmentType, cache);
     m_scrollView = 0;
 }
 

Modified: trunk/Source/WebCore/accessibility/AccessibilityScrollView.h (160777 => 160778)


--- trunk/Source/WebCore/accessibility/AccessibilityScrollView.h	2013-12-18 18:32:55 UTC (rev 160777)
+++ trunk/Source/WebCore/accessibility/AccessibilityScrollView.h	2013-12-18 18:50:47 UTC (rev 160778)
@@ -41,7 +41,7 @@
     ScrollView* scrollView() const { return m_scrollView; }
 
     virtual ~AccessibilityScrollView();
-    virtual void detach() OVERRIDE;
+    virtual void detach(AccessibilityDetachmentType, AXObjectCache*) OVERRIDE;
 
 protected:
     virtual ScrollableArea* getScrollableAreaIfScrollable() const OVERRIDE;

Modified: trunk/Source/WebCore/accessibility/mac/AXObjectCacheMac.mm (160777 => 160778)


--- trunk/Source/WebCore/accessibility/mac/AXObjectCacheMac.mm	2013-12-18 18:32:55 UTC (rev 160777)
+++ trunk/Source/WebCore/accessibility/mac/AXObjectCacheMac.mm	2013-12-18 18:50:47 UTC (rev 160778)
@@ -118,6 +118,9 @@
         case AXElementBusyChanged:
             macNotification = @"AXElementBusyChanged";
             break;
+        case AXMenuClosed:
+            macNotification = (id)kAXMenuClosedNotification;
+            break;
         case AXCheckedStateChanged:
             // Does not exist on Mac.
         default:
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to