Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(268)

Unified Diff: third_party/WebKit/Source/core/css/StyleRuleKeyframe.cpp

Issue 1481383002: [Experimental] CSSSerializer Proof-of-concept Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: snapshot: top_25 sites ser/dser now works Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/css/StyleRuleKeyframe.cpp
diff --git a/third_party/WebKit/Source/core/css/StyleRuleKeyframe.cpp b/third_party/WebKit/Source/core/css/StyleRuleKeyframe.cpp
index c49fdd6fca11d34cd65cb7d8ac1f8c0f81ec3b1f..53ed3ebf9246bcb2b491416d689bdcb17e80c3d6 100644
--- a/third_party/WebKit/Source/core/css/StyleRuleKeyframe.cpp
+++ b/third_party/WebKit/Source/core/css/StyleRuleKeyframe.cpp
@@ -6,14 +6,16 @@
#include "core/css/StylePropertySet.h"
#include "core/css/parser/CSSParser.h"
+#include "core/css/serializer/CSSDeserializeStream.h"
+#include "core/css/serializer/CSSSerializeStream.h"
#include "wtf/text/StringBuilder.h"
namespace blink {
StyleRuleKeyframe::StyleRuleKeyframe(PassOwnPtr<Vector<double>> keys, PassRefPtrWillBeRawPtr<StylePropertySet> properties)
-: StyleRuleBase(Keyframe)
-, m_properties(properties)
-, m_keys(*keys)
+ : StyleRuleBase(Keyframe)
+ , m_properties(properties)
+ , m_keys(*keys)
{
}
@@ -69,6 +71,27 @@ String StyleRuleKeyframe::cssText() const
return result.toString();
}
+void StyleRuleKeyframe::serializeAfterDispatch(CSSSerializeStream* stream) const
+{
+ m_properties->serialize(stream);
+ stream->writeUnsigned(m_keys.size());
+ for (double key : m_keys)
+ stream->writeDouble(key);
+}
+
+PassRefPtrWillBeRawPtr<StyleRuleKeyframe> StyleRuleKeyframe::deserializeAfterDispatch(CSSDeserializeStream* stream)
+{
+ RefPtrWillBeRawPtr<StylePropertySet> properties = ImmutableStylePropertySet::deserialize(stream);
+
+ unsigned size = stream->readUnsigned();
+ OwnPtr<Vector<double>> keys = adoptPtr(new Vector<double>());
+ keys->reserveCapacity(size);
+ for (unsigned i = 0; i < size; ++ i)
+ keys->append(stream->readDouble());
+
+ return create(keys.release(), properties);
+}
+
DEFINE_TRACE_AFTER_DISPATCH(StyleRuleKeyframe)
{
visitor->trace(m_properties);
« no previous file with comments | « third_party/WebKit/Source/core/css/StyleRuleKeyframe.h ('k') | third_party/WebKit/Source/core/css/StyleSheetContents.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698