Title: [289816] trunk/Source/WebKit
Revision
289816
Author
[email protected]
Date
2022-02-15 08:03:16 -0800 (Tue, 15 Feb 2022)

Log Message

[GTK][WPE] Move WebPage::platformInitialize and WebPage::platformDetach() to WebPageGLib.cpp
https://bugs.webkit.org/show_bug.cgi?id=236646

Reviewed by Adrian Perez de Castro.

It's duplicated code related to accessibility.

* WebProcess/WebPage/glib/WebPageGLib.cpp:
(WebKit::WebPage::platformInitialize):
(WebKit::WebPage::platformDetach):
* WebProcess/WebPage/gtk/WebPageGtk.cpp:
(WebKit::WebPage::platformInitialize): Deleted.
(WebKit::WebPage::platformDetach): Deleted.
* WebProcess/WebPage/wpe/WebPageWPE.cpp:
(WebKit::WebPage::platformInitialize): Deleted.
(WebKit::WebPage::platformDetach): Deleted.

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (289815 => 289816)


--- trunk/Source/WebKit/ChangeLog	2022-02-15 15:45:24 UTC (rev 289815)
+++ trunk/Source/WebKit/ChangeLog	2022-02-15 16:03:16 UTC (rev 289816)
@@ -1,5 +1,24 @@
 2022-02-15  Carlos Garcia Campos  <[email protected]>
 
+        [GTK][WPE] Move WebPage::platformInitialize and WebPage::platformDetach() to WebPageGLib.cpp
+        https://bugs.webkit.org/show_bug.cgi?id=236646
+
+        Reviewed by Adrian Perez de Castro.
+
+        It's duplicated code related to accessibility.
+
+        * WebProcess/WebPage/glib/WebPageGLib.cpp:
+        (WebKit::WebPage::platformInitialize):
+        (WebKit::WebPage::platformDetach):
+        * WebProcess/WebPage/gtk/WebPageGtk.cpp:
+        (WebKit::WebPage::platformInitialize): Deleted.
+        (WebKit::WebPage::platformDetach): Deleted.
+        * WebProcess/WebPage/wpe/WebPageWPE.cpp:
+        (WebKit::WebPage::platformInitialize): Deleted.
+        (WebKit::WebPage::platformDetach): Deleted.
+
+2022-02-15  Carlos Garcia Campos  <[email protected]>
+
         [GTK] D-Bus crash atk-bridge
         https://bugs.webkit.org/show_bug.cgi?id=236208
 

Modified: trunk/Source/WebKit/WebProcess/WebPage/glib/WebPageGLib.cpp (289815 => 289816)


--- trunk/Source/WebKit/WebProcess/WebPage/glib/WebPageGLib.cpp	2022-02-15 15:45:24 UTC (rev 289815)
+++ trunk/Source/WebKit/WebProcess/WebPage/glib/WebPageGLib.cpp	2022-02-15 16:03:16 UTC (rev 289816)
@@ -32,6 +32,7 @@
 #include "WebKitExtensionManager.h"
 #include "WebKitUserMessage.h"
 #include "WebKitWebExtension.h"
+#include "WebKitWebPageAccessibilityObject.h"
 #include "WebKitWebPagePrivate.h"
 #include "WebPageProxyMessages.h"
 #include <WebCore/Editor.h>
@@ -48,6 +49,60 @@
 namespace WebKit {
 using namespace WebCore;
 
+void WebPage::platformInitialize(const WebPageCreationParameters&)
+{
+#if ENABLE(ACCESSIBILITY)
+    // Create the accessible object (the plug) that will serve as the
+    // entry point to the Web process, and send a message to the UI
+    // process to connect the two worlds through the accessibility
+    // object there specifically placed for that purpose (the socket).
+#if USE(ATK)
+    auto isValidPlugID = [](const char* plugID) -> bool {
+        if (!plugID || plugID[0] != ':')
+            return false;
+
+        auto* p = g_strrstr(plugID, ":");
+        if (!p)
+            return false;
+
+        if (!g_variant_is_object_path(p + 1))
+            return false;
+
+        GUniquePtr<char> name(g_strndup(plugID, p - plugID));
+        if (!g_dbus_is_unique_name(name.get()))
+            return false;
+
+        return true;
+    };
+
+    m_accessibilityObject = adoptGRef(webkitWebPageAccessibilityObjectNew(this));
+    GUniquePtr<gchar> plugID(atk_plug_get_id(ATK_PLUG(m_accessibilityObject.get())));
+    if (isValidPlugID(plugID.get()))
+        send(Messages::WebPageProxy::BindAccessibilityTree(String(plugID.get())));
+#elif USE(ATSPI)
+#if PLATFORM(GTK) && USE(GTK4)
+    // FIXME: we need a way to connect DOM and app a11y tree in GTK4.
+#else
+    if (auto* page = corePage()) {
+        m_accessibilityRootObject = AccessibilityRootAtspi::create(*page);
+        m_accessibilityRootObject->registerObject([&](const String& plugID) {
+            if (!plugID.isEmpty())
+                send(Messages::WebPageProxy::BindAccessibilityTree(plugID));
+        });
+    }
+#endif
+#endif
+#endif
+}
+
+void WebPage::platformDetach()
+{
+#if USE(ATSPI)
+    if (m_accessibilityRootObject)
+        m_accessibilityRootObject->unregisterObject();
+#endif
+}
+
 void WebPage::sendMessageToWebExtensionWithReply(UserMessage&& message, CompletionHandler<void(UserMessage&&)>&& completionHandler)
 {
     auto* extension = WebKitExtensionManager::singleton().extension();

Modified: trunk/Source/WebKit/WebProcess/WebPage/gtk/WebPageGtk.cpp (289815 => 289816)


--- trunk/Source/WebKit/WebProcess/WebPage/gtk/WebPageGtk.cpp	2022-02-15 15:45:24 UTC (rev 289815)
+++ trunk/Source/WebKit/WebProcess/WebPage/gtk/WebPageGtk.cpp	2022-02-15 16:03:16 UTC (rev 289816)
@@ -30,7 +30,6 @@
 
 #include "WebFrame.h"
 #include "WebKeyboardEvent.h"
-#include "WebKitWebPageAccessibilityObject.h"
 #include "WebPageProxyMessages.h"
 #include "WebProcess.h"
 #include <WebCore/BackForwardController.h>
@@ -56,64 +55,10 @@
 namespace WebKit {
 using namespace WebCore;
 
-void WebPage::platformInitialize(const WebPageCreationParameters&)
-{
-#if ENABLE(ACCESSIBILITY)
-    // Create the accessible object (the plug) that will serve as the
-    // entry point to the Web process, and send a message to the UI
-    // process to connect the two worlds through the accessibility
-    // object there specifically placed for that purpose (the socket).
-#if USE(ATK)
-    auto isValidPlugID = [](const char* plugID) -> bool {
-        if (!plugID || plugID[0] != ':')
-            return false;
-
-        auto* p = g_strrstr(plugID, ":");
-        if (!p)
-            return false;
-
-        if (!g_variant_is_object_path(p + 1))
-            return false;
-
-        GUniquePtr<char> name(g_strndup(plugID, p - plugID));
-        if (!g_dbus_is_unique_name(name.get()))
-            return false;
-
-        return true;
-    };
-
-    m_accessibilityObject = adoptGRef(webkitWebPageAccessibilityObjectNew(this));
-    GUniquePtr<gchar> plugID(atk_plug_get_id(ATK_PLUG(m_accessibilityObject.get())));
-    if (isValidPlugID(plugID.get()))
-        send(Messages::WebPageProxy::BindAccessibilityTree(String(plugID.get())));
-#elif USE(ATSPI)
-#if USE(GTK4)
-    // FIXME: we need a way to connect DOM and app a11y tree in GTK4.
-#else
-    if (auto* page = corePage()) {
-        m_accessibilityRootObject = AccessibilityRootAtspi::create(*page);
-        m_accessibilityRootObject->registerObject([&](const String& plugID) {
-            if (!plugID.isEmpty())
-                send(Messages::WebPageProxy::BindAccessibilityTree(plugID));
-        });
-    }
-#endif
-#endif
-#endif
-}
-
 void WebPage::platformReinitialize()
 {
 }
 
-void WebPage::platformDetach()
-{
-#if USE(ATSPI)
-    if (m_accessibilityRootObject)
-        m_accessibilityRootObject->unregisterObject();
-#endif
-}
-
 bool WebPage::performDefaultBehaviorForKeyEvent(const WebKeyboardEvent& keyboardEvent)
 {
     if (keyboardEvent.type() != WebEvent::KeyDown && keyboardEvent.type() != WebEvent::RawKeyDown)

Modified: trunk/Source/WebKit/WebProcess/WebPage/wpe/WebPageWPE.cpp (289815 => 289816)


--- trunk/Source/WebKit/WebProcess/WebPage/wpe/WebPageWPE.cpp	2022-02-15 15:45:24 UTC (rev 289815)
+++ trunk/Source/WebKit/WebProcess/WebPage/wpe/WebPageWPE.cpp	2022-02-15 16:03:16 UTC (rev 289816)
@@ -26,7 +26,6 @@
 #include "config.h"
 #include "WebPage.h"
 
-#include "WebKitWebPageAccessibilityObject.h"
 #include "WebPageProxy.h"
 #include "WebPageProxyMessages.h"
 #include <WebCore/NotImplemented.h>
@@ -36,40 +35,10 @@
 namespace WebKit {
 using namespace WebCore;
 
-void WebPage::platformInitialize(const WebPageCreationParameters&)
-{
-#if ENABLE(ACCESSIBILITY)
-    // Create the accessible object (the plug) that will serve as the
-    // entry point to the web process, and send a message to the UI
-    // process to connect the two worlds through the accessibility
-    // object there specifically placed for that purpose (the socket).
-#if USE(ATK)
-    m_accessibilityObject = adoptGRef(webkitWebPageAccessibilityObjectNew(this));
-    GUniquePtr<gchar> plugID(atk_plug_get_id(ATK_PLUG(m_accessibilityObject.get())));
-    send(Messages::WebPageProxy::BindAccessibilityTree(String(plugID.get())));
-#elif USE(ATSPI)
-    if (auto* page = corePage()) {
-        m_accessibilityRootObject = AccessibilityRootAtspi::create(*page);
-        m_accessibilityRootObject->registerObject([&](const String& plugID) {
-            send(Messages::WebPageProxy::BindAccessibilityTree(plugID));
-        });
-    }
-#endif
-#endif
-}
-
 void WebPage::platformReinitialize()
 {
 }
 
-void WebPage::platformDetach()
-{
-#if USE(ATSPI)
-    if (m_accessibilityRootObject)
-        m_accessibilityRootObject->unregisterObject();
-#endif
-}
-
 bool WebPage::performDefaultBehaviorForKeyEvent(const WebKeyboardEvent&)
 {
     notImplemented();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to