[GTK] Fix the build when Wayland target is disabled
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 2 Mar 2020 03:20:44 +0000 (03:20 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 2 Mar 2020 03:20:44 +0000 (03:20 +0000)
https://bugs.webkit.org/show_bug.cgi?id=208407

Patch by Ting-Wei Lan <lantw44@gmail.com> on 2020-03-01
Reviewed by Darin Adler.

Values in the enum WebCore::PlatformDisplay::Type are only defined when
their corresponding platform targets are enabled, so we need #if checks
around uses of them.

* UIProcess/API/glib/WebKitProtocolHandler.cpp:
(WebKit::WebKitProtocolHandler::handleGPU):
* UIProcess/API/glib/WebKitUIClient.cpp:
(UIClient::windowConfigureEventCallback):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@257700 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/ChangeLog
Source/WebKit/UIProcess/API/glib/WebKitProtocolHandler.cpp
Source/WebKit/UIProcess/API/glib/WebKitUIClient.cpp

index edd589f..d38924a 100644 (file)
@@ -1,3 +1,19 @@
+2020-03-01  Ting-Wei Lan  <lantw44@gmail.com>
+
+        [GTK] Fix the build when Wayland target is disabled
+        https://bugs.webkit.org/show_bug.cgi?id=208407
+
+        Reviewed by Darin Adler.
+
+        Values in the enum WebCore::PlatformDisplay::Type are only defined when
+        their corresponding platform targets are enabled, so we need #if checks
+        around uses of them.
+
+        * UIProcess/API/glib/WebKitProtocolHandler.cpp:
+        (WebKit::WebKitProtocolHandler::handleGPU):
+        * UIProcess/API/glib/WebKitUIClient.cpp:
+        (UIClient::windowConfigureEventCallback):
+
 2020-03-01  Wenson Hsieh  <wenson_hsieh@apple.com>
 
         Unreviewed, rolling out r257618.
index 0a637b5..41be4fc 100644 (file)
@@ -286,7 +286,14 @@ void WebKitProtocolHandler::handleGPU(WebKitURISchemeRequest* request)
         "  <td><div class=\"titlename\">Type</div></td>"
         "  <td>%s</td>"
         " </tbody></tr>",
-        PlatformDisplay::sharedDisplay().type() == PlatformDisplay::Type::Wayland ? "Wayland" : "X11");
+#if PLATFORM(WAYLAND)
+        PlatformDisplay::sharedDisplay().type() == PlatformDisplay::Type::Wayland ? "Wayland" :
+#endif
+#if PLATFORM(X11)
+        PlatformDisplay::sharedDisplay().type() == PlatformDisplay::Type::X11 ? "X11" :
+#endif
+        "Unknown"
+    );
 #endif
 
     auto rect = IntRect(screenRect(nullptr));
index a22abbf..ec20db9 100644 (file)
@@ -144,7 +144,10 @@ private:
     {
         GdkRectangle geometry = { 0, 0, 0, 0 };
         // Position a toplevel window is not supported under wayland.
-        if (WebCore::PlatformDisplay::sharedDisplay().type() != WebCore::PlatformDisplay::Type::Wayland) {
+#if PLATFORM(WAYLAND)
+        if (WebCore::PlatformDisplay::sharedDisplay().type() != WebCore::PlatformDisplay::Type::Wayland)
+#endif
+        {
             gtk_window_get_position(window, &geometry.x, &geometry.y);
             if (geometry.x != targetGeometry->x || geometry.y != targetGeometry->y)
                 return FALSE;
@@ -172,7 +175,10 @@ private:
         if (webkit_web_view_is_controlled_by_automation(m_webView) && WebCore::widgetIsOnscreenToplevelWindow(window) && gtk_widget_get_visible(window)) {
             bool needsMove = false;
             // Position a toplevel window is not supported under wayland.
-            if (WebCore::PlatformDisplay::sharedDisplay().type() != WebCore::PlatformDisplay::Type::Wayland) {
+#if PLATFORM(WAYLAND)
+            if (WebCore::PlatformDisplay::sharedDisplay().type() != WebCore::PlatformDisplay::Type::Wayland)
+#endif
+            {
                 if (geometry.x >= 0 && geometry.y >= 0) {
                     int x, y;
                     gtk_window_get_position(GTK_WINDOW(window), &x, &y);