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

Unified Diff: third_party/WebKit/Source/core/html/HTMLMarqueeElement.h

Issue 2549443003: Move <marquee> implementation to HTMLMarqueeElement.cpp (Closed)
Patch Set: Add layout tests Created 4 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
Index: third_party/WebKit/Source/core/html/HTMLMarqueeElement.h
diff --git a/third_party/WebKit/Source/core/html/HTMLMarqueeElement.h b/third_party/WebKit/Source/core/html/HTMLMarqueeElement.h
index 45a4af5852fe8621399911db29717db1dfaf0f1a..d083def5a4994b2ce63b01e7a0e7fcaedfbc2e61 100644
--- a/third_party/WebKit/Source/core/html/HTMLMarqueeElement.h
+++ b/third_party/WebKit/Source/core/html/HTMLMarqueeElement.h
@@ -23,7 +23,11 @@
#ifndef HTMLMarqueeElement_h
#define HTMLMarqueeElement_h
+#include "core/animation/Animation.h"
+#include "core/animation/KeyframeEffectModel.h"
+#include "core/dom/FrameRequestCallback.h"
#include "core/html/HTMLElement.h"
+#include "wtf/Noncopyable.h"
namespace blink {
@@ -31,6 +35,8 @@ class HTMLMarqueeElement final : public HTMLElement {
DEFINE_WRAPPERTYPEINFO();
public:
+ DECLARE_VIRTUAL_TRACE();
+
static HTMLMarqueeElement* create(Document&);
void attributeChanged(const QualifiedName&,
@@ -42,8 +48,103 @@ class HTMLMarqueeElement final : public HTMLElement {
bool isHorizontal() const;
+ int scrollAmount();
+ void setScrollAmount(int, ExceptionState&);
+
+ int scrollDelay();
+ void setScrollDelay(int, ExceptionState&);
+
+ int loop();
+ void setLoop(int, ExceptionState&);
+
+ void start();
+ void stop();
+
private:
explicit HTMLMarqueeElement(Document&);
+
+ class RequestAnimationFrameCallback : public FrameRequestCallback {
esprehn 2016/12/05 19:19:42 final
adithyas 2016/12/05 21:03:41 Added, here and below.
+ WTF_MAKE_NONCOPYABLE(RequestAnimationFrameCallback);
+
+ public:
+ explicit RequestAnimationFrameCallback(HTMLMarqueeElement* marquee)
+ : m_marquee(marquee) {}
+ void handleEvent(double) override;
+
+ DEFINE_INLINE_VIRTUAL_TRACE() {
+ visitor->trace(m_marquee);
+ FrameRequestCallback::trace(visitor);
+ }
+
+ private:
+ Member<HTMLMarqueeElement> m_marquee;
+ };
+
+ class AnimationFinished : public EventListener {
esprehn 2016/12/05 19:19:42 final
+ WTF_MAKE_NONCOPYABLE(AnimationFinished);
+
+ public:
+ explicit AnimationFinished(HTMLMarqueeElement* marquee)
+ : EventListener(CPPEventListenerType), m_marquee(marquee) {}
+
+ bool operator==(const EventListener& that) const override {
+ return this == &that;
+ }
+
+ void handleEvent(ExecutionContext*, Event*) override;
+
+ DEFINE_INLINE_VIRTUAL_TRACE() {
+ visitor->trace(m_marquee);
+ EventListener::trace(visitor);
+ }
+
+ private:
+ Member<HTMLMarqueeElement> m_marquee;
+ };
+
+ struct AnimationParameters {
+ String transformBegin;
+ String transformEnd;
+ double distance;
+ };
+
+ struct Metrics {
+ double contentWidth;
+ double contentHeight;
+ double marqueeWidth;
+ double marqueeHeight;
+ };
+
+ void initializeAttribute(const QualifiedName& attr);
+ void attributeChangedCallback(const QualifiedName& attr,
+ const String& newValue);
+
+ StringKeyframeEffectModel* createEffectModel(AnimationParameters&);
+
+ void continueAnimation();
+ bool shouldContinue();
+
+ enum Behavior { Scroll, Slide, Alternate };
+ Behavior behavior() const;
+
+ enum Direction { Left, Right, Up, Down };
+ Direction direction() const;
+
+ bool trueSpeed() const;
+
+ Metrics getMetrics();
+ AnimationParameters getAnimationParameters();
+ AtomicString createTransform(double value) const;
+
+ static const int kDefaultScrollAmount = 6;
+ static const int kDefaultScrollDelayMS = 85;
+ static const int kMinimumScrollDelayMS = 60;
+ static const int kDefaultLoopLimit = -1;
+
+ int m_continueCallbackRequestId = 0;
+ int m_loopCount = 0;
+ Member<Element> m_mover;
+ Member<Animation> m_player;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698