Changeset 287014 in webkit
- Timestamp:
- Dec 14, 2021, 12:12:55 AM (5 years ago)
- Location:
- trunk/Source
- Files:
-
- 15 edited
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/accessibility/atspi/AccessibilityAtspi.cpp (modified) (1 diff)
-
WebCore/accessibility/atspi/AccessibilityRootAtspi.cpp (modified) (5 diffs)
-
WebCore/accessibility/atspi/AccessibilityRootAtspi.h (modified) (2 diffs)
-
WebCore/accessibility/atspi/xml/Socket.xml (modified) (1 diff)
-
WebKit/ChangeLog (modified) (1 diff)
-
WebKit/UIProcess/ProvisionalPageProxy.cpp (modified) (2 diffs)
-
WebKit/UIProcess/ProvisionalPageProxy.h (modified) (2 diffs)
-
WebKit/UIProcess/WebPageProxy.cpp (modified) (1 diff)
-
WebKit/UIProcess/WebPageProxy.h (modified) (1 diff)
-
WebKit/UIProcess/WebPageProxy.messages.in (modified) (1 diff)
-
WebKit/UIProcess/gtk/WebPageProxyGtk.cpp (modified) (2 diffs)
-
WebKit/UIProcess/wpe/WebPageProxyWPE.cpp (modified) (2 diffs)
-
WebKit/WebProcess/WebPage/gtk/WebPageGtk.cpp (modified) (2 diffs)
-
WebKit/WebProcess/WebPage/wpe/WebPageWPE.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r287011 r287014 1 2021-12-13 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [GTK][a11y] Handle the Embedded method sent by AtkSocket from AccessibilityRootAtspi 4 https://bugs.webkit.org/show_bug.cgi?id=234233 5 6 Reviewed by Adrian Perez de Castro. 7 8 * accessibility/atspi/AccessibilityAtspi.cpp: 9 (WebCore::AccessibilityAtspi::registerRoot): 10 * accessibility/atspi/AccessibilityRootAtspi.cpp: 11 (WebCore::AccessibilityRootAtspi::registerObject): 12 (WebCore::AccessibilityRootAtspi::embedded): 13 (WebCore::AccessibilityRootAtspi::setParentPath): Deleted. 14 * accessibility/atspi/AccessibilityRootAtspi.h: 15 * accessibility/atspi/xml/Socket.xml: 16 1 17 2021-12-13 Kate Cheney <katherine_cheney@apple.com> 2 18 -
trunk/Source/WebCore/accessibility/atspi/AccessibilityAtspi.cpp
r286767 r287014 74 74 ensureCache(); 75 75 String path = makeString("/org/a11y/webkit/accessible/", createCanonicalUUIDString().replace('-', '_')); 76 Vector<unsigned, 2> registeredObjects;76 Vector<unsigned, 3> registeredObjects; 77 77 registeredObjects.reserveInitialCapacity(interfaces.size()); 78 78 for (const auto& interface : interfaces) { -
trunk/Source/WebCore/accessibility/atspi/AccessibilityRootAtspi.cpp
r286767 r287014 49 49 GDBusInterfaceVTable AccessibilityRootAtspi::s_accessibleFunctions = { 50 50 // method_call 51 [](GDBusConnection*, const gchar* sender, const gchar*, const gchar*, const gchar* methodName, GVariant* parameters, GDBusMethodInvocation* invocation, gpointer userData) {51 [](GDBusConnection*, const gchar*, const gchar*, const gchar*, const gchar* methodName, GVariant* parameters, GDBusMethodInvocation* invocation, gpointer userData) { 52 52 RELEASE_ASSERT(!isMainThread()); 53 53 auto& rootObject = *static_cast<AccessibilityRootAtspi*>(userData); … … 59 59 g_dbus_method_invocation_return_value(invocation, g_variant_new("(s)", _("filler"))); 60 60 else if (!g_strcmp0(methodName, "GetState")) { 61 #if USE(GTK4)62 // FIXME: we need a way to get the parent atspi reference in GTK4.63 #else64 // Since we don't have a way to know the unique name of the UI process, right after calling65 // atk_socket_embed() the UI process calls atk_object_ref_state_set() to force a GetState message.66 // We use this first GetState message to set the sender as the parent unique name.67 if (rootObject.m_parentUniqueName.isNull())68 rootObject.m_parentUniqueName = sender;69 #endif70 61 GVariantBuilder builder = G_VARIANT_BUILDER_INIT(G_VARIANT_TYPE("(au)")); 71 62 … … 155 146 }; 156 147 148 GDBusInterfaceVTable AccessibilityRootAtspi::s_socketFunctions = { 149 // method_call 150 [](GDBusConnection*, const gchar* sender, const gchar*, const gchar*, const gchar* methodName, GVariant* parameters, GDBusMethodInvocation* invocation, gpointer userData) { 151 RELEASE_ASSERT(!isMainThread()); 152 auto& rootObject = *static_cast<AccessibilityRootAtspi*>(userData); 153 if (!g_strcmp0(methodName, "Embedded")) { 154 const char* path; 155 g_variant_get(parameters, "(&s)", &path); 156 rootObject.embedded(sender, path); 157 g_dbus_method_invocation_return_value(invocation, nullptr); 158 } 159 }, 160 // get_property 161 nullptr, 162 // set_property, 163 nullptr, 164 // padding 165 nullptr 166 }; 167 157 168 void AccessibilityRootAtspi::registerObject(CompletionHandler<void(const String&)>&& completionHandler) 158 169 { … … 163 174 Vector<std::pair<GDBusInterfaceInfo*, GDBusInterfaceVTable*>> interfaces; 164 175 interfaces.append({ const_cast<GDBusInterfaceInfo*>(&webkit_accessible_interface), &s_accessibleFunctions }); 176 interfaces.append({ const_cast<GDBusInterfaceInfo*>(&webkit_socket_interface), &s_socketFunctions }); 165 177 interfaces.append({ const_cast<GDBusInterfaceInfo*>(&webkit_component_interface), &s_componentFunctions }); 166 178 m_atspi.registerRoot(*this, WTFMove(interfaces), WTFMove(completionHandler)); … … 182 194 } 183 195 184 void AccessibilityRootAtspi::setParentPath(String&& path) 185 { 186 RELEASE_ASSERT(isMainThread()); 187 m_parentPath = WTFMove(path); 196 void AccessibilityRootAtspi::embedded(const char* parentUniqueName, const char* parentPath) 197 { 198 RELEASE_ASSERT(!isMainThread()); 199 m_parentUniqueName = parentUniqueName; 200 m_parentPath = parentPath; 188 201 } 189 202 -
trunk/Source/WebCore/accessibility/atspi/AccessibilityRootAtspi.h
r286767 r287014 42 42 void unregisterObject(); 43 43 void setPath(String&&); 44 void setParentPath(String&&);45 44 46 45 const String& path() const { return m_path; } … … 56 55 AccessibilityRootAtspi(Page&, AccessibilityAtspi&); 57 56 57 void embedded(const char* parentUniqueName, const char* parentPath); 58 58 IntRect frameRect(uint32_t) const; 59 59 60 60 static GDBusInterfaceVTable s_accessibleFunctions; 61 static GDBusInterfaceVTable s_socketFunctions; 61 62 static GDBusInterfaceVTable s_componentFunctions; 62 63 -
trunk/Source/WebCore/accessibility/atspi/xml/Socket.xml
r283304 r287014 15 15 </method> 16 16 17 <method name="Embedded"> 18 <arg direction="in" name="socketPath" type="s"/> 19 <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QSpiObjectReference"/> 20 </method> 21 17 22 <signal name="Available"> 18 23 <arg direction="in" name="socket" type="(so)"/> -
trunk/Source/WebKit/ChangeLog
r287013 r287014 1 2021-12-13 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [GTK][a11y] Handle the Embedded method sent by AtkSocket from AccessibilityRootAtspi 4 https://bugs.webkit.org/show_bug.cgi?id=234233 5 6 Reviewed by Adrian Perez de Castro. 7 8 I added some hacks to send the socket path to the web process using WebKit IPC because Embedded message is not 9 in the DBus interface. We can simply add the message to the interface definition and handle it instead to 10 simplify everything. 11 12 * UIProcess/ProvisionalPageProxy.cpp: 13 (WebKit::ProvisionalPageProxy::bindAccessibilityTree): 14 (WebKit::ProvisionalPageProxy::didReceiveMessage): 15 * UIProcess/ProvisionalPageProxy.h: 16 (WebKit::ProvisionalPageProxy::accessibilityPlugID): 17 (WebKit::ProvisionalPageProxy::CompletionHandler<void): Deleted. 18 * UIProcess/WebPageProxy.cpp: 19 (WebKit::WebPageProxy::swapToProvisionalPage): 20 * UIProcess/WebPageProxy.h: 21 * UIProcess/WebPageProxy.messages.in: 22 * UIProcess/gtk/WebPageProxyGtk.cpp: 23 (WebKit::WebPageProxy::bindAccessibilityTree): 24 * UIProcess/wpe/WebPageProxyWPE.cpp: 25 (WebKit::WebPageProxy::bindAccessibilityTree): 26 * WebProcess/WebPage/gtk/WebPageGtk.cpp: 27 (WebKit::WebPage::platformInitialize): 28 1 29 2021-12-13 John Wilander <wilander@apple.com> 2 30 -
trunk/Source/WebKit/UIProcess/ProvisionalPageProxy.cpp
r286815 r287014 445 445 446 446 #if PLATFORM(GTK) || PLATFORM(WPE) 447 void ProvisionalPageProxy::bindAccessibilityTree(const String& plugID , CompletionHandler<void(String&&)>&& completionHandler)447 void ProvisionalPageProxy::bindAccessibilityTree(const String& plugID) 448 448 { 449 449 m_accessibilityPlugID = plugID; 450 m_accessibilityBindCompletionHandler = WTFMove(completionHandler);451 450 } 452 451 #endif … … 513 512 #if PLATFORM(GTK) || PLATFORM(WPE) 514 513 if (decoder.messageName() == Messages::WebPageProxy::BindAccessibilityTree::name()) { 515 IPC::handleMessage Async<Messages::WebPageProxy::BindAccessibilityTree>(connection, decoder, this, &ProvisionalPageProxy::bindAccessibilityTree);514 IPC::handleMessage<Messages::WebPageProxy::BindAccessibilityTree>(connection, decoder, this, &ProvisionalPageProxy::bindAccessibilityTree); 516 515 return; 517 516 } -
trunk/Source/WebKit/UIProcess/ProvisionalPageProxy.h
r286479 r287014 97 97 #if PLATFORM(GTK) || PLATFORM(WPE) 98 98 const String& accessibilityPlugID() { return m_accessibilityPlugID; } 99 CompletionHandler<void(String&&)> takeAccessibilityBindCompletionHandler() { return std::exchange(m_accessibilityBindCompletionHandler, nullptr); }100 99 #endif 101 100 #if HAVE(VISIBILITY_PROPAGATION_VIEW) … … 150 149 #endif 151 150 #if PLATFORM(GTK) || PLATFORM(WPE) 152 void bindAccessibilityTree(const String& , CompletionHandler<void(String&&)>&&);151 void bindAccessibilityTree(const String&); 153 152 #endif 154 153 #if ENABLE(CONTENT_FILTERING) -
trunk/Source/WebKit/UIProcess/WebPageProxy.cpp
r286937 r287014 989 989 #endif 990 990 #if PLATFORM(GTK) || PLATFORM(WPE) 991 if (auto completionHandler = provisionalPage->takeAccessibilityBindCompletionHandler()) 992 bindAccessibilityTree(provisionalPage->accessibilityPlugID(), WTFMove(completionHandler)); 991 auto accessibilityPlugID = provisionalPage->accessibilityPlugID(); 992 if (!accessibilityPlugID.isEmpty()) 993 bindAccessibilityTree(accessibilityPlugID); 993 994 #endif 994 995 } -
trunk/Source/WebKit/UIProcess/WebPageProxy.h
r286937 r287014 2291 2291 2292 2292 #if PLATFORM(GTK) || PLATFORM(WPE) 2293 void bindAccessibilityTree(const String& , CompletionHandler<void(String&&)>&&);2293 void bindAccessibilityTree(const String&); 2294 2294 #endif 2295 2295 -
trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in
r286825 r287014 180 180 #if PLATFORM(GTK) || PLATFORM(WPE) 181 181 # Support for connecting the Accessibility worlds of the UI and the Web processes 182 BindAccessibilityTree(String plugID) -> (String socketPath) Async182 BindAccessibilityTree(String plugID) 183 183 184 184 SetInputMethodState(std::optional<WebKit::InputMethodState> state); -
trunk/Source/WebKit/UIProcess/gtk/WebPageProxyGtk.cpp
r283487 r287014 50 50 } 51 51 52 void WebPageProxy::bindAccessibilityTree(const String& plugID , CompletionHandler<void(String&&)>&& completionHandler)52 void WebPageProxy::bindAccessibilityTree(const String& plugID) 53 53 { 54 54 #if USE(GTK4) … … 58 58 auto* accessible = gtk_widget_get_accessible(viewWidget()); 59 59 atk_socket_embed(ATK_SOCKET(accessible), const_cast<char*>(plugID.utf8().data())); 60 #if USE(ATSPI)61 // ATK doesn't have API to get the atspi reference of an object, but we know the id is stored62 // as an object user data as "spi-dbus-id". To let the web process know about the unique name, we call63 // atk_object_ref_state_set() that sends a GetState message to the web process root object.64 g_object_unref(atk_object_ref_state_set(accessible));65 completionHandler(makeString("/org/a11y/atspi/accessible/", GPOINTER_TO_INT(g_object_get_data(G_OBJECT(accessible), "spi-dbus-id"))));66 #else67 completionHandler({ });68 #endif69 60 atk_object_notify_state_change(accessible, ATK_STATE_TRANSIENT, FALSE); 70 61 #endif -
trunk/Source/WebKit/UIProcess/wpe/WebPageProxyWPE.cpp
r283304 r287014 46 46 } 47 47 48 void WebPageProxy::bindAccessibilityTree(const String& plugID , CompletionHandler<void(String&&)>&& completionHandler)48 void WebPageProxy::bindAccessibilityTree(const String& plugID) 49 49 { 50 50 #if USE(ATK) … … 52 52 atk_socket_embed(ATK_SOCKET(accessible), const_cast<char*>(plugID.utf8().data())); 53 53 atk_object_notify_state_change(accessible, ATK_STATE_TRANSIENT, FALSE); 54 completionHandler({ });55 54 #endif 56 55 } -
trunk/Source/WebKit/WebProcess/WebPage/gtk/WebPageGtk.cpp
r285640 r287014 65 65 m_accessibilityObject = adoptGRef(webkitWebPageAccessibilityObjectNew(this)); 66 66 GUniquePtr<gchar> plugID(atk_plug_get_id(ATK_PLUG(m_accessibilityObject.get()))); 67 send WithAsyncReply(Messages::WebPageProxy::BindAccessibilityTree(String(plugID.get())), [](String&&) { });67 send(Messages::WebPageProxy::BindAccessibilityTree(String(plugID.get()))); 68 68 #elif USE(ATSPI) 69 69 #if USE(GTK4) … … 73 73 m_accessibilityRootObject = AccessibilityRootAtspi::create(*page, WebProcess::singleton().accessibilityAtspi()); 74 74 m_accessibilityRootObject->registerObject([&](const String& plugID) { 75 // ATK uses a custom DBus message to send the socket path to the AtkPlug object. GDBus doesn't allow 76 // to send a message that is not defined in the interface, so we use the WebKit IPC to get the socket 77 // path from the UI process. 78 sendWithAsyncReply(Messages::WebPageProxy::BindAccessibilityTree(plugID), [&](String&& socketPath) { 79 m_accessibilityRootObject->setParentPath(WTFMove(socketPath)); 80 }); 75 send(Messages::WebPageProxy::BindAccessibilityTree(plugID)); 81 76 }); 82 77 } -
trunk/Source/WebKit/WebProcess/WebPage/wpe/WebPageWPE.cpp
r283304 r287014 46 46 m_accessibilityObject = adoptGRef(webkitWebPageAccessibilityObjectNew(this)); 47 47 GUniquePtr<gchar> plugID(atk_plug_get_id(ATK_PLUG(m_accessibilityObject.get()))); 48 send WithAsyncReply(Messages::WebPageProxy::BindAccessibilityTree(String(plugID.get())), [](String&&) { });48 send(Messages::WebPageProxy::BindAccessibilityTree(String(plugID.get()))); 49 49 #endif 50 50 }
Note:
See TracChangeset
for help on using the changeset viewer.