Title: [229729] trunk/Source/WebCore
Revision
229729
Author
n_w...@apple.com
Date
2018-03-19 18:08:53 -0700 (Mon, 19 Mar 2018)

Log Message

AX: embedded attachments do not work correctly with text marker APIs on macOS
https://bugs.webkit.org/show_bug.cgi?id=183751

Reviewed by Chris Fleizach.

In WebKit1, embedded attachments are not working well with text marker APIs.
We should use the corresponding attachment view in the following cases:
1. Hit testing on an attachment object.
2. Getting the attachment object at a text marker position.
3. Asking for the associated element with NSAccessibilityAttachmentTextAttribute.

Not able to construct a layout test because it relies on embedded attachments.

* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(AXAttributeStringSetElement):
(-[WebAccessibilityObjectWrapper accessibilityHitTest:]):
(-[WebAccessibilityObjectWrapper accessibilityAttributeValue:forParameter:]):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (229728 => 229729)


--- trunk/Source/WebCore/ChangeLog	2018-03-20 00:20:46 UTC (rev 229728)
+++ trunk/Source/WebCore/ChangeLog	2018-03-20 01:08:53 UTC (rev 229729)
@@ -1,3 +1,23 @@
+2018-03-19  Nan Wang  <n_w...@apple.com>
+
+        AX: embedded attachments do not work correctly with text marker APIs on macOS
+        https://bugs.webkit.org/show_bug.cgi?id=183751
+
+        Reviewed by Chris Fleizach.
+
+        In WebKit1, embedded attachments are not working well with text marker APIs.
+        We should use the corresponding attachment view in the following cases:
+        1. Hit testing on an attachment object.
+        2. Getting the attachment object at a text marker position.
+        3. Asking for the associated element with NSAccessibilityAttachmentTextAttribute. 
+
+        Not able to construct a layout test because it relies on embedded attachments.
+
+        * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
+        (AXAttributeStringSetElement):
+        (-[WebAccessibilityObjectWrapper accessibilityHitTest:]):
+        (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:forParameter:]):
+
 2018-03-19  Jiewen Tan  <jiewen_...@apple.com>
 
         Unreviewed, another quick fix for r229699

Modified: trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm (229728 => 229729)


--- trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm	2018-03-20 00:20:46 UTC (rev 229728)
+++ trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm	2018-03-20 01:08:53 UTC (rev 229729)
@@ -1015,7 +1015,11 @@
         if (!cache)
             return;
         
-        AXUIElementRef axElement = NSAccessibilityCreateAXUIElementRef(object->wrapper());
+        id objectWrapper = object->wrapper();
+        if ([attribute isEqualToString:NSAccessibilityAttachmentTextAttribute] && object->isAttachment() && [objectWrapper attachmentView])
+            objectWrapper = [objectWrapper attachmentView];
+        
+        AXUIElementRef axElement = NSAccessibilityCreateAXUIElementRef(objectWrapper);
         if (axElement) {
             [attrString addAttribute:attribute value:(id)axElement range:range];
             CFRelease(axElement);
@@ -3307,8 +3311,11 @@
     
     m_object->updateChildrenIfNecessary();
     RefPtr<AccessibilityObject> axObject = m_object->accessibilityHitTest(IntPoint(point));
-    if (axObject)
+    if (axObject) {
+        if (axObject->isAttachment() && [axObject->wrapper() attachmentView])
+            return [axObject->wrapper() attachmentView];
         return NSAccessibilityUnignoredAncestor(axObject->wrapper());
+    }
     return NSAccessibilityUnignoredAncestor(self);
 }
 
@@ -3991,6 +3998,8 @@
         AccessibilityObject* axObject = [self accessibilityObjectForTextMarker:textMarker];
         if (!axObject)
             return nil;
+        if (axObject->isAttachment() && [axObject->wrapper() attachmentView])
+            return [axObject->wrapper() attachmentView];
         return axObject->wrapper();
     }
     
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to