Changeset 181484 in webkit
- Timestamp:
- Mar 13, 2015, 12:24:01 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 11 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/accessibility/parent-delete-expected.txt (modified) (1 diff)
-
LayoutTests/platform/mac/accessibility/document-attributes-expected.txt (modified) (1 diff)
-
LayoutTests/platform/mac/accessibility/prevent-keyboard-event-dispatch-expected.txt (added)
-
LayoutTests/platform/mac/accessibility/prevent-keyboard-event-dispatch.html (added)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/accessibility/AccessibilityObject.cpp (modified) (1 diff)
-
Source/WebCore/accessibility/AccessibilityObject.h (modified) (1 diff)
-
Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm (modified) (5 diffs)
-
Source/WebCore/dom/Element.cpp (modified) (2 diffs)
-
Source/WebCore/page/EventHandler.cpp (modified) (2 diffs)
-
Source/WebCore/page/EventHandler.h (modified) (1 diff)
-
Source/WebCore/page/Settings.in (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r181480 r181484 1 2015-03-13 Doug Russell <d_russell@apple.com> 2 3 AX: Provide API for assistive tech to ignore DOM key event handlers 4 https://bugs.webkit.org/show_bug.cgi?id=142059 5 6 Reviewed by Beth Dakin. 7 8 Assistive technology applications on the desktop are heavily dependent on keyboard navigation being reliable. This is greatly hindered by sites that handle key events without updating keyboard selection and then consume the event. It is important for assistive technology apps to allow users to decide to ignore these handlers that are incorrect for their purposes. 9 10 This can be fixed by exposing, via a new accessibility attribute, a way to decide, for a given WebCore::Frame, to pre-empt DOM dispatch and instead let accessibility caret browsing take place. 11 12 * accessibility/parent-delete-expected.txt: 13 * platform/mac/accessibility/document-attributes-expected.txt: 14 * platform/mac/accessibility/prevent-keyboard-event-dispatch-expected.txt: Added. 15 * platform/mac/accessibility/prevent-keyboard-event-dispatch.html: Added. 16 1 17 2015-03-13 Chris Dumez <cdumez@apple.com> 2 18 -
trunk/LayoutTests/accessibility/parent-delete-expected.txt
r180718 r181484 29 29 AXURL: LayoutTests/accessibility/parent-delete.html 30 30 AXCaretBrowsingEnabled: 0 31 AXPreventKeyboardDOMEventDispatch: 0 31 32 AXElementBusy: 0 32 33 -
trunk/LayoutTests/platform/mac/accessibility/document-attributes-expected.txt
r180718 r181484 28 28 AXURL: LayoutTests/platform/mac/accessibility/document-attributes.html 29 29 AXCaretBrowsingEnabled: 0 30 AXPreventKeyboardDOMEventDispatch: 0 30 31 AXElementBusy: 0 31 32 -
trunk/Source/WebCore/ChangeLog
r181483 r181484 1 2015-03-13 Doug Russell <d_russell@apple.com> 2 3 AX: Provide API for assistive tech to ignore DOM key event handlers 4 https://bugs.webkit.org/show_bug.cgi?id=142059 5 6 Reviewed by Beth Dakin. 7 8 Assistive technology applications on the desktop are heavily dependent on keyboard navigation being reliable. This is greatly hindered by sites that handle key events without updating keyboard selection and then consume the event. It is important for assistive technology apps to allow users to decide to ignore these handlers that are incorrect for their purposes. 9 10 This can be fixed by exposing, via a new accessibility attribute, a way to decide, for a given WebCore::Frame, to pre-empt DOM dispatch and instead let accessibility caret browsing take place. 11 12 Test: platform/mac/accessibility/prevent-keyboard-event-dispatch.html 13 14 * accessibility/AccessibilityObject.cpp: 15 (WebCore::AccessibilityObject::preventKeyboardDOMEventDispatch): 16 (WebCore::AccessibilityObject::setPreventKeyboardDOMEventDispatch): 17 * accessibility/AccessibilityObject.h: 18 * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: 19 (-[WebAccessibilityObjectWrapper accessibilityAttributeNames]): 20 (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]): 21 (-[WebAccessibilityObjectWrapper accessibilityIsAttributeSettable:]): 22 (-[WebAccessibilityObjectWrapper _accessibilitySetValue:forAttribute:]): 23 * dom/Element.cpp: 24 (WebCore::Element::dispatchKeyEvent): 25 * page/EventHandler.cpp: 26 (WebCore::EventHandler::keyEvent): 27 (WebCore::handleKeyboardSelectionMovement): 28 (WebCore::EventHandler::handleKeyboardSelectionMovementForAccessibility): 29 * page/EventHandler.h: 30 * page/Settings.in: 31 1 32 2015-03-09 Conrad Shultz <conrad_shultz@apple.com> 2 33 -
trunk/Source/WebCore/accessibility/AccessibilityObject.cpp
r181408 r181484 2606 2606 } 2607 2607 2608 #if PLATFORM(COCOA) 2609 bool AccessibilityObject::preventKeyboardDOMEventDispatch() const 2610 { 2611 Frame* frame = this->frame(); 2612 return frame && frame->settings().preventKeyboardDOMEventDispatch(); 2613 } 2614 2615 void AccessibilityObject::setPreventKeyboardDOMEventDispatch(bool on) 2616 { 2617 Frame* frame = this->frame(); 2618 if (!frame) 2619 return; 2620 frame->settings().setPreventKeyboardDOMEventDispatch(on); 2621 } 2622 #endif 2623 2608 2624 } // namespace WebCore -
trunk/Source/WebCore/accessibility/AccessibilityObject.h
r180718 r181484 979 979 void updateBackingStore(); 980 980 981 #if PLATFORM(COCOA) 982 bool preventKeyboardDOMEventDispatch() const; 983 void setPreventKeyboardDOMEventDispatch(bool); 984 #endif 985 981 986 #if PLATFORM(COCOA) && !PLATFORM(IOS) 982 987 bool caretBrowsingEnabled() const; -
trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm
r180718 r181484 464 464 #define NSAccessibilityMathPrescriptsAttribute @"AXMathPrescripts" 465 465 #define NSAccessibilityMathPostscriptsAttribute @"AXMathPostscripts" 466 467 #ifndef NSAccessibilityPreventKeyboardDOMEventDispatchAttribute 468 #define NSAccessibilityPreventKeyboardDOMEventDispatchAttribute @"AXPreventKeyboardDOMEventDispatch" 469 #endif 466 470 467 471 #ifndef NSAccessibilityCaretBrowsingEnabledAttribute … … 1360 1364 [tempArray addObject:NSAccessibilityURLAttribute]; 1361 1365 [tempArray addObject:NSAccessibilityCaretBrowsingEnabledAttribute]; 1366 [tempArray addObject:NSAccessibilityPreventKeyboardDOMEventDispatchAttribute]; 1362 1367 webAreaAttrs = [[NSArray alloc] initWithArray:tempArray]; 1363 1368 [tempArray release]; … … 2959 2964 return m_object->getAttribute(idAttr); 2960 2965 2966 if (m_object->isWebArea() && [attributeName isEqualToString:NSAccessibilityPreventKeyboardDOMEventDispatchAttribute]) 2967 return [NSNumber numberWithBool:m_object->preventKeyboardDOMEventDispatch()]; 2968 2961 2969 if (m_object->isWebArea() && [attributeName isEqualToString:NSAccessibilityCaretBrowsingEnabledAttribute]) 2962 2970 return [NSNumber numberWithBool:m_object->caretBrowsingEnabled()]; … … 3032 3040 3033 3041 if ([attributeName isEqualToString:NSAccessibilityGrabbedAttribute]) 3042 return YES; 3043 3044 if (m_object->isWebArea() && [attributeName isEqualToString:NSAccessibilityPreventKeyboardDOMEventDispatchAttribute]) 3034 3045 return YES; 3035 3046 … … 3353 3364 } else if ([attributeName isEqualToString:NSAccessibilityGrabbedAttribute]) 3354 3365 m_object->setARIAGrabbed([number boolValue]); 3366 else if (m_object->isWebArea() && [attributeName isEqualToString:NSAccessibilityPreventKeyboardDOMEventDispatchAttribute]) 3367 m_object->setPreventKeyboardDOMEventDispatch([number boolValue]); 3355 3368 else if (m_object->isWebArea() && [attributeName isEqualToString:NSAccessibilityCaretBrowsingEnabledAttribute]) 3356 3369 m_object->setCaretBrowsingEnabled([number boolValue]); -
trunk/Source/WebCore/dom/Element.cpp
r181396 r181484 40 40 #include "ElementRareData.h" 41 41 #include "EventDispatcher.h" 42 #include "EventHandler.h" 42 43 #include "FlowThreadController.h" 43 44 #include "FocusController.h" … … 290 291 { 291 292 RefPtr<KeyboardEvent> event = KeyboardEvent::create(platformEvent, document().defaultView()); 293 if (Frame* frame = document().frame()) { 294 if (frame->eventHandler().accessibilityPreventsEventPropogation(event.get())) 295 event->stopPropagation(); 296 } 292 297 return EventDispatcher::dispatchEvent(this, event) && !event->defaultHandled(); 293 298 } -
trunk/Source/WebCore/page/EventHandler.cpp
r181420 r181484 3088 3088 keydown->setDefaultHandled(); 3089 3089 } 3090 3091 if (accessibilityPreventsEventPropogation(keydown.get())) 3092 keydown->stopPropagation(); 3090 3093 3091 3094 element->dispatchEvent(keydown, IGNORE_EXCEPTION); … … 3229 3232 handleKeyboardSelectionMovement(m_frame, event); 3230 3233 } 3234 } 3235 3236 bool EventHandler::accessibilityPreventsEventPropogation(KeyboardEvent* event) 3237 { 3238 #if PLATFORM(COCOA) 3239 if (!AXObjectCache::accessibilityEnhancedUserInterfaceEnabled()) 3240 return false; 3241 3242 if (!m_frame.settings().preventKeyboardDOMEventDispatch()) 3243 return false; 3244 3245 // Check for key events that are relevant to accessibility: tab and arrows keys that change focus 3246 if (event->keyIdentifier() == "U+0009") 3247 return true; 3248 FocusDirection direction = focusDirectionForKey(event->keyIdentifier()); 3249 if (direction != FocusDirectionNone) 3250 return true; 3251 #else 3252 UNUSED_PARAM(event); 3253 #endif 3254 return false; 3231 3255 } 3232 3256 -
trunk/Source/WebCore/page/EventHandler.h
r180548 r181484 240 240 void defaultKeyboardEventHandler(KeyboardEvent*); 241 241 242 bool accessibilityPreventsEventPropogation(KeyboardEvent*); 242 243 WEBCORE_EXPORT void handleKeyboardSelectionMovementForAccessibility(KeyboardEvent*); 243 244 -
trunk/Source/WebCore/page/Settings.in
r181134 r181484 46 46 47 47 caretBrowsingEnabled initial=false 48 preventKeyboardDOMEventDispatch initial=false 48 49 localStorageEnabled initial=false 49 50 allowUniversalAccessFromFileURLs initial=true
Note:
See TracChangeset
for help on using the changeset viewer.