[GTK] Build GTK-specific, non-layer-violating source code into WebCore-independent libPlatformGtk.la
https://bugs.webkit.org/show_bug.cgi?id=112546

Reviewed by Martin Robinson.

.: 

* GNUmakefile.am: Define the new platform_webcore_cppflags.

Source/Platform: 

* GNUmakefile.am: Only specify the very minimal set of inclusion directories, containing the Source/WebCore/platform
directory and its subdirectories. This will allow only for the WebCore-independent GTK-specific sources to be built into
libPlatformGtk.la. Also include the GTK, libsecret and libsoup dependencies' cflags amongst the libPlatformGtk's
CPPFLAGS.
* GNUmakefile.list.am: Removed. The build targets are now listed (and will be listed until the migration) in the
GNUmakefile.list.am under Source/WebCore, following the common sense of specifying the build target in the
GNUmakefile.list.am placed in the same framework directory in which the source file is located.

Source/WebCore: 

No new tests - no new functionality.

* GNUmakefile.am: Passing the DATA_DIR value through the cppflags is not required anymore as the affected source is now
built into libPlatformGtk.la.
* GNUmakefile.list.am: Build the GTK-specific source files that are already independent of WebCore into the
libPlatformGtk.la by assigning the build targets listing to the platformgtk_sources variable.
* platform/gtk/GtkVersioning.c: Renamed from Source/Platform/gtk/GtkVersioning.c.
* platform/gtk/GtkVersioning.h: Renamed from Source/Platform/gtk/GtkVersioning.h.

Source/WebKit/gtk: 

* GNUmakefile.am: The GtkVersioning.c file has moved back under Source/WebCore/platform.

Source/WebKit2: 

* GNUmakefile.am: Reference the platform_webcore_cppflags and GTK, libsecret and libsoup dependencies' cflags amongst the
libPlatformGtk2's CPPFLAGS.
* Scripts/generate-forwarding-headers.pl: Remove the Platform framework from the list of the frameworks to be searched
for forwarding headers, it's at the moment not necessary to be included.
* Shared/gtk/ArgumentCodersGtk.cpp: Adjust the forwarding header for GtkVersioning.h that's been moved back under the
WebCore framework.
* Shared/gtk/WebEventFactory.cpp: Ditto.
* UIProcess/API/gtk/WebKitWebViewBase.cpp: Ditto.
* WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp: Ditto.

Tools: 

* GNUmakefile.am: Reference the platformgtk_cppflags amongst the libWebCoreInternals' CPPFLAGS. GtkVersioning.c file has
moved back to Source/WebCore/platform. Fix an indentation issue as well.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@147137 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/ChangeLog b/ChangeLog
index 5fe1c87..837266f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2013-03-28  Zan Dobersek  <zdobersek@igalia.com>
 
+        [GTK] Build GTK-specific, non-layer-violating source code into WebCore-independent libPlatformGtk.la
+        https://bugs.webkit.org/show_bug.cgi?id=112546
+
+        Reviewed by Martin Robinson.
+
+        * GNUmakefile.am: Define the new platform_webcore_cppflags.
+
+2013-03-28  Zan Dobersek  <zdobersek@igalia.com>
+
         Unreviewed GTK build fix after r147039.
 
         * Source/autotools/symbols.filter: Export the missing symbols.
diff --git a/GNUmakefile.am b/GNUmakefile.am
index 228b825..1949b24 100644
--- a/GNUmakefile.am
+++ b/GNUmakefile.am
@@ -70,6 +70,7 @@
 javascriptcore_built_nosources :=
 llint_nosources :=
 offlineasm_nosources :=
+platform_webcore_cppflags :=
 platformgtk_cppflags :=
 platformgtk_sources :=
 webcore_platform_sources :=
diff --git a/Source/Platform/ChangeLog b/Source/Platform/ChangeLog
index fe0a3c1..df5820a 100644
--- a/Source/Platform/ChangeLog
+++ b/Source/Platform/ChangeLog
@@ -1,3 +1,18 @@
+2013-03-28  Zan Dobersek  <zdobersek@igalia.com>
+
+        [GTK] Build GTK-specific, non-layer-violating source code into WebCore-independent libPlatformGtk.la
+        https://bugs.webkit.org/show_bug.cgi?id=112546
+
+        Reviewed by Martin Robinson.
+
+        * GNUmakefile.am: Only specify the very minimal set of inclusion directories, containing the Source/WebCore/platform
+        directory and its subdirectories. This will allow only for the WebCore-independent GTK-specific sources to be built into
+        libPlatformGtk.la. Also include the GTK, libsecret and libsoup dependencies' cflags amongst the libPlatformGtk's
+        CPPFLAGS.
+        * GNUmakefile.list.am: Removed. The build targets are now listed (and will be listed until the migration) in the
+        GNUmakefile.list.am under Source/WebCore, following the common sense of specifying the build target in the
+        GNUmakefile.list.am placed in the same framework directory in which the source file is located.
+
 2013-03-26  Dana Jansens  <danakj@chromium.org>
 
         [chromium] Remove the WebVideoFrame, WebVideoFrameProvider, WebStreamTextureClient, and WebVideoLayer classes.
diff --git a/Source/Platform/GNUmakefile.am b/Source/Platform/GNUmakefile.am
index 5f960cb..b40bc32 100644
--- a/Source/Platform/GNUmakefile.am
+++ b/Source/Platform/GNUmakefile.am
@@ -6,11 +6,34 @@
 # For now we only build the libPlatformGtk library as there are no source files in place yet
 # that could be built into libPlatform.
 
-include $(srcdir)/Source/Platform/GNUmakefile.list.am
-
 platformgtk_cppflags += \
 	-DWEBKITGTK_API_VERSION_STRING=\"@WEBKITGTK_API_VERSION@\" \
-	-I$(srcdir)/Source/Platform/gtk
+	-I$(srcdir)/Source/ThirdParty/ANGLE/src \
+	-I$(srcdir)/Source/ThirdParty/ANGLE/include \
+	-I$(srcdir)/Source/ThirdParty/ANGLE/include/GLSLANG \
+	-I$(srcdir)/Source/ThirdParty/ANGLE/include/KHR \
+	-DDATA_DIR=\"${datadir}\"
+
+# This is the minimal set of Source/WebCore/platform subdirectories that contain headers required by the GTK-specific
+# platform source files. These inclusions are required due to platform layer source files not yet completely migrated
+# into Source/Platform. Only Source/WebCore/platform subdirectories must be listed here as this, coupled with the
+# header inclusion in source files that's done via specifying the header basename, prevents any platform violations
+# occurring.
+platform_webcore_cppflags += \
+	-I$(srcdir)/Source/WebCore/platform \
+	-I$(srcdir)/Source/WebCore/platform/animation \
+	-I$(srcdir)/Source/WebCore/platform/audio \
+	-I$(srcdir)/Source/WebCore/platform/cairo \
+	-I$(srcdir)/Source/WebCore/platform/graphics \
+	-I$(srcdir)/Source/WebCore/platform/graphics/cairo \
+	-I$(srcdir)/Source/WebCore/platform/graphics/gstreamer \
+	-I$(srcdir)/Source/WebCore/platform/graphics/gtk \
+	-I$(srcdir)/Source/WebCore/platform/graphics/transforms \
+	-I$(srcdir)/Source/WebCore/platform/gtk \
+	-I$(srcdir)/Source/WebCore/platform/network \
+	-I$(srcdir)/Source/WebCore/platform/network/gtk \
+	-I$(srcdir)/Source/WebCore/platform/network/soup \
+	-I$(srcdir)/Source/WebCore/platform/text
 
 noinst_LTLIBRARIES += \
 	libPlatformGtk.la
@@ -30,6 +53,9 @@
 	-DBUILDING_WEBKIT \
 	$(global_cppflags) \
 	$(platformgtk_cppflags) \
+	$(platform_webcore_cppflags) \
 	$(javascriptcore_cppflags) \
 	-fno-strict-aliasing \
-	$(GTK_CFLAGS)
+	$(GTK_CFLAGS) \
+	$(LIBSECRET_CFLAGS) \
+	$(LIBSOUP_CFLAGS)
diff --git a/Source/Platform/GNUmakefile.list.am b/Source/Platform/GNUmakefile.list.am
deleted file mode 100644
index 796becf..0000000
--- a/Source/Platform/GNUmakefile.list.am
+++ /dev/null
@@ -1,3 +0,0 @@
-platformgtk_sources += \
-	Source/Platform/gtk/GtkVersioning.c \
-	Source/Platform/gtk/GtkVersioning.h
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 7443cad..dc3a3d6 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,19 @@
+2013-03-28  Zan Dobersek  <zdobersek@igalia.com>
+
+        [GTK] Build GTK-specific, non-layer-violating source code into WebCore-independent libPlatformGtk.la
+        https://bugs.webkit.org/show_bug.cgi?id=112546
+
+        Reviewed by Martin Robinson.
+
+        No new tests - no new functionality.
+
+        * GNUmakefile.am: Passing the DATA_DIR value through the cppflags is not required anymore as the affected source is now
+        built into libPlatformGtk.la.
+        * GNUmakefile.list.am: Build the GTK-specific source files that are already independent of WebCore into the
+        libPlatformGtk.la by assigning the build targets listing to the platformgtk_sources variable.
+        * platform/gtk/GtkVersioning.c: Renamed from Source/Platform/gtk/GtkVersioning.c.
+        * platform/gtk/GtkVersioning.h: Renamed from Source/Platform/gtk/GtkVersioning.h.
+
 2013-03-28  Matt Falkenhagen  <falken@chromium.org>
 
         Refactoring: Replace Element::disabled and isEnabledFormControl with isDisabledFormControl
diff --git a/Source/WebCore/GNUmakefile.am b/Source/WebCore/GNUmakefile.am
index 4ec826f..a3b8f4a 100644
--- a/Source/WebCore/GNUmakefile.am
+++ b/Source/WebCore/GNUmakefile.am
@@ -105,8 +105,7 @@
 	-I$(top_builddir)/WebCore/bindings/js \
 	-I$(top_builddir)/DerivedSources/WebCore \
 	-I$(top_builddir)/DerivedSources \
-	-I$(top_builddir)/DerivedSources/JavaScriptCore \
-	-DDATA_DIR=\"${datadir}\"
+	-I$(top_builddir)/DerivedSources/JavaScriptCore
 
 webcoregtk_cppflags += \
 	-DWEBKITGTK_API_VERSION_STRING=\"@WEBKITGTK_API_VERSION@\" \
diff --git a/Source/WebCore/GNUmakefile.list.am b/Source/WebCore/GNUmakefile.list.am
index c86d000..b08d035 100644
--- a/Source/WebCore/GNUmakefile.list.am
+++ b/Source/WebCore/GNUmakefile.list.am
@@ -5783,14 +5783,6 @@
 	Source/WebCore/platform/gtk/ErrorsGtk.cpp \
 	Source/WebCore/platform/gtk/ErrorsGtk.h \
 	Source/WebCore/platform/gtk/GamepadsGtk.cpp \
-	Source/WebCore/platform/gtk/KURLGtk.cpp \
-	Source/WebCore/platform/gtk/LanguageGtk.cpp \
-	Source/WebCore/platform/gtk/LoggingGtk.cpp \
-	Source/WebCore/platform/gtk/MIMETypeRegistryGtk.cpp \
-	Source/WebCore/platform/gtk/SharedBufferGtk.cpp \
-	Source/WebCore/platform/gtk/UserAgentGtk.cpp \
-	Source/WebCore/platform/gtk/UserAgentGtk.h \
-	Source/WebCore/platform/gtk/TemporaryLinkStubs.cpp \
 	Source/WebCore/platform/HostWindow.h \
 	Source/WebCore/platform/KillRing.h \
 	Source/WebCore/platform/KillRingNone.cpp \
@@ -5948,8 +5940,6 @@
 	Source/WebCore/platform/network/SocketStreamHandleBase.cpp \
 	Source/WebCore/platform/network/SocketStreamHandleBase.h \
 	Source/WebCore/platform/network/SocketStreamHandleClient.h \
-	Source/WebCore/platform/network/gtk/CredentialBackingStore.cpp \
-	Source/WebCore/platform/network/gtk/CredentialBackingStore.h \
 	Source/WebCore/platform/network/soup/AuthenticationChallenge.h \
 	Source/WebCore/platform/network/soup/AuthenticationChallengeSoup.cpp \
 	Source/WebCore/platform/network/soup/CookieJarSoup.cpp \
@@ -6052,7 +6042,6 @@
 	Source/WebCore/platform/SystemTime.h \
 	Source/WebCore/platform/text/enchant/TextCheckerEnchant.h \
 	Source/WebCore/platform/text/enchant/TextCheckerEnchant.cpp \
-	Source/WebCore/platform/text/gtk/TextBreakIteratorInternalICUGtk.cpp \
 	Source/WebCore/platform/text/BidiContext.cpp \
 	Source/WebCore/platform/text/BidiContext.h \
 	Source/WebCore/platform/text/BidiResolver.h \
@@ -6169,7 +6158,6 @@
 	Source/WebCore/editing/atk/FrameSelectionAtk.cpp \
 	Source/WebCore/page/gtk/DragControllerGtk.cpp \
 	Source/WebCore/page/gtk/EventHandlerGtk.cpp \
-	Source/WebCore/platform/audio/gtk/AudioBusGtk.cpp \
 	Source/WebCore/platform/cairo/WidgetBackingStore.h \
 	Source/WebCore/platform/geoclue/GeolocationProviderGeoclue.h \
 	Source/WebCore/platform/geoclue/GeolocationProviderGeoclue.cpp \
@@ -6192,97 +6180,115 @@
 	Source/WebCore/platform/graphics/gstreamer/PlatformVideoWindow.h \
 	Source/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.cpp \
 	Source/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.h \
-	Source/WebCore/platform/graphics/gtk/ColorGtk.cpp \
-	Source/WebCore/platform/graphics/gtk/GdkCairoUtilities.cpp \
-	Source/WebCore/platform/graphics/gtk/GdkCairoUtilities.h \
 	Source/WebCore/platform/graphics/gtk/FullscreenVideoControllerGtk.cpp \
 	Source/WebCore/platform/graphics/gtk/FullscreenVideoControllerGtk.h \
 	Source/WebCore/platform/graphics/gtk/IconGtk.cpp \
 	Source/WebCore/platform/graphics/gtk/ImageBufferGtk.cpp \
-	Source/WebCore/platform/graphics/gtk/ImageGtk.cpp \
-	Source/WebCore/platform/graphics/gtk/IntPointGtk.cpp \
-	Source/WebCore/platform/graphics/gtk/IntRectGtk.cpp \
 	Source/WebCore/platform/gtk/AsyncFileSystemGtk.cpp \
 	Source/WebCore/platform/gtk/AsyncFileSystemGtk.h \
 	Source/WebCore/platform/gtk/ClipboardGtk.cpp \
 	Source/WebCore/platform/gtk/ClipboardGtk.h \
 	Source/WebCore/platform/gtk/ClipboardUtilitiesGtk.cpp \
 	Source/WebCore/platform/gtk/ClipboardUtilitiesGtk.h \
-	Source/WebCore/platform/gtk/CompositionResults.h \
-	Source/WebCore/platform/gtk/ContextMenuGtk.cpp \
-	Source/WebCore/platform/gtk/ContextMenuItemGtk.cpp \
-	Source/WebCore/platform/gtk/CursorGtk.cpp \
-	Source/WebCore/platform/gtk/CursorGtk.h \
 	Source/WebCore/platform/gtk/DataObjectGtk.cpp \
 	Source/WebCore/platform/gtk/DataObjectGtk.h \
 	Source/WebCore/platform/gtk/DragDataGtk.cpp \
-	Source/WebCore/platform/gtk/DragIcon.cpp \
-	Source/WebCore/platform/gtk/DragIcon.h \
 	Source/WebCore/platform/gtk/DragImageGtk.cpp \
-	Source/WebCore/platform/gtk/EventLoopGtk.cpp \
-	Source/WebCore/platform/gtk/FileSystemGtk.cpp \
-	Source/WebCore/platform/gtk/GtkClickCounter.cpp \
-	Source/WebCore/platform/gtk/GtkClickCounter.h \
 	Source/WebCore/platform/gtk/GtkDragAndDropHelper.cpp \
 	Source/WebCore/platform/gtk/GtkDragAndDropHelper.h \
-	Source/WebCore/platform/gtk/GtkInputMethodFilter.cpp \
-	Source/WebCore/platform/gtk/GtkInputMethodFilter.h \
-	Source/WebCore/platform/gtk/GtkUtilities.cpp \
-	Source/WebCore/platform/gtk/GtkUtilities.h \
-	Source/WebCore/platform/gtk/GOwnPtrGtk.cpp \
-	Source/WebCore/platform/gtk/GOwnPtrGtk.h \
-	Source/WebCore/platform/gtk/GRefPtrGtk.cpp \
-	Source/WebCore/platform/gtk/GRefPtrGtk.h \
-	Source/WebCore/platform/gtk/GtkAuthenticationDialog.cpp \
-	Source/WebCore/platform/gtk/GtkAuthenticationDialog.h \
 	Source/WebCore/platform/gtk/GtkPluginWidget.cpp \
 	Source/WebCore/platform/gtk/GtkPluginWidget.h \
-	Source/WebCore/platform/gtk/GtkPopupMenu.cpp \
-	Source/WebCore/platform/gtk/GtkPopupMenu.h \
-	Source/WebCore/platform/gtk/KeyBindingTranslator.cpp \
-	Source/WebCore/platform/gtk/KeyBindingTranslator.h \
-	Source/WebCore/platform/gtk/LocalizedStringsGtk.cpp \
-	Source/WebCore/platform/gtk/MainFrameScrollbarGtk.cpp \
-	Source/WebCore/platform/gtk/MainFrameScrollbarGtk.h \
 	Source/WebCore/platform/gtk/PasteboardGtk.cpp \
 	Source/WebCore/platform/gtk/PasteboardHelper.cpp \
 	Source/WebCore/platform/gtk/PasteboardHelper.h \
-	Source/WebCore/platform/gtk/PlatformKeyboardEventGtk.cpp \
-	Source/WebCore/platform/gtk/PlatformMouseEventGtk.cpp \
-	Source/WebCore/platform/gtk/PlatformScreenGtk.cpp \
-	Source/WebCore/platform/gtk/PlatformWheelEventGtk.cpp \
 	Source/WebCore/platform/gtk/PopupMenuGtk.cpp \
 	Source/WebCore/platform/gtk/PopupMenuGtk.h \
 	Source/WebCore/platform/gtk/RenderThemeGtk.cpp \
 	Source/WebCore/platform/gtk/RenderThemeGtk.h \
 	Source/WebCore/platform/gtk/RenderThemeGtk2.cpp \
 	Source/WebCore/platform/gtk/RenderThemeGtk3.cpp \
-	Source/WebCore/platform/gtk/RunLoopGtk.cpp \
+	Source/WebCore/platform/gtk/ScrollViewGtk.cpp \
 	Source/WebCore/platform/gtk/ScrollbarThemeGtk.cpp \
 	Source/WebCore/platform/gtk/ScrollbarThemeGtk.h \
 	Source/WebCore/platform/gtk/ScrollbarThemeGtk2.cpp \
 	Source/WebCore/platform/gtk/ScrollbarThemeGtk3.cpp \
-	Source/WebCore/platform/gtk/ScrollViewGtk.cpp \
 	Source/WebCore/platform/gtk/SearchPopupMenuGtk.cpp \
 	Source/WebCore/platform/gtk/SearchPopupMenuGtk.h \
-	Source/WebCore/platform/gtk/SharedTimerGtk.cpp \
-	Source/WebCore/platform/gtk/SoundGtk.cpp \
 	Source/WebCore/platform/gtk/WidgetGtk.cpp \
 	Source/WebCore/platform/gtk/WidgetRenderingContext.cpp \
 	Source/WebCore/platform/gtk/WidgetRenderingContext.h
 
+platformgtk_sources += \
+	Source/WebCore/platform/gtk/CompositionResults.h \
+	Source/WebCore/platform/gtk/ContextMenuGtk.cpp \
+	Source/WebCore/platform/gtk/ContextMenuItemGtk.cpp \
+	Source/WebCore/platform/gtk/CursorGtk.cpp \
+	Source/WebCore/platform/gtk/CursorGtk.h \
+	Source/WebCore/platform/gtk/DragIcon.cpp \
+	Source/WebCore/platform/gtk/DragIcon.h \
+	Source/WebCore/platform/gtk/EventLoopGtk.cpp \
+	Source/WebCore/platform/gtk/FileSystemGtk.cpp \
+	Source/WebCore/platform/gtk/GOwnPtrGtk.cpp \
+	Source/WebCore/platform/gtk/GOwnPtrGtk.h \
+	Source/WebCore/platform/gtk/GRefPtrGtk.cpp \
+	Source/WebCore/platform/gtk/GRefPtrGtk.h \
+	Source/WebCore/platform/gtk/GtkAuthenticationDialog.cpp \
+	Source/WebCore/platform/gtk/GtkAuthenticationDialog.h \
+	Source/WebCore/platform/gtk/GtkClickCounter.cpp \
+	Source/WebCore/platform/gtk/GtkClickCounter.h \
+	Source/WebCore/platform/gtk/GtkInputMethodFilter.cpp \
+	Source/WebCore/platform/gtk/GtkInputMethodFilter.h \
+	Source/WebCore/platform/gtk/GtkPopupMenu.cpp \
+	Source/WebCore/platform/gtk/GtkPopupMenu.h \
+	Source/WebCore/platform/gtk/GtkUtilities.cpp \
+	Source/WebCore/platform/gtk/GtkUtilities.h \
+	Source/WebCore/platform/gtk/GtkVersioning.c \
+	Source/WebCore/platform/gtk/GtkVersioning.h \
+	Source/WebCore/platform/gtk/KURLGtk.cpp \
+	Source/WebCore/platform/gtk/KeyBindingTranslator.cpp \
+	Source/WebCore/platform/gtk/KeyBindingTranslator.h \
+	Source/WebCore/platform/gtk/LanguageGtk.cpp \
+	Source/WebCore/platform/gtk/LocalizedStringsGtk.cpp \
+	Source/WebCore/platform/gtk/LoggingGtk.cpp \
+	Source/WebCore/platform/gtk/MIMETypeRegistryGtk.cpp \
+	Source/WebCore/platform/gtk/MainFrameScrollbarGtk.cpp \
+	Source/WebCore/platform/gtk/MainFrameScrollbarGtk.h \
+	Source/WebCore/platform/gtk/PlatformKeyboardEventGtk.cpp \
+	Source/WebCore/platform/gtk/PlatformMouseEventGtk.cpp \
+	Source/WebCore/platform/gtk/PlatformScreenGtk.cpp \
+	Source/WebCore/platform/gtk/PlatformWheelEventGtk.cpp \
+	Source/WebCore/platform/gtk/RunLoopGtk.cpp \
+	Source/WebCore/platform/gtk/SharedBufferGtk.cpp \
+	Source/WebCore/platform/gtk/SharedTimerGtk.cpp \
+	Source/WebCore/platform/gtk/SoundGtk.cpp \
+	Source/WebCore/platform/gtk/TemporaryLinkStubs.cpp \
+	Source/WebCore/platform/gtk/UserAgentGtk.cpp \
+	Source/WebCore/platform/gtk/UserAgentGtk.h \
+	Source/WebCore/platform/audio/gtk/AudioBusGtk.cpp \
+	Source/WebCore/platform/graphics/gtk/ColorGtk.cpp \
+	Source/WebCore/platform/graphics/gtk/GdkCairoUtilities.cpp \
+	Source/WebCore/platform/graphics/gtk/GdkCairoUtilities.h \
+	Source/WebCore/platform/graphics/gtk/ImageGtk.cpp \
+	Source/WebCore/platform/graphics/gtk/IntPointGtk.cpp \
+	Source/WebCore/platform/graphics/gtk/IntRectGtk.cpp \
+	Source/WebCore/platform/network/gtk/CredentialBackingStore.cpp \
+	Source/WebCore/platform/network/gtk/CredentialBackingStore.h \
+	Source/WebCore/platform/text/gtk/TextBreakIteratorInternalICUGtk.cpp
+
 if TARGET_X11
 webcoregtk_sources += \
-	Source/WebCore/platform/gtk/GtkWidgetBackingStoreX11.cpp \
 	Source/WebCore/plugins/gtk/gtk2xtbin.c \
 	Source/WebCore/plugins/gtk/gtk2xtbin.h \
 	Source/WebCore/plugins/gtk/PluginPackageGtk.cpp \
 	Source/WebCore/plugins/gtk/PluginViewGtk.cpp \
 	Source/WebCore/plugins/gtk/xembed.h
+platformgtk_sources += \
+	Source/WebCore/platform/gtk/GtkWidgetBackingStoreX11.cpp
 if USE_OPENGL
 webcoregtk_sources += \
 	Source/WebCore/platform/graphics/cairo/GLContext.cpp \
-	Source/WebCore/platform/graphics/cairo/GLContext.h \
+	Source/WebCore/platform/graphics/cairo/GLContext.h
+platformgtk_sources += \
 	Source/WebCore/platform/gtk/RedirectedXCompositeWindow.cpp \
 	Source/WebCore/platform/gtk/RedirectedXCompositeWindow.h
 endif # END USE_OPENGL
diff --git a/Source/Platform/gtk/GtkVersioning.c b/Source/WebCore/platform/gtk/GtkVersioning.c
similarity index 100%
rename from Source/Platform/gtk/GtkVersioning.c
rename to Source/WebCore/platform/gtk/GtkVersioning.c
diff --git a/Source/Platform/gtk/GtkVersioning.h b/Source/WebCore/platform/gtk/GtkVersioning.h
similarity index 100%
rename from Source/Platform/gtk/GtkVersioning.h
rename to Source/WebCore/platform/gtk/GtkVersioning.h
diff --git a/Source/WebKit/gtk/ChangeLog b/Source/WebKit/gtk/ChangeLog
index e491cd0..06fc3c0 100644
--- a/Source/WebKit/gtk/ChangeLog
+++ b/Source/WebKit/gtk/ChangeLog
@@ -1,3 +1,12 @@
+2013-03-28  Zan Dobersek  <zdobersek@igalia.com>
+
+        [GTK] Build GTK-specific, non-layer-violating source code into WebCore-independent libPlatformGtk.la
+        https://bugs.webkit.org/show_bug.cgi?id=112546
+
+        Reviewed by Martin Robinson.
+
+        * GNUmakefile.am: The GtkVersioning.c file has moved back under Source/WebCore/platform.
+
 2013-03-26  Martin Robinson  <mrobinson@igalia.com>
 
         [GTK] [gyp] Improve support for rerunning gyp automatically
diff --git a/Source/WebKit/gtk/GNUmakefile.am b/Source/WebKit/gtk/GNUmakefile.am
index e396be6..37ccaa4 100644
--- a/Source/WebKit/gtk/GNUmakefile.am
+++ b/Source/WebKit/gtk/GNUmakefile.am
@@ -628,7 +628,7 @@
 Programs_unittests_testkeyevents_LDFLAGS = $(webkit_tests_ldflags)
 
 Programs_unittests_testcopyandpaste_SOURCES = Source/WebKit/gtk/tests/testcopyandpaste.c \
-	Source/Platform/gtk/GtkVersioning.c
+	Source/WebCore/platform/gtk/GtkVersioning.c
 Programs_unittests_testcopyandpaste_CFLAGS = $(webkit_tests_cflags) \
 	-I$(srcdir)/Source/WebCore/platform/gtk \
 	-I$(srcdir)/Source/WebCore
diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog
index fe3aeee..4b3dec3 100644
--- a/Source/WebKit2/ChangeLog
+++ b/Source/WebKit2/ChangeLog
@@ -1,3 +1,20 @@
+2013-03-28  Zan Dobersek  <zdobersek@igalia.com>
+
+        [GTK] Build GTK-specific, non-layer-violating source code into WebCore-independent libPlatformGtk.la
+        https://bugs.webkit.org/show_bug.cgi?id=112546
+
+        Reviewed by Martin Robinson.
+
+        * GNUmakefile.am: Reference the platform_webcore_cppflags and GTK, libsecret and libsoup dependencies' cflags amongst the
+        libPlatformGtk2's CPPFLAGS.
+        * Scripts/generate-forwarding-headers.pl: Remove the Platform framework from the list of the frameworks to be searched
+        for forwarding headers, it's at the moment not necessary to be included.
+        * Shared/gtk/ArgumentCodersGtk.cpp: Adjust the forwarding header for GtkVersioning.h that's been moved back under the
+        WebCore framework.
+        * Shared/gtk/WebEventFactory.cpp: Ditto.
+        * UIProcess/API/gtk/WebKitWebViewBase.cpp: Ditto.
+        * WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp: Ditto.
+
 2013-03-27  Tim Horton  <timothy_horton@apple.com>
 
         Unreviewed Qt build fix after http://trac.webkit.org/changeset/147067.
diff --git a/Source/WebKit2/GNUmakefile.am b/Source/WebKit2/GNUmakefile.am
index 155e67d..93b8efa 100644
--- a/Source/WebKit2/GNUmakefile.am
+++ b/Source/WebKit2/GNUmakefile.am
@@ -512,9 +512,12 @@
 	-DGTK_API_VERSION_2=1 \
 	$(global_cppflags) \
 	$(platformgtk_cppflags) \
+	$(platform_webcore_cppflags) \
 	$(javascriptcore_cppflags) \
 	-fno-strict-aliasing \
-	$(GTK2_CFLAGS)
+	$(GTK2_CFLAGS) \
+	$(LIBSECRET_CFLAGS) \
+	$(LIBSOUP_CFLAGS)
 
 # Injected Bundle
 injectedbundledir = $(libdir)/webkit2gtk-3.0/injected-bundle
diff --git a/Source/WebKit2/Scripts/generate-forwarding-headers.pl b/Source/WebKit2/Scripts/generate-forwarding-headers.pl
index b783a58..bc5496f 100755
--- a/Source/WebKit2/Scripts/generate-forwarding-headers.pl
+++ b/Source/WebKit2/Scripts/generate-forwarding-headers.pl
@@ -36,7 +36,7 @@
 my $srcRoot = realpath(File::Spec->catfile(dirname(abs_path($0)), "../.."));
 my $incFromRoot = abs_path($ARGV[0]);
 my @platformPrefixes = ("blackberry", "cf", "chromium", "curl", "efl", "gtk", "mac", "qt", "soup", "v8", "win", "wx");
-my @frameworks = ("JavaScriptCore", "Platform", "WebCore", "WebKit2");
+my @frameworks = ("JavaScriptCore", "WebCore", "WebKit2");
 my @skippedPrefixes;
 my @frameworkHeaders;
 my $framework;
diff --git a/Source/WebKit2/Shared/gtk/ArgumentCodersGtk.cpp b/Source/WebKit2/Shared/gtk/ArgumentCodersGtk.cpp
index 31cd5da..3969e0c 100644
--- a/Source/WebKit2/Shared/gtk/ArgumentCodersGtk.cpp
+++ b/Source/WebKit2/Shared/gtk/ArgumentCodersGtk.cpp
@@ -29,10 +29,10 @@
 #include "DataReference.h"
 #include "ShareableBitmap.h"
 #include "WebCoreArgumentCoders.h"
-#include <Platform/GtkVersioning.h>
 #include <WebCore/DataObjectGtk.h>
 #include <WebCore/DragData.h>
 #include <WebCore/GraphicsContext.h>
+#include <WebCore/GtkVersioning.h>
 #include <WebCore/PlatformContextCairo.h>
 #include <wtf/gobject/GOwnPtr.h>
 
diff --git a/Source/WebKit2/Shared/gtk/WebEventFactory.cpp b/Source/WebKit2/Shared/gtk/WebEventFactory.cpp
index bd73ab1..cb88a82 100644
--- a/Source/WebKit2/Shared/gtk/WebEventFactory.cpp
+++ b/Source/WebKit2/Shared/gtk/WebEventFactory.cpp
@@ -31,7 +31,7 @@
 #include "PlatformKeyboardEvent.h"
 #include "Scrollbar.h"
 #include "WindowsKeyboardCodes.h"
-#include <Platform/GtkVersioning.h>
+#include <WebCore/GtkVersioning.h>
 #include <gdk/gdk.h>
 #include <gdk/gdkkeysyms.h>
 #include <wtf/ASCIICType.h>
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp
index ba72ddc..2344f89 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp
@@ -41,7 +41,6 @@
 #include "WebKitWebViewBasePrivate.h"
 #include "WebPageProxy.h"
 #include "WebViewBaseInputMethodFilter.h"
-#include <Platform/GtkVersioning.h>
 #include <WebCore/ClipboardGtk.h>
 #include <WebCore/ClipboardUtilitiesGtk.h>
 #include <WebCore/DataObjectGtk.h>
@@ -51,6 +50,7 @@
 #include <WebCore/GtkClickCounter.h>
 #include <WebCore/GtkDragAndDropHelper.h>
 #include <WebCore/GtkUtilities.h>
+#include <WebCore/GtkVersioning.h>
 #include <WebCore/NotImplemented.h>
 #include <WebCore/PasteboardHelper.h>
 #include <WebCore/RefPtrCairo.h>
diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp
index 6e07767..a184687 100644
--- a/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp
+++ b/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp
@@ -42,7 +42,7 @@
 #include <gtk/gtkx.h>
 #endif
 #include <gdk/gdkx.h>
-#include <Platform/GtkVersioning.h>
+#include <WebCore/GtkVersioning.h>
 #elif PLATFORM(EFL) && defined(HAVE_ECORE_X)
 #include <Ecore_X.h>
 #endif
diff --git a/Tools/ChangeLog b/Tools/ChangeLog
index a0b826d..c0f25b6 100644
--- a/Tools/ChangeLog
+++ b/Tools/ChangeLog
@@ -1,3 +1,13 @@
+2013-03-28  Zan Dobersek  <zdobersek@igalia.com>
+
+        [GTK] Build GTK-specific, non-layer-violating source code into WebCore-independent libPlatformGtk.la
+        https://bugs.webkit.org/show_bug.cgi?id=112546
+
+        Reviewed by Martin Robinson.
+
+        * GNUmakefile.am: Reference the platformgtk_cppflags amongst the libWebCoreInternals' CPPFLAGS. GtkVersioning.c file has
+        moved back to Source/WebCore/platform. Fix an indentation issue as well.
+
 2013-03-28  Ming Xie  <mxie@blackberry.com>
 
         [BlackBerry] Committer Email Updates
diff --git a/Tools/GNUmakefile.am b/Tools/GNUmakefile.am
index debcd24..dc40bc8 100644
--- a/Tools/GNUmakefile.am
+++ b/Tools/GNUmakefile.am
@@ -83,6 +83,7 @@
 
 libWebCoreInternals_la_CPPFLAGS = \
 	$(global_cppflags) \
+	$(platformgtk_cppflags) \
 	$(webcore_cppflags) \
 	$(webcoregtk_cppflags) \
 	$(javascriptcore_cppflags) \
@@ -125,6 +126,7 @@
 endif
 
 Programs_DumpRenderTree_SOURCES = \
+	Source/WebCore/platform/gtk/GtkVersioning.c \
 	Tools/DumpRenderTree/DumpRenderTree.h \
 	Tools/DumpRenderTree/DumpRenderTreeCommon.cpp \
 	Tools/DumpRenderTree/DumpRenderTreePrefix.h \
@@ -149,7 +151,7 @@
 	Tools/DumpRenderTree/config.h \
 	Tools/DumpRenderTree/atk/AccessibilityCallbacks.h \
 	Tools/DumpRenderTree/atk/AccessibilityCallbacksAtk.cpp \
-    	Tools/DumpRenderTree/atk/AccessibilityControllerAtk.cpp \
+	Tools/DumpRenderTree/atk/AccessibilityControllerAtk.cpp \
 	Tools/DumpRenderTree/atk/AccessibilityUIElementAtk.cpp \
 	Tools/DumpRenderTree/cairo/PixelDumpSupportCairo.cpp \
 	Tools/DumpRenderTree/cairo/PixelDumpSupportCairo.h \
@@ -168,8 +170,7 @@
 	Tools/DumpRenderTree/gtk/SelfScrollingWebKitWebView.h \
 	Tools/DumpRenderTree/gtk/TextInputController.h \
 	Tools/DumpRenderTree/gtk/TextInputController.cpp \
-	Tools/DumpRenderTree/gtk/WorkQueueItemGtk.cpp \
-	Source/Platform/gtk/GtkVersioning.c
+	Tools/DumpRenderTree/gtk/WorkQueueItemGtk.cpp
 
 Programs_DumpRenderTree_CXXFLAGS = \
 	$(global_cxxflags) \