+2013-07-01 Gustavo Noronha Silva <gustavo.noronha@collabora.com>
+
+ [GTK] Remove unsupported AC backends
+ https://bugs.webkit.org/show_bug.cgi?id=117362
+
+ Reviewed by Martin Robinson.
+
+ * Source/autotools/FindDependencies.m4: remove checks related to acceleration backend,
+ turn them into a check for OpenGL being available, simply.
+ * Source/autotools/ReadCommandLineArguments.m4: remove command line option to select
+ accelerated backend, it's now auto-detected.
+ * Source/autotools/SetupAutoconfHeader.m4: no longer defines USE_CLUTTER and
+ USE_TEXTURE_MAPPER_CAIRO.
+ * Source/autotools/SetupAutomake.m4: remove checks related to acceleration backend,
+ turn them into a check for OpenGL being available, simply.
+ * Source/autotools/Versions.m4: no longer check for clutter/clutter-gtk.
+
2013-07-01 Timothy Hatcher <timothy@apple.com>
Link to WebInspectorUI.framework at build time instead of soft linking.
-I$(srcdir)/Source/WebCore/platform/graphics/gstreamer \
-I$(srcdir)/Source/WebCore/platform/graphics/gtk \
-I$(srcdir)/Source/WebCore/platform/graphics/harfbuzz \
+ -I$(srcdir)/Source/WebCore/platform/graphics/opengl \
-I$(srcdir)/Source/WebCore/platform/graphics/texmap \
-I$(srcdir)/Source/WebCore/platform/graphics/transforms \
-I$(srcdir)/Source/WebCore/platform/gtk \
+2013-07-01 Gustavo Noronha Silva <gustavo.noronha@collabora.com>
+
+ [GTK] Remove unsupported AC backends
+ https://bugs.webkit.org/show_bug.cgi?id=117362
+
+ Reviewed by Martin Robinson.
+
+ * GNUmakefile.am:
+ * GNUmakefile.list.am:
+ * Source/WebCore/platform/graphics/PlatformLayer.h: Removed mentions of clutter
+ and the texmap cairo backend.
+ * platform/graphics/clutter/DrawingBufferClutter.cpp: Removed.
+ * platform/graphics/clutter/GraphicsContext3DClutter.cpp: Removed.
+ * platform/graphics/clutter/GraphicsContext3DPrivate.cpp: Removed.
+ * platform/graphics/clutter/GraphicsContext3DPrivate.h: Removed.
+ * platform/graphics/clutter/GraphicsLayerActor.cpp: Removed.
+ * platform/graphics/clutter/GraphicsLayerActor.h: Removed.
+ * platform/graphics/clutter/GraphicsLayerClutter.cpp: Removed.
+ * platform/graphics/clutter/GraphicsLayerClutter.h: Removed.
+ * platform/graphics/clutter/PlatformClutterAnimation.cpp: Removed.
+ * platform/graphics/clutter/PlatformClutterAnimation.h: Removed.
+ * platform/graphics/clutter/PlatformClutterLayerClient.h: Removed.
+ * platform/graphics/clutter/TransformationMatrixClutter.cpp: Removed.
+ * Source/WebCore/platform/graphics/transforms/TransformationMatrix.h: Removed cogl
+ matrix type conversion.
+
2013-07-01 Alex Christensen <achristensen@apple.com>
DrawingBuffer constructor and destructor were not defined for Windows.
DerivedSources/WebCore/XLinkNames.cpp : $(WebCore)/dom/make_names.pl $(WebCore)/bindings/scripts/Hasher.pm $(WebCore)/bindings/scripts/StaticString.pm $(WebCore)/svg/xlinkattrs.in
$(AM_V_GEN)$(PERL) -I$(WebCore)/bindings/scripts $< --attrs $(WebCore)/svg/xlinkattrs.in --outputDir "$(GENSOURCES_WEBCORE)"
-if USE_TEXTURE_MAPPER_CAIRO
-webcore_cppflags += \
- -I$(srcdir)/Source/WebCore/platform/graphics/texmap
-endif # END USE_TEXTURE_MAPPER_CAIRO
-
if USE_TEXTURE_MAPPER_GL
webcore_cppflags += \
-I$(srcdir)/Source/WebCore/platform/graphics/texmap
endif # END USETEXTURE_MAPPER_GL
-if USE_CLUTTER
-webcore_cppflags += \
- -I$(srcdir)/Source/WebCore/platform/clutter \
- -I$(srcdir)/Source/WebCore/platform/graphics/clutter
-endif # END USE_CLUTTER
-
if ENABLE_INDEXED_DATABASE
webcore_cppflags += \
-DWTF_USE_LEVELDB=1 \
$(javascriptcore_cppflags) \
-fno-strict-aliasing \
$(CAIRO_CFLAGS) \
- $(CLUTTER_CFLAGS) \
$(COVERAGE_CFLAGS) \
$(ENCHANT_CFLAGS) \
$(FREETYPE_CFLAGS) \
$(javascriptcore_cppflags) \
-fno-strict-aliasing \
$(CAIRO_CFLAGS) \
- $(CLUTTER_CFLAGS) \
$(COVERAGE_CFLAGS) \
$(ENCHANT_CFLAGS) \
$(FREETYPE_CFLAGS) \
$(javascriptcore_cppflags) \
-fno-strict-aliasing \
$(CAIRO_CFLAGS) \
- $(CLUTTER_CFLAGS) \
$(COVERAGE_CFLAGS) \
$(ENCHANT_CFLAGS) \
$(FREETYPE_CFLAGS) \
Source/WebCore/platform/graphics/cairo/CairoUtilities.cpp \
Source/WebCore/platform/graphics/cairo/CairoUtilities.h \
Source/WebCore/platform/graphics/cairo/DrawErrorUnderline.h \
+ Source/WebCore/platform/graphics/cairo/DrawingBufferCairo.cpp \
Source/WebCore/platform/graphics/cairo/FloatRectCairo.cpp \
Source/WebCore/platform/graphics/cairo/FontCairo.cpp \
Source/WebCore/platform/graphics/cairo/FontCairoHarfbuzzNG.cpp \
Source/WebCore/platform/graphics/cairo/FontCustomPlatformData.h \
Source/WebCore/platform/graphics/cairo/GradientCairo.cpp \
+ Source/WebCore/platform/graphics/cairo/GraphicsContext3DCairo.cpp \
+ Source/WebCore/platform/graphics/cairo/GraphicsContext3DPrivate.cpp \
+ Source/WebCore/platform/graphics/cairo/GraphicsContext3DPrivate.h \
Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp \
Source/WebCore/platform/graphics/cairo/ImageBufferDataCairo.h \
Source/WebCore/platform/graphics/cairo/ImageCairo.cpp \
Source/WebCore/platform/graphics/gstreamer/GStreamerVersioning.h
endif
-if USE_CLUTTER
-webcore_sources += \
- Source/WebCore/platform/graphics/clutter/DrawingBufferClutter.cpp \
- Source/WebCore/platform/graphics/clutter/GraphicsContext3DClutter.cpp \
- Source/WebCore/platform/graphics/clutter/GraphicsContext3DPrivate.cpp \
- Source/WebCore/platform/graphics/clutter/GraphicsContext3DPrivate.h
-else
-webcore_sources += \
- Source/WebCore/platform/graphics/cairo/DrawingBufferCairo.cpp \
- Source/WebCore/platform/graphics/cairo/GraphicsContext3DCairo.cpp \
- Source/WebCore/platform/graphics/cairo/GraphicsContext3DPrivate.cpp \
- Source/WebCore/platform/graphics/cairo/GraphicsContext3DPrivate.h
-endif # END USE_CLUTTER
-
# ---
# Accelerated compositing support
# ---
if USE_ACCELERATED_COMPOSITING
-if USE_CLUTTER
-webcore_sources += \
- Source/WebCore/platform/graphics/clutter/GraphicsLayerActor.cpp \
- Source/WebCore/platform/graphics/clutter/GraphicsLayerActor.h \
- Source/WebCore/platform/graphics/clutter/GraphicsLayerClutter.cpp \
- Source/WebCore/platform/graphics/clutter/GraphicsLayerClutter.h \
- Source/WebCore/platform/graphics/clutter/PlatformClutterAnimation.cpp \
- Source/WebCore/platform/graphics/clutter/PlatformClutterAnimation.h \
- Source/WebCore/platform/graphics/clutter/TransformationMatrixClutter.cpp
-endif # END USE_CLUTTER
-
-if USE_TEXTURE_MAPPER_CAIRO
-webcore_sources += \
- Source/WebCore//platform/graphics/filters/texmap/CustomFilterValidatedProgramTextureMapper.cpp \
- Source/WebCore//platform/graphics/filters/texmap/TextureMapperPlatformCompiledProgram.h \
- Source/WebCore/platform/graphics/texmap/TextureMapperShaderProgram.cpp \
- Source/WebCore/platform/graphics/texmap/TextureMapperShaderProgram.h \
- Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp \
- Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h \
- Source/WebCore/platform/graphics/GraphicsLayerTransform.cpp \
- Source/WebCore/platform/graphics/GraphicsLayerTransform.h \
- Source/WebCore/platform/graphics/GraphicsLayerAnimation.cpp \
- Source/WebCore/platform/graphics/GraphicsLayerAnimation.h \
- Source/WebCore/platform/graphics/texmap/TextureMapperBackingStore.cpp \
- Source/WebCore/platform/graphics/texmap/TextureMapperBackingStore.h \
- Source/WebCore/platform/graphics/texmap/TextureMapper.cpp \
- Source/WebCore/platform/graphics/texmap/TextureMapper.h \
- Source/WebCore/platform/graphics/texmap/TextureMapperFPSCounter.cpp \
- Source/WebCore/platform/graphics/texmap/TextureMapperFPSCounter.h \
- Source/WebCore/platform/graphics/texmap/TextureMapperImageBuffer.cpp \
- Source/WebCore/platform/graphics/texmap/TextureMapperImageBuffer.h \
- Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp \
- Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h \
- Source/WebCore/platform/graphics/texmap/TextureMapperPlatformLayer.h \
- Source/WebCore/platform/graphics/texmap/TextureMapperSurfaceBackingStore.cpp \
- Source/WebCore/platform/graphics/texmap/TextureMapperSurfaceBackingStore.h \
- Source/WebCore/platform/graphics/texmap/TextureMapperTile.cpp \
- Source/WebCore/platform/graphics/texmap/TextureMapperTile.h \
- Source/WebCore/platform/graphics/texmap/TextureMapperTiledBackingStore.cpp \
- Source/WebCore/platform/graphics/texmap/TextureMapperTiledBackingStore.h
-endif # END USE_TEXTURE_MAPPER_CAIRO
-
if USE_TEXTURE_MAPPER_GL
webcore_sources += \
Source/WebCore/platform/graphics/filters/texmap/CustomFilterValidatedProgramTextureMapper.cpp \
typedef TextureMapperPlatformLayer PlatformLayer;
};
#elif PLATFORM(GTK)
-#if USE(TEXTURE_MAPPER_CAIRO) || USE(TEXTURE_MAPPER_GL)
+#if USE(TEXTURE_MAPPER_GL)
namespace WebCore {
class TextureMapperPlatformLayer;
typedef TextureMapperPlatformLayer PlatformLayer;
};
-#elif USE(CLUTTER)
-typedef struct _ClutterActor ClutterActor;
-namespace WebCore {
-typedef ClutterActor PlatformLayer;
-};
#endif
#elif PLATFORM(EFL)
#if USE(TEXTURE_MAPPER)
+++ /dev/null
-/*
- * Copyright (c) 2010, Google Inc. All rights reserved.
- * Copyright (c) 2012, Collabora Ltd.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-
-#if ENABLE(ACCELERATED_2D_CANVAS) || USE(3D_GRAPHICS)
-
-#include "DrawingBuffer.h"
-
-#include "Extensions3D.h"
-
-namespace WebCore {
-
-DrawingBuffer::DrawingBuffer(GraphicsContext3D* context,
- const IntSize& size,
- bool multisampleExtensionSupported,
- bool packedDepthStencilExtensionSupported,
- PreserveDrawingBuffer preserveDrawingBuffer,
- AlphaRequirement alpha)
- : m_preserveDrawingBuffer(preserveDrawingBuffer)
- , m_alpha(alpha)
- , m_frontColorBuffer(0)
- , m_separateFrontTexture(false)
-{
-}
-
-DrawingBuffer::~DrawingBuffer()
-{
-}
-
-#if USE(ACCELERATED_COMPOSITING)
-
-unsigned DrawingBuffer::frontColorBuffer() const
-{
- return colorBuffer();
-}
-
-void DrawingBuffer::paintCompositedResultsToCanvas(ImageBuffer*)
-{
-}
-#endif
-
-}
-
-#endif
+++ /dev/null
-/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
- * Copyright (C) 2010 Google Inc. All rights reserved.
- * Copyright (C) 2011 Igalia S.L.
- * Copyright (C) 2012 Collabora Ltd.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "GraphicsContext3D.h"
-
-#if USE(3D_GRAPHICS)
-
-#include "Extensions3DOpenGL.h"
-#include "GraphicsContext3DPrivate.h"
-#include "NotImplemented.h"
-#include <wtf/NotFound.h>
-#include <wtf/OwnPtr.h>
-#include <wtf/PassOwnPtr.h>
-
-namespace WebCore {
-
-PassRefPtr<GraphicsContext3D> GraphicsContext3D::create(GraphicsContext3D::Attributes attributes, HostWindow* hostWindow, GraphicsContext3D::RenderStyle renderStyle)
-{
- RefPtr<GraphicsContext3D> context = adoptRef(new GraphicsContext3D(attributes, hostWindow, renderStyle));
- return context.release();
-}
-
-GraphicsContext3D::GraphicsContext3D(GraphicsContext3D::Attributes attributes, HostWindow* hostWindow, GraphicsContext3D::RenderStyle renderStyle)
-{
- notImplemented();
-}
-
-GraphicsContext3D::~GraphicsContext3D()
-{
- notImplemented();
-}
-
-GraphicsContext3D::ImageExtractor::~ImageExtractor()
-{
-}
-
-bool GraphicsContext3D::ImageExtractor::extractImage(bool premultiplyAlpha, bool ignoreGammaAndColorProfile)
-{
- notImplemented();
- return false;
-}
-
-void GraphicsContext3D::paintToCanvas(const unsigned char* imagePixels, int imageWidth, int imageHeight, int canvasWidth, int canvasHeight, PlatformContextCairo* context)
-{
- notImplemented();
-}
-
-void GraphicsContext3D::setContextLostCallback(PassOwnPtr<ContextLostCallback>)
-{
-}
-
-void GraphicsContext3D::setErrorMessageCallback(PassOwnPtr<ErrorMessageCallback>)
-{
-}
-
-bool GraphicsContext3D::makeContextCurrent()
-{
- if (!m_private)
- return false;
- return m_private->makeContextCurrent();
-}
-PlatformGraphicsContext3D GraphicsContext3D::platformGraphicsContext3D()
-{
- return m_private->platformContext();
-}
-
-bool GraphicsContext3D::isGLES2Compliant() const
-{
- return false;
-}
-
-#if USE(ACCELERATED_COMPOSITING)
-PlatformLayer* GraphicsContext3D::platformLayer() const
-{
- return m_private->platformLayer();
-}
-#endif
-
-} // namespace WebCore
-
-#endif // USE(3D_GRAPHICS)
+++ /dev/null
-/*
- * Copyright (C) 2011, 2012 Igalia S.L.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301 USA
- */
-
-#include "config.h"
-#include "GraphicsContext3DPrivate.h"
-
-#if USE(3D_GRAPHICS)
-
-#include "HostWindow.h"
-#include "NotImplemented.h"
-#include "TransformationMatrix.h"
-
-namespace WebCore {
-
-PassOwnPtr<GraphicsContext3DPrivate> GraphicsContext3DPrivate::create(GraphicsContext3D* context, HostWindow* window)
-{
- return adoptPtr(new GraphicsContext3DPrivate(context, window));
-}
-
-GraphicsContext3DPrivate::GraphicsContext3DPrivate(GraphicsContext3D* context, HostWindow* window)
- : m_context(context)
- , m_window(window)
-{
-}
-
-GraphicsContext3DPrivate::~GraphicsContext3DPrivate()
-{
-}
-
-bool GraphicsContext3DPrivate::makeContextCurrent()
-{
- return false;
-}
-
-PlatformGraphicsContext3D GraphicsContext3DPrivate::platformContext()
-{
- return 0;
-}
-
-#if USE(ACCELERATED_COMPOSITING) && USE(CLUTTER)
-void GraphicsContext3DPrivate::paintToGraphicsLayerActor(ClutterActor*, const FloatRect& target, const TransformationMatrix& matrix, float opacity)
-{
-}
-#endif // USE(ACCELERATED_COMPOSITING)
-
-} // namespace WebCore
-
-#endif // USE(3D_GRAPHICS)
+++ /dev/null
-/*
- * Copyright (C) 2011 Igalia S.L.
- * Copyright (C) 2012 Collabora Ltd.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301 USA
- */
-
-#ifndef GraphicsContext3DPrivate_h
-#define GraphicsContext3DPrivate_h
-
-#include "GraphicsContext3D.h"
-#include <wtf/PassOwnPtr.h>
-
-#if USE(ACCELERATED_COMPOSITING) && USE(CLUTTER)
-#include <clutter/clutter.h>
-#endif
-
-namespace WebCore {
-
-class TransformationMatrix;
-
-class GraphicsContext3DPrivate {
-public:
- static PassOwnPtr<GraphicsContext3DPrivate> create(GraphicsContext3D*, HostWindow*);
- ~GraphicsContext3DPrivate();
- bool makeContextCurrent();
- PlatformGraphicsContext3D platformContext();
- ClutterActor* platformLayer() { return m_layer; }
-
-#if USE(ACCELERATED_COMPOSITING) && USE(CLUTTER)
- virtual void paintToGraphicsLayerActor(ClutterActor*, const FloatRect& target, const TransformationMatrix&, float opacity);
-#endif
-
-private:
- GraphicsContext3DPrivate(GraphicsContext3D*, HostWindow*);
-
- GraphicsContext3D* m_context;
- HostWindow* m_window;
- ClutterActor* m_layer;
-};
-
-}
-
-#endif // GraphicsContext3DPrivate_h
+++ /dev/null
-/*
- * Copyright 2011, 2012, 2013 Collabora Limited
- * Copyright (C) 2012 Intel Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU Lesser General Public License,
- * version 2.1, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
- * more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
- *
- */
-
-#include "config.h"
-
-#if USE(ACCELERATED_COMPOSITING)
-
-#include "GraphicsLayerActor.h"
-
-#include "GraphicsContext.h"
-#include "GraphicsLayerClutter.h"
-#include "PlatformClutterLayerClient.h"
-#include "PlatformContextCairo.h"
-#include "RefPtrCairo.h"
-#include "TransformationMatrix.h"
-#include <algorithm>
-#include <wtf/gobject/GOwnPtr.h>
-#include <wtf/text/CString.h>
-
-using namespace WebCore;
-
-G_DEFINE_TYPE(GraphicsLayerActor, graphics_layer_actor, CLUTTER_TYPE_ACTOR)
-
-#define GRAPHICS_LAYER_ACTOR_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), GRAPHICS_LAYER_TYPE_ACTOR, GraphicsLayerActorPrivate))
-
-struct _GraphicsLayerActorPrivate {
- PlatformClutterLayerClient* layerClient;
- RefPtr<cairo_surface_t> surface;
-
- GraphicsLayerClutter::LayerType layerType;
-
- bool flatten;
- bool drawsContent;
-
- float scrollX;
- float scrollY;
-
- float translateX;
- float translateY;
-};
-
-enum {
- Property0,
-
- PropertyTranslateX,
- PropertyTranslateY,
-
- PropertyLast
-};
-
-static void graphicsLayerActorAllocate(ClutterActor*, const ClutterActorBox*, ClutterAllocationFlags);
-static void graphicsLayerActorApplyTransform(ClutterActor*, CoglMatrix*);
-static void graphicsLayerActorDispose(GObject*);
-static void graphicsLayerActorGetProperty(GObject*, guint propID, GValue*, GParamSpec*);
-static void graphicsLayerActorSetProperty(GObject*, guint propID, const GValue*, GParamSpec*);
-static void graphicsLayerActorPaint(ClutterActor*);
-
-static gboolean graphicsLayerActorDraw(ClutterCanvas*, cairo_t*, gint width, gint height, GraphicsLayerActor*);
-static void graphicsLayerActorUpdateTexture(GraphicsLayerActor*);
-static void drawLayerContents(ClutterActor*, GraphicsContext&);
-
-static void graphics_layer_actor_class_init(GraphicsLayerActorClass* klass)
-{
- GObjectClass* objectClass = G_OBJECT_CLASS(klass);
- ClutterActorClass* actorClass = CLUTTER_ACTOR_CLASS(klass);
-
- objectClass->get_property = graphicsLayerActorGetProperty;
- objectClass->set_property = graphicsLayerActorSetProperty;
- objectClass->dispose = graphicsLayerActorDispose;
-
- actorClass->allocate = graphicsLayerActorAllocate;
- actorClass->apply_transform = graphicsLayerActorApplyTransform;
- actorClass->paint = graphicsLayerActorPaint;
-
- g_type_class_add_private(klass, sizeof(GraphicsLayerActorPrivate));
-
- GParamSpec* pspec = g_param_spec_float("translate-x", "Translate X", "Translation value for the X axis", -G_MAXFLOAT, G_MAXFLOAT, 0.0, static_cast<GParamFlags>(G_PARAM_READWRITE));
- g_object_class_install_property(objectClass, PropertyTranslateX, pspec);
-
- pspec = g_param_spec_float("translate-y", "Translate Y", "Translation value for the Y ayis", -G_MAXFLOAT, G_MAXFLOAT, 0.0, static_cast<GParamFlags>(G_PARAM_READWRITE));
- g_object_class_install_property(objectClass, PropertyTranslateY, pspec);
-}
-
-static void graphics_layer_actor_init(GraphicsLayerActor* self)
-{
- self->priv = GRAPHICS_LAYER_ACTOR_GET_PRIVATE(self);
-
- clutter_actor_set_reactive(CLUTTER_ACTOR(self), FALSE);
-
- self->priv->flatten = true;
-
- // Default used by GraphicsLayer.
- graphicsLayerActorSetAnchorPoint(self, 0.5, 0.5, 0.0);
-}
-
-static void graphicsLayerActorSetProperty(GObject* object, guint propID, const GValue* value, GParamSpec* pspec)
-{
- GraphicsLayerActor* layer = GRAPHICS_LAYER_ACTOR(object);
-
- switch (propID) {
- case PropertyTranslateX:
- graphicsLayerActorSetTranslateX(layer, g_value_get_float(value));
- break;
- case PropertyTranslateY:
- graphicsLayerActorSetTranslateY(layer, g_value_get_float(value));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propID, pspec);
- }
-}
-
-static void graphicsLayerActorGetProperty(GObject* object, guint propID, GValue* value, GParamSpec* pspec)
-{
- GraphicsLayerActor* layer = GRAPHICS_LAYER_ACTOR(object);
-
- switch (propID) {
- case PropertyTranslateX:
- g_value_set_float(value, graphicsLayerActorGetTranslateX(layer));
- break;
- case PropertyTranslateY:
- g_value_set_float(value, graphicsLayerActorGetTranslateY(layer));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propID, pspec);
- }
-}
-
-
-static void graphicsLayerActorDispose(GObject* object)
-{
- GraphicsLayerActor* layer = GRAPHICS_LAYER_ACTOR(object);
- GraphicsLayerActorPrivate* priv = layer->priv;
-
- priv->surface.clear();
-
- G_OBJECT_CLASS(graphics_layer_actor_parent_class)->dispose(object);
-}
-
-// Copied from cairo.
-#define MAX_IMAGE_SIZE 32767
-
-static void graphicsLayerActorAllocate(ClutterActor* self, const ClutterActorBox* box, ClutterAllocationFlags flags)
-{
- CLUTTER_ACTOR_CLASS(graphics_layer_actor_parent_class)->allocate(self, box, flags);
-
- ClutterContent* canvas = clutter_actor_get_content(self);
- if (canvas)
- clutter_canvas_set_size(CLUTTER_CANVAS(canvas), clutter_actor_get_width(self), clutter_actor_get_height(self));
-
- // FIXME: maybe we can cache children allocation and not call
- // allocate on them this often?
- GOwnPtr<GList> children(clutter_actor_get_children(self));
- for (GList* child = children.get(); child; child = child->next) {
- ClutterActor* childActor = CLUTTER_ACTOR(child->data);
-
- float childWidth = clutter_actor_get_width(childActor);
- float childHeight = clutter_actor_get_height(childActor);
-
- ClutterActorBox childBox;
- childBox.x1 = clutter_actor_get_x(childActor);
- childBox.y1 = clutter_actor_get_y(childActor);
- childBox.x2 = childBox.x1 + childWidth;
- childBox.y2 = childBox.y1 + childHeight;
-
- clutter_actor_allocate(childActor, &childBox, flags);
- }
-}
-
-static void graphicsLayerActorApplyTransform(ClutterActor* actor, CoglMatrix* matrix)
-{
- GraphicsLayerActorPrivate* priv = GRAPHICS_LAYER_ACTOR(actor)->priv;
-
- // Apply translation and scrolling as a single translation. These
- // need to come before anything else, otherwise they'll be
- // affected by other operations such as scaling, which is not what
- // we want.
- float translateX = priv->scrollX + priv->translateX;
- float translateY = priv->scrollY + priv->translateY;
-
- if (translateX || translateY)
- cogl_matrix_translate(matrix, translateX, translateY, 0);
-
- CoglMatrix modelViewTransform = TransformationMatrix();
- CLUTTER_ACTOR_CLASS(graphics_layer_actor_parent_class)->apply_transform(actor, &modelViewTransform);
-
- if (priv->flatten)
- modelViewTransform = TransformationMatrix(&modelViewTransform).to2dTransform();
- cogl_matrix_multiply(matrix, matrix, &modelViewTransform);
-}
-
-static void graphicsLayerActorPaint(ClutterActor* actor)
-{
- GOwnPtr<GList> children(clutter_actor_get_children(actor));
- for (GList* child = children.get(); child; child = child->next)
- clutter_actor_paint(CLUTTER_ACTOR(child->data));
-}
-
-static gboolean graphicsLayerActorDraw(ClutterCanvas* texture, cairo_t* cr, gint width, gint height, GraphicsLayerActor* layer)
-{
- if (!width || !height)
- return FALSE;
-
- GraphicsContext context(cr);
- context.clearRect(FloatRect(0, 0, width, height));
-
- GraphicsLayerActorPrivate* priv = layer->priv;
- if (priv->surface) {
- gint surfaceWidth = cairo_image_surface_get_width(priv->surface.get());
- gint surfaceHeight = cairo_image_surface_get_height(priv->surface.get());
-
- FloatRect srcRect(0.0, 0.0, static_cast<float>(surfaceWidth), static_cast<float>(surfaceHeight));
- FloatRect destRect(0.0, 0.0, width, height);
- context.platformContext()->drawSurfaceToContext(priv->surface.get(), destRect, srcRect, &context);
- }
-
- if (priv->layerType == GraphicsLayerClutter::LayerTypeWebLayer)
- drawLayerContents(CLUTTER_ACTOR(layer), context);
-
- return TRUE;
-}
-
-static void graphicsLayerActorUpdateTexture(GraphicsLayerActor* layer)
-{
- GraphicsLayerActorPrivate* priv = layer->priv;
- ASSERT(priv->layerType != GraphicsLayerClutter::LayerTypeVideoLayer);
-
- ClutterActor* actor = CLUTTER_ACTOR(layer);
- GRefPtr<ClutterContent> canvas = clutter_actor_get_content(actor);
- if (canvas) {
- // Nothing needs a texture, remove the one we have, if any.
- if (!priv->drawsContent && !priv->surface) {
- g_signal_handlers_disconnect_by_func(canvas.get(), reinterpret_cast<void*>(graphicsLayerActorDraw), layer);
- clutter_actor_set_content(actor, 0);
- }
- return;
- }
-
- // We should have a texture, so create one.
- canvas = adoptGRef(clutter_canvas_new());
- clutter_actor_set_content(actor, canvas.get());
-
- int width = std::max(static_cast<int>(ceilf(clutter_actor_get_width(actor))), 1);
- int height = std::max(static_cast<int>(ceilf(clutter_actor_get_height(actor))), 1);
- clutter_canvas_set_size(CLUTTER_CANVAS(canvas.get()), width, height);
-
- g_signal_connect(canvas.get(), "draw", G_CALLBACK(graphicsLayerActorDraw), layer);
-}
-
-// Draw content into the layer.
-static void drawLayerContents(ClutterActor* actor, GraphicsContext& context)
-{
- GraphicsLayerActorPrivate* priv = GRAPHICS_LAYER_ACTOR(actor)->priv;
-
- if (!priv->drawsContent || !priv->layerClient)
- return;
-
- int width = static_cast<int>(clutter_actor_get_width(actor));
- int height = static_cast<int>(clutter_actor_get_height(actor));
- IntRect clip(0, 0, width, height);
-
- // Apply the painted content to the layer.
- priv->layerClient->platformClutterLayerPaintContents(context, clip);
-}
-
-static GraphicsLayerActor* graphicsLayerActorNew(GraphicsLayerClutter::LayerType type)
-{
- GraphicsLayerActor* layer = GRAPHICS_LAYER_ACTOR(g_object_new(GRAPHICS_LAYER_TYPE_ACTOR, 0));
- GraphicsLayerActorPrivate* priv = layer->priv;
-
- priv->layerType = type;
- if (priv->layerType == GraphicsLayerClutter::LayerTypeTransformLayer)
- priv->flatten = false;
-
- return layer;
-}
-
-GraphicsLayerActor* graphicsLayerActorNewWithClient(GraphicsLayerClutter::LayerType type, PlatformClutterLayerClient* layerClient)
-{
- GraphicsLayerActor* layer = graphicsLayerActorNew(type);
- graphicsLayerActorSetClient(layer, layerClient);
-
- return layer;
-}
-
-void graphicsLayerActorSetClient(GraphicsLayerActor* layer, PlatformClutterLayerClient* client)
-{
- layer->priv->layerClient = client;
-}
-
-PlatformClutterLayerClient* graphicsLayerActorGetClient(GraphicsLayerActor* layer)
-{
- return layer->priv->layerClient;
-}
-
-void graphicsLayerActorSetSurface(GraphicsLayerActor* layer, cairo_surface_t* surface)
-{
- GraphicsLayerActorPrivate* priv = layer->priv;
- priv->surface = surface;
- graphicsLayerActorUpdateTexture(layer);
-}
-
-void graphicsLayerActorInvalidateRectangle(GraphicsLayerActor* layer, const FloatRect& dirtyRect)
-{
- ClutterContent* canvas = clutter_actor_get_content(CLUTTER_ACTOR(layer));
- if (!canvas)
- return;
-
- // FIXME: Need to invalidate a specific area?
- clutter_content_invalidate(canvas);
-}
-
-void graphicsLayerActorSetAnchorPoint(GraphicsLayerActor* layer, float x, float y, float z)
-{
- ClutterActor* actor = CLUTTER_ACTOR(layer);
- clutter_actor_set_pivot_point(actor, x, y);
- clutter_actor_set_pivot_point_z(actor, z);
-}
-
-void graphicsLayerActorSetScrollPosition(GraphicsLayerActor* layer, float x, float y)
-{
- if (x > 0 || y > 0)
- return;
-
- GraphicsLayerActorPrivate* priv = layer->priv;
- priv->scrollX = x;
- priv->scrollY = y;
-
- clutter_actor_queue_redraw(CLUTTER_ACTOR(layer));
-}
-
-void graphicsLayerActorSetSublayers(GraphicsLayerActor* layer, GraphicsLayerActorList& subLayers)
-{
- if (subLayers.isEmpty()) {
- clutter_actor_remove_all_children(CLUTTER_ACTOR(layer));
- return;
- }
-
- ClutterActor* newParentActor = CLUTTER_ACTOR(layer);
- for (size_t i = 0; i < subLayers.size(); ++i) {
- ClutterActor* childActor = CLUTTER_ACTOR(subLayers[i].get());
- ClutterActor* oldParentActor = clutter_actor_get_parent(childActor);
- if (oldParentActor) {
- if (oldParentActor == newParentActor)
- continue;
- clutter_actor_remove_child(oldParentActor, childActor);
- }
- clutter_actor_add_child(newParentActor, childActor);
- }
-}
-
-void graphicsLayerActorRemoveFromSuperLayer(GraphicsLayerActor* layer)
-{
- ClutterActor* actor = CLUTTER_ACTOR(layer);
- ClutterActor* parentActor = clutter_actor_get_parent(actor);
- if (!parentActor)
- return;
-
- clutter_actor_remove_child(parentActor, actor);
-}
-
-GraphicsLayerClutter::LayerType graphicsLayerActorGetLayerType(GraphicsLayerActor* layer)
-{
- GraphicsLayerActorPrivate* priv = layer->priv;
- return priv->layerType;
-}
-
-void graphicsLayerActorSetLayerType(GraphicsLayerActor* layer, GraphicsLayerClutter::LayerType layerType)
-{
- GraphicsLayerActorPrivate* priv = layer->priv;
- priv->layerType = layerType;
-}
-
-void graphicsLayerActorSetTranslateX(GraphicsLayerActor* layer, float value)
-{
- GraphicsLayerActorPrivate* priv = layer->priv;
- priv->translateX = value;
- clutter_actor_queue_redraw(CLUTTER_ACTOR(layer));
-}
-
-float graphicsLayerActorGetTranslateX(GraphicsLayerActor* layer)
-{
- GraphicsLayerActorPrivate* priv = layer->priv;
- return priv->translateX;
-}
-
-void graphicsLayerActorSetTranslateY(GraphicsLayerActor* layer, float value)
-{
- GraphicsLayerActorPrivate* priv = layer->priv;
- priv->translateY = value;
- clutter_actor_queue_redraw(CLUTTER_ACTOR(layer));
-}
-
-float graphicsLayerActorGetTranslateY(GraphicsLayerActor* layer)
-{
- GraphicsLayerActorPrivate* priv = layer->priv;
- return priv->translateY;
-}
-
-void graphicsLayerActorSetDrawsContent(GraphicsLayerActor* layer, bool drawsContent)
-{
- GraphicsLayerActorPrivate* priv = layer->priv;
-
- if (drawsContent == priv->drawsContent)
- return;
-
- priv->drawsContent = drawsContent;
-
- graphicsLayerActorUpdateTexture(layer);
-}
-
-void graphicsLayerActorSetFlatten(GraphicsLayerActor* layer, bool flatten)
-{
- GraphicsLayerActorPrivate* priv = layer->priv;
- if (flatten == priv->flatten)
- return;
-
- priv->flatten = flatten;
-}
-
-void graphicsLayerActorSetMasksToBounds(GraphicsLayerActor* layer, bool masksToBounds)
-{
- ClutterActor* actor = CLUTTER_ACTOR(layer);
- if (masksToBounds)
- clutter_actor_set_clip(actor, 0, 0, clutter_actor_get_width(actor), clutter_actor_get_height(actor));
- else
- clutter_actor_remove_clip(actor);
-}
-
-WebCore::PlatformClutterAnimation* graphicsLayerActorGetAnimationForKey(GraphicsLayerActor* layer, const String key)
-{
- return static_cast<WebCore::PlatformClutterAnimation*>(g_object_get_data(G_OBJECT(layer), key.utf8().data()));
-}
-
-#endif // USE(ACCELERATED_COMPOSITING)
+++ /dev/null
-/*
- * Copyright 2011, 2012 Collabora Limited
- * Copyright (C) 2012 Intel Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU Lesser General Public License,
- * version 2.1, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
- * more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
- *
- */
-
-#ifndef GraphicsLayerActor_h
-#define GraphicsLayerActor_h
-
-#if USE(ACCELERATED_COMPOSITING)
-
-#include "GraphicsLayerClutter.h"
-#include <clutter/clutter.h>
-#include <cogl/cogl.h>
-#include <glib-object.h>
-
-G_BEGIN_DECLS
-
-#define GRAPHICS_LAYER_TYPE_ACTOR graphics_layer_actor_get_type()
-
-#define GRAPHICS_LAYER_ACTOR(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj), \
- GRAPHICS_LAYER_TYPE_ACTOR, GraphicsLayerActor))
-
-#define GRAPHICS_LAYER_ACTOR_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass), \
- GRAPHICS_LAYER_TYPE_ACTOR, GraphicsLayerActorClass))
-
-#define GRAPHICS_LAYER_IS_ACTOR(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
- GRAPHICS_LAYER_TYPE_ACTOR))
-
-#define GRAPHICS_LAYER_IS_ACTOR_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass), \
- GRAPHICS_LAYER_TYPE_ACTOR))
-
-#define GRAPHICS_LAYER_ACTOR_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS((obj), \
- GRAPHICS_LAYER_TYPE_ACTOR, GraphicsLayerActorClass))
-
-typedef struct _GraphicsLayerActor GraphicsLayerActor;
-typedef struct _GraphicsLayerActorClass GraphicsLayerActorClass;
-typedef struct _GraphicsLayerActorPrivate GraphicsLayerActorPrivate;
-
-/**
- * GraphicsLayerActor:
- *
- * The contents of this structure are private and should only be accessed
- * through the public API.
- */
-struct _GraphicsLayerActor {
- ClutterRectangle parent;
- GraphicsLayerActorPrivate *priv;
-};
-
-struct _GraphicsLayerActorClass {
- ClutterRectangleClass parent_class;
-};
-
-GType graphics_layer_actor_get_type(void) G_GNUC_CONST;
-
-GraphicsLayerActor* graphicsLayerActorNewWithClient(WebCore::GraphicsLayerClutter::LayerType, WebCore::PlatformClutterLayerClient*);
-
-WebCore::GraphicsLayerClutter::LayerType graphicsLayerActorGetLayerType(GraphicsLayerActor*);
-void graphicsLayerActorSetLayerType(GraphicsLayerActor*, WebCore::GraphicsLayerClutter::LayerType);
-
-WebCore::PlatformClutterLayerClient* graphicsLayerActorGetClient(GraphicsLayerActor*);
-void graphicsLayerActorSetClient(GraphicsLayerActor*, WebCore::PlatformClutterLayerClient*);
-
-void graphicsLayerActorInvalidateRectangle(GraphicsLayerActor*, const WebCore::FloatRect&);
-void graphicsLayerActorSetScrollPosition(GraphicsLayerActor*, float, float);
-void graphicsLayerActorSetTranslateX(GraphicsLayerActor*, float);
-float graphicsLayerActorGetTranslateX(GraphicsLayerActor*);
-void graphicsLayerActorSetTranslateY(GraphicsLayerActor*, float);
-float graphicsLayerActorGetTranslateY(GraphicsLayerActor*);
-
-void graphicsLayerActorRemoveFromSuperLayer(GraphicsLayerActor*);
-
-void graphicsLayerActorSetAnchorPoint(GraphicsLayerActor*, float, float, float);
-void graphicsLayerActorSetDrawsContent(GraphicsLayerActor*, bool drawsContent);
-void graphicsLayerActorSetFlatten(GraphicsLayerActor*, bool flatten);
-void graphicsLayerActorSetMasksToBounds(GraphicsLayerActor*, bool masksToBounds);
-void graphicsLayerActorSetSublayers(GraphicsLayerActor*, WebCore::GraphicsLayerActorList&);
-void graphicsLayerActorSetSurface(GraphicsLayerActor*, cairo_surface_t*);
-
-WebCore::PlatformClutterAnimation* graphicsLayerActorGetAnimationForKey(GraphicsLayerActor*, const String);
-
-G_END_DECLS
-
-#endif // USE(ACCELERATED_COMPOSITING)
-
-#endif /* GraphicsLayerActor_h */
+++ /dev/null
-/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
- * Copyright (C) 2011, 2012, 2013 Collabora Ltd.
- * Copyright (C) 2012, 2013 Intel Corporation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-
-#if USE(ACCELERATED_COMPOSITING)
-#include "GraphicsLayerClutter.h"
-
-#include "Animation.h"
-#include "FloatConversion.h"
-#include "FloatRect.h"
-#include "GraphicsLayerActor.h"
-#include "GraphicsLayerFactory.h"
-#include "NotImplemented.h"
-#include "RefPtrCairo.h"
-#include "RotateTransformOperation.h"
-#include "ScaleTransformOperation.h"
-#include "TransformState.h"
-#include "TransformationMatrix.h"
-#include "TranslateTransformOperation.h"
-#include <limits.h>
-#include <wtf/text/CString.h>
-#include <wtf/text/WTFString.h>
-
-using namespace std;
-
-namespace WebCore {
-
-// If we send a duration of 0 to ClutterTimeline, then it will fail to set the duration.
-// So send a very small value instead.
-static const float cAnimationAlmostZeroDuration = 1e-3f;
-
-static bool isTransformTypeTransformationMatrix(TransformOperation::OperationType transformType)
-{
- switch (transformType) {
- case TransformOperation::SKEW_X:
- case TransformOperation::SKEW_Y:
- case TransformOperation::SKEW:
- case TransformOperation::MATRIX:
- case TransformOperation::ROTATE_3D:
- case TransformOperation::MATRIX_3D:
- case TransformOperation::PERSPECTIVE:
- case TransformOperation::IDENTITY:
- case TransformOperation::NONE:
- return true;
- default:
- return false;
- }
-}
-
-static bool isTransformTypeFloatPoint3D(TransformOperation::OperationType transformType)
-{
- switch (transformType) {
- case TransformOperation::SCALE:
- case TransformOperation::SCALE_3D:
- case TransformOperation::TRANSLATE:
- case TransformOperation::TRANSLATE_3D:
- return true;
- default:
- return false;
- }
-}
-
-static bool isTransformTypeNumber(TransformOperation::OperationType transformType)
-{
- return !isTransformTypeTransformationMatrix(transformType) && !isTransformTypeFloatPoint3D(transformType);
-}
-
-static void getTransformFunctionValue(const TransformOperation* transformOp, TransformOperation::OperationType transformType, const IntSize& size, float& value)
-{
- switch (transformType) {
- case TransformOperation::ROTATE:
- case TransformOperation::ROTATE_X:
- case TransformOperation::ROTATE_Y:
- value = transformOp ? narrowPrecisionToFloat(deg2rad(static_cast<const RotateTransformOperation*>(transformOp)->angle())) : 0;
- break;
- case TransformOperation::SCALE_X:
- value = transformOp ? narrowPrecisionToFloat(static_cast<const ScaleTransformOperation*>(transformOp)->x()) : 1;
- break;
- case TransformOperation::SCALE_Y:
- value = transformOp ? narrowPrecisionToFloat(static_cast<const ScaleTransformOperation*>(transformOp)->y()) : 1;
- break;
- case TransformOperation::SCALE_Z:
- value = transformOp ? narrowPrecisionToFloat(static_cast<const ScaleTransformOperation*>(transformOp)->z()) : 1;
- break;
- case TransformOperation::TRANSLATE_X:
- value = transformOp ? narrowPrecisionToFloat(static_cast<const TranslateTransformOperation*>(transformOp)->x(size)) : 0;
- break;
- case TransformOperation::TRANSLATE_Y:
- value = transformOp ? narrowPrecisionToFloat(static_cast<const TranslateTransformOperation*>(transformOp)->y(size)) : 0;
- break;
- case TransformOperation::TRANSLATE_Z:
- value = transformOp ? narrowPrecisionToFloat(static_cast<const TranslateTransformOperation*>(transformOp)->z(size)) : 0;
- break;
- default:
- break;
- }
-}
-
-static void getTransformFunctionValue(const TransformOperation* transformOp, TransformOperation::OperationType transformType, const IntSize& size, FloatPoint3D& value)
-{
- switch (transformType) {
- case TransformOperation::SCALE:
- case TransformOperation::SCALE_3D:
- value.setX(transformOp ? narrowPrecisionToFloat(static_cast<const ScaleTransformOperation*>(transformOp)->x()) : 1);
- value.setY(transformOp ? narrowPrecisionToFloat(static_cast<const ScaleTransformOperation*>(transformOp)->y()) : 1);
- value.setZ(transformOp ? narrowPrecisionToFloat(static_cast<const ScaleTransformOperation*>(transformOp)->z()) : 1);
- break;
- case TransformOperation::TRANSLATE:
- case TransformOperation::TRANSLATE_3D:
- value.setX(transformOp ? narrowPrecisionToFloat(static_cast<const TranslateTransformOperation*>(transformOp)->x(size)) : 0);
- value.setY(transformOp ? narrowPrecisionToFloat(static_cast<const TranslateTransformOperation*>(transformOp)->y(size)) : 0);
- value.setZ(transformOp ? narrowPrecisionToFloat(static_cast<const TranslateTransformOperation*>(transformOp)->z(size)) : 0);
- break;
- default:
- break;
- }
-}
-
-static void getTransformFunctionValue(const TransformOperation* transformOp, TransformOperation::OperationType transformType, const IntSize& size, TransformationMatrix& value)
-{
- switch (transformType) {
- case TransformOperation::SKEW_X:
- case TransformOperation::SKEW_Y:
- case TransformOperation::SKEW:
- case TransformOperation::MATRIX:
- case TransformOperation::ROTATE_3D:
- case TransformOperation::MATRIX_3D:
- case TransformOperation::PERSPECTIVE:
- case TransformOperation::IDENTITY:
- case TransformOperation::NONE:
- if (transformOp)
- transformOp->apply(value, size);
- else
- value.makeIdentity();
- break;
- default:
- break;
- }
-}
-
-static PlatformClutterAnimation::ValueFunctionType getValueFunctionNameForTransformOperation(TransformOperation::OperationType transformType)
-{
- // Use literal strings to avoid link-time dependency on those symbols.
- switch (transformType) {
- case TransformOperation::ROTATE_X:
- return PlatformClutterAnimation::RotateX;
- case TransformOperation::ROTATE_Y:
- return PlatformClutterAnimation::RotateY;
- case TransformOperation::ROTATE:
- return PlatformClutterAnimation::RotateZ;
- case TransformOperation::SCALE_X:
- return PlatformClutterAnimation::ScaleX;
- case TransformOperation::SCALE_Y:
- return PlatformClutterAnimation::ScaleY;
- case TransformOperation::SCALE_Z:
- return PlatformClutterAnimation::ScaleZ;
- case TransformOperation::TRANSLATE_X:
- return PlatformClutterAnimation::TranslateX;
- case TransformOperation::TRANSLATE_Y:
- return PlatformClutterAnimation::TranslateY;
- case TransformOperation::TRANSLATE_Z:
- return PlatformClutterAnimation::TranslateZ;
- case TransformOperation::SCALE:
- case TransformOperation::SCALE_3D:
- return PlatformClutterAnimation::Scale;
- case TransformOperation::TRANSLATE:
- case TransformOperation::TRANSLATE_3D:
- return PlatformClutterAnimation::Translate;
- case TransformOperation::MATRIX_3D:
- return PlatformClutterAnimation::Matrix;
- default:
- return PlatformClutterAnimation::NoValueFunction;
- }
-}
-
-static String propertyIdToString(AnimatedPropertyID property)
-{
- switch (property) {
- case AnimatedPropertyWebkitTransform:
- return "transform";
- case AnimatedPropertyOpacity:
- return "opacity";
- case AnimatedPropertyBackgroundColor:
- return "backgroundColor";
- case AnimatedPropertyWebkitFilter:
- ASSERT_NOT_REACHED();
- case AnimatedPropertyInvalid:
- ASSERT_NOT_REACHED();
- }
- ASSERT_NOT_REACHED();
- return "";
-}
-
-static String animationIdentifier(const String& animationName, AnimatedPropertyID property, int index)
-{
- return animationName + '_' + String::number(property) + '_' + String::number(index);
-}
-
-static bool animationHasStepsTimingFunction(const KeyframeValueList& valueList, const Animation* anim)
-{
- if (anim->timingFunction()->isStepsTimingFunction())
- return true;
-
- for (unsigned i = 0; i < valueList.size(); ++i) {
- const TimingFunction* timingFunction = valueList.at(i).timingFunction();
- if (timingFunction && timingFunction->isStepsTimingFunction())
- return true;
- }
-
- return false;
-}
-
-// This is the hook for WebCore compositor to know that the webKit clutter port implements
-// compositing with GraphicsLayerClutter.
-PassOwnPtr<GraphicsLayer> GraphicsLayer::create(GraphicsLayerFactory* factory, GraphicsLayerClient* client)
-{
- if (!factory)
- return adoptPtr(new GraphicsLayerClutter(client));
-
- return factory->createGraphicsLayer(client);
-}
-
-PassOwnPtr<GraphicsLayer> GraphicsLayer::create(GraphicsLayerClient* client)
-{
- return adoptPtr(new GraphicsLayerClutter(client));
-}
-
-GraphicsLayerClutter::GraphicsLayerClutter(GraphicsLayerClient* client)
- : GraphicsLayer(client)
- , m_contentsLayerPurpose(NoContentsLayer)
- , m_uncommittedChanges(0)
-{
- // ClutterRectangle will be used to show the debug border.
- m_layer = graphicsLayerActorNewWithClient(LayerTypeWebLayer, this);
-}
-
-static gboolean idleDestroy(gpointer data)
-{
- GRefPtr<ClutterActor> actor = adoptGRef(CLUTTER_ACTOR(data));
- ClutterActor* parent = clutter_actor_get_parent(actor.get());
-
- // We should remove child actors manually because the container of Clutter
- // seems to have a bug to remove its child actors when it is removed.
- if (GRAPHICS_LAYER_IS_ACTOR(GRAPHICS_LAYER_ACTOR(actor.get())))
- clutter_actor_remove_all_children(actor.get());
-
- if (parent)
- clutter_actor_remove_child(parent, actor.get());
-
- // FIXME: we should assert that the actor's ref count is 1 here, but some
- // of them are getting here with 2!
- // ASSERT((G_OBJECT(actor.get()))->ref_count == 1);
-
- return FALSE;
-}
-
-GraphicsLayerClutter::~GraphicsLayerClutter()
-{
- if (graphicsLayerActorGetLayerType(m_layer.get()) == GraphicsLayerClutter::LayerTypeRootLayer)
- return;
-
- // Even though we call notifyFlushRequired to remove existing animations in removeAnimation(),
- // removeClutterAnimationFromLayer has been never reached since the root layer is destroyed.
- // It means that we haven't lost a change to remove actual animations from clutterActor.
- // So, we call explictly updateAnimations once here to remove uncommitted animations.
- if (m_uncommittedChanges & AnimationChanged)
- updateAnimations();
-
- willBeDestroyed();
-
- // We destroy the actors on an idle so that the main loop can run enough to
- // repaint the background that will replace the actor.
- if (m_layer) {
- graphicsLayerActorSetClient(m_layer.get(), 0);
- g_idle_add(idleDestroy, m_layer.leakRef());
- }
-
- if (m_structuralLayer) {
- graphicsLayerActorSetClient(m_structuralLayer.get(), 0);
- g_idle_add(idleDestroy, m_structuralLayer.leakRef());
- }
-
- if (m_contentsLayer) {
- graphicsLayerActorSetClient(m_contentsLayer.get(), 0);
- g_idle_add(idleDestroy, m_contentsLayer.leakRef());
- }
-}
-
-void GraphicsLayerClutter::setName(const String& name)
-{
- String longName = String::format("Actor(%p) GraphicsLayer(%p) ", m_layer.get(), this) + name;
- GraphicsLayer::setName(longName);
- noteLayerPropertyChanged(NameChanged);
-}
-
-ClutterActor* GraphicsLayerClutter::platformLayer() const
-{
- return CLUTTER_ACTOR(primaryLayer());
-}
-
-void GraphicsLayerClutter::setNeedsDisplay()
-{
- FloatRect hugeRect(FloatPoint(), m_size);
- setNeedsDisplayInRect(hugeRect);
-}
-
-void GraphicsLayerClutter::setNeedsDisplayInRect(const FloatRect& r)
-{
- if (!drawsContent())
- return;
-
- FloatRect rect(r);
- FloatRect layerBounds(FloatPoint(), m_size);
- rect.intersect(layerBounds);
- if (rect.isEmpty())
- return;
-
- const size_t maxDirtyRects = 32;
-
- for (size_t i = 0; i < m_dirtyRects.size(); ++i) {
- if (m_dirtyRects[i].contains(rect))
- return;
- }
-
- if (m_dirtyRects.size() < maxDirtyRects)
- m_dirtyRects.append(rect);
- else
- m_dirtyRects[0].unite(rect);
-
- noteLayerPropertyChanged(DirtyRectsChanged);
-}
-
-void GraphicsLayerClutter::setAnchorPoint(const FloatPoint3D& point)
-{
- if (point == m_anchorPoint)
- return;
-
- GraphicsLayer::setAnchorPoint(point);
- noteLayerPropertyChanged(GeometryChanged);
-}
-
-void GraphicsLayerClutter::setOpacity(float opacity)
-{
- float clampedOpacity = max(0.0f, min(opacity, 1.0f));
- if (clampedOpacity == m_opacity)
- return;
-
- GraphicsLayer::setOpacity(clampedOpacity);
- noteLayerPropertyChanged(OpacityChanged);
-}
-
-void GraphicsLayerClutter::setPosition(const FloatPoint& point)
-{
- if (point == m_position)
- return;
-
- GraphicsLayer::setPosition(point);
- noteLayerPropertyChanged(GeometryChanged);
-}
-
-void GraphicsLayerClutter::setSize(const FloatSize& size)
-{
- if (size == m_size)
- return;
-
- GraphicsLayer::setSize(size);
- noteLayerPropertyChanged(masksToBounds() ? GeometryChanged | MasksToBoundsChanged : GeometryChanged);
-}
-void GraphicsLayerClutter::setTransform(const TransformationMatrix& t)
-{
- if (t == m_transform)
- return;
-
- GraphicsLayer::setTransform(t);
- noteLayerPropertyChanged(TransformChanged);
-}
-
-void GraphicsLayerClutter::moveOrCopyLayerAnimation(MoveOrCopy operation, const String& animationIdentifier, GraphicsLayerActor* fromLayer, GraphicsLayerActor* toLayer)
-{
- RefPtr<PlatformClutterAnimation> anim = graphicsLayerActorGetAnimationForKey(fromLayer, animationIdentifier);
- if (!anim)
- return;
-
- switch (operation) {
- case Move:
- anim->removeAnimationForKey(fromLayer, animationIdentifier);
- anim->addAnimationForKey(toLayer, animationIdentifier);
- break;
- case Copy:
- anim->addAnimationForKey(toLayer, animationIdentifier);
- break;
- }
-}
-
-void GraphicsLayerClutter::moveOrCopyAnimations(MoveOrCopy operation, GraphicsLayerActor* fromLayer, GraphicsLayerActor* toLayer)
-{
- // Look for running animations affecting this property.
- AnimationsMap::const_iterator end = m_runningAnimations.end();
- for (AnimationsMap::const_iterator it = m_runningAnimations.begin(); it != end; ++it) {
- const Vector<LayerPropertyAnimation>& propertyAnimations = it->value;
- size_t numAnimations = propertyAnimations.size();
- for (size_t i = 0; i < numAnimations; ++i) {
- const LayerPropertyAnimation& currAnimation = propertyAnimations[i];
-
- if (currAnimation.m_property == AnimatedPropertyWebkitTransform
- || currAnimation.m_property == AnimatedPropertyOpacity
- || currAnimation.m_property == AnimatedPropertyBackgroundColor)
- moveOrCopyLayerAnimation(operation, animationIdentifier(currAnimation.m_name, currAnimation.m_property, currAnimation.m_index), fromLayer, toLayer);
- }
- }
-}
-
-void GraphicsLayerClutter::setPreserves3D(bool preserves3D)
-{
- if (preserves3D == m_preserves3D)
- return;
-
- GraphicsLayer::setPreserves3D(preserves3D);
- noteLayerPropertyChanged(Preserves3DChanged);
-}
-
-void GraphicsLayerClutter::setMasksToBounds(bool masksToBounds)
-{
- if (masksToBounds == m_masksToBounds)
- return;
-
- GraphicsLayer::setMasksToBounds(masksToBounds);
- noteLayerPropertyChanged(MasksToBoundsChanged);
-}
-
-void GraphicsLayerClutter::setDrawsContent(bool drawsContent)
-{
- if (drawsContent == m_drawsContent)
- return;
-
- GraphicsLayer::setDrawsContent(drawsContent);
- noteLayerPropertyChanged(DrawsContentChanged);
-}
-
-
-void GraphicsLayerClutter::setContentsToImage(Image* image)
-{
- if (image) {
- RefPtr<cairo_surface_t> newImage = image->nativeImageForCurrentFrame();
- if (!newImage)
- return;
-
- m_pendingContentsImage = newImage;
-
- m_contentsLayerPurpose = ContentsLayerForImage;
- if (!m_contentsLayer)
- noteSublayersChanged();
- } else {
- m_pendingContentsImage = 0;
- m_contentsLayerPurpose = NoContentsLayer;
- if (m_contentsLayer)
- noteSublayersChanged();
- }
-
- noteLayerPropertyChanged(ContentsImageChanged);
-}
-
-void GraphicsLayerClutter::setContentsNeedsDisplay()
-{
- noteLayerPropertyChanged(ContentsNeedsDisplay);
-}
-
-void GraphicsLayerClutter::setContentsRect(const IntRect& rect)
-{
- if (rect == m_contentsRect)
- return;
-
- GraphicsLayer::setContentsRect(rect);
- noteLayerPropertyChanged(ContentsRectChanged);
-}
-
-void GraphicsLayerClutter::setParent(GraphicsLayer* childLayer)
-{
- notImplemented();
-
- GraphicsLayer::setParent(childLayer);
-}
-
-bool GraphicsLayerClutter::setChildren(const Vector<GraphicsLayer*>& children)
-{
- bool childrenChanged = GraphicsLayer::setChildren(children);
- if (childrenChanged)
- noteSublayersChanged();
-
- return childrenChanged;
-}
-
-void GraphicsLayerClutter::addChild(GraphicsLayer* childLayer)
-{
- GraphicsLayer::addChild(childLayer);
- noteSublayersChanged();
-}
-
-void GraphicsLayerClutter::addChildAtIndex(GraphicsLayer* childLayer, int index)
-{
- GraphicsLayer::addChildAtIndex(childLayer, index);
- noteSublayersChanged();
-}
-
-void GraphicsLayerClutter::addChildBelow(GraphicsLayer* childLayer, GraphicsLayer* sibling)
-{
- GraphicsLayer::addChildBelow(childLayer, sibling);
- noteSublayersChanged();
-}
-
-void GraphicsLayerClutter::addChildAbove(GraphicsLayer* childLayer, GraphicsLayer* sibling)
-{
- GraphicsLayer::addChildAbove(childLayer, sibling);
- noteSublayersChanged();
-}
-
-bool GraphicsLayerClutter::replaceChild(GraphicsLayer* oldChild, GraphicsLayer* newChild)
-{
- if (GraphicsLayer::replaceChild(oldChild, newChild)) {
- noteSublayersChanged();
- return true;
- }
- return false;
-}
-
-void GraphicsLayerClutter::removeFromParent()
-{
- if (m_parent)
- static_cast<GraphicsLayerClutter*>(m_parent)->noteSublayersChanged();
- GraphicsLayer::removeFromParent();
-}
-
-void GraphicsLayerClutter::platformClutterLayerPaintContents(GraphicsContext& context, const IntRect& clip)
-{
- paintGraphicsLayerContents(context, clip);
-}
-
-void GraphicsLayerClutter::platformClutterLayerAnimationStarted(double startTime)
-{
- if (m_client)
- m_client->notifyAnimationStarted(this, startTime);
-}
-
-void GraphicsLayerClutter::repaintLayerDirtyRects()
-{
- if (!m_dirtyRects.size())
- return;
-
- for (size_t i = 0; i < m_dirtyRects.size(); ++i)
- graphicsLayerActorInvalidateRectangle(m_layer.get(), m_dirtyRects[i]);
-
- m_dirtyRects.clear();
-}
-
-void GraphicsLayerClutter::updateOpacityOnLayer()
-{
- clutter_actor_set_opacity(CLUTTER_ACTOR(primaryLayer()), static_cast<guint8>(roundf(m_opacity * 255)));
-}
-
-void GraphicsLayerClutter::updateAnimations()
-{
- if (m_animationsToProcess.size()) {
- AnimationsToProcessMap::const_iterator end = m_animationsToProcess.end();
- for (AnimationsToProcessMap::const_iterator it = m_animationsToProcess.begin(); it != end; ++it) {
- const String& currAnimationName = it->key;
- AnimationsMap::iterator animationIt = m_runningAnimations.find(currAnimationName);
- if (animationIt == m_runningAnimations.end())
- continue;
-
- const AnimationProcessingAction& processingInfo = it->value;
- const Vector<LayerPropertyAnimation>& animations = animationIt->value;
- for (size_t i = 0; i < animations.size(); ++i) {
- const LayerPropertyAnimation& currAnimation = animations[i];
- switch (processingInfo.action) {
- case Remove:
- removeClutterAnimationFromLayer(currAnimation.m_property, currAnimationName, currAnimation.m_index);
- break;
- case Pause:
- pauseClutterAnimationOnLayer(currAnimation.m_property, currAnimationName, currAnimation.m_index, processingInfo.timeOffset);
- break;
- }
- }
-
- if (processingInfo.action == Remove)
- m_runningAnimations.remove(currAnimationName);
- }
-
- m_animationsToProcess.clear();
- }
-
- size_t numAnimations;
- if ((numAnimations = m_uncomittedAnimations.size())) {
- for (size_t i = 0; i < numAnimations; ++i) {
- const LayerPropertyAnimation& pendingAnimation = m_uncomittedAnimations[i];
- setAnimationOnLayer(pendingAnimation.m_animation.get(), pendingAnimation.m_property, pendingAnimation.m_name, pendingAnimation.m_index, pendingAnimation.m_timeOffset);
-
- AnimationsMap::iterator it = m_runningAnimations.find(pendingAnimation.m_name);
- if (it == m_runningAnimations.end()) {
- Vector<LayerPropertyAnimation> animations;
- animations.append(pendingAnimation);
- m_runningAnimations.add(pendingAnimation.m_name, animations);
- } else {
- Vector<LayerPropertyAnimation>& animations = it->value;
- animations.append(pendingAnimation);
- }
- }
-
- m_uncomittedAnimations.clear();
- }
-}
-
-FloatPoint GraphicsLayerClutter::computePositionRelativeToBase(float& pageScale) const
-{
- pageScale = 1;
-
- FloatPoint offset;
- for (const GraphicsLayer* currLayer = this; currLayer; currLayer = currLayer->parent()) {
- if (currLayer->appliesPageScale()) {
- if (currLayer->client())
- pageScale = currLayer->pageScaleFactor();
- return offset;
- }
-
- offset += currLayer->position();
- }
-
- return FloatPoint();
-}
-
-// called from void RenderLayerCompositor::flushPendingLayerChanges
-void GraphicsLayerClutter::flushCompositingState(const FloatRect& clipRect)
-{
- TransformState state(TransformState::UnapplyInverseTransformDirection, FloatQuad(clipRect));
- recursiveCommitChanges(CommitState(), state);
-}
-
-void GraphicsLayerClutter::recursiveCommitChanges(const CommitState& commitState, const TransformState& state, float pageScaleFactor, const FloatPoint& positionRelativeToBase, bool affectedByPageScale)
-{
- if (appliesPageScale()) {
- pageScaleFactor = this->pageScaleFactor();
- affectedByPageScale = true;
- }
-
- // Accumulate an offset from the ancestral pixel-aligned layer.
- FloatPoint baseRelativePosition = positionRelativeToBase;
- if (affectedByPageScale)
- baseRelativePosition += m_position;
-
- commitLayerChangesBeforeSublayers(pageScaleFactor, baseRelativePosition);
-
- const Vector<GraphicsLayer*>& childLayers = children();
- size_t numChildren = childLayers.size();
-
- for (size_t i = 0; i < numChildren; ++i) {
- GraphicsLayerClutter* currentChild = static_cast<GraphicsLayerClutter*>(childLayers[i]);
- currentChild->recursiveCommitChanges(commitState, state, pageScaleFactor, baseRelativePosition, affectedByPageScale);
- }
-
- commitLayerChangesAfterSublayers();
-}
-
-void GraphicsLayerClutter::flushCompositingStateForThisLayerOnly()
-{
- float pageScaleFactor;
- FloatPoint offset = computePositionRelativeToBase(pageScaleFactor);
- commitLayerChangesBeforeSublayers(pageScaleFactor, offset);
- commitLayerChangesAfterSublayers();
-}
-
-void GraphicsLayerClutter::commitLayerChangesAfterSublayers()
-{
- if (!m_uncommittedChanges)
- return;
-
- if (m_uncommittedChanges & ChildrenChanged)
- updateSublayerList();
-
- m_uncommittedChanges = NoChange;
-}
-void GraphicsLayerClutter::noteSublayersChanged()
-{
- noteLayerPropertyChanged(ChildrenChanged);
-}
-
-void GraphicsLayerClutter::noteLayerPropertyChanged(LayerChangeFlags flags)
-{
- if (!m_uncommittedChanges && m_client)
- m_client->notifyFlushRequired(this); // call RenderLayerBacking::notifyFlushRequired
-
- m_uncommittedChanges |= flags;
-}
-
-void GraphicsLayerClutter::commitLayerChangesBeforeSublayers(float pageScaleFactor, const FloatPoint& positionRelativeToBase)
-{
- if (!m_uncommittedChanges)
- return;
-
- // Need to handle Preserves3DChanged first, because it affects which layers subsequent properties are applied to
- if (m_uncommittedChanges & Preserves3DChanged)
- updateStructuralLayer();
-
- if (m_uncommittedChanges & NameChanged)
- updateLayerNames();
-
- if (m_uncommittedChanges & ContentsImageChanged) // Needs to happen before ChildrenChanged
- updateContentsImage();
-
- if (m_uncommittedChanges & ChildrenChanged)
- updateSublayerList();
-
- if (m_uncommittedChanges & GeometryChanged)
- updateGeometry(pageScaleFactor, positionRelativeToBase);
-
- if (m_uncommittedChanges & DrawsContentChanged)
- updateLayerDrawsContent(pageScaleFactor, positionRelativeToBase);
-
- if (m_uncommittedChanges & NameChanged)
- updateLayerNames();
-
- if (m_uncommittedChanges & TransformChanged)
- updateTransform();
-
- if (m_uncommittedChanges & MasksToBoundsChanged)
- updateMasksToBounds();
-
- if (m_uncommittedChanges & OpacityChanged)
- updateOpacityOnLayer();
-
- if (m_uncommittedChanges & AnimationChanged)
- updateAnimations();
-
- if (m_uncommittedChanges & DirtyRectsChanged)
- repaintLayerDirtyRects();
-
- if (m_uncommittedChanges & ContentsRectChanged)
- updateContentsRect();
-
- if (m_uncommittedChanges & ContentsNeedsDisplay)
- updateContentsNeedsDisplay();
-
- if (m_uncommittedChanges & ChildrenChanged) {
- updateSublayerList();
- // Sublayers may set this flag again, so clear it to avoid always updating sublayers in commitLayerChangesAfterSublayers().
- m_uncommittedChanges &= ~ChildrenChanged;
- }
-}
-
-void GraphicsLayerClutter::setupContentsLayer(GraphicsLayerActor* contentsLayer)
-{
- graphicsLayerActorSetMasksToBounds(contentsLayer, true);
- graphicsLayerActorSetAnchorPoint(contentsLayer, 0.0, 0.0, 0.0);
-}
-
-void GraphicsLayerClutter::updateContentsImage()
-{
- if (m_pendingContentsImage) {
- if (!m_contentsLayer) {
- m_contentsLayer = graphicsLayerActorNewWithClient(LayerTypeLayer, this);
- clutter_actor_set_name(CLUTTER_ACTOR(m_contentsLayer.get()), "Image Layer");
- setupContentsLayer(m_contentsLayer.get());
- }
-
- graphicsLayerActorSetSurface(GRAPHICS_LAYER_ACTOR(m_contentsLayer.get()), m_pendingContentsImage.get());
- m_pendingContentsImage = 0;
-
- updateContentsRect();
- } else {
- // No image.
- // m_contentsLayer will be removed via updateSublayerList.
- m_contentsLayer = 0;
- }
-}
-
-void GraphicsLayerClutter::updateContentsNeedsDisplay()
-{
- if (m_contentsLayer)
- graphicsLayerActorInvalidateRectangle(m_contentsLayer.get(), FloatRect(FloatPoint(0, 0), size()));
-}
-
-void GraphicsLayerClutter::updateContentsRect()
-{
- if (!m_contentsLayer)
- return;
-
- FloatPoint point(m_contentsRect.x(), m_contentsRect.y());
- FloatRect rect(0, 0, m_contentsRect.width(), m_contentsRect.height());
-
- clutter_actor_set_position(CLUTTER_ACTOR(m_contentsLayer.get()), point.x(), point.y());
- clutter_actor_set_size(CLUTTER_ACTOR(m_contentsLayer.get()), rect.width(), rect.height());
-}
-
-
-void GraphicsLayerClutter::updateGeometry(float pageScaleFactor, const FloatPoint& positionRelativeToBase)
-{
- // FIXME: Need to support page scaling.
- if (m_structuralLayer) {
- clutter_actor_set_position(CLUTTER_ACTOR(m_structuralLayer.get()), m_position.x(), m_position.y());
- clutter_actor_set_size(CLUTTER_ACTOR(m_structuralLayer.get()), m_size.width(), m_size.height());
- graphicsLayerActorSetAnchorPoint(m_structuralLayer.get(), m_anchorPoint.x(), m_anchorPoint.y(), m_anchorPoint.z());
- }
-
- clutter_actor_set_position(CLUTTER_ACTOR(m_layer.get()), m_position.x(), m_position.y());
- clutter_actor_set_size(CLUTTER_ACTOR(m_layer.get()), m_size.width(), m_size.height());
- graphicsLayerActorSetAnchorPoint(m_layer.get(), m_anchorPoint.x(), m_anchorPoint.y(), m_anchorPoint.z());
-}
-
-// Each GraphicsLayer has the corresponding layer in the platform port.
-// So whenever the list of child layer changes, the list of GraphicsLayerActor should be updated accordingly.
-void GraphicsLayerClutter::updateSublayerList()
-{
- GraphicsLayerActorList structuralLayerChildren;
- GraphicsLayerActorList primaryLayerChildren;
-
- GraphicsLayerActorList& childListForSublayers = m_structuralLayer ? structuralLayerChildren : primaryLayerChildren;
-
- if (m_structuralLayer)
- structuralLayerChildren.append(m_layer);
-
- if (m_contentsLayer)
- primaryLayerChildren.append(m_contentsLayer);
-
- const Vector<GraphicsLayer*>& childLayers = children();
- size_t numChildren = childLayers.size();
- for (size_t i = 0; i < numChildren; ++i) {
- GraphicsLayerClutter* currentChild = static_cast<GraphicsLayerClutter*>(childLayers[i]);
- GraphicsLayerActor* childLayer = currentChild->layerForSuperlayer();
- ASSERT(GRAPHICS_LAYER_IS_ACTOR(childLayer));
- childListForSublayers.append(childLayer);
-
- // The child layer only preserves 3D if either itself or its parent has preserves3D set.
- graphicsLayerActorSetFlatten(childLayer, !(preserves3D() || currentChild->preserves3D()));
- }
-
- if (m_structuralLayer)
- graphicsLayerActorSetSublayers(m_structuralLayer.get(), structuralLayerChildren);
-
- graphicsLayerActorSetSublayers(m_layer.get(), primaryLayerChildren);
-}
-
-void GraphicsLayerClutter::updateLayerNames()
-{
- clutter_actor_set_name(CLUTTER_ACTOR(m_layer.get()), name().utf8().data());
-}
-
-void GraphicsLayerClutter::updateTransform()
-{
- CoglMatrix matrix = m_transform;
- clutter_actor_set_transform(CLUTTER_ACTOR(primaryLayer()), &matrix);
-}
-
-void GraphicsLayerClutter::updateMasksToBounds()
-{
- graphicsLayerActorSetMasksToBounds(m_layer.get(), m_masksToBounds);
-}
-
-void GraphicsLayerClutter::updateStructuralLayer()
-{
- ensureStructuralLayer(structuralLayerPurpose());
-}
-
-void GraphicsLayerClutter::ensureStructuralLayer(StructuralLayerPurpose purpose)
-{
- const LayerChangeFlags structuralLayerChangeFlags = NameChanged
- | GeometryChanged
- | TransformChanged
- | ChildrenTransformChanged
- | ChildrenChanged
- | BackfaceVisibilityChanged
- | OpacityChanged;
-
- if (purpose == NoStructuralLayer) {
- if (m_structuralLayer) {
- // Replace the transformLayer in the parent with this layer.
- graphicsLayerActorRemoveFromSuperLayer(m_layer.get());
-
- // If m_layer doesn't have a parent, it means it's the root layer and
- // is likely hosted by something that is not expecting to be changed
- ClutterActor* parentActor = clutter_actor_get_parent(CLUTTER_ACTOR(m_structuralLayer.get()));
- ASSERT(parentActor);
- clutter_actor_replace_child(parentActor, CLUTTER_ACTOR(m_structuralLayer.get()), CLUTTER_ACTOR(m_layer.get()));
-
- moveOrCopyAnimations(Move, m_structuralLayer.get(), m_layer.get());
-
- // Release the structural layer.
- m_structuralLayer = 0;
-
- m_uncommittedChanges |= structuralLayerChangeFlags;
- }
- return;
- }
-
- bool structuralLayerChanged = false;
- if (purpose == StructuralLayerForPreserves3D) {
- if (m_structuralLayer && (graphicsLayerActorGetLayerType(m_structuralLayer.get()) != GraphicsLayerClutter::LayerTypeTransformLayer))
- m_structuralLayer = 0;
-
- if (!m_structuralLayer) {
- m_structuralLayer = graphicsLayerActorNewWithClient(GraphicsLayerClutter::LayerTypeTransformLayer, this);
- structuralLayerChanged = true;
- }
- } else {
- if (m_structuralLayer && (graphicsLayerActorGetLayerType(m_structuralLayer.get()) != GraphicsLayerClutter::LayerTypeLayer))
- m_structuralLayer = 0;
-
- if (!m_structuralLayer) {
- m_structuralLayer = graphicsLayerActorNewWithClient(GraphicsLayerClutter::LayerTypeLayer, this);
- structuralLayerChanged = true;
- }
- }
-
- if (!structuralLayerChanged)
- return;
-
- m_uncommittedChanges |= structuralLayerChangeFlags;
-
- // We've changed the layer that our parent added to its sublayer list, so tell it to update
- // sublayers again in its commitLayerChangesAfterSublayers().
- static_cast<GraphicsLayerClutter*>(parent())->noteSublayersChanged();
-
- // Set properties of m_layer to their default values, since these are expressed on on the structural layer.
- FloatPoint point(0, 0);
- FloatPoint3D anchorPoint(0.5f, 0.5f, 0);
- clutter_actor_set_position(CLUTTER_ACTOR(m_layer.get()), point.x(), point.y());
- graphicsLayerActorSetAnchorPoint(m_layer.get(), anchorPoint.x(), anchorPoint.y(), anchorPoint.z());
-
- CoglMatrix matrix = TransformationMatrix();
- clutter_actor_set_transform(CLUTTER_ACTOR(m_layer.get()), &matrix);
-
- clutter_actor_set_opacity(CLUTTER_ACTOR(m_layer.get()), 255);
-
- moveOrCopyAnimations(Move, m_layer.get(), m_structuralLayer.get());
-}
-
-GraphicsLayerClutter::StructuralLayerPurpose GraphicsLayerClutter::structuralLayerPurpose() const
-{
- if (preserves3D())
- return StructuralLayerForPreserves3D;
-
- return NoStructuralLayer;
-}
-
-void GraphicsLayerClutter::updateLayerDrawsContent(float pageScaleFactor, const FloatPoint& positionRelativeToBase)
-{
- graphicsLayerActorSetDrawsContent(m_layer.get(), m_drawsContent);
-
- if (m_drawsContent)
- setNeedsDisplay();
- else
- graphicsLayerActorSetSurface(m_layer.get(), 0);
-
- updateDebugIndicators();
-}
-
-void GraphicsLayerClutter::setupAnimation(PlatformClutterAnimation* propertyAnim, const Animation* anim, bool additive)
-{
- double duration = anim->duration();
- if (duration <= 0)
- duration = cAnimationAlmostZeroDuration;
-
- float repeatCount = anim->iterationCount();
- if (repeatCount == Animation::IterationCountInfinite)
- repeatCount = numeric_limits<float>::max();
- else if (anim->direction() == Animation::AnimationDirectionAlternate || anim->direction() == Animation::AnimationDirectionAlternateReverse)
- repeatCount /= 2;
-
- PlatformClutterAnimation::FillModeType fillMode = PlatformClutterAnimation::NoFillMode;
- switch (anim->fillMode()) {
- case AnimationFillModeNone:
- fillMode = PlatformClutterAnimation::Forwards; // Use "forwards" rather than "removed" because the style system will remove the animation when it is finished. This avoids a flash.
- break;
- case AnimationFillModeBackwards:
- fillMode = PlatformClutterAnimation::Both; // Use "both" rather than "backwards" because the style system will remove the animation when it is finished. This avoids a flash.
- break;
- case AnimationFillModeForwards:
- fillMode = PlatformClutterAnimation::Forwards;
- break;
- case AnimationFillModeBoth:
- fillMode = PlatformClutterAnimation::Both;
- break;
- }
-
- propertyAnim->setDuration(duration);
- propertyAnim->setRepeatCount(repeatCount);
- propertyAnim->setAutoreverses(anim->direction() == Animation::AnimationDirectionAlternate || anim->direction() == Animation::AnimationDirectionAlternateReverse);
- propertyAnim->setRemovedOnCompletion(false);
- propertyAnim->setAdditive(additive);
- propertyAnim->setFillMode(fillMode);
-}
-
-const TimingFunction* GraphicsLayerClutter::timingFunctionForAnimationValue(const AnimationValue& animValue, const Animation& anim)
-{
- if (animValue.timingFunction())
- return animValue.timingFunction();
- if (anim.isTimingFunctionSet())
- return anim.timingFunction().get();
-
- return CubicBezierTimingFunction::defaultTimingFunction();
-}
-
-PassRefPtr<PlatformClutterAnimation> GraphicsLayerClutter::createBasicAnimation(const Animation* anim, const String& keyPath, bool additive)
-{
- RefPtr<PlatformClutterAnimation> basicAnim = PlatformClutterAnimation::create(PlatformClutterAnimation::Basic, keyPath);
- setupAnimation(basicAnim.get(), anim, additive);
- return basicAnim;
-}
-
-PassRefPtr<PlatformClutterAnimation>GraphicsLayerClutter::createKeyframeAnimation(const Animation* anim, const String& keyPath, bool additive)
-{
- RefPtr<PlatformClutterAnimation> keyframeAnim = PlatformClutterAnimation::create(PlatformClutterAnimation::Keyframe, keyPath);
- setupAnimation(keyframeAnim.get(), anim, additive);
- return keyframeAnim;
-}
-
-bool GraphicsLayerClutter::setTransformAnimationKeyframes(const KeyframeValueList& valueList, const Animation* animation, PlatformClutterAnimation* keyframeAnim, int functionIndex, TransformOperation::OperationType transformOpType, bool isMatrixAnimation, const IntSize& boxSize)
-{
- Vector<float> keyTimes;
- Vector<float> floatValues;
- Vector<FloatPoint3D> floatPoint3DValues;
- Vector<TransformationMatrix> transformationMatrixValues;
- Vector<const TimingFunction*> timingFunctions;
-
- bool forwards = animation->directionIsForwards();
-
- for (unsigned i = 0; i < valueList.size(); ++i) {
- unsigned index = forwards ? i : (valueList.size() - i - 1);
- const TransformAnimationValue& curValue = static_cast<const TransformAnimationValue&>(valueList.at(index));
- keyTimes.append(forwards ? curValue.keyTime() : (1 - curValue.keyTime()));
-
- if (isMatrixAnimation) {
- TransformationMatrix transform;
- curValue.value().apply(boxSize, transform);
-
- // FIXME: In CoreAnimation case, if any matrix is singular, CA won't animate it correctly.
- // But I'm not sure clutter also does. Check it later, and then decide
- // whether removing following lines or not.
- if (!transform.isInvertible())
- return false;
-
- transformationMatrixValues.append(transform);
- } else {
- const TransformOperation* transformOp = curValue.value().at(functionIndex);
- if (isTransformTypeNumber(transformOpType)) {
- float value;
- getTransformFunctionValue(transformOp, transformOpType, boxSize, value);
- floatValues.append(value);
- } else if (isTransformTypeFloatPoint3D(transformOpType)) {
- FloatPoint3D value;
- getTransformFunctionValue(transformOp, transformOpType, boxSize, value);
- floatPoint3DValues.append(value);
- } else {
- TransformationMatrix value;
- getTransformFunctionValue(transformOp, transformOpType, boxSize, value);
- transformationMatrixValues.append(value);
- }
- }
-
- if (i < (valueList.size() - 1))
- timingFunctions.append(timingFunctionForAnimationValue(forwards ? curValue : valueList.at(index - 1), *animation));
- }
-
- keyframeAnim->setKeyTimes(keyTimes);
-
- if (isTransformTypeNumber(transformOpType))
- keyframeAnim->setValues(floatValues);
- else if (isTransformTypeFloatPoint3D(transformOpType))
- keyframeAnim->setValues(floatPoint3DValues);
- else
- keyframeAnim->setValues(transformationMatrixValues);
-
- keyframeAnim->setTimingFunctions(timingFunctions, !forwards);
-
- PlatformClutterAnimation::ValueFunctionType valueFunction = getValueFunctionNameForTransformOperation(transformOpType);
- if (valueFunction != PlatformClutterAnimation::NoValueFunction)
- keyframeAnim->setValueFunction(valueFunction);
-
- return true;
-}
-
-bool GraphicsLayerClutter::setTransformAnimationEndpoints(const KeyframeValueList& valueList, const Animation* animation, PlatformClutterAnimation* basicAnim, int functionIndex, TransformOperation::OperationType transformOpType, bool isMatrixAnimation, const IntSize& boxSize)
-{
- ASSERT(valueList.size() == 2);
-
- bool forwards = animation->directionIsForwards();
-
- unsigned fromIndex = !forwards;
- unsigned toIndex = forwards;
-
- const TransformAnimationValue& startValue = static_cast<const TransformAnimationValue&>(valueList.at(fromIndex));
- const TransformAnimationValue& endValue = static_cast<const TransformAnimationValue&>(valueList.at(toIndex));
-
- if (isMatrixAnimation) {
- TransformationMatrix fromTransform, toTransform;
- startValue.value().apply(boxSize, fromTransform);
- endValue.value().apply(boxSize, toTransform);
-
- // FIXME: If any matrix is singular, CA won't animate it correctly.
- // So fall back to software animation, But it's not sure in clutter case.
- // We need to investigate it more.
- if (!fromTransform.isInvertible() || !toTransform.isInvertible())
- return false;
-
- basicAnim->setFromValue(fromTransform);
- basicAnim->setToValue(toTransform);
- } else {
- if (isTransformTypeNumber(transformOpType)) {
- float fromValue;
- getTransformFunctionValue(startValue.value().at(functionIndex), transformOpType, boxSize, fromValue);
- basicAnim->setFromValue(fromValue);
-
- float toValue;
- getTransformFunctionValue(endValue.value().at(functionIndex), transformOpType, boxSize, toValue);
- basicAnim->setToValue(toValue);
- } else if (isTransformTypeFloatPoint3D(transformOpType)) {
- FloatPoint3D fromValue;
- getTransformFunctionValue(startValue.value().at(functionIndex), transformOpType, boxSize, fromValue);
- basicAnim->setFromValue(fromValue);
-
- FloatPoint3D toValue;
- getTransformFunctionValue(endValue.value().at(functionIndex), transformOpType, boxSize, toValue);
- basicAnim->setToValue(toValue);
- } else {
- TransformationMatrix fromValue;
- getTransformFunctionValue(startValue.value().at(functionIndex), transformOpType, boxSize, fromValue);
- basicAnim->setFromValue(fromValue);
-
- TransformationMatrix toValue;
- getTransformFunctionValue(endValue.value().at(functionIndex), transformOpType, boxSize, toValue);
- basicAnim->setToValue(toValue);
- }
- }
-
- // This codepath is used for 2-keyframe animations, so we still need to look in the start
- // for a timing function. Even in the reversing animation case, the first keyframe provides the timing function.
- const TimingFunction* timingFunction = timingFunctionForAnimationValue(valueList.at(0), *animation);
- basicAnim->setTimingFunction(timingFunction, !forwards);
-
- PlatformClutterAnimation::ValueFunctionType valueFunction = getValueFunctionNameForTransformOperation(transformOpType);
- if (valueFunction != PlatformClutterAnimation::NoValueFunction)
- basicAnim->setValueFunction(valueFunction);
-
- return true;
-}
-
-bool GraphicsLayerClutter::appendToUncommittedAnimations(const KeyframeValueList& valueList, const TransformOperations* operations, const Animation* animation, const String& animationName, const IntSize& boxSize, int animationIndex, double timeOffset, bool isMatrixAnimation)
-{
- TransformOperation::OperationType transformOp = isMatrixAnimation ? TransformOperation::MATRIX_3D : operations->operations().at(animationIndex)->getOperationType();
- bool additive = animationIndex > 0;
- bool isKeyframe = valueList.size() > 2;
-
- RefPtr<PlatformClutterAnimation> clutterAnimation;
- bool validMatrices = true;
- if (isKeyframe) {
- clutterAnimation = createKeyframeAnimation(animation, propertyIdToString(valueList.property()), additive);
- validMatrices = setTransformAnimationKeyframes(valueList, animation, clutterAnimation.get(), animationIndex, transformOp, isMatrixAnimation, boxSize);
- } else {
- clutterAnimation = createBasicAnimation(animation, propertyIdToString(valueList.property()), additive);
- validMatrices = setTransformAnimationEndpoints(valueList, animation, clutterAnimation.get(), animationIndex, transformOp, isMatrixAnimation, boxSize);
- }
-
- if (!validMatrices)
- return false;
-
- m_uncomittedAnimations.append(LayerPropertyAnimation(clutterAnimation, animationName, valueList.property(), animationIndex, timeOffset));
- return true;
-}
-
-bool GraphicsLayerClutter::createTransformAnimationsFromKeyframes(const KeyframeValueList& valueList, const Animation* animation, const String& animationName, double timeOffset, const IntSize& boxSize)
-{
- ASSERT(valueList.property() == AnimatedPropertyWebkitTransform);
-
- bool hasBigRotation;
- int listIndex = validateTransformOperations(valueList, hasBigRotation);
- const TransformOperations* operations = (listIndex >= 0) ? &static_cast<const TransformAnimationValue&>(valueList.at(listIndex)).value() : 0;
-
- // We need to fall back to software animation if we don't have setValueFunction:, and
- // we would need to animate each incoming transform function separately. This is the
- // case if we have a rotation >= 180 or we have more than one transform function.
- if ((hasBigRotation || (operations && operations->size() > 1)) && !PlatformClutterAnimation::supportsValueFunction())
- return false;
-
- bool validMatrices = true;
-
- // If function lists don't match we do a matrix animation, otherwise we do a component hardware animation.
- // Also, we can't do component animation unless we have valueFunction, so we need to do matrix animation
- // if that's not true as well.
- bool isMatrixAnimation = listIndex < 0 || !PlatformClutterAnimation::supportsValueFunction() || (operations->size() >= 2 && !PlatformClutterAnimation::supportsAdditiveValueFunction());
- int numAnimations = isMatrixAnimation ? 1 : operations->size();
-
- for (int animationIndex = 0; animationIndex < numAnimations; ++animationIndex) {
- if (!appendToUncommittedAnimations(valueList, operations, animation, animationName, boxSize, animationIndex, timeOffset, isMatrixAnimation)) {
- validMatrices = false;
- break;
- }
- }
-
- return validMatrices;
-}
-
-bool GraphicsLayerClutter::createAnimationFromKeyframes(const KeyframeValueList& valueList, const Animation* animation, const String& animationName, double timeOffset)
-{
- ASSERT(valueList.property() != AnimatedPropertyWebkitTransform);
-
- bool isKeyframe = valueList.size() > 2;
- bool valuesOK;
-
- bool additive = false;
- int animationIndex = 0;
-
- RefPtr<PlatformClutterAnimation> clutterAnimation;
-
- if (isKeyframe) {
- clutterAnimation = createKeyframeAnimation(animation, propertyIdToString(valueList.property()), additive);
- valuesOK = setAnimationKeyframes(valueList, animation, clutterAnimation.get());
- } else {
- clutterAnimation = createBasicAnimation(animation, propertyIdToString(valueList.property()), additive);
- valuesOK = setAnimationEndpoints(valueList, animation, clutterAnimation.get());
- }
-
- if (!valuesOK)
- return false;
-
- m_uncomittedAnimations.append(LayerPropertyAnimation(clutterAnimation, animationName, valueList.property(), animationIndex, timeOffset));
-
- return true;
-}
-
-bool GraphicsLayerClutter::addAnimation(const KeyframeValueList& valueList, const IntSize& boxSize, const Animation* anim, const String& animationName, double timeOffset)
-{
- ASSERT(!animationName.isEmpty());
-
- if (!anim || anim->isEmptyOrZeroDuration() || valueList.size() < 2)
- return false;
-
- // FIXME: ClutterTimeline seems to support steps timing function. So we need to improve here.
- // See http://developer.gnome.org/clutter/stable/ClutterTimeline.html#ClutterAnimationMode
- if (animationHasStepsTimingFunction(valueList, anim))
- return false;
-
- bool createdAnimations = false;
- if (valueList.property() == AnimatedPropertyWebkitTransform)
- createdAnimations = createTransformAnimationsFromKeyframes(valueList, anim, animationName, timeOffset, boxSize);
- else
- createdAnimations = createAnimationFromKeyframes(valueList, anim, animationName, timeOffset);
-
- if (createdAnimations)
- noteLayerPropertyChanged(AnimationChanged);
-
- return createdAnimations;
-}
-
-void GraphicsLayerClutter::removeAnimation(const String& animationName)
-{
- if (!animationIsRunning(animationName))
- return;
-
- m_animationsToProcess.add(animationName, AnimationProcessingAction(Remove));
- noteLayerPropertyChanged(AnimationChanged);
-}
-
-bool GraphicsLayerClutter::removeClutterAnimationFromLayer(AnimatedPropertyID property, const String& animationName, int index)
-{
- GraphicsLayerActor* layer = animatedLayer(property);
-
- String animationID = animationIdentifier(animationName, property, index);
-
- PlatformClutterAnimation* existingAnimation = graphicsLayerActorGetAnimationForKey(layer, animationID);
- if (!existingAnimation)
- return false;
-
- existingAnimation->removeAnimationForKey(layer, animationID);
- return true;
-}
-
-void GraphicsLayerClutter::pauseClutterAnimationOnLayer(AnimatedPropertyID property, const String& animationName, int index, double timeOffset)
-{
- notImplemented();
-}
-
-void GraphicsLayerClutter::setAnimationOnLayer(PlatformClutterAnimation* clutterAnim, AnimatedPropertyID property, const String& animationName, int index, double timeOffset)
-{
- GraphicsLayerActor* layer = animatedLayer(property);
-
- if (timeOffset)
- clutterAnim->setBeginTime(g_get_real_time() - timeOffset);
-
- String animationID = animationIdentifier(animationName, property, index);
-
- PlatformClutterAnimation* existingAnimation = graphicsLayerActorGetAnimationForKey(layer, animationID);
- if (existingAnimation)
- existingAnimation->removeAnimationForKey(layer, animationID);
-
- clutterAnim->addAnimationForKey(layer, animationID);
-}
-
-bool GraphicsLayerClutter::setAnimationEndpoints(const KeyframeValueList& valueList, const Animation* animation, PlatformClutterAnimation* basicAnim)
-{
- bool forwards = animation->directionIsForwards();
-
- unsigned fromIndex = !forwards;
- unsigned toIndex = forwards;
-
- switch (valueList.property()) {
- case AnimatedPropertyOpacity: {
- basicAnim->setFromValue(static_cast<const FloatAnimationValue&>(valueList.at(fromIndex)).value());
- basicAnim->setToValue(static_cast<const FloatAnimationValue&>(valueList.at(toIndex)).value());
- break;
- }
- default:
- ASSERT_NOT_REACHED(); // we don't animate color yet
- break;
- }
-
- // This codepath is used for 2-keyframe animations, so we still need to look in the start
- // for a timing function. Even in the reversing animation case, the first keyframe provides the timing function.
- const TimingFunction* timingFunction = timingFunctionForAnimationValue(valueList.at(0), *animation);
- if (timingFunction)
- basicAnim->setTimingFunction(timingFunction, !forwards);
-
- return true;
-}
-
-bool GraphicsLayerClutter::setAnimationKeyframes(const KeyframeValueList& valueList, const Animation* animation, PlatformClutterAnimation* keyframeAnim)
-{
- Vector<float> keyTimes;
- Vector<float> values;
- Vector<const TimingFunction*> timingFunctions;
-
- bool forwards = animation->directionIsForwards();
-
- for (unsigned i = 0; i < valueList.size(); ++i) {
- unsigned index = forwards ? i : (valueList.size() - i - 1);
- const AnimationValue& curValue = valueList.at(index);
- keyTimes.append(forwards ? curValue.keyTime() : (1 - curValue.keyTime()));
-
- switch (valueList.property()) {
- case AnimatedPropertyOpacity: {
- const FloatAnimationValue& floatValue = static_cast<const FloatAnimationValue&>(curValue);
- values.append(floatValue.value());
- break;
- }
- default:
- ASSERT_NOT_REACHED(); // we don't animate color yet
- break;
- }
-
- if (i < (valueList.size() - 1))
- timingFunctions.append(timingFunctionForAnimationValue(forwards ? curValue : valueList.at(index - 1), *animation));
- }
-
- keyframeAnim->setKeyTimes(keyTimes);
- keyframeAnim->setValues(values);
- keyframeAnim->setTimingFunctions(timingFunctions, !forwards);
-
- return true;
-}
-
-GraphicsLayerActor* GraphicsLayerClutter::layerForSuperlayer() const
-{
- return m_structuralLayer ? m_structuralLayer.get() : m_layer.get();
-}
-
-GraphicsLayerActor* GraphicsLayerClutter::animatedLayer(AnimatedPropertyID property) const
-{
- return primaryLayer();
-}
-
-} // namespace WebCore
-
-#endif // USE(ACCELERATED_COMPOSITING)
+++ /dev/null
-/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
- * Copyright (C) 2011, 2012 Collabora Ltd.
- * Copyright (C) 2012, 2013 Intel Corporation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef GraphicsLayerClutter_h
-#define GraphicsLayerClutter_h
-
-#if USE(ACCELERATED_COMPOSITING)
-
-#include "GraphicsLayer.h"
-#include "GraphicsLayerClient.h"
-#include "Image.h"
-#include "ImageSource.h"
-#include "PlatformClutterAnimation.h"
-#include "PlatformClutterLayerClient.h"
-#include <wtf/HashMap.h>
-#include <wtf/HashSet.h>
-#include <wtf/text/StringHash.h>
-
-#include <clutter/clutter.h>
-#include <wtf/gobject/GRefPtr.h>
-
-typedef struct _GraphicsLayerActor GraphicsLayerActor;
-
-namespace WebCore {
-
-class TransformState;
-
-typedef Vector<GRefPtr<GraphicsLayerActor> > GraphicsLayerActorList;
-
-class GraphicsLayerClutter : public GraphicsLayer, public PlatformClutterLayerClient {
-public:
- enum LayerType { LayerTypeLayer, LayerTypeWebLayer, LayerTypeVideoLayer, LayerTypeTransformLayer, LayerTypeRootLayer, LayerTypeCustom };
-
- GraphicsLayerClutter(GraphicsLayerClient*);
- virtual ~GraphicsLayerClutter();
-
- virtual ClutterActor* platformLayer() const;
- virtual void addChild(GraphicsLayer*);
- virtual void addChildAtIndex(GraphicsLayer*, int index);
- virtual void addChildAbove(GraphicsLayer*, GraphicsLayer* sibling);
- virtual void addChildBelow(GraphicsLayer*, GraphicsLayer* sibling);
-
- virtual void removeFromParent();
-
- virtual bool replaceChild(GraphicsLayer* oldChild, GraphicsLayer* newChild);
- virtual bool setChildren(const Vector<GraphicsLayer*>&);
- virtual void setParent(GraphicsLayer*);
-
- virtual void setDrawsContent(bool);
- virtual void setAnchorPoint(const FloatPoint3D&);
- virtual void setOpacity(float);
- virtual void setPosition(const FloatPoint&);
- virtual void setSize(const FloatSize&);
-
- virtual void setTransform(const TransformationMatrix&);
- virtual void setName(const String&);
- virtual void setNeedsDisplay();
- virtual void setNeedsDisplayInRect(const FloatRect&);
- virtual void setContentsNeedsDisplay();
-
- virtual void setContentsToImage(Image*);
- virtual void setContentsRect(const IntRect&);
-
- virtual bool hasContentsLayer() const { return m_contentsLayer; }
-
- virtual void setPreserves3D(bool);
- virtual void setMasksToBounds(bool);
-
- virtual bool addAnimation(const KeyframeValueList&, const IntSize& boxSize, const Animation*, const String& animationName, double timeOffset);
- virtual void removeAnimation(const String& animationName);
-
- virtual void flushCompositingState(const FloatRect&);
- virtual void flushCompositingStateForThisLayerOnly();
-
- struct CommitState {
- bool ancestorHasTransformAnimation;
- CommitState()
- : ancestorHasTransformAnimation(false)
- { }
- };
- void recursiveCommitChanges(const CommitState&, const TransformState&, float pageScaleFactor = 1, const FloatPoint& positionRelativeToBase = FloatPoint(), bool affectedByPageScale = false);
-
-private:
- FloatPoint computePositionRelativeToBase(float& pageScale) const;
-
- bool animationIsRunning(const String& animationName) const
- {
- return m_runningAnimations.find(animationName) != m_runningAnimations.end();
- }
-
- void commitLayerChangesBeforeSublayers(float pageScaleFactor, const FloatPoint& positionRelativeToBase);
- void commitLayerChangesAfterSublayers();
-
- void updateOpacityOnLayer();
- void setupContentsLayer(GraphicsLayerActor*);
- GraphicsLayerActor* contentsLayer() const { return m_contentsLayer.get(); }
-
- virtual void platformClutterLayerAnimationStarted(double beginTime);
- virtual void platformClutterLayerPaintContents(GraphicsContext&, const IntRect& clip);
-
- GraphicsLayerActor* primaryLayer() const { return m_structuralLayer.get() ? m_structuralLayer.get() : m_layer.get(); }
- GraphicsLayerActor* layerForSuperlayer() const;
- GraphicsLayerActor* animatedLayer(AnimatedPropertyID) const;
-
- PassRefPtr<PlatformClutterAnimation> createBasicAnimation(const Animation*, const String& keyPath, bool additive);
- PassRefPtr<PlatformClutterAnimation> createKeyframeAnimation(const Animation*, const String&, bool additive);
- void setupAnimation(PlatformClutterAnimation*, const Animation*, bool additive);
-
- const TimingFunction* timingFunctionForAnimationValue(const AnimationValue&, const Animation&);
-
- bool setAnimationEndpoints(const KeyframeValueList&, const Animation*, PlatformClutterAnimation*);
- bool setAnimationKeyframes(const KeyframeValueList&, const Animation*, PlatformClutterAnimation*);
-
- void setAnimationOnLayer(PlatformClutterAnimation*, AnimatedPropertyID, const String& animationName, int index, double timeOffset);
- bool removeClutterAnimationFromLayer(AnimatedPropertyID, const String& animationName, int index);
- void pauseClutterAnimationOnLayer(AnimatedPropertyID, const String& animationName, int index, double timeOffset);
-
- bool createAnimationFromKeyframes(const KeyframeValueList&, const Animation*, const String& animationName, double timeOffset);
- bool createTransformAnimationsFromKeyframes(const KeyframeValueList&, const Animation*, const String& animationName, double timeOffset, const IntSize& boxSize);
-
- bool setTransformAnimationEndpoints(const KeyframeValueList&, const Animation*, PlatformClutterAnimation*, int functionIndex, TransformOperation::OperationType, bool isMatrixAnimation, const IntSize& boxSize);
- bool setTransformAnimationKeyframes(const KeyframeValueList&, const Animation*, PlatformClutterAnimation*, int functionIndex, TransformOperation::OperationType, bool isMatrixAnimation, const IntSize& boxSize);
-
- enum MoveOrCopy { Move, Copy };
- static void moveOrCopyLayerAnimation(MoveOrCopy, const String& animationIdentifier, GraphicsLayerActor* fromLayer, GraphicsLayerActor* toLayer);
- void moveOrCopyAnimations(MoveOrCopy, GraphicsLayerActor* fromLayer, GraphicsLayerActor* toLayer);
-
- bool appendToUncommittedAnimations(const KeyframeValueList&, const TransformOperations*, const Animation*, const String& animationName, const IntSize& boxSize, int animationIndex, double timeOffset, bool isMatrixAnimation);
-
- enum LayerChange {
- NoChange = 0,
- NameChanged = 1 << 1,
- ChildrenChanged = 1 << 2, // also used for content layer, and preserves-3d, and size if tiling changes?
- GeometryChanged = 1 << 3,
- TransformChanged = 1 << 4,
- ChildrenTransformChanged = 1 << 5,
- Preserves3DChanged = 1 << 6,
- MasksToBoundsChanged = 1 << 7,
- DrawsContentChanged = 1 << 8, // need this?
- BackgroundColorChanged = 1 << 9,
- ContentsOpaqueChanged = 1 << 10,
- BackfaceVisibilityChanged = 1 << 11,
- OpacityChanged = 1 << 12,
- AnimationChanged = 1 << 13,
- DirtyRectsChanged = 1 << 14,
- ContentsImageChanged = 1 << 15,
- ContentsMediaLayerChanged = 1 << 16,
- ContentsCanvasLayerChanged = 1 << 17,
- ContentsColorLayerChanged = 1 << 18,
- ContentsRectChanged = 1 << 19,
- MaskLayerChanged = 1 << 20,
- ReplicatedLayerChanged = 1 << 21,
- ContentsNeedsDisplay = 1 << 22,
- AcceleratesDrawingChanged = 1 << 23,
- ContentsScaleChanged = 1 << 24,
- ContentsVisibilityChanged = 1 << 25,
- VisibleRectChanged = 1 << 26,
- FiltersChanged = 1 << 27,
- DebugIndicatorsChanged = 1 << 28
- };
-
- typedef unsigned LayerChangeFlags;
- void noteLayerPropertyChanged(LayerChangeFlags);
- void noteSublayersChanged();
-
- void updateBackfaceVisibility();
- void updateStructuralLayer();
- void updateLayerNames();
- void updateSublayerList();
- void updateGeometry(float pixelAlignmentScale, const FloatPoint& positionRelativeToBase);
- void updateTransform();
- void updateMasksToBounds();
- void updateLayerDrawsContent(float pixelAlignmentScale, const FloatPoint& positionRelativeToBase);
- void updateContentsImage();
- void updateContentsRect();
- void updateContentsNeedsDisplay();
- void updateAnimations();
-
- enum StructuralLayerPurpose {
- NoStructuralLayer = 0,
- StructuralLayerForPreserves3D,
- StructuralLayerForReplicaFlattening
- };
- void ensureStructuralLayer(StructuralLayerPurpose);
- StructuralLayerPurpose structuralLayerPurpose() const;
-
- void repaintLayerDirtyRects();
-
- GRefPtr<GraphicsLayerActor> m_layer;
- GRefPtr<GraphicsLayerActor> m_structuralLayer; // A layer used for structural reasons, like preserves-3d or replica-flattening. Is the parent of m_layer.
- GRefPtr<GraphicsLayerActor> m_contentsLayer; // A layer used for inner content, like image and video
- enum ContentsLayerPurpose {
- NoContentsLayer = 0,
- ContentsLayerForImage,
- ContentsLayerForMedia,
- ContentsLayerForCanvas,
- ContentsLayerForBackgroundColor
- };
-
- ContentsLayerPurpose m_contentsLayerPurpose;
- RefPtr<cairo_surface_t> m_pendingContentsImage;
-
- Vector<FloatRect> m_dirtyRects;
- LayerChangeFlags m_uncommittedChanges;
-
- // This represents the animation of a single property. There may be multiple transform animations for
- // a single transition or keyframe animation, so index is used to distinguish these.
- struct LayerPropertyAnimation {
- LayerPropertyAnimation(PassRefPtr<PlatformClutterAnimation> caAnimation, const String& animationName, AnimatedPropertyID property, int index, double timeOffset)
- : m_animation(caAnimation)
- , m_name(animationName)
- , m_property(property)
- , m_index(index)
- , m_timeOffset(timeOffset)
- { }
-
- RefPtr<PlatformClutterAnimation> m_animation;
- String m_name;
- AnimatedPropertyID m_property;
- int m_index;
- double m_timeOffset;
- };
-
- // Uncommitted transitions and animations.
- Vector<LayerPropertyAnimation> m_uncomittedAnimations;
-
- enum Action { Remove, Pause };
- struct AnimationProcessingAction {
- AnimationProcessingAction(Action action = Remove, double timeOffset = 0)
- : action(action)
- , timeOffset(timeOffset)
- {
- }
- Action action;
- double timeOffset; // only used for pause
- };
- typedef HashMap<String, AnimationProcessingAction> AnimationsToProcessMap;
- AnimationsToProcessMap m_animationsToProcess;
-
- // Map of animation names to their associated lists of property animations, so we can remove/pause them.
- typedef HashMap<String, Vector<LayerPropertyAnimation> > AnimationsMap;
- AnimationsMap m_runningAnimations;
-};
-
-} // namespace WebCore
-
-#endif // USE(ACCELERATED_COMPOSITING)
-
-#endif // GraphicsLayerClutter_h
+++ /dev/null
-/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
- * Copyright (C) 2013 Collabora Ltd.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-
-#if USE(ACCELERATED_COMPOSITING)
-
-#include "PlatformClutterAnimation.h"
-
-#include "FloatConversion.h"
-#include "GraphicsLayerActor.h"
-#include "Logging.h"
-#include "NotImplemented.h"
-#include "TimingFunction.h"
-#include "UnitBezier.h"
-#include <limits.h>
-#include <wtf/CurrentTime.h>
-#include <wtf/OwnArrayPtr.h>
-#include <wtf/gobject/GOwnPtr.h>
-#include <wtf/text/CString.h>
-
-using namespace std;
-
-namespace WebCore {
-
-static void timelineStartedCallback(ClutterTimeline*, PlatformClutterAnimation* animation)
-{
- animation->animationDidStart();
-}
-
-static String toClutterActorPropertyString(const PlatformClutterAnimation::ValueFunctionType valueFunctionType)
-{
- // ClutterActor doesn't have 'scale' and 'translate' properties. So we should support
- // 'scale' and 'translate' ValueFunctionType by combination of existing property animations.
- const char* clutterActorProperty[] = { "NoProperty", "rotation-angle-x", "rotation-angle-y", "rotation-angle-z", "scale-x", "scale-y", "scale-z", "scale", "translation-x", "translation-y", "translation-z", "translate", "transform" };
- return clutterActorProperty[valueFunctionType];
-}
-
-static ClutterAnimationMode toClutterAnimationMode(const TimingFunction* timingFunction)
-{
- ASSERT(timingFunction);
-
- if (timingFunction->isLinearTimingFunction())
- return CLUTTER_LINEAR;
- if (timingFunction->isCubicBezierTimingFunction()) {
- CubicBezierTimingFunction::TimingFunctionPreset timingFunctionPreset = static_cast<const CubicBezierTimingFunction*>(timingFunction)->timingFunctionPreset();
- switch (timingFunctionPreset) {
- case CubicBezierTimingFunction::Ease:
- return CLUTTER_EASE;
- case CubicBezierTimingFunction::EaseIn:
- return CLUTTER_EASE_IN;
- case CubicBezierTimingFunction::EaseOut:
- return CLUTTER_EASE_OUT;
- case CubicBezierTimingFunction::EaseInOut:
- return CLUTTER_EASE_IN_OUT;
- default:
- ASSERT_NOT_REACHED();
- }
- }
-
- return CLUTTER_EASE;
-}
-
-static gboolean clutterMatrixProgress(const GValue* fromValue, const GValue* toValue, gdouble progress, GValue* returnValue)
-{
- const CoglMatrix* fromCoglMatrix = static_cast<CoglMatrix*>(g_value_get_boxed(fromValue));
- const CoglMatrix* toCoglMatrix = static_cast<CoglMatrix*>(g_value_get_boxed(toValue));
-
- ASSERT(fromCoglMatrix && toCoglMatrix);
-
- TransformationMatrix fromMatrix(fromCoglMatrix);
- TransformationMatrix toMatrix(toCoglMatrix);
- toMatrix.blend(fromMatrix, progress);
-
- CoglMatrix resultCoglMatrix = toMatrix;
- g_value_set_boxed(returnValue, &resultCoglMatrix);
-
- return true;
-}
-
-PlatformClutterAnimation::AnimatedPropertyType PlatformClutterAnimation::stringToAnimatedPropertyType(const String& keyPath) const
-{
- if (keyPath == "transform")
- return Transform;
- if (keyPath == "opacity")
- return Opacity;
- if (keyPath == "backgroundColor")
- return BackgroundColor;
- return NoAnimatedPropertyType;
-}
-
-PassRefPtr<PlatformClutterAnimation> PlatformClutterAnimation::create(AnimationType type, const String& keyPath)
-{
- return adoptRef(new PlatformClutterAnimation(type, keyPath));
-}
-
-PassRefPtr<PlatformClutterAnimation> PlatformClutterAnimation::create(PlatformClutterAnimation* animation)
-{
- return adoptRef(new PlatformClutterAnimation(animation));
-}
-
-PlatformClutterAnimation::PlatformClutterAnimation(AnimationType type, const String& keyPath)
- : m_type(type)
- , m_animatedPropertyType(stringToAnimatedPropertyType(keyPath))
- , m_additive(false)
- , m_fromValue(0)
- , m_toValue(0)
- , m_repeatCount(0)
- , m_timingFunction(0)
- , m_valueFunctionType(NoValueFunction)
-{
- m_animation = adoptGRef(G_OBJECT(clutter_transition_group_new()));
-}
-
-PlatformClutterAnimation::PlatformClutterAnimation(const PlatformClutterAnimation* animation)
-{
- notImplemented();
-}
-
-PlatformClutterAnimation::~PlatformClutterAnimation()
-{
- m_animation.clear();
- m_layer.clear();
-}
-
-bool PlatformClutterAnimation::supportsValueFunction()
-{
- return true;
-}
-
-bool PlatformClutterAnimation::supportsAdditiveValueFunction()
-{
- // FIXME: Clutter 1.12 doesn't support additive valueFunction type animations.
- // So, we use matrix animation instead until clutter supports it.
- return false;
-}
-
-double PlatformClutterAnimation::beginTime() const
-{
- notImplemented();
- return 0;
-}
-
-void PlatformClutterAnimation::setBeginTime(double value)
-{
- notImplemented();
-}
-
-double PlatformClutterAnimation::duration() const
-{
- double duration = clutter_timeline_get_duration(CLUTTER_TIMELINE(m_animation.get()));
- return duration / 1000;
-}
-
-void PlatformClutterAnimation::setDuration(double value)
-{
- // Clutter Animation sets the duration time in milliseconds.
- gint duration = value * 1000;
- clutter_timeline_set_duration(CLUTTER_TIMELINE(m_animation.get()), duration);
-}
-
-float PlatformClutterAnimation::speed() const
-{
- notImplemented();
- return 0;
-}
-
-void PlatformClutterAnimation::setSpeed(float value)
-{
- notImplemented();
-}
-
-double PlatformClutterAnimation::timeOffset() const
-{
- notImplemented();
- return 0;
-}
-
-void PlatformClutterAnimation::setTimeOffset(double value)
-{
- notImplemented();
-}
-
-float PlatformClutterAnimation::repeatCount() const
-{
- return m_repeatCount;
-}
-
-void PlatformClutterAnimation::setRepeatCount(float value)
-{
- if (m_repeatCount == value)
- return;
-
- m_repeatCount = value;
- clutter_timeline_set_repeat_count(timeline(), static_cast<gint>(value == numeric_limits<float>::max() ? -1 : value));
-}
-
-bool PlatformClutterAnimation::autoreverses() const
-{
- notImplemented();
- return false;
-}
-
-void PlatformClutterAnimation::setAutoreverses(bool value)
-{
- notImplemented();
-}
-
-PlatformClutterAnimation::FillModeType PlatformClutterAnimation::fillMode() const
-{
- notImplemented();
- return PlatformClutterAnimation::NoFillMode;
-}
-
-void PlatformClutterAnimation::setFillMode(FillModeType value)
-{
- notImplemented();
-}
-
-void PlatformClutterAnimation::setTimingFunction(const TimingFunction* timingFunction, bool reverse)
-{
- if (!timingFunction)
- return;
-
- m_timingFunction = timingFunction;
-}
-
-void PlatformClutterAnimation::copyTimingFunctionFrom(const PlatformClutterAnimation* value)
-{
- notImplemented();
-}
-
-bool PlatformClutterAnimation::isRemovedOnCompletion() const
-{
- notImplemented();
- return false;
-}
-
-void PlatformClutterAnimation::setRemovedOnCompletion(bool value)
-{
- notImplemented();
-}
-
-bool PlatformClutterAnimation::isAdditive() const
-{
- return m_additive;
-}
-
-void PlatformClutterAnimation::setAdditive(bool value)
-{
- if (m_additive == value)
- return;
-
- m_additive = value;
-}
-
-PlatformClutterAnimation::ValueFunctionType PlatformClutterAnimation::valueFunction() const
-{
- return m_valueFunctionType;
-}
-
-void PlatformClutterAnimation::setValueFunction(ValueFunctionType value)
-{
- if (m_valueFunctionType == value)
- return;
-
- m_valueFunctionType = value;
-}
-
-void PlatformClutterAnimation::setFromValue(float value)
-{
- if (animationType() != Basic || m_fromValue == value)
- return;
-
- m_fromValue = value;
-}
-
-void PlatformClutterAnimation::setFromValue(const WebCore::TransformationMatrix& value)
-{
- if (animationType() != Basic || m_fromValueMatrix == value)
- return;
-
- m_fromValueMatrix = value;
-}
-
-void PlatformClutterAnimation::setFromValue(const FloatPoint3D& value)
-{
- if (animationType() != Basic || m_fromValue3D == value)
- return;
-
- m_fromValue3D = value;
-}
-
-void PlatformClutterAnimation::setFromValue(const WebCore::Color& value)
-{
- notImplemented();
-}
-
-void PlatformClutterAnimation::copyFromValueFrom(const PlatformClutterAnimation* value)
-{
- notImplemented();
-}
-
-void PlatformClutterAnimation::setToValue(float value)
-{
- if (animationType() != Basic || m_toValue == value)
- return;
-
- m_toValue = value;
-}
-
-void PlatformClutterAnimation::setToValue(const WebCore::TransformationMatrix& value)
-{
- if (animationType() != Basic || m_toValueMatrix == value)
- return;
-
- m_toValueMatrix = value;
-}
-
-void PlatformClutterAnimation::setToValue(const FloatPoint3D& value)
-{
- if (animationType() != Basic || m_toValue3D == value)
- return;
-
- m_toValue3D = value;
-}
-
-void PlatformClutterAnimation::setToValue(const WebCore::Color& value)
-{
- notImplemented();
-}
-
-void PlatformClutterAnimation::copyToValueFrom(const PlatformClutterAnimation* value)
-{
- notImplemented();
-}
-
-void PlatformClutterAnimation::setValues(const Vector<float>& value)
-{
- ASSERT(animationType() == Keyframe);
-
- m_values = value;
-}
-
-void PlatformClutterAnimation::setValues(const Vector<WebCore::TransformationMatrix>& value)
-{
- ASSERT(animationType() == Keyframe);
-
- m_valuesMatrix = value;
-}
-
-void PlatformClutterAnimation::setValues(const Vector<FloatPoint3D>& value)
-{
- ASSERT(animationType() == Keyframe);
-
- m_values3D = value;
-}
-
-void PlatformClutterAnimation::setValues(const Vector<WebCore::Color>& value)
-{
- notImplemented();
-}
-
-void PlatformClutterAnimation::copyValuesFrom(const PlatformClutterAnimation* value)
-{
- notImplemented();
-}
-
-void PlatformClutterAnimation::setKeyTimes(const Vector<float>& value)
-{
- ASSERT(animationType() == Keyframe);
-
- m_keyTimes = value;
-}
-
-void PlatformClutterAnimation::copyKeyTimesFrom(const PlatformClutterAnimation* value)
-{
- notImplemented();
-}
-
-void PlatformClutterAnimation::setTimingFunctions(const Vector<const TimingFunction*>& value, bool reverse)
-{
- ASSERT(animationType() == Keyframe);
-
- m_timingFunctions = value;
-}
-
-void PlatformClutterAnimation::copyTimingFunctionsFrom(const PlatformClutterAnimation* value)
-{
- notImplemented();
-}
-
-void PlatformClutterAnimation::animationDidStart()
-{
- ASSERT(CLUTTER_IS_ACTOR(m_layer.get()));
-
- PlatformClutterLayerClient* client = graphicsLayerActorGetClient(GRAPHICS_LAYER_ACTOR(m_layer.get()));
- if (!client)
- return;
-
- client->platformClutterLayerAnimationStarted(WTF::currentTime());
-}
-
-ClutterTimeline* PlatformClutterAnimation::timeline() const
-{
- ASSERT(m_animation);
- return CLUTTER_TIMELINE(m_animation.get());
-}
-
-void PlatformClutterAnimation::addClutterTransitionForProperty(const String& property, const float fromValue, const float toValue)
-{
- ASSERT(property != "NoProperty");
-
- GRefPtr<ClutterTransition> transition = adoptGRef(clutter_property_transition_new(property.utf8().data()));
- if (property == "opacity") {
- clutter_transition_set_from(transition.get(), G_TYPE_UINT, static_cast<unsigned>(fromValue));
- clutter_transition_set_to(transition.get(), G_TYPE_UINT, static_cast<unsigned>(toValue));
- } else {
- clutter_transition_set_from(transition.get(), G_TYPE_FLOAT, fromValue);
- clutter_transition_set_to(transition.get(), G_TYPE_FLOAT, toValue);
- }
-
- clutter_timeline_set_progress_mode(timeline(), toClutterAnimationMode(m_timingFunction));
-
- clutter_transition_group_add_transition(CLUTTER_TRANSITION_GROUP(m_animation.get()), transition.get());
-}
-
-void PlatformClutterAnimation::addClutterTransitionForProperty(const String& property, const WebCore::TransformationMatrix& fromValue, const WebCore::TransformationMatrix& toValue)
-{
- ASSERT(property != "NoProperty");
-
- const CoglMatrix fromCoglMatrix = fromValue;
- const CoglMatrix toCoglMatrix = toValue;
-
- GRefPtr<ClutterTransition> transition = adoptGRef(clutter_property_transition_new(property.utf8().data()));
- clutter_transition_set_from(transition.get(), CLUTTER_TYPE_MATRIX, &fromCoglMatrix);
- clutter_transition_set_to(transition.get(), CLUTTER_TYPE_MATRIX, &toCoglMatrix);
-
- clutter_timeline_set_progress_mode(timeline(), toClutterAnimationMode(m_timingFunction));
-
- clutter_transition_group_add_transition(CLUTTER_TRANSITION_GROUP(m_animation.get()), transition.get());
-
- // FIXME: The matrix interpolation api, clutter_matrix_progress of Clutter 1.12 works unexpectedly.
- // So we overwrite it and handle the interpolation of two matrices with TransformationMatrix.
- // See https://bugzilla.gnome.org/show_bug.cgi?id=694197
- clutter_interval_register_progress_func(CLUTTER_TYPE_MATRIX, clutterMatrixProgress);
-}
-
-void PlatformClutterAnimation::addClutterTransitionForProperty(const String& property, const FloatPoint3D& fromValue, const FloatPoint3D& toValue)
-{
- ASSERT(property != "NoProperty");
-
- if (property == "scale") {
- addClutterTransitionForProperty(String("scale-x"), fromValue.x(), toValue.x());
- addClutterTransitionForProperty(String("scale-y"), fromValue.y(), toValue.y());
- return;
- }
- if (property == "translate") {
- addClutterTransitionForProperty(String("translation-x"), fromValue.x(), toValue.x());
- addClutterTransitionForProperty(String("translation-y"), fromValue.x(), toValue.y());
- return;
- }
-
- ASSERT_NOT_REACHED();
-}
-
-void PlatformClutterAnimation::addClutterKeyframeTransitionForProperty(const String& property, const Vector<float>& values)
-{
- ASSERT(property != "NoProperty");
-
- GType gType = (property == "opacity" ? G_TYPE_UINT : G_TYPE_FLOAT);
-
- GRefPtr<ClutterTransition> transition = adoptGRef(clutter_keyframe_transition_new(property.utf8().data()));
- if (gType == G_TYPE_UINT) {
- clutter_transition_set_from(transition.get(), gType, static_cast<unsigned>(values.first()));
- clutter_transition_set_to(transition.get(), gType, static_cast<unsigned>(values.last()));
- } else {
- clutter_transition_set_from(transition.get(), gType, values.first());
- clutter_transition_set_to(transition.get(), gType, values.last());
- }
-
- // Ignore the first keyframe, since it's a '0' frame, meaningless.
- const unsigned nKeyframes = values.size() - 1;
- OwnArrayPtr<ClutterAnimationMode> animationModes = adoptArrayPtr(new ClutterAnimationMode[nKeyframes]);
- OwnArrayPtr<double> keyTimes = adoptArrayPtr(new double[nKeyframes]);
- GOwnPtr<GValue> keyValues(g_new0(GValue, nKeyframes));
-
- for (unsigned i = 0; i < nKeyframes; ++i) {
- keyTimes[i] = static_cast<double>(m_keyTimes[i + 1]);
- animationModes[i] = toClutterAnimationMode(m_timingFunctions[i]);
- g_value_init(&keyValues.get()[i], gType);
- if (gType == G_TYPE_UINT)
- g_value_set_uint(&keyValues.get()[i], static_cast<unsigned>(values[i + 1]));
- else
- g_value_set_float(&keyValues.get()[i], values[i + 1]);
- }
-
- clutter_keyframe_transition_set_key_frames(CLUTTER_KEYFRAME_TRANSITION(transition.get()), nKeyframes, keyTimes.get());
- clutter_keyframe_transition_set_values(CLUTTER_KEYFRAME_TRANSITION(transition.get()), nKeyframes, keyValues.get());
- clutter_keyframe_transition_set_modes(CLUTTER_KEYFRAME_TRANSITION(transition.get()), nKeyframes, animationModes.get());
-
- clutter_transition_group_add_transition(CLUTTER_TRANSITION_GROUP(m_animation.get()), transition.get());
-
- for (unsigned i = 0; i < nKeyframes; ++i)
- g_value_unset(&keyValues.get()[i]);
-}
-
-void PlatformClutterAnimation::addClutterKeyframeTransitionForProperty(const String& property, const Vector<WebCore::TransformationMatrix>& values)
-{
- ASSERT(property != "NoProperty");
-
- Vector<CoglMatrix> coglMatrices;
- for (unsigned i = 0; i < values.size(); ++i)
- coglMatrices.append(values[i]);
-
- GRefPtr<ClutterTransition> transition = adoptGRef(clutter_keyframe_transition_new(property.utf8().data()));
- clutter_transition_set_from(transition.get(), CLUTTER_TYPE_MATRIX, coglMatrices.first());
- clutter_transition_set_to(transition.get(), CLUTTER_TYPE_MATRIX, coglMatrices.last());
-
- // Ignore the first keyframe, since it's a '0' frame, meaningless.
- const unsigned nKeyframes = values.size() - 1;
- OwnArrayPtr<ClutterAnimationMode> animationModes = adoptArrayPtr(new ClutterAnimationMode[nKeyframes]);
- OwnArrayPtr<double> keyTimes = adoptArrayPtr(new double[nKeyframes]);
- GOwnPtr<GValue> keyValues(g_new0(GValue, nKeyframes));
-
- for (unsigned i = 0; i < nKeyframes; ++i) {
- keyTimes[i] = static_cast<double>(m_keyTimes[i + 1]);
- animationModes[i] = toClutterAnimationMode(m_timingFunctions[i]);
- g_value_init(&keyValues.get()[i], CLUTTER_TYPE_MATRIX);
- g_value_set_boxed(&keyValues.get()[i], &coglMatrices[i + 1]);
- }
-
- clutter_keyframe_transition_set_key_frames(CLUTTER_KEYFRAME_TRANSITION(transition.get()), nKeyframes, keyTimes.get());
- clutter_keyframe_transition_set_values(CLUTTER_KEYFRAME_TRANSITION(transition.get()), nKeyframes, keyValues.get());
- clutter_keyframe_transition_set_modes(CLUTTER_KEYFRAME_TRANSITION(transition.get()), nKeyframes, animationModes.get());
-
- clutter_transition_group_add_transition(CLUTTER_TRANSITION_GROUP(m_animation.get()), transition.get());
-
- clutter_interval_register_progress_func(CLUTTER_TYPE_MATRIX, clutterMatrixProgress);
-
- for (unsigned i = 0; i < nKeyframes; ++i)
- g_value_unset(&keyValues.get()[i]);
-}
-
-void PlatformClutterAnimation::addClutterKeyframeTransitionForProperty(const String& property, const Vector<FloatPoint3D>& values)
-{
- ASSERT(property != "NoProperty");
-
- Vector<float> valuesX, valuesY;
- for (unsigned i = 0; i < values.size(); ++i) {
- valuesX.append(values[i].x());
- valuesY.append(values[i].y());
- }
-
- if (property == "scale") {
- addClutterKeyframeTransitionForProperty(String("scale-x"), valuesX);
- addClutterKeyframeTransitionForProperty(String("scale-y"), valuesY);
- return;
- }
- if (property == "translate") {
- addClutterKeyframeTransitionForProperty(String("translation-x"), valuesX);
- addClutterKeyframeTransitionForProperty(String("translation-y"), valuesY);
- return;
- }
-
- ASSERT_NOT_REACHED();
-}
-
-void PlatformClutterAnimation::addOpacityTransition()
-{
- if (animationType() == Keyframe) {
- for (unsigned i = 0; i < m_values.size(); ++i)
- m_values[i] *= 255;
-
- addClutterKeyframeTransitionForProperty(String("opacity"), m_values);
- } else {
- m_fromValue *= 255;
- m_toValue *= 255;
-
- addClutterTransitionForProperty(String("opacity"), m_fromValue, m_toValue);
- }
-}
-
-void PlatformClutterAnimation::addTransformTransition()
-{
- const bool isKeyframe = (animationType() == Keyframe);
-
- switch (m_valueFunctionType) {
- case RotateX:
- case RotateY:
- case RotateZ:
- if (isKeyframe) {
- for (unsigned i = 0; i < m_values.size(); ++i)
- m_values[i] = rad2deg(m_values[i]);
-
- addClutterKeyframeTransitionForProperty(toClutterActorPropertyString(m_valueFunctionType), m_values);
- } else {
- m_fromValue = rad2deg(m_fromValue);
- m_toValue = rad2deg(m_toValue);
-
- addClutterTransitionForProperty(toClutterActorPropertyString(m_valueFunctionType), m_fromValue, m_toValue);
- }
- break;
- case ScaleX:
- case ScaleY:
- case ScaleZ:
- case TranslateX:
- case TranslateY:
- case TranslateZ:
- if (isKeyframe)
- addClutterKeyframeTransitionForProperty(toClutterActorPropertyString(m_valueFunctionType), m_values);
- else
- addClutterTransitionForProperty(toClutterActorPropertyString(m_valueFunctionType), m_fromValue, m_toValue);
- break;
- case Scale:
- case Translate:
- if (isKeyframe)
- addClutterKeyframeTransitionForProperty(toClutterActorPropertyString(m_valueFunctionType), m_values3D);
- else
- addClutterTransitionForProperty(toClutterActorPropertyString(m_valueFunctionType), m_fromValue3D, m_toValue3D);
- break;
- case Matrix:
- if (isKeyframe)
- addClutterKeyframeTransitionForProperty(toClutterActorPropertyString(m_valueFunctionType), m_valuesMatrix);
- else
- addClutterTransitionForProperty(toClutterActorPropertyString(m_valueFunctionType), m_fromValueMatrix, m_toValueMatrix);
- break;
- default:
- ASSERT_NOT_REACHED();
- }
-
- // FIXME: Work-around the fact that if there is a transform already set the animation fails to start.
- // https://bugzilla.gnome.org/show_bug.cgi?id=696804
- clutter_actor_set_transform(m_layer.get(), 0);
-}
-
-void PlatformClutterAnimation::addAnimationForKey(GraphicsLayerActor* platformLayer, const String& key)
-{
- ASSERT(!g_object_get_data(G_OBJECT(platformLayer), key.utf8().data()));
-
- m_layer = CLUTTER_ACTOR(platformLayer);
-
- if (m_animatedPropertyType == Opacity)
- addOpacityTransition();
- else if (m_animatedPropertyType == Transform)
- addTransformTransition();
- else if (m_animatedPropertyType == BackgroundColor)
- ASSERT_NOT_REACHED();
- else
- ASSERT_NOT_REACHED();
-
- g_signal_connect(timeline(), "started", G_CALLBACK(timelineStartedCallback), this);
- g_object_set_data(G_OBJECT(platformLayer), key.utf8().data(), this);
-
- clutter_actor_add_transition(m_layer.get(), key.utf8().data(), CLUTTER_TRANSITION(m_animation.get()));
-}
-
-void PlatformClutterAnimation::removeAnimationForKey(GraphicsLayerActor* layer, const String& key)
-{
- clutter_actor_remove_transition(CLUTTER_ACTOR(layer), key.utf8().data());
- g_object_set_data(G_OBJECT(layer), key.utf8().data(), 0);
-}
-
-} // namespace WebCore
-
-#endif // USE(ACCELERATED_COMPOSITING)
+++ /dev/null
-/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
- * Copyright (C) 2013 Collabora Ltd.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef PlatformClutterAnimation_h
-#define PlatformClutterAnimation_h
-
-#if USE(ACCELERATED_COMPOSITING)
-
-#include "Color.h"
-#include "FilterOperation.h"
-#include "FloatPoint3D.h"
-#include "TransformationMatrix.h"
-#include <glib-object.h>
-#include <glib.h>
-#include <wtf/RefCounted.h>
-#include <wtf/RetainPtr.h>
-#include <wtf/Vector.h>
-#include <wtf/gobject/GRefPtr.h>
-
-typedef struct _ClutterActor ClutterActor;
-typedef struct _ClutterTimeline ClutterTimeline;
-typedef struct _GraphicsLayerActor GraphicsLayerActor;
-
-namespace WebCore {
-
-class FloatRect;
-class PlatformClutterAnimation;
-class TimingFunction;
-
-class PlatformClutterAnimation : public RefCounted<PlatformClutterAnimation> {
-public:
- enum AnimationType { Basic, Keyframe };
- enum AnimatedPropertyType { NoAnimatedPropertyType, Transform, Opacity, BackgroundColor };
- enum FillModeType { NoFillMode, Forwards, Backwards, Both };
- enum ValueFunctionType { NoValueFunction, RotateX, RotateY, RotateZ, ScaleX, ScaleY, ScaleZ, Scale, TranslateX, TranslateY, TranslateZ, Translate, Matrix };
-
- static PassRefPtr<PlatformClutterAnimation> create(AnimationType, const String& keyPath);
- static PassRefPtr<PlatformClutterAnimation> create(PlatformClutterAnimation*);
-
- ~PlatformClutterAnimation();
-
- static bool supportsValueFunction();
- static bool supportsAdditiveValueFunction();
-
- AnimationType animationType() const { return m_type; }
-
- double beginTime() const;
- void setBeginTime(double);
-
- double duration() const;
- void setDuration(double);
-
- float speed() const;
- void setSpeed(float);
-
- double timeOffset() const;
- void setTimeOffset(double);
-
- float repeatCount() const;
- void setRepeatCount(float);
-
- bool autoreverses() const;
- void setAutoreverses(bool);
-
- FillModeType fillMode() const;
- void setFillMode(FillModeType);
-
- void setTimingFunction(const TimingFunction*, bool reverse = false);
- void copyTimingFunctionFrom(const PlatformClutterAnimation*);
-
- bool isRemovedOnCompletion() const;
- void setRemovedOnCompletion(bool);
-
- bool isAdditive() const;
- void setAdditive(bool);
-
- ValueFunctionType valueFunction() const;
- void setValueFunction(ValueFunctionType);
-
- // Basic-animation properties.
- void setFromValue(float);
- void setFromValue(const WebCore::TransformationMatrix&);
- void setFromValue(const FloatPoint3D&);
- void setFromValue(const WebCore::Color&);
- void copyFromValueFrom(const PlatformClutterAnimation*);
-
- void setToValue(float);
- void setToValue(const WebCore::TransformationMatrix&);
- void setToValue(const FloatPoint3D&);
- void setToValue(const WebCore::Color&);
- void copyToValueFrom(const PlatformClutterAnimation*);
-
- // Keyframe-animation properties.
- void setValues(const Vector<float>&);
- void setValues(const Vector<WebCore::TransformationMatrix>&);
- void setValues(const Vector<FloatPoint3D>&);
- void setValues(const Vector<WebCore::Color>&);
- void copyValuesFrom(const PlatformClutterAnimation*);
-
- void setKeyTimes(const Vector<float>&);
- void copyKeyTimesFrom(const PlatformClutterAnimation*);
-
- void setTimingFunctions(const Vector<const TimingFunction*>&, bool reverse = false);
- void copyTimingFunctionsFrom(const PlatformClutterAnimation*);
-
- void addAnimationForKey(GraphicsLayerActor*, const String&);
- void removeAnimationForKey(GraphicsLayerActor*, const String&);
-
- void animationDidStart();
-
-protected:
- PlatformClutterAnimation(AnimationType, const String& keyPath);
- PlatformClutterAnimation(const PlatformClutterAnimation*);
-
-private:
- ClutterTimeline* timeline() const;
- AnimatedPropertyType stringToAnimatedPropertyType(const String& keyPath) const;
-
- void addClutterTransitionForProperty(const String& property, const float fromValue, const float toValue);
- void addClutterTransitionForProperty(const String& property, const WebCore::TransformationMatrix&, const WebCore::TransformationMatrix&);
- void addClutterTransitionForProperty(const String& property, const FloatPoint3D& fromValue, const FloatPoint3D& toValue);
-
- void addClutterKeyframeTransitionForProperty(const String& property, const Vector<float>& values);
- void addClutterKeyframeTransitionForProperty(const String& property, const Vector<WebCore::TransformationMatrix>& values);
- void addClutterKeyframeTransitionForProperty(const String& property, const Vector<FloatPoint3D>& values);
-
- void addOpacityTransition();
- void addTransformTransition();
-
- AnimationType m_type;
- AnimatedPropertyType m_animatedPropertyType;
-
- GRefPtr<GObject> m_animation;
- GRefPtr<ClutterActor> m_layer;
-
- bool m_additive;
-
- float m_fromValue;
- float m_toValue;
-
- FloatPoint3D m_fromValue3D;
- FloatPoint3D m_toValue3D;
-
- WebCore::TransformationMatrix m_fromValueMatrix;
- WebCore::TransformationMatrix m_toValueMatrix;
-
- float m_repeatCount;
-
- const TimingFunction* m_timingFunction;
- ValueFunctionType m_valueFunctionType;
-
- Vector<float> m_keyTimes;
- Vector<const TimingFunction*> m_timingFunctions;
-
- Vector<float> m_values;
- Vector<FloatPoint3D> m_values3D;
- Vector<WebCore::TransformationMatrix> m_valuesMatrix;
-};
-
-}
-
-#endif // USE(ACCELERATED_COMPOSITING)
-
-#endif // PlatformClutterAnimation_h
+++ /dev/null
-/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
- * Copyright (C) 2011 Collabora Ltd.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef PlatformClutterLayerClient_h
-#define PlatformClutterLayerClient_h
-
-#if USE(ACCELERATED_COMPOSITING)
-
-#include "GraphicsContext.h"
-#include "GraphicsLayer.h"
-
-namespace WebCore {
-
-class PlatformClutterLayerClient {
-public:
- virtual void platformClutterLayerPaintContents(GraphicsContext&, const IntRect& inClip) = 0;
- virtual void platformClutterLayerAnimationStarted(double startTime) = 0;
-
-protected:
- virtual ~PlatformClutterLayerClient() { }
-};
-
-}
-
-#endif // USE(ACCELERATED_COMPOSITING)
-
-#endif // PlatformClutterLayerClient_h
-
+++ /dev/null
-/*
- * Copyright (C) 2011 Collabora Ltd.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301 USA
- */
-
-#include "config.h"
-#include "TransformationMatrix.h"
-
-#include <cogl/cogl.h>
-
-namespace WebCore {
-
-TransformationMatrix::operator CoglMatrix() const
-{
- CoglMatrix matrix;
-
- matrix.xx = m11();
- matrix.xy = m21();
- matrix.xz = m31();
- matrix.xw = m41();
-
- matrix.yx = m12();
- matrix.yy = m22();
- matrix.yz = m32();
- matrix.yw = m42();
-
- matrix.zx = m13();
- matrix.zy = m23();
- matrix.zz = m33();
- matrix.zw = m43();
-
- matrix.wx = m14();
- matrix.wy = m24();
- matrix.wz = m34();
- matrix.ww = m44();
-
- return matrix;
-}
-
-TransformationMatrix::TransformationMatrix(const CoglMatrix* matrix)
-{
- setMatrix(matrix->xx, matrix->yx, matrix->zx, matrix->wx,
- matrix->xy, matrix->yy, matrix->zy, matrix->wy,
- matrix->xz, matrix->yz, matrix->zz, matrix->wz,
- matrix->xw, matrix->yw, matrix->zw, matrix->ww);
-}
-
-}
#if USE(CA)
typedef struct CATransform3D CATransform3D;
#endif
-#if USE(CLUTTER)
-typedef struct _CoglMatrix CoglMatrix;
-#endif
#if USE(CG)
typedef struct CGAffineTransform CGAffineTransform;
#elif USE(CAIRO)
TransformationMatrix(const CATransform3D&);
operator CATransform3D() const;
#endif
-#if USE(CLUTTER)
- TransformationMatrix(const CoglMatrix*);
- operator CoglMatrix() const;
-#endif
#if USE(CG)
TransformationMatrix(const CGAffineTransform&);
operator CGAffineTransform() const;
+2013-07-01 Gustavo Noronha Silva <gustavo.noronha@collabora.com>
+
+ [GTK] Remove unsupported AC backends
+ https://bugs.webkit.org/show_bug.cgi?id=117362
+
+ Reviewed by Martin Robinson.
+
+ * GNUmakefile.am:
+ * WebCoreSupport/AcceleratedCompositingContext.h: removed clutter and cairo
+ additions.
+ * WebCoreSupport/AcceleratedCompositingContextCairo.cpp: Removed.
+ * WebCoreSupport/AcceleratedCompositingContextClutter.cpp: Removed.
+ * webkit/webkitglobals.cpp:
+ (webkitInit): removed clutter-gtk initialization.
+
2013-07-01 ChangSeok Oh <changseok.oh@collabora.com>
[GTK] Use PassOwnPtr for the returned value of createBackingStore
$(javascriptcore_cppflags) \
$(webkitgtk_cppflags) \
-fno-strict-aliasing \
- $(CLUTTER_CFLAGS) \
- $(CLUTTER_GTK_CFLAGS) \
$(COVERAGE_CFLAGS) \
$(ENCHANT_CFLAGS) \
$(FREETYPE_CFLAGS) \
libwebkitgtk_@WEBKITGTK_API_MAJOR_VERSION@_@WEBKITGTK_API_MINOR_VERSION@_la_LIBADD += \
libjavascriptcoregtk-@WEBKITGTK_API_MAJOR_VERSION@.@WEBKITGTK_API_MINOR_VERSION@.la \
$(CAIRO_LIBS) \
- $(CLUTTER_LIBS) \
- $(CLUTTER_GTK_LIBS) \
$(COVERAGE_LDFLAGS) \
$(ENCHANT_LIBS) \
$(FREETYPE_LIBS) \
webkitgtk_sources += \
Source/WebKit/gtk/WebCoreSupport/AcceleratedCompositingContext.h \
- Source/WebKit/gtk/WebCoreSupport/AcceleratedCompositingContextClutter.cpp \
Source/WebKit/gtk/WebCoreSupport/AcceleratedCompositingContextGL.cpp \
- Source/WebKit/gtk/WebCoreSupport/AcceleratedCompositingContextCairo.cpp \
Source/WebKit/gtk/WebCoreSupport/AssertMatchingEnums.cpp \
Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp \
Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h \
WebKitWebView* m_webView;
unsigned int m_layerFlushTimerCallbackId;
-#if USE(CLUTTER)
- GtkWidget* m_rootLayerEmbedder;
- OwnPtr<WebCore::GraphicsLayer> m_rootLayer;
- OwnPtr<WebCore::GraphicsLayer> m_nonCompositedContentLayer;
-
- static gboolean layerFlushTimerFiredCallback(AcceleratedCompositingContext*);
-#elif USE(TEXTURE_MAPPER_GL)
+#if USE(TEXTURE_MAPPER_GL)
OwnPtr<WebCore::RedirectedXCompositeWindow> m_redirectedWindow;
OwnPtr<WebCore::GraphicsLayer> m_rootLayer;
OwnPtr<WebCore::GraphicsLayer> m_nonCompositedContentLayer;
+++ /dev/null
-/*
- * Copyright (C) 2012 Igalia, S.L.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "config.h"
-#include "AcceleratedCompositingContext.h"
-
-#if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER_CAIRO)
-
-#include "CairoUtilities.h"
-#include "Chrome.h"
-#include "ChromeClientGtk.h"
-#include "Frame.h"
-#include "FrameView.h"
-#include "PlatformContextCairo.h"
-#include "TextureMapperImageBuffer.h"
-#include "TextureMapperLayer.h"
-#include "webkitwebviewprivate.h"
-#include <cairo.h>
-#include <gdk/gdk.h>
-#include <gtk/gtk.h>
-
-using namespace WebCore;
-
-namespace WebKit {
-
-AcceleratedCompositingContext::AcceleratedCompositingContext(WebKitWebView* webView)
- : m_webView(webView)
- , m_syncTimerCallbackId(0)
- , m_rootTextureMapperLayer(0)
-{
-}
-
-AcceleratedCompositingContext::~AcceleratedCompositingContext()
-{
- if (m_syncTimerCallbackId)
- g_source_remove(m_syncTimerCallbackId);
-}
-
-bool AcceleratedCompositingContext::enabled()
-{
- return m_rootTextureMapperLayer && m_textureMapper;
-}
-
-bool AcceleratedCompositingContext::renderLayersToWindow(cairo_t* cr, const IntRect& clipRect)
-{
- if (!cr || !enabled())
- return false;
-
- GraphicsContext context(cr);
- m_textureMapper->setGraphicsContext(&context);
-
- m_textureMapper->beginPainting();
- m_rootTextureMapperLayer->paint();
- m_textureMapper->endPainting();
-
- return true;
-}
-
-void AcceleratedCompositingContext::attachRootGraphicsLayer(GraphicsLayer* graphicsLayer)
-{
- if (!graphicsLayer) {
- m_rootGraphicsLayer.clear();
- m_rootTextureMapperLayer = 0;
- return;
- }
-
- m_rootGraphicsLayer = GraphicsLayer::create(this);
- m_rootTextureMapperLayer = toTextureMapperLayer(m_rootGraphicsLayer.get());
- m_rootGraphicsLayer->addChild(graphicsLayer);
- m_rootGraphicsLayer->setDrawsContent(true);
- m_rootGraphicsLayer->setMasksToBounds(false);
- m_rootGraphicsLayer->setNeedsDisplay();
- m_rootGraphicsLayer->setSize(core(m_webView)->mainFrame()->view()->frameRect().size());
-
- m_textureMapper = TextureMapperImageBuffer::create();
- m_rootTextureMapperLayer->setTextureMapper(m_textureMapper.get());
- m_rootGraphicsLayer->flushCompositingStateForThisLayerOnly();
-}
-
-void AcceleratedCompositingContext::scheduleRootLayerRepaint(const IntRect& rect)
-{
- if (!m_rootGraphicsLayer)
- return;
- if (rect.isEmpty()) {
- m_rootGraphicsLayer->setNeedsDisplay();
- return;
- }
- m_rootGraphicsLayer->setNeedsDisplayInRect(rect);
-
- gtk_widget_queue_draw_area(GTK_WIDGET(m_webView), rect.x(), rect.y(), rect.width(), rect.height());
-}
-
-void AcceleratedCompositingContext::resizeRootLayer(const IntSize& size)
-{
- if (!m_rootGraphicsLayer)
- return;
- m_rootGraphicsLayer->setSize(size);
- m_rootGraphicsLayer->flushCompositingStateForThisLayerOnly();
-}
-
-static gboolean syncLayersTimeoutCallback(AcceleratedCompositingContext* context)
-{
- context->syncLayersTimeout();
- return FALSE;
-}
-
-void AcceleratedCompositingContext::markForSync()
-{
- if (m_syncTimerCallbackId)
- return;
-
- // We use a GLib timer because otherwise GTK+ event handling during
- // dragging can starve WebCore timers, which have a lower priority.
- m_syncTimerCallbackId = g_timeout_add_full(GDK_PRIORITY_EVENTS, 0, reinterpret_cast<GSourceFunc>(syncLayersTimeoutCallback), this, 0);
-}
-
-void AcceleratedCompositingContext::syncLayersNow()
-{
- if (core(m_webView)->mainFrame()->view()->needsLayout())
- core(m_webView)->mainFrame()->view()->layout();
-
- if (m_rootGraphicsLayer)
- m_rootGraphicsLayer->flushCompositingStateForThisLayerOnly();
-
- core(m_webView)->mainFrame()->view()->flushCompositingStateIncludingSubframes();
-}
-
-void AcceleratedCompositingContext::syncLayersTimeout()
-{
- m_syncTimerCallbackId = 0;
- syncLayersNow();
- if (!m_rootGraphicsLayer)
- return;
-
- // FIXME: Invalidate just the animations rectangles.
- gtk_widget_queue_draw(GTK_WIDGET(m_webView));
-
- if (toTextureMapperLayer(m_rootGraphicsLayer.get())->descendantsOrSelfHaveRunningAnimations())
- m_syncTimerCallbackId = g_timeout_add_full(GDK_PRIORITY_EVENTS, 1000.0 / 60.0, reinterpret_cast<GSourceFunc>(syncLayersTimeoutCallback), this, 0);
-}
-
-void AcceleratedCompositingContext::notifyAnimationStarted(const GraphicsLayer*, double time)
-{
-
-}
-void AcceleratedCompositingContext::notifyFlushRequired(const GraphicsLayer*)
-{
-
-}
-
-void AcceleratedCompositingContext::paintContents(const GraphicsLayer*, GraphicsContext& context, GraphicsLayerPaintingPhase, const IntRect& rectToPaint)
-{
- cairo_t* cr = context.platformContext()->cr();
- copyRectFromCairoSurfaceToContext(m_webView->priv->backingStore->cairoSurface(), cr, IntSize(), rectToPaint);
-}
-
-} // namespace WebKit
-
-#endif // USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER_CAIRO)
+++ /dev/null
-/*
- * Copyright (C) 2011 Collabora Ltd.
- * Copyright (C) 2012 Igalia, S.L.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "config.h"
-#include "AcceleratedCompositingContext.h"
-
-#if USE(ACCELERATED_COMPOSITING) && USE(CLUTTER)
-
-#include "Frame.h"
-#include "FrameView.h"
-#include "GraphicsLayer.h"
-#include "GraphicsLayerActor.h"
-#include "NotImplemented.h"
-#include "Settings.h"
-#include "webkitwebviewprivate.h"
-#include <clutter-gtk/clutter-gtk.h>
-#include <clutter/clutter.h>
-
-using namespace WebCore;
-
-namespace WebKit {
-
-AcceleratedCompositingContext::AcceleratedCompositingContext(WebKitWebView* webView)
- : m_webView(webView)
- , m_layerFlushTimerCallbackId(0)
- , m_rootLayerEmbedder(0)
-{
-}
-
-void AcceleratedCompositingContext::initialize()
-{
- if (m_rootLayer)
- return;
-
- GtkAllocation allocation;
- gtk_widget_get_allocation(GTK_WIDGET(m_webView), &allocation);
- IntSize pageSize(allocation.width, allocation.height);
-
- m_rootLayer = GraphicsLayer::create(0, this);
- m_rootLayer->setDrawsContent(false);
- m_rootLayer->setSize(pageSize);
-
- // The non-composited contents are a child of the root layer.
- m_nonCompositedContentLayer = GraphicsLayer::create(0, this);
- m_nonCompositedContentLayer->setDrawsContent(true);
- m_nonCompositedContentLayer->setContentsOpaque(!m_webView->priv->transparent);
- m_nonCompositedContentLayer->setSize(pageSize);
- if (core(m_webView)->settings()->acceleratedDrawingEnabled())
- m_nonCompositedContentLayer->setAcceleratesDrawing(true);
-
-#ifndef NDEBUG
- m_rootLayer->setName("Root layer");
- m_nonCompositedContentLayer->setName("Non-composited content");
-#endif
-
- m_rootLayer->addChild(m_nonCompositedContentLayer.get());
- m_nonCompositedContentLayer->setNeedsDisplay();
-
- scheduleLayerFlush();
-}
-
-AcceleratedCompositingContext::~AcceleratedCompositingContext()
-{
- if (m_layerFlushTimerCallbackId)
- g_source_remove(m_layerFlushTimerCallbackId);
-}
-
-bool AcceleratedCompositingContext::enabled()
-{
- return m_rootLayer;
-}
-
-bool AcceleratedCompositingContext::renderLayersToWindow(cairo_t*, const IntRect& clipRect)
-{
- notImplemented();
- return true;
-}
-
-void AcceleratedCompositingContext::setRootCompositingLayer(GraphicsLayer* graphicsLayer)
-{
- if (!graphicsLayer) {
- gtk_container_remove(GTK_CONTAINER(m_webView), m_rootLayerEmbedder);
- m_rootLayerEmbedder = 0;
- m_rootLayer = nullptr;
- m_nonCompositedContentLayer = nullptr;
- return;
- }
-
- // Create an instance of GtkClutterEmbed to embed actors as GraphicsLayers.
- if (!m_rootLayerEmbedder) {
- m_rootLayerEmbedder = gtk_clutter_embed_new();
- gtk_container_add(GTK_CONTAINER(m_webView), m_rootLayerEmbedder);
-
- GtkAllocation allocation;
- gtk_widget_get_allocation(GTK_WIDGET(m_webView), &allocation);
- gtk_widget_size_allocate(GTK_WIDGET(m_rootLayerEmbedder), &allocation);
- gtk_widget_show(m_rootLayerEmbedder);
- }
-
- // Add the accelerated layer tree hierarchy.
- initialize();
-
- m_nonCompositedContentLayer->removeAllChildren();
- m_nonCompositedContentLayer->addChild(graphicsLayer);
-
- // Add a root GraphicsLayer to the stage.
- if (graphicsLayer) {
- ClutterColor stageColor = { 0xFF, 0xFF, 0xFF, 0xFF };
- ClutterActor* stage = gtk_clutter_embed_get_stage(GTK_CLUTTER_EMBED(m_rootLayerEmbedder));
- clutter_actor_set_background_color(stage, &stageColor);
- clutter_actor_add_child(stage, m_rootLayer->platformLayer());
- }
-
- scheduleLayerFlush();
-}
-
-void AcceleratedCompositingContext::setNonCompositedContentsNeedDisplay(const IntRect& rect)
-{
- if (!m_rootLayer)
- return;
-
- if (rect.isEmpty()) {
- m_rootLayer->setNeedsDisplay();
- return;
- }
-
- m_nonCompositedContentLayer->setNeedsDisplayInRect(rect);
- scheduleLayerFlush();
-}
-
-void AcceleratedCompositingContext::resizeRootLayer(const IntSize& newSize)
-{
- if (!m_rootLayerEmbedder)
- return;
-
- if (m_rootLayer->size() == newSize)
- return;
-
- GtkAllocation allocation;
- allocation.x = 0;
- allocation.y = 0;
- allocation.width = newSize.width();
- allocation.height = newSize.height();
- gtk_widget_size_allocate(GTK_WIDGET(m_rootLayerEmbedder), &allocation);
-
- m_rootLayer->setSize(newSize);
-
- // If the newSize exposes new areas of the non-composited content a setNeedsDisplay is needed
- // for those newly exposed areas.
- FloatSize oldSize = m_nonCompositedContentLayer->size();
- m_nonCompositedContentLayer->setSize(newSize);
-
- if (newSize.width() > oldSize.width()) {
- float height = std::min(static_cast<float>(newSize.height()), oldSize.height());
- m_nonCompositedContentLayer->setNeedsDisplayInRect(FloatRect(oldSize.width(), 0, newSize.width() - oldSize.width(), height));
- }
-
- if (newSize.height() > oldSize.height())
- m_nonCompositedContentLayer->setNeedsDisplayInRect(FloatRect(0, oldSize.height(), newSize.width(), newSize.height() - oldSize.height()));
-
- m_nonCompositedContentLayer->setNeedsDisplayInRect(IntRect(IntPoint(), newSize));
- scheduleLayerFlush();
-}
-
-void AcceleratedCompositingContext::scrollNonCompositedContents(const IntRect& scrollRect, const IntSize& scrollOffset)
-{
- m_nonCompositedContentLayer->setNeedsDisplayInRect(scrollRect);
- scheduleLayerFlush();
-}
-
-gboolean AcceleratedCompositingContext::layerFlushTimerFiredCallback(AcceleratedCompositingContext* context)
-{
- context->flushAndRenderLayers();
- return FALSE;
-}
-
-void AcceleratedCompositingContext::scheduleLayerFlush()
-{
- if (m_layerFlushTimerCallbackId)
- return;
-
- // We use a GLib timer because otherwise GTK+ event handling during
- // dragging can starve WebCore timers, which have a lower priority.
- m_layerFlushTimerCallbackId = g_timeout_add_full(GDK_PRIORITY_EVENTS, 0, reinterpret_cast<GSourceFunc>(layerFlushTimerFiredCallback), this, 0);
-}
-
-bool AcceleratedCompositingContext::flushPendingLayerChanges()
-{
- if (m_rootLayer) {
- m_rootLayer->flushCompositingStateForThisLayerOnly();
- m_nonCompositedContentLayer->flushCompositingStateForThisLayerOnly();
- }
-
- return core(m_webView)->mainFrame()->view()->flushCompositingStateIncludingSubframes();
-}
-
-void AcceleratedCompositingContext::flushAndRenderLayers()
-{
- m_layerFlushTimerCallbackId = 0;
-
- if (!enabled())
- return;
-
- Frame* frame = core(m_webView)->mainFrame();
- if (!frame || !frame->contentRenderer() || !frame->view())
- return;
- frame->view()->updateLayoutAndStyleIfNeededRecursive();
-
- if (!flushPendingLayerChanges())
- return;
-}
-
-void AcceleratedCompositingContext::notifyAnimationStarted(const WebCore::GraphicsLayer*, double time)
-{
- notImplemented();
-}
-void AcceleratedCompositingContext::notifyFlushRequired(const WebCore::GraphicsLayer*)
-{
- notImplemented();
-}
-
-void AcceleratedCompositingContext::paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext& context, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect& rectToPaint)
-{
- context.save();
- context.clip(rectToPaint);
- core(m_webView)->mainFrame()->view()->paint(&context, rectToPaint);
- context.restore();
-}
-
-} // namespace WebKit
-
-#endif // USE(ACCELERATED_COMPOSITING) && USE(CLUTTER)
#include <wtf/gobject/GOwnPtr.h>
#include <wtf/gobject/GRefPtr.h>
-#if USE(CLUTTER)
-#include <clutter-gtk/clutter-gtk.h>
-#endif
-
static WebKitCacheModel cacheModel = WEBKIT_CACHE_MODEL_DEFAULT;
using namespace WebCore;
WebCore::ResourceHandle::setIgnoreSSLErrors(true);
-#if USE(CLUTTER)
- gtk_clutter_init(0, 0);
-#endif
-
atexit(webkitExit);
}
AC_CHECK_HEADERS([GL/gl.h], [found_opengl="yes"], [])
fi
-if test "$with_acceleration_backend" = "auto"; then
- if test "$found_opengl" = "yes"; then
- with_acceleration_backend="opengl";
- else
- with_acceleration_backend="none";
- fi
-fi
-
-if test "$with_acceleration_backend" = "opengl"; then
+if test "$found_opengl" = "yes"; then
PKG_CHECK_MODULES([XCOMPOSITE], [xcomposite]);
PKG_CHECK_MODULES([XDAMAGE], [xdamage]);
AC_SUBST(XCOMPOSITE_CFLAGS)
AC_SUBST(XDAMAGE_LIBS)
fi
-# OpenGL is turned on by default (along with WebGL and accelerated compositing), but if Clutter is chosen
-# as the accelerated drawing backend, we want to disable it. COGL does not play well with OpenGL.
+# OpenGL is turned on by default if available (along with WebGL and accelerated compositing).
if test "$enable_webgl" = "auto"; then
- if test "$with_acceleration_backend" = "opengl"; then
+ if test "$found_opengl" = yes; then
enable_webgl="yes";
else
enable_webgl="no";
fi
fi
-if test "$enable_webgl" = "yes" && test "$with_acceleration_backend" != "opengl"; then
- AC_MSG_ERROR([OpenGL must be active (and Clutter disabled) to use WebGL.])
+if test "$enable_webgl" = "yes" && test "$found_opengl" != "yes"; then
+ AC_MSG_ERROR([OpenGL must be active to use WebGL.])
fi;
-if test "$enable_accelerated_compositing" = "yes" && test "$with_acceleration_backend" = "none"; then
- AC_MSG_ERROR([OpenGL or Clutter must be active to use accelerated compositing.])
+if test "$enable_accelerated_compositing" = "yes" && test "$found_opengl" != "yes"; then
+ AC_MSG_ERROR([OpenGL must be active to use accelerated compositing.])
fi
if test "$enable_accelerated_compositing" = "auto"; then
- if test "$with_acceleration_backend" != "none"; then
+ if test "$found_opengl" = "yes"; then
enable_accelerated_compositing="yes";
else
enable_accelerated_compositing="no";
enable_css_filters=no;
enable_css_shaders=no;
AC_MSG_CHECKING([whether to enable CSS Filters and Shaders])
-if test "$enable_accelerated_compositing" = "yes" && test "$with_acceleration_backend" = "opengl"; then
+if test "$enable_accelerated_compositing" = "yes" && test "$found_opengl" = "yes"; then
enable_css_filters=yes;
enable_css_shaders=yes;
fi
AC_SUBST([GSTREAMER_LIBS])
fi
-acceleration_backend_description=$with_acceleration_backend
-if test "$with_acceleration_backend" = "clutter"; then
- PKG_CHECK_MODULES(CLUTTER, clutter-1.0 >= clutter_required_version)
- PKG_CHECK_MODULES([CLUTTER_GTK], [clutter-gtk-1.0 >= clutter_gtk_required_version])
-
- AC_SUBST(CLUTTER_CFLAGS)
- AC_SUBST(CLUTTER_LIBS)
- AC_SUBST(CLUTTER_GTK_CFLAGS)
- AC_SUBST(CLUTTER_GTK_LIBS)
-
- enable_gles2=no
- enable_glx=no
- enable_egl=no
-fi
-
-if test "$with_acceleration_backend" = "opengl"; then
+acceleration_description=
+if test "$found_opengl" = "yes"; then
+ acceleration_description="OpenGL"
if test "$enable_gles2" = "yes"; then
- acceleration_backend_description="$acceleration_backend_description (gles2"
+ acceleration_description="$acceleration_description (gles2"
OPENGL_LIBS="-lGLESv2"
else
- acceleration_backend_description="$acceleration_backend_description (gl"
+ acceleration_description="$acceleration_description (gl"
OPENGL_LIBS="-lGL"
fi
if test "$enable_egl" = "yes"; then
- acceleration_backend_description="$acceleration_backend_description, egl"
+ acceleration_description="$acceleration_description, egl"
OPENGL_LIBS="$OPENGL_LIBS -lEGL"
fi
if test "$enable_glx" = "yes"; then
- acceleration_backend_description="$acceleration_backend_description, glx"
+ acceleration_description="$acceleration_description, glx"
fi
# Check whether dlopen() is in the core libc like on FreeBSD, or in a separate
AC_SUBST([DLOPEN_LIBS])
OPENGL_LIBS="$OPENGL_LIBS $DLOPEN_LIBS"
- acceleration_backend_description="$acceleration_backend_description)"
+ acceleration_description="$acceleration_description)"
fi
AC_SUBST([OPENGL_LIBS])
enable_accelerated_canvas=no
-if test "$enable_accelerated_compositing" = "yes" && test "$with_acceleration_backend" = "opengl"; then
+if test "$enable_accelerated_compositing" = "yes" && test "$found_opengl" = "yes"; then
CAIRO_GL_LIBS="cairo-gl"
if test "$enable_glx" = "yes"; then
CAIRO_GL_LIBS="$CAIRO_GL_LIBS cairo-glx"
])
AC_MSG_RESULT([$enable_debug_symbols])
-AC_MSG_CHECKING([which GPU acceleration backend to use])
-AC_ARG_WITH(acceleration_backend,
- AC_HELP_STRING([--with-acceleration-backend=@<:@opengl/clutter/none@:>@],
- [Select accelerated backend (Clutter currently unsupported, OpenGL autodetected) [default=autodetect]]),
- [],
- [with_acceleration_backend="auto"])
-AC_MSG_RESULT([$with_acceleration_backend])
-
AC_MSG_CHECKING([whether to enable WebGL support])
AC_ARG_ENABLE(webgl, AC_HELP_STRING([--enable-webgl], [enable support for WebGL [default=check]]),
[],
if test "$enable_accelerated_compositing" = "yes"; then
AC_DEFINE([WTF_USE_ACCELERATED_COMPOSITING], [1], [ ])
-
- if test "$with_acceleration_backend" = "none"; then
- AC_DEFINE([WTF_USE_TEXTURE_MAPPER], [1], [ ])
- AC_DEFINE([WTF_USE_TEXTURE_MAPPER_CAIRO], [1], [ ])
- fi
-
- if test "$with_acceleration_backend" = "opengl"; then
- AC_DEFINE([WTF_USE_TEXTURE_MAPPER], [1], [ ])
- AC_DEFINE([WTF_USE_TEXTURE_MAPPER_GL], [1], [ ])
- fi
-
- if test "$with_acceleration_backend" = "clutter"; then
- AC_DEFINE([WTF_USE_CLUTTER], [1], [ ])
- fi
-fi
-
-if test "$with_acceleration_backend" = "opengl"; then
AC_DEFINE([WTF_USE_OPENGL], [1], [ ])
+ AC_DEFINE([WTF_USE_TEXTURE_MAPPER], [1], [ ])
+ AC_DEFINE([WTF_USE_TEXTURE_MAPPER_GL], [1], [ ])
fi
if test "$enable_glx" = "yes"; then
# Accelerated compositing conditionals.
AM_CONDITIONAL([USE_ACCELERATED_COMPOSITING], [test "$enable_accelerated_compositing" = "yes"])
-AM_CONDITIONAL([USE_TEXTURE_MAPPER_CAIRO],
- [test "$enable_accelerated_compositing" = "yes" && test "$with_acceleration_backend" = "none"])
AM_CONDITIONAL([USE_TEXTURE_MAPPER_GL],
- [test "$enable_accelerated_compositing" = "yes" && test "$with_acceleration_backend" = "opengl"])
-AM_CONDITIONAL([USE_CLUTTER], [test "$with_acceleration_backend" = "clutter"])
+ [test "$enable_accelerated_compositing" = "yes" && test "$found_opengl" = "yes"])
# These are the same for now, but they will soon be separate.
-AM_CONDITIONAL([USE_OPENGL], [test "$with_acceleration_backend" = "opengl"])
+AM_CONDITIONAL([USE_OPENGL], [test "$found_opengl" = "yes"])
AM_CONDITIONAL([USE_EGL], [test "$enable_egl" = "yes"])
AM_CONDITIONAL([USE_GLES2], [test "$enable_gles2" = "yes"])
AM_CONDITIONAL([USE_GLX], [test "$enable_glx" = "yes"])
m4_define([libxslt_required_version], [1.1.7])
m4_define([pango_required_version], [1.30.0])
m4_define([sqlite_required_version], [3.0])
-
-m4_define([clutter_required_version], [1.14])
-m4_define([clutter_gtk_required_version], [1.4])
-
+2013-07-01 Gustavo Noronha Silva <gustavo.noronha@collabora.com>
+
+ [GTK] Remove unsupported AC backends
+ https://bugs.webkit.org/show_bug.cgi?id=117362
+
+ Reviewed by Martin Robinson.
+
+ * gtk/jhbuild-optional.modules: no longer needs clutter-gtk, clutter
+ and cogl, so removed.
+
2013-07-01 Timothy Hatcher <timothy@apple.com>
Link to WebInspectorUI.framework at build time instead of soft linking.
certain distributions. Feel free to add more here, within reason,
as long as they are not built by default. -->
- <metamodule id="webkitgtk-clutter-dependencies">
- <dependencies>
- <dep package="clutter"/>
- <dep package="clutter-gtk"/>
- <dep package="cogl"/>
- </dependencies>
- </metamodule>
-
<repository type="tarball" name="ftp.gnome.org"
href="http://ftp.gnome.org"/>
hash="sha256:e5399dfb61376a7500d20cb22715152780aa3a2c8a64281ec6bc8f0ebeb8b689"/>
</autotools>
- <autotools id="cogl"
- autogen-sh="configure"
- autogenargs="--disable-introspection">
- <branch module="/pub/GNOME/sources/cogl/1.14/cogl-1.14.0.tar.xz" version="1.14.0"
- repo="ftp.gnome.org"
- hash="sha256:276e8c9f5ff0fcd57c1eaf74cc245f41ad469a95a18ac831fac2d5960baa5ae8"/>
- </autotools>
-
- <autotools id="clutter"
- autogen-sh="configure"
- autogenargs="--disable-introspection">
- <dependencies>
- <dep package="cogl"/>
- <dep package="atk"/>
- </dependencies>
- <branch module="/pub/GNOME/sources/clutter/1.14/clutter-1.14.0.tar.xz" version="1.14.0"
- repo="ftp.gnome.org"
- hash="sha256:3b7a07373c27fad4f0cf59fd66a6855d66f9a42b7b570a00ca51a8b488af64d5"/>
- </autotools>
-
- <autotools id="clutter-gtk"
- autogen-sh="configure"
- autogenargs="--disable-introspection">
- <dependencies>
- <dep package="clutter"/>
- </dependencies>
- <branch module="/pub/GNOME/sources/clutter-gtk/1.4/clutter-gtk-1.4.4.tar.xz" version="1.4.4"
- repo="ftp.gnome.org"
- hash="sha256:bc3108594a01a08bb6d9b538afe995e4fd78634a8356064ee8137d87aad51b2e"/>
- </autotools>
-
</moduleset>