Title: [87707] trunk/Source
Revision
87707
Author
[email protected]
Date
2011-05-30 19:21:49 -0700 (Mon, 30 May 2011)

Log Message

2011-05-30  No'am Rosenthal  <[email protected]>

        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  <[email protected]>

        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:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (87706 => 87707)


--- trunk/Source/WebCore/ChangeLog	2011-05-31 02:18:05 UTC (rev 87706)
+++ trunk/Source/WebCore/ChangeLog	2011-05-31 02:21:49 UTC (rev 87707)
@@ -1,3 +1,17 @@
+2011-05-30  No'am Rosenthal  <[email protected]>
+
+        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  <[email protected]>
 
         Reviewed by Alexey Proskuryakov.

Modified: trunk/Source/WebCore/platform/animation/Animation.h (87706 => 87707)


--- trunk/Source/WebCore/platform/animation/Animation.h	2011-05-31 02:18:05 UTC (rev 87706)
+++ trunk/Source/WebCore/platform/animation/Animation.h	2011-05-31 02:21:49 UTC (rev 87707)
@@ -81,6 +81,19 @@
     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 };

Modified: trunk/Source/WebKit2/ChangeLog (87706 => 87707)


--- trunk/Source/WebKit2/ChangeLog	2011-05-31 02:18:05 UTC (rev 87706)
+++ trunk/Source/WebKit2/ChangeLog	2011-05-31 02:21:49 UTC (rev 87707)
@@ -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  <[email protected]>
+
+        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.
 

Modified: trunk/Source/WebKit2/Scripts/webkit2/messages.py (87706 => 87707)


--- trunk/Source/WebKit2/Scripts/webkit2/messages.py	2011-05-31 02:18:05 UTC (rev 87706)
+++ trunk/Source/WebKit2/Scripts/webkit2/messages.py	2011-05-31 02:21:49 UTC (rev 87707)
@@ -251,6 +251,7 @@
 
 def struct_or_class(namespace, type):
     structs = frozenset([
+        'WebCore::Animation',
         'WebCore::EditorCommandsForKeyEvent',
         'WebCore::CompositionUnderline',
         'WebCore::GrammarDetail',

Modified: trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.h (87706 => 87707)


--- trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.h	2011-05-31 02:18:05 UTC (rev 87706)
+++ trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.h	2011-05-31 02:21:49 UTC (rev 87707)
@@ -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<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
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to