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

Side by Side 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * Copyright (C) 2007, 2010 Apple Inc. All rights reserved. 4 * Copyright (C) 2007, 2010 Apple Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
11 * This library is distributed in the hope that it will be useful, 11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details. 14 * Library General Public License for more details.
15 * 15 *
16 * You should have received a copy of the GNU Library General Public License 16 * You should have received a copy of the GNU Library General Public License
17 * along with this library; see the file COPYING.LIB. If not, write to 17 * along with this library; see the file COPYING.LIB. If not, write to
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA. 19 * Boston, MA 02110-1301, USA.
20 * 20 *
21 */ 21 */
22 22
23 #ifndef HTMLMarqueeElement_h 23 #ifndef HTMLMarqueeElement_h
24 #define HTMLMarqueeElement_h 24 #define HTMLMarqueeElement_h
25 25
26 #include "core/animation/Animation.h"
27 #include "core/animation/KeyframeEffectModel.h"
28 #include "core/dom/FrameRequestCallback.h"
26 #include "core/html/HTMLElement.h" 29 #include "core/html/HTMLElement.h"
30 #include "wtf/Noncopyable.h"
27 31
28 namespace blink { 32 namespace blink {
29 33
30 class HTMLMarqueeElement final : public HTMLElement { 34 class HTMLMarqueeElement final : public HTMLElement {
31 DEFINE_WRAPPERTYPEINFO(); 35 DEFINE_WRAPPERTYPEINFO();
32 36
33 public: 37 public:
38 DECLARE_VIRTUAL_TRACE();
39
34 static HTMLMarqueeElement* create(Document&); 40 static HTMLMarqueeElement* create(Document&);
35 41
36 void attributeChanged(const QualifiedName&, 42 void attributeChanged(const QualifiedName&,
37 const AtomicString& oldValue, 43 const AtomicString& oldValue,
38 const AtomicString& newValue, 44 const AtomicString& newValue,
39 AttributeModificationReason) final; 45 AttributeModificationReason) final;
40 InsertionNotificationRequest insertedInto(ContainerNode*) final; 46 InsertionNotificationRequest insertedInto(ContainerNode*) final;
41 void removedFrom(ContainerNode*) final; 47 void removedFrom(ContainerNode*) final;
42 48
43 bool isHorizontal() const; 49 bool isHorizontal() const;
44 50
51 int scrollAmount();
52 void setScrollAmount(int, ExceptionState&);
53
54 int scrollDelay();
55 void setScrollDelay(int, ExceptionState&);
56
57 int loop();
58 void setLoop(int, ExceptionState&);
59
60 void start();
61 void stop();
62
45 private: 63 private:
46 explicit HTMLMarqueeElement(Document&); 64 explicit HTMLMarqueeElement(Document&);
65
66 class RequestAnimationFrameCallback : public FrameRequestCallback {
esprehn 2016/12/05 19:19:42 final
adithyas 2016/12/05 21:03:41 Added, here and below.
67 WTF_MAKE_NONCOPYABLE(RequestAnimationFrameCallback);
68
69 public:
70 explicit RequestAnimationFrameCallback(HTMLMarqueeElement* marquee)
71 : m_marquee(marquee) {}
72 void handleEvent(double) override;
73
74 DEFINE_INLINE_VIRTUAL_TRACE() {
75 visitor->trace(m_marquee);
76 FrameRequestCallback::trace(visitor);
77 }
78
79 private:
80 Member<HTMLMarqueeElement> m_marquee;
81 };
82
83 class AnimationFinished : public EventListener {
esprehn 2016/12/05 19:19:42 final
84 WTF_MAKE_NONCOPYABLE(AnimationFinished);
85
86 public:
87 explicit AnimationFinished(HTMLMarqueeElement* marquee)
88 : EventListener(CPPEventListenerType), m_marquee(marquee) {}
89
90 bool operator==(const EventListener& that) const override {
91 return this == &that;
92 }
93
94 void handleEvent(ExecutionContext*, Event*) override;
95
96 DEFINE_INLINE_VIRTUAL_TRACE() {
97 visitor->trace(m_marquee);
98 EventListener::trace(visitor);
99 }
100
101 private:
102 Member<HTMLMarqueeElement> m_marquee;
103 };
104
105 struct AnimationParameters {
106 String transformBegin;
107 String transformEnd;
108 double distance;
109 };
110
111 struct Metrics {
112 double contentWidth;
113 double contentHeight;
114 double marqueeWidth;
115 double marqueeHeight;
116 };
117
118 void initializeAttribute(const QualifiedName& attr);
119 void attributeChangedCallback(const QualifiedName& attr,
120 const String& newValue);
121
122 StringKeyframeEffectModel* createEffectModel(AnimationParameters&);
123
124 void continueAnimation();
125 bool shouldContinue();
126
127 enum Behavior { Scroll, Slide, Alternate };
128 Behavior behavior() const;
129
130 enum Direction { Left, Right, Up, Down };
131 Direction direction() const;
132
133 bool trueSpeed() const;
134
135 Metrics getMetrics();
136 AnimationParameters getAnimationParameters();
137 AtomicString createTransform(double value) const;
138
139 static const int kDefaultScrollAmount = 6;
140 static const int kDefaultScrollDelayMS = 85;
141 static const int kMinimumScrollDelayMS = 60;
142 static const int kDefaultLoopLimit = -1;
143
144 int m_continueCallbackRequestId = 0;
145 int m_loopCount = 0;
146 Member<Element> m_mover;
147 Member<Animation> m_player;
47 }; 148 };
48 149
49 } // namespace blink 150 } // namespace blink
50 151
51 #endif // HTMLMarqueeElement_h 152 #endif // HTMLMarqueeElement_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698