Diff
Modified: trunk/LayoutTests/ChangeLog (261247 => 261248)
--- trunk/LayoutTests/ChangeLog 2020-05-06 20:02:40 UTC (rev 261247)
+++ trunk/LayoutTests/ChangeLog 2020-05-06 20:11:39 UTC (rev 261248)
@@ -1,3 +1,14 @@
+2020-05-06 Chris Fleizach <[email protected]>
+
+ AX: Implement accessibility of HTML 5.1 Drag & Drop
+ https://bugs.webkit.org/show_bug.cgi?id=211415
+ <rdar://problem/22695531>
+
+ Reviewed by Joanmarie Diggs.
+
+ * accessibility/mac/draggable-expected.txt: Added.
+ * accessibility/mac/draggable.html: Added.
+
2020-05-06 Antoine Quint <[email protected]>
pointermove event sometimes has incorrect pointerType of 'mouse' on touch interactions
Added: trunk/LayoutTests/accessibility/mac/draggable-expected.txt (0 => 261248)
--- trunk/LayoutTests/accessibility/mac/draggable-expected.txt (rev 0)
+++ trunk/LayoutTests/accessibility/mac/draggable-expected.txt 2020-05-06 20:11:39 UTC (rev 261248)
@@ -0,0 +1,21 @@
+This test checks various accessibility attributes and notifications are handled for dragging operations.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Drop the red square onto me.
+Items that can be dragged to the drop target:
+
+Square
+PASS accessibilityController.accessibleElementById('dragMe').isAttributeSupported('AXGrabbed') is true
+PASS accessibilityController.accessibleElementById('dropTarget').isAttributeSupported('AXGrabbed') is false
+Target is grabbed: 0
+Dropzone effects: copy
+Target is grabbed during drag: 1
+Target is grabbed after drag: 1
+AXDraggingSourceDragBegan
+AXDraggingDestinationDropAllowed
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Modified: trunk/Source/WebCore/ChangeLog (261247 => 261248)
--- trunk/Source/WebCore/ChangeLog 2020-05-06 20:02:40 UTC (rev 261247)
+++ trunk/Source/WebCore/ChangeLog 2020-05-06 20:11:39 UTC (rev 261248)
@@ -1,3 +1,49 @@
+2020-05-06 Chris Fleizach <[email protected]>
+
+ AX: Implement accessibility of HTML 5.1 Drag & Drop
+ https://bugs.webkit.org/show_bug.cgi?id=211415
+ <rdar://problem/22695531>
+
+ Reviewed by Joanmarie Diggs.
+ Support HTML5 drag and drop. Support dropzone attribute.
+ Add new notifications for VoiceOver to consume.
+
+ It appears that most of the dragging tests are skipped because of eventSender issues.
+ I think this test could do a little more if those issues were resolved. Specifically, not all
+ the notifications are seen that are expected.
+
+ Test: accessibility/mac/draggable.html
+
+ * accessibility/AXObjectCache.h:
+ * accessibility/AccessibilityObject.cpp:
+ (WebCore::AccessibilityObject::supportsARIAAttributes const):
+ (WebCore::AccessibilityObject::isAXHidden const):
+ * accessibility/AccessibilityObject.h:
+ * accessibility/AccessibilityObjectInterface.h:
+ * accessibility/AccessibilityRenderObject.cpp:
+ (WebCore::AccessibilityRenderObject::supportsDropping const):
+ (WebCore::AccessibilityRenderObject::supportsDragging const):
+ (WebCore::AccessibilityRenderObject::isGrabbed):
+ (WebCore::AccessibilityRenderObject::determineDropEffects):
+ (WebCore::AccessibilityRenderObject::supportsARIADropping const): Deleted.
+ (WebCore::AccessibilityRenderObject::supportsARIADragging const): Deleted.
+ (WebCore::AccessibilityRenderObject::isARIAGrabbed): Deleted.
+ (WebCore::AccessibilityRenderObject::determineARIADropEffects): Deleted.
+ * accessibility/AccessibilityRenderObject.h:
+ * accessibility/isolatedtree/AXIsolatedObject.cpp:
+ (WebCore::AXIsolatedObject::initializeAttributeData):
+ * accessibility/isolatedtree/AXIsolatedObject.h:
+ * accessibility/mac/AXObjectCacheMac.mm:
+ (WebCore::AXObjectCache::postPlatformNotification):
+ * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
+ (-[WebAccessibilityObjectWrapper additionalAccessibilityAttributeNames]):
+ (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
+ * html/HTMLAttributeNames.in:
+ * page/EventHandler.cpp:
+ (WebCore::EventHandler::dispatchDragEvent):
+ (WebCore::EventHandler::draggingElement const):
+ * page/EventHandler.h:
+
2020-05-06 Wenson Hsieh <[email protected]>
Cut and paste from Google Doc to Notes in several (non-Latin) languages doesn't work
Modified: trunk/Source/WebCore/accessibility/AXObjectCache.h (261247 => 261248)
--- trunk/Source/WebCore/accessibility/AXObjectCache.h 2020-05-06 20:02:40 UTC (rev 261247)
+++ trunk/Source/WebCore/accessibility/AXObjectCache.h 2020-05-06 20:11:39 UTC (rev 261248)
@@ -303,7 +303,12 @@
AXRequiredStatusChanged,
AXTextChanged,
AXAriaAttributeChanged,
- AXElementBusyChanged
+ AXElementBusyChanged,
+ AXDraggingStarted,
+ AXDraggingEnded,
+ AXDraggingEnteredDropZone,
+ AXDraggingDropped,
+ AXDraggingExitedDropZone
};
void postNotification(RenderObject*, AXNotification, PostTarget = TargetElement, PostType = PostAsynchronously);
Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.cpp (261247 => 261248)
--- trunk/Source/WebCore/accessibility/AccessibilityObject.cpp 2020-05-06 20:02:40 UTC (rev 261247)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.cpp 2020-05-06 20:11:39 UTC (rev 261248)
@@ -2534,8 +2534,8 @@
{
// This returns whether the element supports any global ARIA attributes.
return supportsLiveRegion()
- || supportsARIADragging()
- || supportsARIADropping()
+ || supportsDragging()
+ || supportsDropping()
|| supportsARIAOwns()
|| hasAttribute(aria_atomicAttr)
|| hasAttribute(aria_busyAttr)
Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.h (261247 => 261248)
--- trunk/Source/WebCore/accessibility/AccessibilityObject.h 2020-05-06 20:02:40 UTC (rev 261247)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.h 2020-05-06 20:11:39 UTC (rev 261248)
@@ -327,11 +327,11 @@
int posInSet() const override;
// ARIA drag and drop
- bool supportsARIADropping() const override { return false; }
- bool supportsARIADragging() const override { return false; }
- bool isARIAGrabbed() override { return false; }
+ bool supportsDropping() const override { return false; }
+ bool supportsDragging() const override { return false; }
+ bool isGrabbed() override { return false; }
void setARIAGrabbed(bool) override { }
- Vector<String> determineARIADropEffects() override { return { }; }
+ Vector<String> determineDropEffects() const override { return { }; }
// Called on the root AX object to return the deepest available element.
AXCoreObject* accessibilityHitTest(const IntPoint&) const override { return nullptr; }
Modified: trunk/Source/WebCore/accessibility/AccessibilityObjectInterface.h (261247 => 261248)
--- trunk/Source/WebCore/accessibility/AccessibilityObjectInterface.h 2020-05-06 20:02:40 UTC (rev 261247)
+++ trunk/Source/WebCore/accessibility/AccessibilityObjectInterface.h 2020-05-06 20:11:39 UTC (rev 261248)
@@ -756,11 +756,11 @@
virtual int posInSet() const = 0;
// ARIA drag and drop
- virtual bool supportsARIADropping() const = 0;
- virtual bool supportsARIADragging() const = 0;
- virtual bool isARIAGrabbed() = 0;
+ virtual bool supportsDropping() const = 0;
+ virtual bool supportsDragging() const = 0;
+ virtual bool isGrabbed() = 0;
virtual void setARIAGrabbed(bool) = 0;
- virtual Vector<String> determineARIADropEffects() = 0;
+ virtual Vector<String> determineDropEffects() const = 0;
// Called on the root AX object to return the deepest available element.
virtual AXCoreObject* accessibilityHitTest(const IntPoint&) const = 0;
Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (261247 => 261248)
--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp 2020-05-06 20:02:40 UTC (rev 261247)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp 2020-05-06 20:11:39 UTC (rev 261248)
@@ -1040,33 +1040,46 @@
});
}
-bool AccessibilityRenderObject::supportsARIADropping() const
+bool AccessibilityRenderObject::supportsDropping() const
{
- const AtomString& dropEffect = getAttribute(aria_dropeffectAttr);
- return !dropEffect.isEmpty();
+ return determineDropEffects().size();
}
-bool AccessibilityRenderObject::supportsARIADragging() const
+bool AccessibilityRenderObject::supportsDragging() const
{
const AtomString& grabbed = getAttribute(aria_grabbedAttr);
- return equalLettersIgnoringASCIICase(grabbed, "true") || equalLettersIgnoringASCIICase(grabbed, "false");
+ return equalLettersIgnoringASCIICase(grabbed, "true") || equalLettersIgnoringASCIICase(grabbed, "false") || hasAttribute(draggableAttr);
}
-bool AccessibilityRenderObject::isARIAGrabbed()
+bool AccessibilityRenderObject::isGrabbed()
{
+#if ENABLE(DRAG_SUPPORT)
+ if (mainFrame() && mainFrame()->eventHandler().draggingElement() == element())
+ return true;
+#endif
+
return elementAttributeValue(aria_grabbedAttr);
}
-Vector<String> AccessibilityRenderObject::determineARIADropEffects()
+Vector<String> AccessibilityRenderObject::determineDropEffects() const
{
+ // Order is aria-dropeffect, dropzone, webkitdropzone
const AtomString& dropEffects = getAttribute(aria_dropeffectAttr);
- if (dropEffects.isEmpty()) {
- return { };
+ if (!dropEffects.isEmpty()) {
+ String dropEffectsString = dropEffects.string();
+ dropEffectsString.replace('\n', ' ');
+ return dropEffectsString.split(' ');
}
- String dropEffectsString = dropEffects.string();
- dropEffectsString.replace('\n', ' ');
- return dropEffectsString.split(' ');
+ auto dropzone = getAttribute(dropzoneAttr);
+ if (!dropzone.isEmpty())
+ return Vector<String> { dropzone };
+
+ auto webkitdropzone = getAttribute(webkitdropzoneAttr);
+ if (!webkitdropzone.isEmpty())
+ return Vector<String> { webkitdropzone };
+
+ return { };
}
bool AccessibilityRenderObject::exposesTitleUIElement() const
Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.h (261247 => 261248)
--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.h 2020-05-06 20:02:40 UTC (rev 261247)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.h 2020-05-06 20:11:39 UTC (rev 261248)
@@ -171,10 +171,10 @@
bool isVisiblePositionRangeInDifferentDocument(const VisiblePositionRange&) const;
bool hasPopup() const override;
- bool supportsARIADropping() const override;
- bool supportsARIADragging() const override;
- bool isARIAGrabbed() override;
- Vector<String> determineARIADropEffects() override;
+ bool supportsDropping() const override;
+ bool supportsDragging() const override;
+ bool isGrabbed() override;
+ Vector<String> determineDropEffects() const override;
VisiblePosition visiblePositionForPoint(const IntPoint&) const override;
VisiblePosition visiblePositionForIndex(unsigned indexValue, bool lastIndexOK) const override;
Modified: trunk/Source/WebCore/accessibility/atk/WebKitAccessible.cpp (261247 => 261248)
--- trunk/Source/WebCore/accessibility/atk/WebKitAccessible.cpp 2020-05-06 20:02:40 UTC (rev 261247)
+++ trunk/Source/WebCore/accessibility/atk/WebKitAccessible.cpp 2020-05-06 20:11:39 UTC (rev 261248)
@@ -563,9 +563,9 @@
if (!dropEffect.isEmpty())
attributeSet = addToAtkAttributeSet(attributeSet, "dropeffect", dropEffect.utf8().data());
- if (coreObject->isARIAGrabbed())
+ if (coreObject->isGrabbed())
attributeSet = addToAtkAttributeSet(attributeSet, "grabbed", "true");
- else if (coreObject->supportsARIADragging())
+ else if (coreObject->supportsDragging())
attributeSet = addToAtkAttributeSet(attributeSet, "grabbed", "false");
// The Core AAM states the author-provided value should be exposed as-is.
Modified: trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp (261247 => 261248)
--- trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp 2020-05-06 20:02:40 UTC (rev 261247)
+++ trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp 2020-05-06 20:11:39 UTC (rev 261248)
@@ -172,10 +172,10 @@
setProperty(AXPropertyName::SupportsPosInSet, object.supportsPosInSet());
setProperty(AXPropertyName::SetSize, object.setSize());
setProperty(AXPropertyName::PosInSet, object.posInSet());
- setProperty(AXPropertyName::SupportsARIADropping, object.supportsARIADropping());
- setProperty(AXPropertyName::SupportsARIADragging, object.supportsARIADragging());
- setProperty(AXPropertyName::IsARIAGrabbed, object.isARIAGrabbed());
- setProperty(AXPropertyName::ARIADropEffects, object.determineARIADropEffects());
+ setProperty(AXPropertyName::SupportsDropping, object.supportsDropping());
+ setProperty(AXPropertyName::SupportsDragging, object.supportsDragging());
+ setProperty(AXPropertyName::IsGrabbed, object.isGrabbed());
+ setProperty(AXPropertyName::DropEffects, object.determineDropEffects());
setObjectProperty(AXPropertyName::TitleUIElement, object.titleUIElement());
setProperty(AXPropertyName::ExposesTitleUIElement, object.exposesTitleUIElement());
setObjectProperty(AXPropertyName::VerticalScrollBar, object.scrollBar(AccessibilityOrientation::Vertical));
Modified: trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h (261247 => 261248)
--- trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h 2020-05-06 20:02:40 UTC (rev 261247)
+++ trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h 2020-05-06 20:11:39 UTC (rev 261248)
@@ -89,7 +89,7 @@
AutoCompleteValue,
ARIAControlsElements,
ARIADetailsElements,
- ARIADropEffects,
+ DropEffects,
ARIAErrorMessageElements,
ARIAIsMultiline,
ARIAFlowToElements,
@@ -161,7 +161,7 @@
IsAccessibilityIgnored,
IsActiveDescendantOfFocusedContainer,
IsAnonymousMathOperator,
- IsARIAGrabbed,
+ IsGrabbed,
IsARIATreeGridRow,
IsAttachment,
IsButton,
@@ -299,8 +299,8 @@
SpeakAs,
SpeechHint,
StringValue,
- SupportsARIADragging,
- SupportsARIADropping,
+ SupportsDragging,
+ SupportsDropping,
SupportsARIAOwns,
SupportsCurrent,
SupportsDatetimeAttribute,
@@ -504,10 +504,10 @@
bool supportsPosInSet() const override { return boolAttributeValue(AXPropertyName::SupportsPosInSet); }
int setSize() const override { return intAttributeValue(AXPropertyName::SetSize); }
int posInSet() const override { return intAttributeValue(AXPropertyName::PosInSet); }
- bool supportsARIADropping() const override { return boolAttributeValue(AXPropertyName::SupportsARIADropping); }
- bool supportsARIADragging() const override { return boolAttributeValue(AXPropertyName::SupportsARIADragging); }
- bool isARIAGrabbed() override { return boolAttributeValue(AXPropertyName::IsARIAGrabbed); }
- Vector<String> determineARIADropEffects() override { return vectorAttributeValue<String>(AXPropertyName::ARIADropEffects); }
+ bool supportsDropping() const override { return boolAttributeValue(AXPropertyName::SupportsDropping); }
+ bool supportsDragging() const override { return boolAttributeValue(AXPropertyName::SupportsDragging); }
+ bool isGrabbed() override { return boolAttributeValue(AXPropertyName::IsGrabbed); }
+ Vector<String> determineDropEffects() const override { return vectorAttributeValue<String>(AXPropertyName::DropEffects); }
AXCoreObject* accessibilityHitTest(const IntPoint&) const override;
AXCoreObject* focusedUIElement() const override;
AXCoreObject* parentObject() const override { return parentObjectUnignored(); }
Modified: trunk/Source/WebCore/accessibility/mac/AXObjectCacheMac.mm (261247 => 261248)
--- trunk/Source/WebCore/accessibility/mac/AXObjectCacheMac.mm 2020-05-06 20:02:40 UTC (rev 261247)
+++ trunk/Source/WebCore/accessibility/mac/AXObjectCacheMac.mm 2020-05-06 20:11:39 UTC (rev 261248)
@@ -96,6 +96,30 @@
#define NSAccessibilitySelectedTextMarkerRangeAttribute @"AXSelectedTextMarkerRange"
#endif
+#ifndef kAXDraggingSourceDragBeganNotification
+#define kAXDraggingSourceDragBeganNotification CFSTR("AXDraggingSourceDragBegan")
+#endif
+
+#ifndef kAXDraggingSourceDragEndedNotification
+#define kAXDraggingSourceDragEndedNotification CFSTR("AXDraggingSourceDragEnded")
+#endif
+
+#ifndef kAXDraggingDestinationDropAllowedNotification
+#define kAXDraggingDestinationDropAllowedNotification CFSTR("AXDraggingDestinationDropAllowed")
+#endif
+
+#ifndef kAXDraggingDestinationDropNotAllowedNotification
+#define kAXDraggingDestinationDropNotAllowedNotification CFSTR("AXDraggingDestinationDropNotAllowed")
+#endif
+
+#ifndef kAXDraggingDestinationDragAcceptedNotification
+#define kAXDraggingDestinationDragAcceptedNotification CFSTR("AXDraggingDestinationDragAccepted")
+#endif
+
+#ifndef kAXDraggingDestinationDragNotAcceptedNotification
+#define kAXDraggingDestinationDragNotAcceptedNotification CFSTR("AXDraggingDestinationDragNotAccepted")
+#endif
+
// Very large strings can negatively impact the performance of notifications, so this length is chosen to try to fit an average paragraph or line of text, but not allow strings to be large enough to hurt performance.
static const NSUInteger AXValueChangeTruncationLength = 1000;
@@ -353,6 +377,21 @@
case AXMenuOpened:
macNotification = (id)kAXMenuOpenedNotification;
break;
+ case AXDraggingStarted:
+ macNotification = (id)kAXDraggingSourceDragBeganNotification;
+ break;
+ case AXDraggingEnded:
+ macNotification = (id)kAXDraggingSourceDragEndedNotification;
+ break;
+ case AXDraggingEnteredDropZone:
+ macNotification = (id)kAXDraggingDestinationDropAllowedNotification;
+ break;
+ case AXDraggingDropped:
+ macNotification = (id)kAXDraggingDestinationDragAcceptedNotification;
+ break;
+ case AXDraggingExitedDropZone:
+ macNotification = (id)kAXDraggingDestinationDragNotAcceptedNotification;
+ break;
default:
return;
}
Modified: trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm (261247 => 261248)
--- trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm 2020-05-06 20:02:40 UTC (rev 261247)
+++ trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm 2020-05-06 20:11:39 UTC (rev 261248)
@@ -1350,10 +1350,10 @@
|| backingObject->isToolbar())
[additional addObject:NSAccessibilityOrientationAttribute];
- if (backingObject->supportsARIADragging())
+ if (backingObject->supportsDragging())
[additional addObject:NSAccessibilityGrabbedAttribute];
- if (backingObject->supportsARIADropping())
+ if (backingObject->supportsDropping())
[additional addObject:NSAccessibilityDropEffectsAttribute];
if (backingObject->isTable() && backingObject->isExposable() && backingObject->supportsSelectedRows())
@@ -2917,10 +2917,10 @@
return @(backingObject->setSize());
if ([attributeName isEqualToString:NSAccessibilityGrabbedAttribute])
- return [NSNumber numberWithBool:backingObject->isARIAGrabbed()];
+ return [NSNumber numberWithBool:backingObject->isGrabbed()];
if ([attributeName isEqualToString:NSAccessibilityDropEffectsAttribute])
- return createNSArray(backingObject->determineARIADropEffects()).autorelease();
+ return createNSArray(backingObject->determineDropEffects()).autorelease();
if ([attributeName isEqualToString:NSAccessibilityPlaceholderValueAttribute])
return backingObject->placeholderValue();
Modified: trunk/Source/WebCore/html/HTMLAttributeNames.in (261247 => 261248)
--- trunk/Source/WebCore/html/HTMLAttributeNames.in 2020-05-06 20:02:40 UTC (rev 261247)
+++ trunk/Source/WebCore/html/HTMLAttributeNames.in 2020-05-06 20:11:39 UTC (rev 261248)
@@ -121,6 +121,7 @@
disposition
download
draggable
+dropzone
webkitdropzone
enctype
end
Modified: trunk/Source/WebCore/page/EventHandler.cpp (261247 => 261248)
--- trunk/Source/WebCore/page/EventHandler.cpp 2020-05-06 20:02:40 UTC (rev 261247)
+++ trunk/Source/WebCore/page/EventHandler.cpp 2020-05-06 20:11:39 UTC (rev 261248)
@@ -2288,9 +2288,28 @@
event.modifiers(), 0, 0, nullptr, event.force(), NoTap, &dataTransfer);
dragTarget.dispatchEvent(dragEvent);
+
+ if (auto* cache = m_frame.document()->existingAXObjectCache()) {
+ if (eventType == eventNames().dragstartEvent)
+ cache->postNotification(&dragTarget, AXObjectCache::AXDraggingStarted);
+ else if (eventType == eventNames().dragendEvent)
+ cache->postNotification(&dragTarget, AXObjectCache::AXDraggingEnded);
+ else if (eventType == eventNames().dragenterEvent)
+ cache->postNotification(&dragTarget, AXObjectCache::AXDraggingEnteredDropZone);
+ else if (eventType == eventNames().dragleaveEvent)
+ cache->postNotification(&dragTarget, AXObjectCache::AXDraggingExitedDropZone);
+ else if (eventType == eventNames().dropEvent)
+ cache->postNotification(&dragTarget, AXObjectCache::AXDraggingDropped);
+ }
+
return dragEvent->defaultPrevented();
}
+Element* EventHandler::draggingElement() const
+{
+ return dragState().source.get();
+}
+
static bool targetIsFrame(Node* target, Frame*& frame)
{
if (!is<HTMLFrameElementBase>(target))
Modified: trunk/Source/WebCore/page/EventHandler.h (261247 => 261248)
--- trunk/Source/WebCore/page/EventHandler.h 2020-05-06 20:02:40 UTC (rev 261247)
+++ trunk/Source/WebCore/page/EventHandler.h 2020-05-06 20:11:39 UTC (rev 261248)
@@ -339,6 +339,9 @@
WEBCORE_EXPORT Optional<Cursor> selectCursor(const HitTestResult&, bool shiftKey);
+#if ENABLE(DRAG_SUPPORT)
+ Element* draggingElement() const;
+#endif
private:
#if ENABLE(DRAG_SUPPORT)
static DragState& dragState();