2011-05-30 No'am Rosenthal <noam.rosenthal@nokia.com>
authornoam.rosenthal@nokia.com <noam.rosenthal@nokia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 31 May 2011 02:21:49 +0000 (02:21 +0000)
committernoam.rosenthal@nokia.com <noam.rosenthal@nokia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 31 May 2011 02:21:49 +0000 (02:21 +0000)
        Reviewed by Simon Hausmann.

        WebKit2: Enable serializing of data types needed for cross-process accelerated compositing
        https://bugs.webkit.org/show_bug.cgi?id=61694

        Expose a public clearAll() function to reset WebCore::Animation.

        No new functionality, so no new tests.

        * platform/animation/Animation.h:
        (WebCore::Animation::clearAll):
2011-05-30  No'am Rosenthal  <noam.rosenthal@nokia.com>

        Reviewed by Simon Hausmann.

        WebKit2: Enable serializing of data types needed for cross-process accelerated compositing
        https://bugs.webkit.org/show_bug.cgi?id=61694

        Create an ArgumentCoder for WebCore::Animation.

        * Scripts/webkit2/messages.py:
        * Shared/WebCoreArgumentCoders.h:

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

Source/WebCore/ChangeLog
Source/WebCore/platform/animation/Animation.h
Source/WebKit2/ChangeLog
Source/WebKit2/Scripts/webkit2/messages.py
Source/WebKit2/Shared/WebCoreArgumentCoders.h

index 4eb3a92..64393d8 100644 (file)
@@ -1,3 +1,17 @@
+2011-05-30  No'am Rosenthal  <noam.rosenthal@nokia.com>
+
+        Reviewed by Simon Hausmann.
+
+        WebKit2: Enable serializing of data types needed for cross-process accelerated compositing
+        https://bugs.webkit.org/show_bug.cgi?id=61694
+
+        Expose a public clearAll() function to reset WebCore::Animation.
+
+        No new functionality, so no new tests.
+
+        * platform/animation/Animation.h:
+        (WebCore::Animation::clearAll):
+
 2011-05-30  Eric Carlson  <eric.carlson@apple.com>
 
         Reviewed by Alexey Proskuryakov.
index d16f74c..d21137a 100644 (file)
@@ -81,6 +81,19 @@ public:
     void clearProperty() { m_propertySet = false; }
     void clearTimingFunction() { m_timingFunctionSet = false; }
 
+    void clearAll()
+    {
+        clearDelay();
+        clearDirection();
+        clearDuration();
+        clearFillMode();
+        clearIterationCount();
+        clearName();
+        clearPlayState();
+        clearProperty();
+        clearTimingFunction();
+    }
+
     double delay() const { return m_delay; }
 
     enum AnimationDirection { AnimationDirectionNormal, AnimationDirectionAlternate };
index f418968..0f37e15 100644 (file)
@@ -5,6 +5,18 @@
         WebKit2: Enable serializing of data types needed for cross-process accelerated compositing
         https://bugs.webkit.org/show_bug.cgi?id=61694
 
+        Create an ArgumentCoder for WebCore::Animation.
+
+        * Scripts/webkit2/messages.py:
+        * Shared/WebCoreArgumentCoders.h:
+
+2011-05-30  No'am Rosenthal  <noam.rosenthal@nokia.com>
+
+        Reviewed by Simon Hausmann.
+
+        WebKit2: Enable serializing of data types needed for cross-process accelerated compositing
+        https://bugs.webkit.org/show_bug.cgi?id=61694
+
         Add an ArgumentCoder for WebCore::TimingFunction. This serializer can create the appropriate
         TimingFunction subclass based on the type of timing function.
 
index ffe1ed0..1f70604 100644 (file)
@@ -251,6 +251,7 @@ def message_to_struct_declaration(message):
 
 def struct_or_class(namespace, type):
     structs = frozenset([
+        'WebCore::Animation',
         'WebCore::EditorCommandsForKeyEvent',
         'WebCore::CompositionUnderline',
         'WebCore::GrammarDetail',
index fdb1cf0..5d7a311 100644 (file)
@@ -31,6 +31,7 @@
 #include "ArgumentEncoder.h"
 #include "Arguments.h"
 #include "ShareableBitmap.h"
+#include <WebCore/Animation.h>
 #include <WebCore/AuthenticationChallenge.h>
 #include <WebCore/BitmapImage.h>
 #include <WebCore/Credential.h>
@@ -559,6 +560,122 @@ template<> struct ArgumentCoder<RefPtr<WebCore::TimingFunction> > {
     }
 };
 
+template<> struct ArgumentCoder<WebCore::Animation> {
+    static bool encodeBoolAndReturnValue(ArgumentEncoder* encoder, bool value)
+    {
+        encoder->encodeBool(value);
+        return value;
+    }
+
+    template<typename T>
+    static void encodeBoolAndValue(ArgumentEncoder* encoder, bool isSet, const T& value)
+    {
+        if (encodeBoolAndReturnValue(encoder, isSet))
+            encoder->encode<T>(value);
+    }
+
+    static bool decodeBoolAndValue(ArgumentDecoder* decoder, bool& isSet, double& value)
+    {
+        if (!decoder->decodeBool(isSet))
+            return false;
+        if (!isSet)
+            return true;
+
+        return decoder->decodeDouble(value);
+    }
+
+    template<class T>
+    static bool decodeBoolAndValue(ArgumentDecoder* decoder, bool& isSet, T& value)
+    {
+        if (!decoder->decodeBool(isSet))
+            return false;
+        if (!isSet)
+            return true;
+
+        return ArgumentCoder<T>::decode(decoder, value);
+    }
+
+    static bool decodeBoolAndValue(ArgumentDecoder* decoder, bool& isSet, int& value)
+    {
+        if (!decoder->decodeBool(isSet))
+            return false;
+        if (!isSet)
+            return true;
+
+        return decoder->decodeInt32(value);
+    }
+
+    static void encode(ArgumentEncoder* encoder, const WebCore::Animation& animation)
+    {
+        encodeBoolAndValue(encoder, animation.isDelaySet(), animation.delay());
+        encodeBoolAndValue<int>(encoder, animation.isDirectionSet(), animation.direction());
+        encodeBoolAndValue(encoder, animation.isDurationSet(), animation.duration());
+        encodeBoolAndValue(encoder, animation.isFillModeSet(), animation.fillMode());
+        encodeBoolAndValue(encoder, animation.isIterationCountSet(), animation.iterationCount());
+
+        if (encodeBoolAndReturnValue(encoder, animation.isNameSet()))
+            ArgumentCoder<String>::encode(encoder, animation.name());
+
+        encodeBoolAndValue<int>(encoder, animation.isPlayStateSet(), animation.playState());
+        encodeBoolAndValue(encoder, animation.isPropertySet(), animation.property());
+
+        if (encodeBoolAndReturnValue(encoder, animation.isTimingFunctionSet()))
+            ArgumentCoder<RefPtr<WebCore::TimingFunction> >::encode(encoder, animation.timingFunction());
+        encoder->encodeBool(animation.isNoneAnimation());
+    }
+
+    static bool decode(ArgumentDecoder* decoder, WebCore::Animation& animation)
+    {
+        bool isDelaySet, isDirectionSet, isDurationSet, isFillModeSet, isIterationCountSet, isNameSet, isPlayStateSet, isPropertySet, isTimingFunctionSet;
+        int property, iterationCount, direction, fillMode, playState;
+        double delay, duration;
+        RefPtr<WebCore::TimingFunction> timingFunction;
+        String name;
+
+        animation.clearAll();
+
+        if (!decodeBoolAndValue(decoder, isDelaySet, delay))
+            return false;
+        if (!decodeBoolAndValue(decoder, isDirectionSet, direction))
+            return false;
+        if (!decodeBoolAndValue(decoder, isDurationSet, duration))
+            return false;
+        if (!decodeBoolAndValue(decoder, isFillModeSet, fillMode))
+            return false;
+        if (!decodeBoolAndValue(decoder, isIterationCountSet, iterationCount))
+            return false;
+        if (!decodeBoolAndValue<String>(decoder, isNameSet, name))
+            return false;
+        if (!decodeBoolAndValue(decoder, isPlayStateSet, playState))
+            return false;
+        if (!decodeBoolAndValue(decoder, isPropertySet, property))
+            return false;
+        if (!decodeBoolAndValue<RefPtr<WebCore::TimingFunction> >(decoder, isTimingFunctionSet, timingFunction))
+            return false;
+
+        if (isDelaySet)
+            animation.setDelay(delay);
+        if (isDirectionSet)
+            animation.setDirection(static_cast<WebCore::Animation::AnimationDirection>(direction));
+        if (isDurationSet)
+            animation.setDuration(duration);
+        if (isFillModeSet)
+            animation.setFillMode(fillMode);
+        if (isIterationCountSet)
+            animation.setIterationCount(iterationCount);
+        if (isNameSet)
+            animation.setName(name);
+        if (isPlayStateSet)
+            animation.setPlayState(static_cast<WebCore::EAnimPlayState>(playState));
+        if (isPropertySet)
+            animation.setProperty(property);
+        if (isTimingFunctionSet)
+            animation.setTimingFunction(timingFunction);
+
+        return true;
+    }
+};
+
 } // namespace CoreIPC
 
 #endif // WebCoreArgumentCoders_h