Changeset 228827 in webkit
- Timestamp:
- Feb 20, 2018 11:02:25 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r228822 r228827 1 2018-02-20 Nan Wang <n_wang@apple.com> 2 3 AX: AOM: Dispatch accessibleclick event 4 https://bugs.webkit.org/show_bug.cgi?id=180898 5 <rdar://problem/36086710> 6 7 Reviewed by Ryosuke Niwa. 8 9 * accessibility/mac/AOM-events-expected.txt: Added. 10 * accessibility/mac/AOM-events.html: Added. 11 * js/dom/dom-static-property-for-in-iteration-expected.txt: 12 * platform/mac-wk1/TestExpectations: 13 1 14 2018-02-19 Dean Jackson <dino@apple.com> 2 15 -
trunk/LayoutTests/js/dom/dom-static-property-for-in-iteration-expected.txt
r228427 r228827 135 135 PASS a["innerHTML"] is nerget 136 136 PASS a["outerHTML"] is <a id="foo" href="bar">nerget</a> 137 PASS a["onaccessibleclick"] is null 137 138 PASS a["oncopy"] is null 138 139 PASS a["oncut"] is null -
trunk/LayoutTests/platform/mac-wk1/TestExpectations
r228700 r228827 487 487 webkit.org/b/172044 [ Debug ] imported/w3c/web-platform-tests/IndexedDB/open-request-queue.html [ Pass Timeout ] 488 488 489 webkit.org/b/180898 accessibility/mac/AOM-events.html [ Skip ] 490 489 491 # User-installed fonts test infrastructure is not present in WK1 490 492 webkit.org/b/180062 fast/text/user-installed-fonts [ ImageOnlyFailure ] -
trunk/Source/WebCore/ChangeLog
r228825 r228827 1 2018-02-20 Nan Wang <n_wang@apple.com> 2 3 AX: AOM: Dispatch accessibleclick event 4 https://bugs.webkit.org/show_bug.cgi?id=180898 5 <rdar://problem/36086710> 6 7 Reviewed by Ryosuke Niwa. 8 9 Accessibility events. 10 Spec: https://wicg.github.io/aom/spec/phase2.html 11 12 This patch allows developers to register event handlers on Elements 13 for custom accessibility events. 14 15 Accessibility events go through a capturing and bubbling phase just 16 like DOM events, but in the accessibility tree. 17 18 Implemented "accessibleclick" event. 19 20 Test: accessibility/mac/AOM-events.html 21 22 * accessibility/AccessibilityObject.cpp: 23 (WebCore::AccessibilityObject::press): 24 (WebCore::AccessibilityObject::dispatchAccessibilityEvent): 25 * accessibility/AccessibilityObject.h: 26 * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: 27 (-[WebAccessibilityObjectWrapper accessibilityPerformAction:]): 28 * dom/Element.idl: 29 * dom/EventDispatcher.cpp: 30 (WebCore::dispatchEventWithType): 31 (WebCore::EventDispatcher::dispatchEvent): 32 * dom/EventDispatcher.h: 33 * dom/EventNames.h: 34 * dom/EventPath.cpp: 35 (WebCore::EventPath::EventPath): 36 * dom/EventPath.h: 37 1 38 2018-02-20 Wenson Hsieh <wenson_hsieh@apple.com> 2 39 -
trunk/Source/WebCore/accessibility/AccessibilityObject.cpp
r228427 r228827 38 38 #include "Editor.h" 39 39 #include "ElementIterator.h" 40 #include "Event.h" 41 #include "EventDispatcher.h" 40 42 #include "EventHandler.h" 41 43 #include "FloatRect.h" … … 992 994 pressElement = hitTestElement; 993 995 996 // dispatch accessibleclick event 997 if (auto* cache = axObjectCache()) { 998 if (auto* pressObject = cache->getOrCreate(pressElement)) { 999 auto event = Event::create(eventNames().accessibleclickEvent, true, true); 1000 pressObject->dispatchAccessibilityEvent(event); 1001 if (event->defaultPrevented()) 1002 return true; 1003 } 1004 } 1005 994 1006 UserGestureIndicator gestureIndicator(ProcessingUserGesture, document); 995 1007 … … 2140 2152 return element->attributeWithoutSynchronization(attribute); 2141 2153 return nullAtom(); 2154 } 2155 2156 void AccessibilityObject::dispatchAccessibilityEvent(Event& event) 2157 { 2158 Vector<Element*> eventPath; 2159 for (auto* parentObject = this; parentObject; parentObject = parentObject->parentObject()) { 2160 if (auto* parentElement = parentObject->element()) 2161 eventPath.append(parentElement); 2162 } 2163 2164 EventDispatcher::dispatchEvent(eventPath, event); 2142 2165 } 2143 2166 -
trunk/Source/WebCore/accessibility/AccessibilityObject.h
r228427 r228827 90 90 class ScrollView; 91 91 class Widget; 92 93 enum class AXPropertyName;94 92 95 93 typedef unsigned AXID; … … 897 895 const AtomicString& getAttribute(const QualifiedName&) const; 898 896 bool hasTagName(const QualifiedName&) const; 899 900 bool hasProperty(AXPropertyName) const; 901 const String stringValueForProperty(AXPropertyName) const; 902 std::optional<bool> boolValueForProperty(AXPropertyName) const; 903 int intValueForProperty(AXPropertyName) const; 904 unsigned unsignedValueForProperty(AXPropertyName) const; 905 double doubleValueForProperty(AXPropertyName) const; 906 Element* elementValueForProperty(AXPropertyName) const; 897 898 void dispatchAccessibilityEvent(Event&); 907 899 908 900 virtual VisiblePositionRange visiblePositionRange() const { return VisiblePositionRange(); } -
trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm
r228531 r228827 3578 3578 [self accessibilityPerformPressAction]; 3579 3579 3580 // Used in layout tests, so that we don't have to wait for the async press action. 3581 else if ([action isEqualToString:@"AXSyncPressAction"]) 3582 [self _accessibilityPerformPressAction]; 3583 3580 3584 else if ([action isEqualToString:NSAccessibilityShowMenuAction]) 3581 3585 [self accessibilityPerformShowMenuAction]; -
trunk/Source/WebCore/dom/Element.idl
r228427 r228827 141 141 // Non standard event handler (https://developer.apple.com/reference/webkitjs/element/1629580-onwebkitplaybacktargetavailabili). 142 142 [NotEnumerable, Conditional=WIRELESS_PLAYBACK_TARGET] attribute EventHandler onwebkitplaybacktargetavailabilitychanged; 143 144 // Accessibility events. 145 [EnabledAtRuntime=AccessibilityObjectModel] attribute EventHandler onaccessibleclick; 143 146 }; 144 147 -
trunk/Source/WebCore/dom/EventDispatcher.cpp
r228260 r228827 178 178 } 179 179 180 void EventDispatcher::dispatchEvent(const Vector<EventTarget*>& targets, Event& event) 180 template<typename T> 181 static void dispatchEventWithType(const Vector<T*>& targets, Event& event) 181 182 { 182 183 ASSERT(targets.size() >= 1); … … 191 192 } 192 193 193 } 194 void EventDispatcher::dispatchEvent(const Vector<EventTarget*>& targets, Event& event) 195 { 196 dispatchEventWithType<EventTarget>(targets, event); 197 } 198 199 void EventDispatcher::dispatchEvent(const Vector<Element*>& targets, Event& event) 200 { 201 dispatchEventWithType<Element>(targets, event); 202 } 203 204 } -
trunk/Source/WebCore/dom/EventDispatcher.h
r224459 r228827 25 25 namespace WebCore { 26 26 27 class Element; 27 28 class Event; 28 29 class EventTarget; … … 33 34 void dispatchEvent(Node&, Event&); 34 35 void dispatchEvent(const Vector<EventTarget*>&, Event&); 36 void dispatchEvent(const Vector<Element*>&, Event&); 35 37 36 38 void dispatchScopedEvent(Node&, Event&); -
trunk/Source/WebCore/dom/EventNames.h
r226766 r228827 46 46 macro(DOMSubtreeModified) \ 47 47 macro(abort) \ 48 macro(accessibleclick) \ 48 49 macro(activate) \ 49 50 macro(active) \ -
trunk/Source/WebCore/dom/EventPath.cpp
r224740 r228827 271 271 } 272 272 273 EventPath::EventPath(const Vector<Element*>& targets) 274 { 275 for (auto* target : targets) { 276 ASSERT(target); 277 Node* origin = *targets.begin(); 278 if (!target->isClosedShadowHidden(*origin)) 279 m_path.append(std::make_unique<EventContext>(target, target, origin)); 280 } 281 } 282 273 283 EventPath::EventPath(const Vector<EventTarget*>& targets) 274 284 { -
trunk/Source/WebCore/dom/EventPath.h
r224615 r228827 34 34 EventPath(Node& origin, Event&); 35 35 explicit EventPath(const Vector<EventTarget*>&); 36 explicit EventPath(const Vector<Element*>&); 36 37 37 38 bool isEmpty() const { return m_path.isEmpty(); } -
trunk/Tools/ChangeLog
r228825 r228827 1 2018-02-20 Nan Wang <n_wang@apple.com> 2 3 AX: AOM: Dispatch accessibleclick event 4 https://bugs.webkit.org/show_bug.cgi?id=180898 5 <rdar://problem/36086710> 6 7 Reviewed by Ryosuke Niwa. 8 9 * WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h: 10 (WTR::AccessibilityUIElement::syncPress): 11 * WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl: 12 * WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm: 13 (WTR::AccessibilityUIElement::syncPress): 14 1 15 2018-02-20 Wenson Hsieh <wenson_hsieh@apple.com> 2 16 -
trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h
r226432 r228827 98 98 void showMenu(); 99 99 void press(); 100 #if PLATFORM(MAC) 101 void syncPress(); 102 #else 103 void syncPress() { press(); } 104 #endif 100 105 101 106 // Attributes - platform-independent implementations -
trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl
r226432 r228827 117 117 void decrement(); 118 118 void press(); 119 void syncPress(); 119 120 void showMenu(); 120 121 -
trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm
r226432 r228827 1433 1433 } 1434 1434 1435 void AccessibilityUIElement::syncPress() 1436 { 1437 BEGIN_AX_OBJC_EXCEPTIONS 1438 [m_element accessibilityPerformAction:@"AXSyncPressAction"]; 1439 END_AX_OBJC_EXCEPTIONS 1440 } 1441 1435 1442 void AccessibilityUIElement::setSelectedChild(AccessibilityUIElement* element) const 1436 1443 {
Note: See TracChangeset
for help on using the changeset viewer.