Changeset 286056 in webkit
- Timestamp:
- Nov 19, 2021, 6:30:34 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 7 edited
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/SourcesGTK.txt (modified) (1 diff)
-
Source/WebCore/accessibility/atspi/AccessibilityObjectActionAtspi.cpp (added)
-
Source/WebCore/accessibility/atspi/AccessibilityObjectAtspi.cpp (modified) (3 diffs)
-
Source/WebCore/accessibility/atspi/AccessibilityObjectAtspi.h (modified) (4 diffs)
-
Tools/ChangeLog (modified) (1 diff)
-
Tools/TestWebKitAPI/Tests/WebKitGtk/TestWebKitAccessibility.cpp (modified) (2 diffs)
-
Tools/WebKitTestRunner/InjectedBundle/atspi/AccessibilityUIElementAtspi.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r286055 r286056 1 2021-11-19 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [GTK][a11y] Add implementation of action interface when building with ATSPI 4 https://bugs.webkit.org/show_bug.cgi?id=232749 5 6 Reviewed by Adrian Perez de Castro. 7 8 * SourcesGTK.txt: 9 * accessibility/atspi/AccessibilityObjectActionAtspi.cpp: Added. 10 (WebCore::AccessibilityObjectAtspi::actionName const): 11 (WebCore::AccessibilityObjectAtspi::localizedActionName const): 12 (WebCore::AccessibilityObjectAtspi::actionKeyBinding const): 13 (WebCore::AccessibilityObjectAtspi::doAction const): 14 * accessibility/atspi/AccessibilityObjectAtspi.cpp: 15 (WebCore::AccessibilityObjectAtspi::interfacesForObject): 16 (WebCore::AccessibilityObjectAtspi::path): 17 (WebCore::AccessibilityObjectAtspi::buildInterfaces const): 18 * accessibility/atspi/AccessibilityObjectAtspi.h: 19 1 20 2021-11-19 Carlos Garcia Campos <cgarcia@igalia.com> 2 21 -
trunk/Source/WebCore/SourcesGTK.txt
r286055 r286056 42 42 accessibility/atspi/AccessibilityAtspi.cpp 43 43 accessibility/atspi/AccessibilityObjectAtspi.cpp 44 accessibility/atspi/AccessibilityObjectActionAtspi.cpp 44 45 accessibility/atspi/AccessibilityObjectComponentAtspi.cpp 45 46 accessibility/atspi/AccessibilityObjectHyperlinkAtspi.cpp -
trunk/Source/WebCore/accessibility/atspi/AccessibilityObjectAtspi.cpp
r286055 r286056 61 61 OptionSet<AccessibilityObjectAtspi::Interface> AccessibilityObjectAtspi::interfacesForObject(AXCoreObject& coreObject) 62 62 { 63 OptionSet<Interface> interfaces = { Interface::Accessible, Interface::Component };63 OptionSet<Interface> interfaces = { Interface::Accessible, Interface::Component, Interface::Action }; 64 64 65 65 RenderObject* renderer = coreObject.isAccessibilityRenderObject() ? coreObject.renderer() : nullptr; … … 484 484 if (m_interfaces.contains(Interface::Hypertext)) 485 485 interfaces.append({ const_cast<GDBusInterfaceInfo*>(&webkit_hypertext_interface), &s_hypertextFunctions }); 486 if (m_interfaces.contains(Interface::Action)) 487 interfaces.append({ const_cast<GDBusInterfaceInfo*>(&webkit_action_interface), &s_actionFunctions }); 486 488 m_path = atspiRoot->atspi().registerObject(*this, WTFMove(interfaces)); 487 489 } … … 1116 1118 if (m_interfaces.contains(Interface::Hypertext)) 1117 1119 g_variant_builder_add(builder, "s", webkit_hypertext_interface.name); 1120 if (m_interfaces.contains(Interface::Action)) 1121 g_variant_builder_add(builder, "s", webkit_action_interface.name); 1118 1122 } 1119 1123 -
trunk/Source/WebCore/accessibility/atspi/AccessibilityObjectAtspi.h
r286055 r286056 49 49 Value = 1 << 3, 50 50 Hyperlink = 1 << 4, 51 Hypertext = 1 << 5 51 Hypertext = 1 << 5, 52 Action = 1 << 6 52 53 }; 53 54 const OptionSet<Interface>& interfaces() const { return m_interfaces; } … … 123 124 WEBCORE_EXPORT URL url() const; 124 125 126 WEBCORE_EXPORT String actionName() const; 127 WEBCORE_EXPORT bool doAction() const; 128 125 129 private: 126 130 explicit AccessibilityObjectAtspi(AXCoreObject*); … … 162 166 std::optional<unsigned> hyperlinkIndex(unsigned) const; 163 167 168 String localizedActionName() const; 169 String actionKeyBinding() const; 170 164 171 static OptionSet<Interface> interfacesForObject(AXCoreObject&); 165 172 … … 170 177 static GDBusInterfaceVTable s_hyperlinkFunctions; 171 178 static GDBusInterfaceVTable s_hypertextFunctions; 179 static GDBusInterfaceVTable s_actionFunctions; 172 180 173 181 AXCoreObject* m_axObject { nullptr }; -
trunk/Tools/ChangeLog
r286055 r286056 1 2021-11-19 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [GTK][a11y] Add implementation of action interface when building with ATSPI 4 https://bugs.webkit.org/show_bug.cgi?id=232749 5 6 Reviewed by Adrian Perez de Castro. 7 8 Add a unit test for the action interface and WTR implementation. 9 10 * TestWebKitAPI/Tests/WebKitGtk/TestWebKitAccessibility.cpp: 11 (testActionBasic): 12 (beforeAll): 13 * WebKitTestRunner/InjectedBundle/atspi/AccessibilityUIElementAtspi.cpp: 14 (WTR::AccessibilityUIElement::isPressActionSupported): 15 (WTR::AccessibilityUIElement::press): 16 1 17 2021-11-19 Carlos Garcia Campos <cgarcia@igalia.com> 2 18 -
trunk/Tools/TestWebKitAPI/Tests/WebKitGtk/TestWebKitAccessibility.cpp
r286055 r286056 1885 1885 } 1886 1886 1887 static void testActionBasic(AccessibilityTest* test, gconstpointer) 1888 { 1889 test->showInWindow(800, 600); 1890 test->loadHtml( 1891 "<html>" 1892 " <body>" 1893 " <p>This is <button accessKey='p'>button</button> and <a href='https://www.webkitgtk.org'>link</a> in a paragraph</p>" 1894 " </body>" 1895 "</html>", 1896 nullptr); 1897 test->waitUntilLoadFinished(); 1898 1899 auto testApp = test->findTestApplication(); 1900 g_assert_true(ATSPI_IS_ACCESSIBLE(testApp.get())); 1901 1902 auto documentWeb = test->findDocumentWeb(testApp.get()); 1903 g_assert_true(ATSPI_IS_ACCESSIBLE(documentWeb.get())); 1904 g_assert_cmpint(atspi_accessible_get_child_count(documentWeb.get(), nullptr), ==, 1); 1905 1906 auto p = adoptGRef(atspi_accessible_get_child_at_index(documentWeb.get(), 0, nullptr)); 1907 g_assert_true(ATSPI_IS_ACTION(p.get())); 1908 // Paragraph implements action interface, but it does nothing. 1909 g_assert_cmpint(atspi_action_get_n_actions(ATSPI_ACTION(p.get()), nullptr), ==, 1); 1910 GUniquePtr<char> name(atspi_action_get_action_name(ATSPI_ACTION(p.get()), 0, nullptr)); 1911 g_assert_cmpstr(name.get(), ==, ""); 1912 GUniquePtr<char> localizedName(atspi_action_get_localized_name(ATSPI_ACTION(p.get()), 0, nullptr)); 1913 g_assert_cmpstr(localizedName.get(), ==, ""); 1914 GUniquePtr<char> keyBinding(atspi_action_get_key_binding(ATSPI_ACTION(p.get()), 0, nullptr)); 1915 g_assert_cmpstr(keyBinding.get(), ==, ""); 1916 1917 auto button = adoptGRef(atspi_accessible_get_child_at_index(p.get(), 0, nullptr)); 1918 g_assert_true(ATSPI_IS_ACTION(button.get())); 1919 g_assert_cmpint(atspi_action_get_n_actions(ATSPI_ACTION(button.get()), nullptr), ==, 1); 1920 name.reset(atspi_action_get_action_name(ATSPI_ACTION(button.get()), 0, nullptr)); 1921 g_assert_cmpstr(name.get(), ==, "press"); 1922 #if USE(ATSPI) 1923 localizedName.reset(atspi_action_get_localized_name(ATSPI_ACTION(button.get()), 0, nullptr)); 1924 g_assert_cmpstr(localizedName.get(), ==, "press"); 1925 #endif 1926 keyBinding.reset(atspi_action_get_key_binding(ATSPI_ACTION(button.get()), 0, nullptr)); 1927 g_assert_cmpstr(keyBinding.get(), ==, "p"); 1928 1929 auto a = adoptGRef(atspi_accessible_get_child_at_index(p.get(), 1, nullptr)); 1930 g_assert_true(ATSPI_IS_ACTION(a.get())); 1931 g_assert_cmpint(atspi_action_get_n_actions(ATSPI_ACTION(a.get()), nullptr), ==, 1); 1932 name.reset(atspi_action_get_action_name(ATSPI_ACTION(a.get()), 0, nullptr)); 1933 g_assert_cmpstr(name.get(), ==, "jump"); 1934 #if USE(ATSPI) 1935 localizedName.reset(atspi_action_get_localized_name(ATSPI_ACTION(a.get()), 0, nullptr)); 1936 g_assert_cmpstr(localizedName.get(), ==, "jump"); 1937 #endif 1938 keyBinding.reset(atspi_action_get_key_binding(ATSPI_ACTION(a.get()), 0, nullptr)); 1939 g_assert_cmpstr(keyBinding.get(), ==, ""); 1940 } 1941 1887 1942 void beforeAll() 1888 1943 { … … 1908 1963 AccessibilityTest::add("WebKitAccessibility", "hyperlink/basic", testHyperlinkBasic); 1909 1964 AccessibilityTest::add("WebKitAccessibility", "hypertext/basic", testHypertextBasic); 1965 AccessibilityTest::add("WebKitAccessibility", "action/basic", testActionBasic); 1910 1966 } 1911 1967 -
trunk/Tools/WebKitTestRunner/InjectedBundle/atspi/AccessibilityUIElementAtspi.cpp
r286050 r286056 795 795 bool AccessibilityUIElement::isPressActionSupported() 796 796 { 797 return false; 797 m_element->updateBackingStore(); 798 auto name = m_element->actionName(); 799 return name == "press" || name == "jump"; 798 800 } 799 801 … … 1095 1097 void AccessibilityUIElement::press() 1096 1098 { 1099 m_element->doAction(); 1097 1100 } 1098 1101
Note:
See TracChangeset
for help on using the changeset viewer.