Reviewed by Darin.
authorharrison <harrison@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 28 Jan 2005 21:04:22 +0000 (21:04 +0000)
committerharrison <harrison@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 28 Jan 2005 21:04:22 +0000 (21:04 +0000)
        <rdar://problem/3584942> AX: Safari Accessibility parent-child mismatch

        Use AppKit SPI _accessibilityParentForSubview to return KWQAccObject parent of AppKit AX object.

        * kwq/KWQAccObject.mm:
        (-[KWQAccObject _accessibilityParentForSubview:]):
        New.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@8470 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog-2005-08-23
WebCore/kwq/KWQAccObject.mm

index 840cabafd278def6ac64a7952e80f1af822f8a54..6e294c4c1248c6b14a98504aace46a36c4ac6d39 100644 (file)
@@ -1,3 +1,15 @@
+2005-01-28  David Harrison  <harrison@apple.com>
+
+        Reviewed by Darin.
+
+        <rdar://problem/3584942> AX: Safari Accessibility parent-child mismatch
+
+        Use AppKit SPI _accessibilityParentForSubview to return KWQAccObject parent of AppKit AX object.
+        
+        * kwq/KWQAccObject.mm:
+        (-[KWQAccObject _accessibilityParentForSubview:]):
+        New.
+
 2005-01-27  Adele Amchan  <adele@apple.com>
 
         fixed by Darin, reviewed by me.
index 5fb48912044c821318c429c00316422e9e047c81..a5d7573ba8f93368c7e2d5a30d03bc307b62bbef 100644 (file)
@@ -42,6 +42,7 @@ extern "C" AXUIElementRef NSAccessibilityCreateAXUIElementRef(id element);
 #import "KWQAssertions.h"
 #import "KWQFoundationExtras.h"
 #import "KWQWidget.h"
+#import "WebCoreBridge.h"
 
 #import "dom_docimpl.h"
 #import "dom_elementimpl.h"
@@ -67,6 +68,7 @@ extern "C" AXUIElementRef NSAccessibilityCreateAXUIElementRef(id element);
 #import "visible_units.h"
 #import "html_miscimpl.h"
 #import "qptrstack.h"
+#import "DOMInternal.h"
 
 using DOM::DocumentImpl;
 using DOM::ElementImpl;
@@ -1828,6 +1830,33 @@ static void AXAttributedStringAppendReplaced (NSMutableAttributedString *attrStr
     return obj->document()->getAccObjectCache()->accObject(obj);
 }
 
+// _accessibilityParentForSubview is called by AppKit when moving up the tree
+// we override it so that we can return our KWQAccObject parent of an AppKit AX object
+- (id)_accessibilityParentForSubview:(NSView *)subview
+{   
+    ASSERT(m_renderer && m_renderer->document());
+    
+    KHTMLPart* docPart = m_renderer->document()->part();
+    if (!docPart)
+        return nil;
+    
+    // check for nested WebArea (WebFrameView does not support elementForView)
+    if (m_renderer->isCanvas() && ([subview superview] == docPart->view()->getDocumentView()))
+        return [self accessibilityIsIgnored] == false ? self : [self parentObjectUnignored];
+       
+    // check for view that supports elementForView
+    DOMElement *domElement = [KWQ(docPart)->bridge() elementForView:subview];
+    if (!domElement)
+        return nil;
+        
+    RenderObject *renderer = [domElement _elementImpl]->renderer();
+    if (!renderer)
+        return nil;
+        
+    KWQAccObject* obj = renderer->document()->getAccObjectCache()->accObject(renderer);
+    return [obj parentObjectUnignored];
+}
+
 - (id)accessibilityFocusedUIElement
 {
     // NOTE: BUG support nested WebAreas