Chromium Code Reviews| OLD | NEW |
|---|---|
| 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() const; | |
| 52 void setScrollAmount(int, ExceptionState&); | |
| 53 | |
| 54 int scrollDelay() const; | |
| 55 void setScrollDelay(int, ExceptionState&); | |
| 56 | |
| 57 int loop() const; | |
| 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 final : public FrameRequestCallback { | |
|
tkent
2016/12/06 22:43:11
This class definition should be moved to HTMLMarqu
| |
| 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 final : public EventListener { | |
|
tkent
2016/12/06 22:43:11
This class definition should be moved to HTMLMarqu
| |
| 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 attributeChangedCallback(const QualifiedName& attr, | |
| 119 const String& newValue); | |
| 120 | |
| 121 StringKeyframeEffectModel* createEffectModel(AnimationParameters&); | |
| 122 | |
| 123 void continueAnimation(); | |
| 124 bool shouldContinue(); | |
| 125 | |
| 126 enum Behavior { Scroll, Slide, Alternate }; | |
|
tkent
2016/12/06 22:43:11
Please prepend 'k' to enum members.
| |
| 127 Behavior behavior() const; | |
|
tkent
2016/12/06 22:43:11
This will prevent naming rule conversion coming so
| |
| 128 | |
| 129 enum Direction { Left, Right, Up, Down }; | |
|
tkent
2016/12/06 22:43:11
Please prepend 'k' to enum members.
| |
| 130 Direction direction() const; | |
|
tkent
2016/12/06 22:43:11
This will prevent naming rule conversion coming so
| |
| 131 | |
| 132 bool trueSpeed() const; | |
|
tkent
2016/12/06 22:43:11
I don't think this function is necessary. It's us
esprehn
2016/12/07 00:10:00
This is web exposed API.
adithyas
2016/12/08 15:12:11
This function is private, the web exposed API is i
| |
| 133 | |
| 134 Metrics getMetrics(); | |
| 135 AnimationParameters getAnimationParameters(); | |
| 136 AtomicString createTransform(double value) const; | |
| 137 | |
| 138 static const int kDefaultScrollAmount = 6; | |
| 139 static const int kDefaultScrollDelayMS = 85; | |
| 140 static const int kMinimumScrollDelayMS = 60; | |
| 141 static const int kDefaultLoopLimit = -1; | |
| 142 | |
| 143 int m_continueCallbackRequestId = 0; | |
| 144 int m_loopCount = 0; | |
| 145 Member<Element> m_mover; | |
| 146 Member<Animation> m_player; | |
| 47 }; | 147 }; |
| 48 | 148 |
| 49 } // namespace blink | 149 } // namespace blink |
| 50 | 150 |
| 51 #endif // HTMLMarqueeElement_h | 151 #endif // HTMLMarqueeElement_h |
| OLD | NEW |