[Gtk] allow building with css-shaders
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 11 Sep 2012 22:32:24 +0000 (22:32 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 11 Sep 2012 22:32:24 +0000 (22:32 +0000)
https://bugs.webkit.org/show_bug.cgi?id=95603

Patch by Arnaud Renevier <a.renevier@sisa.samsung.com> on 2012-09-11
Reviewed by Martin Robinson.

.:

if unstable features and accelerated compositing are turned on, and
acceleration backend is opengl, then build CSS Shaders and CSS
Filters.

* configure.ac:

Source/WebCore:

Add support for css filters and shaders in GNUmakefile.am and include
Texture.cpp, Texture.h, TilingData.cpp and TilingData.h in
webcore_sources

No functional change, so no new tests.

* GNUmakefile.am:
* GNUmakefile.list.am:

Source/WebKit/gtk:

Add enable-css-shaders property to WebKit WebSettings, and connects it
to WebCore settings setCSSCustomFilterEnabled.

* webkit/webkitwebsettings.cpp:
(webkit_web_settings_class_init):
(webkit_web_settings_set_property):
(webkit_web_settings_get_property):
* webkit/webkitwebsettingsprivate.h:
* webkit/webkitwebview.cpp:
(webkit_web_view_update_settings):
(webkit_web_view_settings_notify):

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

ChangeLog
Source/WebCore/ChangeLog
Source/WebCore/GNUmakefile.am
Source/WebCore/GNUmakefile.list.am
Source/WebKit/gtk/ChangeLog
Source/WebKit/gtk/webkit/webkitwebsettings.cpp
Source/WebKit/gtk/webkit/webkitwebsettingsprivate.h
Source/WebKit/gtk/webkit/webkitwebview.cpp
configure.ac

index cfeec2e..d5f6460 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2012-09-11  Arnaud Renevier  <a.renevier@sisa.samsung.com>
+
+        [Gtk] allow building with css-shaders
+        https://bugs.webkit.org/show_bug.cgi?id=95603
+
+        Reviewed by Martin Robinson.
+
+        if unstable features and accelerated compositing are turned on, and
+        acceleration backend is opengl, then build CSS Shaders and CSS
+        Filters.
+
+        * configure.ac:
+
 2012-09-11  Marcelo Lira  <marcelo.lira@openbossa.org>
 
         Restore original value of mock scrollbars enabled in InternalSettings
index 5fba393..1330cf0 100644 (file)
@@ -1,3 +1,19 @@
+2012-09-11  Arnaud Renevier  <a.renevier@sisa.samsung.com>
+
+        [Gtk] allow building with css-shaders
+        https://bugs.webkit.org/show_bug.cgi?id=95603
+
+        Reviewed by Martin Robinson.
+
+        Add support for css filters and shaders in GNUmakefile.am and include
+        Texture.cpp, Texture.h, TilingData.cpp and TilingData.h in
+        webcore_sources
+
+        No functional change, so no new tests.
+
+        * GNUmakefile.am:
+        * GNUmakefile.list.am:
+
 2012-09-11  Dimitri Glazkov  <dglazkov@chromium.org>
 
         Remove StyleResolver::setStyle, because it's no longer used.
index 45e3bc6..f3eeb36 100644 (file)
@@ -254,6 +254,15 @@ feature_defines_overrides += ENABLE_FULLSCREEN_API=0
 endif # END ENABLE_FULLSCREEN_API
 
 # ----
+# Filters
+# ----
+if ENABLE_CSS_FILTERS
+feature_defines_overrides += ENABLE_CSS_FILTERS=1
+else
+feature_defines_overrides += ENABLE_CSS_FILTERS=0
+endif # END ENABLE_CSS_FILTERS
+
+# ----
 # Track Support
 # ----
 if ENABLE_VIDEO_TRACK
@@ -357,6 +366,14 @@ else
 feature_defines_overrides += ENABLE_CSS_EXCLUSIONS=0
 endif # END ENABLE_CSS_EXCLUSIONS
 
+# Shaders
+# ----
+if ENABLE_CSS_SHADERS
+feature_defines_overrides += ENABLE_CSS_SHADERS=1
+else
+feature_defines_overrides += ENABLE_CSS_SHADERS=0
+endif # END ENABLE_CSS_SHADERS
+
 # ----
 # Geolocation
 # ----
index cb547d5..2f0327a 100644 (file)
@@ -4384,6 +4384,10 @@ webcore_sources += \
        Source/WebCore/platform/graphics/GlyphPageTreeNode.h \
        Source/WebCore/platform/graphics/gpu/DrawingBuffer.cpp \
        Source/WebCore/platform/graphics/gpu/DrawingBuffer.h \
+       Source/WebCore/platform/graphics/gpu/Texture.cpp \
+       Source/WebCore/platform/graphics/gpu/Texture.h \
+       Source/WebCore/platform/graphics/gpu/TilingData.cpp \
+       Source/WebCore/platform/graphics/gpu/TilingData.h \
        Source/WebCore/platform/graphics/Gradient.cpp \
        Source/WebCore/platform/graphics/Gradient.h \
        Source/WebCore/platform/graphics/GraphicsContext.cpp \
index 778dabc..b4549a5 100644 (file)
@@ -1,3 +1,22 @@
+2012-09-11  Arnaud Renevier  <a.renevier@sisa.samsung.com>
+
+        [Gtk] allow building with css-shaders
+        https://bugs.webkit.org/show_bug.cgi?id=95603
+
+        Reviewed by Martin Robinson.
+
+        Add enable-css-shaders property to WebKit WebSettings, and connects it
+        to WebCore settings setCSSCustomFilterEnabled.
+
+        * webkit/webkitwebsettings.cpp:
+        (webkit_web_settings_class_init):
+        (webkit_web_settings_set_property):
+        (webkit_web_settings_get_property):
+        * webkit/webkitwebsettingsprivate.h:
+        * webkit/webkitwebview.cpp:
+        (webkit_web_view_update_settings):
+        (webkit_web_view_settings_notify):
+
 2012-09-09  Emil A Eklund  <eae@chromium.org>
 
         Rename Node::getRect/getPixelSnappedRect and remove ContainerNode::getRect
index b933611..db74507 100644 (file)
@@ -118,7 +118,8 @@ enum {
     PROP_ENABLE_ACCELERATED_COMPOSITING,
     PROP_ENABLE_SMOOTH_SCROLLING,
     PROP_MEDIA_PLAYBACK_REQUIRES_USER_GESTURE,
-    PROP_MEDIA_PLAYBACK_ALLOWS_INLINE
+    PROP_MEDIA_PLAYBACK_ALLOWS_INLINE,
+    PROP_ENABLE_CSS_SHADERS
 };
 
 static void webkit_web_settings_finalize(GObject* object);
@@ -941,6 +942,25 @@ static void webkit_web_settings_class_init(WebKitWebSettingsClass* klass)
                                                          TRUE,
                                                          flags));
 
+    /**
+    * WebKitWebSettings:enable-css-shaders
+    *
+    * Enable or disable support for css shaders (css custom filters).
+    * Accelerated compositing needs to be enabled at compile time, but needs
+    * not be enabled at runtime.
+    *
+    * See also https://dvcs.w3.org/hg/FXTF/raw-file/tip/custom/index.html
+    *
+    * Since: 2.0
+    */
+    g_object_class_install_property(gobject_class,
+                                    PROP_ENABLE_CSS_SHADERS,
+                                    g_param_spec_boolean("enable-css-shaders",
+                                                         _("Enable CSS shaders"),
+                                                         _("Whether to enable css shaders"),
+                                                         FALSE,
+                                                         flags));
+
 }
 
 static void webkit_web_settings_init(WebKitWebSettings* web_settings)
@@ -1119,6 +1139,9 @@ static void webkit_web_settings_set_property(GObject* object, guint prop_id, con
     case PROP_ENABLE_SMOOTH_SCROLLING:
         priv->enableSmoothScrolling = g_value_get_boolean(value);
         break;
+    case PROP_ENABLE_CSS_SHADERS:
+        priv->enableCSSShaders = g_value_get_boolean(value);
+        break;
     case PROP_MEDIA_PLAYBACK_REQUIRES_USER_GESTURE:
         priv->mediaPlaybackRequiresUserGesture = g_value_get_boolean(value);
         break;
@@ -1293,6 +1316,9 @@ static void webkit_web_settings_get_property(GObject* object, guint prop_id, GVa
     case PROP_ENABLE_SMOOTH_SCROLLING:
         g_value_set_boolean(value, priv->enableSmoothScrolling);
         break;
+    case PROP_ENABLE_CSS_SHADERS:
+        g_value_set_boolean(value, priv->enableCSSShaders);
+        break;
     case PROP_MEDIA_PLAYBACK_REQUIRES_USER_GESTURE:
         g_value_set_boolean(value, priv->mediaPlaybackRequiresUserGesture);
         break;
index 5ed24a5..d8df8ef 100644 (file)
@@ -81,6 +81,7 @@ struct _WebKitWebSettingsPrivate {
     gboolean enableWebAudio;
     gboolean enableAcceleratedCompositing;
     gboolean enableSmoothScrolling;
+    gboolean enableCSSShaders;
     gboolean mediaPlaybackRequiresUserGesture;
     gboolean mediaPlaybackAllowsInline;
 };
index 8b99211..0cc8d96 100644 (file)
@@ -3444,6 +3444,10 @@ static void webkit_web_view_update_settings(WebKitWebView* webView)
     coreSettings->setEnableScrollAnimator(settingsPrivate->enableSmoothScrolling);
 #endif
 
+#if ENABLE(CSS_SHADERS)
+    coreSettings->setCSSCustomFilterEnabled(settingsPrivate->enableCSSShaders);
+#endif
+
     // Use mock scrollbars if in DumpRenderTree mode (i.e. testing layout tests).
     coreSettings->setMockScrollbarsEnabled(DumpRenderTreeSupportGtk::dumpRenderTreeModeEnabled());
 
@@ -3585,6 +3589,11 @@ static void webkit_web_view_settings_notify(WebKitWebSettings* webSettings, GPar
         settings->setEnableScrollAnimator(g_value_get_boolean(&value));
 #endif
 
+#if ENABLE(CSS_SHADERS)
+    else if (name == g_intern_string("enable-css-shaders"))
+        settings->setCSSCustomFilterEnabled(g_value_get_boolean(&value));
+#endif
+
     else if (!g_object_class_find_property(G_OBJECT_GET_CLASS(webSettings), name))
         g_warning("Unexpected setting '%s'", name);
     g_value_unset(&value);
index 15c7186..e89179d 100644 (file)
@@ -964,6 +964,16 @@ AC_ARG_ENABLE(css_regions,
               [],[enable_css_regions="yes"])
 AC_MSG_RESULT([$enable_css_regions])
 
+# Enable css shaders if unstable_features, css_filters and
+# accelerated_compositing are turned on.
+AC_MSG_CHECKING([whether to enable CSS Shaders])
+if test "$enable_unstable_features" = "yes" && test "$enable_accelerated_compositing" = "yes" && test "$with_acceleration_backend" = "opengl"; then
+    enable_css_shaders=yes;
+    enable_css_filters=yes;
+fi
+AC_MSG_RESULT([$enable_css_filters])
+AC_MSG_RESULT([$enable_css_shaders])
+
 G_IR_SCANNER=
 G_IR_COMPILER=
 G_IR_GENERATE=
@@ -1276,6 +1286,8 @@ AM_CONDITIONAL([ENABLE_MUTATION_OBSERVERS],[test "$enable_mutation_observers" =
 AM_CONDITIONAL([ENABLE_IFRAME_SEAMLESS],[test "$enable_iframe_seamless" = "yes"])
 AM_CONDITIONAL([ENABLE_CSS_EXCLUSIONS],[test "$enable_css_exclusions" = "yes"])
 AM_CONDITIONAL([ENABLE_CSS_REGIONS],[test "$enable_css_regions" = "yes"])
+AM_CONDITIONAL([ENABLE_CSS_FILTERS],[test "$enable_css_filters" = "yes"])
+AM_CONDITIONAL([ENABLE_CSS_SHADERS],[test "$enable_css_shaders" = "yes"])
 
 # Gtk conditionals
 AM_CONDITIONAL([ENABLE_INTROSPECTION],[test "$enable_introspection" = "yes"])