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

Unified Diff: sky/engine/core/css/StyleRuleKeyframes.cpp

Issue 780483002: Remove the CSSOM. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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
« no previous file with comments | « sky/engine/core/css/StyleRuleKeyframes.h ('k') | sky/engine/core/css/StyleSheet.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/engine/core/css/StyleRuleKeyframes.cpp
diff --git a/sky/engine/platform/Clock.cpp b/sky/engine/core/css/StyleRuleKeyframes.cpp
similarity index 53%
copy from sky/engine/platform/Clock.cpp
copy to sky/engine/core/css/StyleRuleKeyframes.cpp
index b80f3782514221d679c2eb46f645ea2b26748f80..9c432fc108fae55e2a9cf0dcf23920bb62610e3c 100644
--- a/sky/engine/platform/Clock.cpp
+++ b/sky/engine/core/css/StyleRuleKeyframes.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2007, 2008, 2012 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -24,72 +24,61 @@
*/
#include "sky/engine/config.h"
-#include "sky/engine/platform/Clock.h"
+#include "sky/engine/core/css/StyleRuleKeyframes.h"
-#include "sky/engine/wtf/CurrentTime.h"
+#include "sky/engine/core/css/StyleKeyframe.h"
namespace blink {
-Clock::Clock()
- : m_running(false)
- , m_rate(1)
- , m_offset(0)
+StyleRuleKeyframes::StyleRuleKeyframes()
+ : StyleRuleBase(Keyframes)
{
- m_startTime = m_lastTime = now();
}
-void Clock::setCurrentTime(double time)
+StyleRuleKeyframes::StyleRuleKeyframes(const StyleRuleKeyframes& o)
+ : StyleRuleBase(o)
+ , m_keyframes(o.m_keyframes)
+ , m_name(o.m_name)
+ , m_isPrefixed(o.m_isPrefixed)
{
- m_startTime = m_lastTime = now();
- m_offset = time;
}
-double Clock::currentTime() const
+StyleRuleKeyframes::~StyleRuleKeyframes()
{
- return currentDelta() + m_offset;
}
-void Clock::setPlayRate(double rate)
+void StyleRuleKeyframes::parserAppendKeyframe(PassRefPtr<StyleKeyframe> keyframe)
{
- m_offset += currentDelta();
- m_lastTime = m_startTime = now();
- m_rate = rate;
-}
-
-void Clock::start()
-{
- if (m_running)
+ if (!keyframe)
return;
-
- m_lastTime = m_startTime = now();
- m_running = true;
+ m_keyframes.append(keyframe);
}
-void Clock::stop()
+void StyleRuleKeyframes::wrapperAppendKeyframe(PassRefPtr<StyleKeyframe> keyframe)
{
- if (!m_running)
- return;
-
- m_offset += currentDelta();
- m_lastTime = m_startTime = now();
- m_running = false;
+ m_keyframes.append(keyframe);
}
-double Clock::now() const
+void StyleRuleKeyframes::wrapperRemoveKeyframe(unsigned index)
{
- return WTF::currentTime();
+ m_keyframes.remove(index);
}
-double Clock::currentDelta() const
+int StyleRuleKeyframes::findKeyframeIndex(const String& key) const
{
- if (m_running)
- m_lastTime = now();
- return (m_lastTime - m_startTime) * m_rate;
-}
+ String percentageString;
+ if (equalIgnoringCase(key, "from"))
+ percentageString = "0%";
+ else if (equalIgnoringCase(key, "to"))
+ percentageString = "100%";
+ else
+ percentageString = key;
-PassOwnPtr<Clock> Clock::create()
-{
- return adoptPtr(new Clock());
+ for (unsigned i = 0; i < m_keyframes.size(); ++i) {
+ if (m_keyframes[i]->keyText() == percentageString)
+ return i;
+ }
+ return -1;
}
} // namespace blink
« no previous file with comments | « sky/engine/core/css/StyleRuleKeyframes.h ('k') | sky/engine/core/css/StyleSheet.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698