[SCM] WebKit Debian packaging branch, webkit-1.3, updated. upstream/1.3.7-4207-g178b198

andersca at apple.com andersca at apple.com
Mon Feb 21 00:14:45 UTC 2011


The following commit has been merged in the webkit-1.3 branch:
commit c6d77aecb5cefd3cad7077e4141745cc4685b365
Author: andersca at apple.com <andersca at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sat Jan 29 00:06:49 2011 +0000

    2011-01-28  Anders Carlsson  <andersca at apple.com>
    
            Reviewed by Sam Weinig.
    
            Add CoreAnimationRenderer class
            https://bugs.webkit.org/show_bug.cgi?id=53343
    
            * Shared/mac/CoreAnimationRenderer.h: Added.
            * Shared/mac/CoreAnimationRenderer.mm: Added.
    
            (WebKit::CoreAnimationRenderer::CoreAnimationRenderer):
            Initialize the underlying CARenderer object and hook up a notification observer.
    
            (WebKit::CoreAnimationRenderer::~CoreAnimationRenderer):
            Assert that the client is null. It has been set to null by the call to invalidate().
    
            (WebKit::CoreAnimationRenderer::setBounds):
            Update the bounds on the CARenderer and the root layer.
    
            (WebKit::CoreAnimationRenderer::render):
            Ask the renderer to render and return the next frame time.
    
            (WebKit::CoreAnimationRenderer::invalidate):
            Remove the change observer and reset the client.
    
            (WebKit::CoreAnimationRenderer::rendererDidChange):
            Call the client member function.
    
            * WebKit2.xcodeproj/project.pbxproj:
            Add new files.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@77012 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog
index b9028de..8a00270 100644
--- a/Source/WebKit2/ChangeLog
+++ b/Source/WebKit2/ChangeLog
@@ -2,6 +2,37 @@
 
         Reviewed by Sam Weinig.
 
+        Add CoreAnimationRenderer class
+        https://bugs.webkit.org/show_bug.cgi?id=53343
+
+        * Shared/mac/CoreAnimationRenderer.h: Added.
+        * Shared/mac/CoreAnimationRenderer.mm: Added.
+
+        (WebKit::CoreAnimationRenderer::CoreAnimationRenderer):
+        Initialize the underlying CARenderer object and hook up a notification observer.
+
+        (WebKit::CoreAnimationRenderer::~CoreAnimationRenderer):
+        Assert that the client is null. It has been set to null by the call to invalidate().
+
+        (WebKit::CoreAnimationRenderer::setBounds):
+        Update the bounds on the CARenderer and the root layer.
+
+        (WebKit::CoreAnimationRenderer::render):
+        Ask the renderer to render and return the next frame time.
+
+        (WebKit::CoreAnimationRenderer::invalidate):
+        Remove the change observer and reset the client.
+
+        (WebKit::CoreAnimationRenderer::rendererDidChange):
+        Call the client member function.
+
+        * WebKit2.xcodeproj/project.pbxproj:
+        Add new files.
+
+2011-01-28  Anders Carlsson  <andersca at apple.com>
+
+        Reviewed by Sam Weinig.
+
         Add an OBJC_CLASS macro for forward declaring an Objective-C class
         https://bugs.webkit.org/show_bug.cgi?id=53337
 
diff --git a/Source/WebKit2/Shared/mac/CoreAnimationRenderer.h b/Source/WebKit2/Shared/mac/CoreAnimationRenderer.h
new file mode 100644
index 0000000..482f579
--- /dev/null
+++ b/Source/WebKit2/Shared/mac/CoreAnimationRenderer.h
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2011 Apple Inc. 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. AND ITS 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 APPLE INC. OR ITS 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 CoreAnimationRenderer_h
+#define CoreAnimationRenderer_h
+
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/RetainPtr.h>
+
+OBJC_CLASS CALayer;
+OBJC_CLASS CARenderer;
+
+typedef struct _CGLContextObject* CGLContextObj;
+
+namespace WebKit {
+
+class CoreAnimationRenderer : public RefCounted<CoreAnimationRenderer> {
+public:
+    class Client {
+    public:
+        virtual ~Client() { }
+        virtual void rendererDidChange(CoreAnimationRenderer*) = 0;
+    };
+
+    static PassRefPtr<CoreAnimationRenderer> create(Client*, CGLContextObj, CALayer *);
+    ~CoreAnimationRenderer();
+
+    void invalidate();
+
+    void setBounds(CGRect);
+    void render(CFTimeInterval frameTime, CVTimeStamp*, CFTimeInterval& nextFrameTime);
+
+private:
+    CoreAnimationRenderer(Client*, CGLContextObj, CALayer *);
+
+    static void rendererDidChange(void*);
+    void rendererDidChange();
+
+    Client* m_client;
+    CGLContextObj m_cglContext;
+    RetainPtr<CARenderer> m_renderer;
+};    
+    
+} // namespace WebKit
+
+#endif // CoreAnimationRenderer_h
diff --git a/Source/WebKit2/Shared/mac/CoreAnimationRenderer.mm b/Source/WebKit2/Shared/mac/CoreAnimationRenderer.mm
new file mode 100644
index 0000000..faeaef0
--- /dev/null
+++ b/Source/WebKit2/Shared/mac/CoreAnimationRenderer.mm
@@ -0,0 +1,100 @@
+/*
+ * Copyright (C) 2011 Apple Inc. 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. AND ITS 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 APPLE INC. OR ITS 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.
+ */
+
+#import "config.h"
+#import "CoreAnimationRenderer.h"
+
+#import <WebKitSystemInterface.h>
+#import <QuartzCore/QuartzCore.h>
+#import <OpenGL/CGLMacro.h>
+
+// The CGLMacro.h header adds an implicit CGLContextObj parameter to all OpenGL calls,
+// which is good because it allows us to make OpenGL calls without saving and restoring the
+// current context. The context argument is named "cgl_ctx" by default, so we the macro
+// below to declare this variable.
+#define DECLARE_GL_CONTEXT_VARIABLE(name) \
+    CGLContextObj cgl_ctx = (name)
+
+namespace WebKit {
+
+PassRefPtr<CoreAnimationRenderer> CoreAnimationRenderer::create(Client* client, CGLContextObj cglContextObj, CALayer *layer)
+{
+    return adoptRef(new CoreAnimationRenderer(client, cglContextObj, layer));
+}
+
+CoreAnimationRenderer::CoreAnimationRenderer(Client* client, CGLContextObj cglContextObj, CALayer *layer)
+    : m_client(client)
+    , m_cglContext(cglContextObj)
+    , m_renderer([CARenderer rendererWithCGLContext:m_cglContext options:nil])
+{
+    [m_renderer.get() setLayer:layer];
+
+    WKCARendererAddChangeNotificationObserver(m_renderer.get(), rendererDidChange, this);
+}
+
+CoreAnimationRenderer::~CoreAnimationRenderer()
+{
+    ASSERT(!m_client);
+}
+
+void CoreAnimationRenderer::setBounds(CGRect bounds)
+{
+    [m_renderer.get() setBounds:bounds];
+
+    [CATransaction begin];
+    [CATransaction setDisableActions:YES];
+    [[m_renderer.get() layer] setFrame:bounds];
+    [CATransaction commit];
+}
+
+void CoreAnimationRenderer::render(CFTimeInterval frameTime, CVTimeStamp* timeStamp, CFTimeInterval& nextFrameTime)
+{
+    [m_renderer.get() beginFrameAtTime:frameTime timeStamp:timeStamp];
+    [m_renderer.get() render];
+    nextFrameTime = [m_renderer.get() nextFrameTime];
+    [m_renderer.get() endFrame];
+}
+
+void CoreAnimationRenderer::invalidate()
+{
+    ASSERT(m_client);
+
+    WKCARendererRemoveChangeNotificationObserver(m_renderer.get(), rendererDidChange, this);
+    m_client = 0;
+}
+
+void CoreAnimationRenderer::rendererDidChange(void* context)
+{
+    static_cast<CoreAnimationRenderer*>(context)->rendererDidChange();
+}
+
+void CoreAnimationRenderer::rendererDidChange()
+{
+    ASSERT(m_client);
+
+    m_client->rendererDidChange(this);
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj b/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
index 3ee06f3..4517c89 100644
--- a/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
+++ b/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
@@ -176,6 +176,8 @@
 		1A91010B1268C8CA001842F5 /* FindIndicatorWindow.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A9101091268C8CA001842F5 /* FindIndicatorWindow.mm */; };
 		1A9636BC12F348490078A062 /* ShareableSurface.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A9636BA12F348490078A062 /* ShareableSurface.cpp */; };
 		1A9636BD12F348490078A062 /* ShareableSurface.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A9636BB12F348490078A062 /* ShareableSurface.h */; };
+		1A9639F712F38ECD0078A062 /* CoreAnimationRenderer.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A9639F512F38ECD0078A062 /* CoreAnimationRenderer.h */; };
+		1A9639F812F38ECD0078A062 /* CoreAnimationRenderer.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A9639F612F38ECD0078A062 /* CoreAnimationRenderer.mm */; };
 		1AA1CC5D100FA1A10078DEBC /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1AA1CC5C100FA1A10078DEBC /* QuartzCore.framework */; };
 		1AA1CD07100FA1BA0078DEBC /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1AA1CD06100FA1BA0078DEBC /* Carbon.framework */; };
 		1AA2E51D12E4C05E00BC4966 /* CGUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AA2E51B12E4C05E00BC4966 /* CGUtilities.h */; };
@@ -922,6 +924,8 @@
 		1A9101091268C8CA001842F5 /* FindIndicatorWindow.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = FindIndicatorWindow.mm; sourceTree = "<group>"; };
 		1A9636BA12F348490078A062 /* ShareableSurface.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ShareableSurface.cpp; sourceTree = "<group>"; };
 		1A9636BB12F348490078A062 /* ShareableSurface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShareableSurface.h; sourceTree = "<group>"; };
+		1A9639F512F38ECD0078A062 /* CoreAnimationRenderer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CoreAnimationRenderer.h; sourceTree = "<group>"; };
+		1A9639F612F38ECD0078A062 /* CoreAnimationRenderer.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CoreAnimationRenderer.mm; sourceTree = "<group>"; };
 		1AA1C79A100E7FC50078DEBC /* WebCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = WebCore.framework; sourceTree = BUILT_PRODUCTS_DIR; };
 		1AA1C7DE100E846E0078DEBC /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = JavaScriptCore.framework; sourceTree = BUILT_PRODUCTS_DIR; };
 		1AA1CC5C100FA1A10078DEBC /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = /System/Library/Frameworks/QuartzCore.framework; sourceTree = "<absolute>"; };
@@ -2359,6 +2363,8 @@
 			isa = PBXGroup;
 			children = (
 				1A6F9FB611E1408500DB1371 /* CommandLineMac.cpp */,
+				1A9639F512F38ECD0078A062 /* CoreAnimationRenderer.h */,
+				1A9639F612F38ECD0078A062 /* CoreAnimationRenderer.mm */,
 				C02BFF1D1251502E009CCBEA /* NativeWebKeyboardEventMac.mm */,
 				C574A57F12E66681002DFE98 /* PasteboardTypes.h */,
 				C574A58012E66681002DFE98 /* PasteboardTypes.mm */,
@@ -3108,6 +3114,7 @@
 				1A186EEA12EF7618008E5F37 /* LayerTreeHost.h in Headers */,
 				BFA6179F12F0B99D0033E0CA /* WKViewPrivate.h in Headers */,
 				1A9636BD12F348490078A062 /* ShareableSurface.h in Headers */,
+				1A9639F712F38ECD0078A062 /* CoreAnimationRenderer.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -3576,6 +3583,7 @@
 				1A18718512EF9877008E5F37 /* LayerTreeHostMac.mm in Sources */,
 				6501BD1A12F1243400E9F248 /* WKBundleInspector.cpp in Sources */,
 				1A9636BC12F348490078A062 /* ShareableSurface.cpp in Sources */,
+				1A9639F812F38ECD0078A062 /* CoreAnimationRenderer.mm in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list