Changeset 263823 in webkit
- Timestamp:
- Jul 1, 2020, 4:35:43 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 15 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/accessibility/keyevents-for-increment-actions-with-node-removal-expected.txt (added)
-
LayoutTests/accessibility/keyevents-for-increment-actions-with-node-removal.html (added)
-
LayoutTests/accessibility/keyevents-posted-for-increment-actions-expected.txt (added)
-
LayoutTests/accessibility/keyevents-posted-for-increment-actions.html (added)
-
LayoutTests/platform/win/TestExpectations (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/accessibility/AccessibilityNodeObject.cpp (modified) (4 diffs)
-
Source/WebCore/accessibility/AccessibilityNodeObject.h (modified) (1 diff)
-
Source/WebCore/accessibility/AccessibilityObject.h (modified) (1 diff)
-
Source/WebCore/accessibility/AccessibilityObjectInterface.h (modified) (1 diff)
-
Source/WebCore/accessibility/AccessibilityRenderObject.cpp (modified) (3 diffs)
-
Source/WebCore/accessibility/AccessibilityRenderObject.h (modified) (1 diff)
-
Source/WebCore/accessibility/AccessibilityScrollbar.cpp (modified) (1 diff)
-
Source/WebCore/accessibility/AccessibilityScrollbar.h (modified) (1 diff)
-
Source/WebCore/accessibility/AccessibilitySlider.cpp (modified) (1 diff)
-
Source/WebCore/accessibility/AccessibilitySlider.h (modified) (1 diff)
-
Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp (modified) (2 diffs)
-
Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r263822 r263823 1 2020-07-01 Chris Fleizach <cfleizach@apple.com> 2 3 AX: Implement relevant simulated key presses for custom ARIA widgets for increment/decrement 4 https://bugs.webkit.org/show_bug.cgi?id=213744 5 6 Reviewed by Darin Adler. 7 8 * accessibility/keyevents-posted-for-increment-actions-expected.txt: Added. 9 * accessibility/keyevents-posted-for-increment-actions.html: Added. 10 * accessibility/keyevents-for-increment-actions-with-node-removal-expected.txt: Added. 11 * accessibility/keyevents-for-increment-actions-with-node-removal.htmk: Added. 12 1 13 2020-07-01 Chris Dumez <cdumez@apple.com> 2 14 -
trunk/LayoutTests/platform/win/TestExpectations
r263567 r263823 1381 1381 accessibility/menu-list-sends-change-notification.html [ Skip ] 1382 1382 accessibility/multiselect-list-reports-active-option.html [ Skip ] 1383 1384 # increment/decrement not implemented in test runner 1385 accessibility/keyevents-for-increment-actions-with-node-removal.html [ Skip ] 1386 accessibility/keyevents-posted-for-increment-actions.html [ Skip ] 1383 1387 1384 1388 webkit.org/b/140796 accessibility/alt-tag-on-image-with-nonimage-role.html [ Skip ] -
trunk/Source/WebCore/ChangeLog
r263814 r263823 1 2020-07-01 Chris Fleizach <cfleizach@apple.com> 2 3 AX: Implement relevant simulated key presses for custom ARIA widgets for increment/decrement 4 https://bugs.webkit.org/show_bug.cgi?id=213744 5 6 Reviewed by Darin Adler. 7 8 In order to allow custom ARIA widgets to work, we can post keyboard events for specific ax actions 9 that are not handled natively. 10 11 Spec: https://github.com/WICG/aom/blob/gh-pages/explainer.md#user-action-events-from-assistive-technology 12 13 Test: accessibility/keyevents-posted-for-increment-actions.html 14 accessibility/keyevents-for-increment-actions-with-node-removal.html 15 16 * accessibility/AccessibilityNodeObject.cpp: 17 (WebCore::AccessibilityNodeObject::postKeyboardKeysForValueChange): 18 (WebCore::AccessibilityNodeObject::setNodeValue): 19 (WebCore::AccessibilityNodeObject::changeValueByStep): 20 (WebCore::AccessibilityNodeObject::changeValueByPercent): 21 * accessibility/AccessibilityNodeObject.h: 22 * accessibility/AccessibilityObject.h: 23 * accessibility/AccessibilityObjectInterface.h: 24 * accessibility/AccessibilityRenderObject.cpp: 25 (WebCore::AccessibilityRenderObject::setValue): 26 * accessibility/AccessibilityRenderObject.h: 27 * accessibility/AccessibilityScrollbar.cpp: 28 (WebCore::AccessibilityScrollbar::setValue): 29 * accessibility/AccessibilityScrollbar.h: 30 * accessibility/AccessibilitySlider.cpp: 31 (WebCore::AccessibilitySlider::setValue): 32 * accessibility/AccessibilitySlider.h: 33 * accessibility/isolatedtree/AXIsolatedObject.cpp: 34 (WebCore::AXIsolatedObject::setValue): 35 * accessibility/isolatedtree/AXIsolatedObject.h: 36 1 37 2020-07-01 Wenson Hsieh <wenson_hsieh@apple.com> 2 38 -
trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp
r262224 r263823 58 58 #include "HTMLTextAreaElement.h" 59 59 #include "HTMLTextFormControlElement.h" 60 #include "KeyboardEvent.h" 60 61 #include "LabelableElement.h" 61 62 #include "LocalizedStrings.h" … … 1095 1096 } 1096 1097 1098 // Fire a keyboard event if we were not able to set this value natively. 1099 void AccessibilityNodeObject::postKeyboardKeysForValueChange(bool increase) 1100 { 1101 // In case the keyboard event causes this element to be removed. 1102 Ref<AccessibilityObject> protectedThis(*this); 1103 1104 auto keyInit = KeyboardEvent::Init(); 1105 bool vertical = orientation() == AccessibilityOrientation::Vertical; 1106 bool isLTR = page()->userInterfaceLayoutDirection() == UserInterfaceLayoutDirection::LTR; 1107 1108 keyInit.key = increase ? vertical ? "ArrowUp"_s : isLTR ? "ArrowRight"_s : "ArrowLeft"_s : vertical ? "ArrowDown"_s : isLTR ? "ArrowLeft"_s : "ArrowRight"_s; 1109 keyInit.keyIdentifier = increase ? vertical ? "up"_s : isLTR ? "right"_s : "left"_s : vertical ? "down"_s : isLTR ? "left"_s : "right"_s; 1110 1111 if (auto* node = this->node()) 1112 node->dispatchEvent(KeyboardEvent::create(eventNames().keydownEvent, keyInit)); 1113 1114 // Ensure node is still valid and wasn't removed after the keydown. 1115 if (auto* node = this->node()) 1116 node->dispatchEvent(KeyboardEvent::create(eventNames().keyupEvent, keyInit)); 1117 } 1118 1119 void AccessibilityNodeObject::setNodeValue(bool increase, float value) 1120 { 1121 bool didSet = setValue(String::number(value)); 1122 1123 if (didSet) { 1124 if (auto* cache = axObjectCache()) 1125 cache->postNotification(this, document(), AXObjectCache::AXValueChanged); 1126 } else 1127 postKeyboardKeysForValueChange(increase); 1128 } 1129 1097 1130 void AccessibilityNodeObject::changeValueByStep(bool increase) 1098 1131 { … … 1101 1134 1102 1135 value += increase ? step : -step; 1103 1104 setValue(String::number(value)); 1105 1106 auto objectCache = axObjectCache(); 1107 if (objectCache) 1108 objectCache->postNotification(node(), AXObjectCache::AXValueChanged); 1136 setNodeValue(increase, value); 1109 1137 } 1110 1138 … … 1120 1148 1121 1149 value += step; 1122 setValue(String::number(value)); 1123 1124 auto objectCache = axObjectCache(); 1125 if (objectCache) 1126 objectCache->postNotification(node(), AXObjectCache::AXValueChanged); 1150 setNodeValue(percentChange > 0, value); 1127 1151 } 1128 1152 -
trunk/Source/WebCore/accessibility/AccessibilityNodeObject.h
r262224 r263823 190 190 bool usesAltTagForTextComputation() const; 191 191 bool roleIgnoresTitle() const; 192 192 void postKeyboardKeysForValueChange(bool increase); 193 void setNodeValue(bool increase, float value); 193 194 Node* m_node; 194 195 }; -
trunk/Source/WebCore/accessibility/AccessibilityObject.h
r262224 r263823 464 464 void setSelectedText(const String&) override { } 465 465 void setSelectedTextRange(const PlainTextRange&) override { } 466 void setValue(const String&) override {}466 bool setValue(const String&) override { return false; } 467 467 bool replaceTextInRange(const String&, const PlainTextRange&) override; 468 468 bool insertText(const String&) override; 469 469 470 void setValue(float) override {}470 bool setValue(float) override { return false; } 471 471 void setSelected(bool) override { } 472 472 void setSelectedRows(AccessibilityChildrenVector&) override { } -
trunk/Source/WebCore/accessibility/AccessibilityObjectInterface.h
r262966 r263823 897 897 virtual void setSelectedText(const String&) = 0; 898 898 virtual void setSelectedTextRange(const PlainTextRange&) = 0; 899 virtual voidsetValue(const String&) = 0;899 virtual bool setValue(const String&) = 0; 900 900 virtual bool replaceTextInRange(const String&, const PlainTextRange&) = 0; 901 901 virtual bool insertText(const String&) = 0; 902 902 903 virtual voidsetValue(float) = 0;903 virtual bool setValue(float) = 0; 904 904 virtual void setSelected(bool) = 0; 905 905 virtual void setSelectedRows(AccessibilityChildrenVector&) = 0; -
trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp
r263673 r263823 1664 1664 auto node = this->node(); 1665 1665 ASSERT(node); 1666 auto elementRange = this->elementRange(); 1666 1667 VisiblePosition start = visiblePositionForIndexUsingCharacterIterator(*node, range.start); 1668 if (!elementRange->contains(start)) 1669 start = VisiblePosition(elementRange->startPosition()); 1670 1667 1671 VisiblePosition end = visiblePositionForIndexUsingCharacterIterator(*node, range.start + range.length); 1672 if (!elementRange->contains(end)) 1673 end = VisiblePosition(elementRange->endPosition()); 1674 1668 1675 m_renderer->frame().selection().setSelection(VisibleSelection(start, end), FrameSelection::defaultSetSelectionOptions(UserTriggered)); 1669 1676 } … … 1861 1868 } 1862 1869 1863 voidAccessibilityRenderObject::setValue(const String& string)1870 bool AccessibilityRenderObject::setValue(const String& string) 1864 1871 { 1865 1872 if (!m_renderer || !is<Element>(m_renderer->node())) 1866 return ;1873 return false; 1867 1874 1868 1875 Element& element = downcast<Element>(*m_renderer->node()); … … 1876 1883 editor.clearText(); 1877 1884 editor.insertText(string, nullptr); 1878 return ;1885 return true; 1879 1886 } 1880 1887 } 1881 1888 // FIXME: Do we want to do anything here for ARIA textboxes? 1882 if (renderer.isTextField() && is<HTMLInputElement>(element)) 1889 if (renderer.isTextField() && is<HTMLInputElement>(element)) { 1883 1890 downcast<HTMLInputElement>(element).setValue(string); 1884 else if (renderer.isTextArea() && is<HTMLTextAreaElement>(element)) 1891 return true; 1892 } 1893 if (renderer.isTextArea() && is<HTMLTextAreaElement>(element)) { 1885 1894 downcast<HTMLTextAreaElement>(element).setValue(string); 1895 return true; 1896 } 1897 1898 return false; 1886 1899 } 1887 1900 -
trunk/Source/WebCore/accessibility/AccessibilityRenderObject.h
r261705 r263823 147 147 void setFocused(bool) override; 148 148 void setSelectedTextRange(const PlainTextRange&) override; 149 voidsetValue(const String&) override;149 bool setValue(const String&) override; 150 150 void setSelectedRows(AccessibilityChildrenVector&) override; 151 151 AccessibilityOrientation orientation() const override; -
trunk/Source/WebCore/accessibility/AccessibilityScrollbar.cpp
r244582 r263823 93 93 } 94 94 95 voidAccessibilityScrollbar::setValue(float value)95 bool AccessibilityScrollbar::setValue(float value) 96 96 { 97 97 if (!m_scrollbar) 98 return ;98 return false; 99 99 100 100 float newValue = value * m_scrollbar->maximum(); 101 101 m_scrollbar->scrollableArea().scrollToOffsetWithoutAnimation(m_scrollbar->orientation(), newValue); 102 return true; 102 103 } 103 104 -
trunk/Source/WebCore/accessibility/AccessibilityScrollbar.h
r224074 r263823 56 56 57 57 // Assumes float [0..1] 58 voidsetValue(float) override;58 bool setValue(float) override; 59 59 float valueForRange() const override; 60 60 -
trunk/Source/WebCore/accessibility/AccessibilitySlider.cpp
r251798 r263823 127 127 } 128 128 129 voidAccessibilitySlider::setValue(const String& value)129 bool AccessibilitySlider::setValue(const String& value) 130 130 { 131 131 HTMLInputElement* input = inputElement(); 132 132 133 133 if (input->value() == value) 134 return ;134 return true; 135 135 136 136 input->setValue(value, DispatchChangeEvent); 137 return true; 137 138 } 138 139 -
trunk/Source/WebCore/accessibility/AccessibilitySlider.h
r251798 r263823 58 58 const AtomString& getAttribute(const QualifiedName&) const override; 59 59 60 voidsetValue(const String&) override;60 bool setValue(const String&) override; 61 61 float valueForRange() const override; 62 62 float maxValueForRange() const override; -
trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp
r263120 r263823 630 630 }); 631 631 } 632 void AXIsolatedObject::setValue(float value) 633 { 634 performFunctionOnMainThread([&value](AXCoreObject* object) { 635 object->setValue(value); 632 633 bool AXIsolatedObject::setValue(float value) 634 { 635 return Accessibility::retrieveValueFromMainThread<bool>([&value, this] () -> bool { 636 if (auto* axObject = associatedAXObject()) 637 return axObject->setValue(value); 638 return false; 639 }); 640 } 641 642 bool AXIsolatedObject::setValue(const String& value) 643 { 644 return Accessibility::retrieveValueFromMainThread<bool>([&value, this] () -> bool { 645 if (auto* axObject = associatedAXObject()) 646 return axObject->setValue(value); 647 return false; 636 648 }); 637 649 } … … 669 681 performFunctionOnMainThread([&value](AXCoreObject* object) { 670 682 object->setSelectedTextRange(value); 671 });672 }673 674 void AXIsolatedObject::setValue(const String& value)675 {676 performFunctionOnMainThread([&value](AXCoreObject* object) {677 object->setValue(value);678 683 }); 679 684 } -
trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h
r263573 r263823 704 704 void setARIAGrabbed(bool) override; 705 705 void setIsExpanded(bool) override; 706 voidsetValue(float) override;706 bool setValue(float) override; 707 707 void setSelected(bool) override; 708 708 void setSelectedRows(AccessibilityChildrenVector&) override; … … 710 710 void setSelectedText(const String&) override; 711 711 void setSelectedTextRange(const PlainTextRange&) override; 712 voidsetValue(const String&) override;712 bool setValue(const String&) override; 713 713 #if PLATFORM(COCOA) && !PLATFORM(IOS_FAMILY) 714 714 void setCaretBrowsingEnabled(bool) override;
Note:
See TracChangeset
for help on using the changeset viewer.