From 646e347c173dbb9782492ac7cb4f54b65533ba90 Mon Sep 17 00:00:00 2001
From: Martin Jansa <Martin.Jansa@gmail.com>
Date: Sun, 17 Oct 2021 20:49:21 +0000
Subject: [PATCH] Fix build without opengl-or-es

* fix build failure when opengl-or-es is disabled:
  In file included from /OE/build/oe-core/tmp-glibc/work/core2-64-oe-linux/webkitgtk/2.34.0-r0/webkitgtk-2.34.0/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp:30,
                   from /OE/build/oe-core/tmp-glibc/work/core2-64-oe-linux/webkitgtk/2.34.0-r0/build/DerivedSources/WebKit/unified-sources/UnifiedSource-54928a2b-36.cpp:1:
  /OE/build/oe-core/tmp-glibc/work/core2-64-oe-linux/webkitgtk/2.34.0-r0/webkitgtk-2.34.0/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.h:41:10: fatal error: WebCore/CoordinatedGraphicsLayer.h: No such file or directory
     41 | #include <WebCore/CoordinatedGraphicsLayer.h>
        |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  compilation terminated.

* the CoordinatedGraphicsLayer.h header installation is controled by
  USE_COORDINATED_GRAPHICS in webkitgtk-2.34.0/Source/WebCore/platform/TextureMapper.cmake
  but in Source/cmake/OptionsGTK.cmake USE_COORDINATED_GRAPHICS was enabled only inside
  if (USE_OPENGL_OR_ES)

Upstream-Status: Submitted [https://bugs.webkit.org/show_bug.cgi?id=232934]
---
 .../DrawingAreaProxyCoordinatedGraphics.cpp                 | 2 +-
 .../DrawingAreaProxyCoordinatedGraphics.h                   | 2 +-
 .../CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp  | 2 +-
 .../CoordinatedGraphics/DrawingAreaCoordinatedGraphics.h    | 2 +-
 .../WebPage/CoordinatedGraphics/LayerTreeHost.cpp           | 4 ++--
 .../WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.h  | 6 +++---
 6 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/Source/WebKit/UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp b/Source/WebKit/UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp
index 038d9ee2..5e828a10 100644
--- a/Source/WebKit/UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp
+++ b/Source/WebKit/UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp
@@ -152,7 +152,7 @@ void DrawingAreaProxyCoordinatedGraphics::setBackingStoreIsDiscardable(bool isBa
 #endif
 }
 
-#if PLATFORM(GTK)
+#if PLATFORM(GTK) && USE(COORDINATED_GRAPHICS)
 void DrawingAreaProxyCoordinatedGraphics::adjustTransientZoom(double scale, FloatPoint origin)
 {
     send(Messages::DrawingArea::AdjustTransientZoom(scale, origin));
diff --git a/Source/WebKit/UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.h b/Source/WebKit/UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.h
index b23a45ff..cd263402 100644
--- a/Source/WebKit/UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.h
+++ b/Source/WebKit/UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.h
@@ -57,7 +57,7 @@ private:
     void waitForBackingStoreUpdateOnNextPaint() override;
     void setBackingStoreIsDiscardable(bool) override;
 
-#if PLATFORM(GTK)
+#if PLATFORM(GTK) && USE(COORDINATED_GRAPHICS)
     void adjustTransientZoom(double scale, WebCore::FloatPoint origin) override;
     void commitTransientZoom(double scale, WebCore::FloatPoint origin) override;
 #endif
diff --git a/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp b/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp
index 33ac2e1d..42375784 100644
--- a/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp
+++ b/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp
@@ -486,7 +486,7 @@ void DrawingAreaCoordinatedGraphics::didUpdate()
     displayTimerFired();
 }
 
-#if PLATFORM(GTK)
+#if PLATFORM(GTK) && USE(COORDINATED_GRAPHICS)
 void DrawingAreaCoordinatedGraphics::adjustTransientZoom(double scale, FloatPoint origin)
 {
     if (!m_transientZoom) {
diff --git a/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.h b/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.h
index d8dc6df7..c8322364 100644
--- a/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.h
+++ b/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.h
@@ -84,7 +84,7 @@ private:
     void updateBackingStoreState(uint64_t backingStoreStateID, bool respondImmediately, float deviceScaleFactor, const WebCore::IntSize&, const WebCore::IntSize& scrollOffset) override;
     void didUpdate() override;
 
-#if PLATFORM(GTK)
+#if PLATFORM(GTK) && USE(COORDINATED_GRAPHICS)
     void adjustTransientZoom(double scale, WebCore::FloatPoint origin) override;
     void commitTransientZoom(double scale, WebCore::FloatPoint origin) override;
 #endif
diff --git a/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp b/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp
index f3304d10..ca0476ff 100644
--- a/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp
+++ b/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp
@@ -156,7 +156,7 @@ void LayerTreeHost::layerFlushTimerFired()
 
     bool didSync = m_coordinator.flushPendingLayerChanges(flags);
 
-#if PLATFORM(GTK)
+#if PLATFORM(GTK) && USE(COORDINATED_GRAPHICS)
     // If we have an active transient zoom, we want the zoom to win over any changes
     // that WebCore makes to the relevant layers, so re-apply our changes after flushing.
     if (m_transientZoom)
@@ -453,7 +453,7 @@ void LayerTreeHost::renderNextFrame(bool forceRepaint)
     }
 }
 
-#if PLATFORM(GTK)
+#if PLATFORM(GTK) && USE(COORDINATED_GRAPHICS)
 FloatPoint LayerTreeHost::constrainTransientZoomOrigin(double scale, FloatPoint origin) const
 {
     FrameView& frameView = *m_webPage.mainFrameView();
diff --git a/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.h b/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.h
index 4f727e41..b070266e 100644
--- a/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.h
+++ b/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.h
@@ -37,7 +37,7 @@
 #include <wtf/Forward.h>
 #include <wtf/OptionSet.h>
 #include <wtf/RunLoop.h>
-#if PLATFORM(GTK)
+#if PLATFORM(GTK) && USE(COORDINATED_GRAPHICS)
 #include <WebCore/CoordinatedGraphicsLayer.h>
 #endif
 
@@ -100,7 +100,7 @@ public:
 
     WebCore::PlatformDisplayID displayID() const { return m_displayID; }
 
-#if PLATFORM(GTK)
+#if PLATFORM(GTK) && USE(COORDINATED_GRAPHICS)
     void adjustTransientZoom(double, WebCore::FloatPoint);
     void commitTransientZoom(double, WebCore::FloatPoint);
 #endif
@@ -213,7 +213,7 @@ private:
 #endif // USE(COORDINATED_GRAPHICS)
     WebCore::PlatformDisplayID m_displayID;
 
-#if PLATFORM(GTK)
+#if PLATFORM(GTK) && USE(COORDINATED_GRAPHICS)
     bool m_transientZoom { false };
     double m_transientZoomScale { 1 };
     WebCore::FloatPoint m_transientZoomOrigin;
