simon.fraser@apple.com | 6a1316d | 2008-08-07 21:55:37 +0000 | [diff] [blame] | 1 | /* |
mjs@apple.com | 9204733 | 2014-03-15 04:08:27 +0000 | [diff] [blame] | 2 | * Copyright (C) 2003 Apple Inc. |
simon.fraser@apple.com | 6a1316d | 2008-08-07 21:55:37 +0000 | [diff] [blame] | 3 | * |
| 4 | * Portions are Copyright (C) 1998 Netscape Communications Corporation. |
| 5 | * |
| 6 | * Other contributors: |
| 7 | * Robert O'Callahan <roc+@cs.cmu.edu> |
| 8 | * David Baron <dbaron@fas.harvard.edu> |
| 9 | * Christian Biesinger <cbiesinger@web.de> |
| 10 | * Randall Jesup <rjesup@wgate.com> |
| 11 | * Roland Mainz <roland.mainz@informatik.med.uni-giessen.de> |
| 12 | * Josh Soref <timeless@mac.com> |
| 13 | * Boris Zbarsky <bzbarsky@mit.edu> |
| 14 | * |
| 15 | * This library is free software; you can redistribute it and/or |
| 16 | * modify it under the terms of the GNU Lesser General Public |
| 17 | * License as published by the Free Software Foundation; either |
| 18 | * version 2.1 of the License, or (at your option) any later version. |
| 19 | * |
| 20 | * This library is distributed in the hope that it will be useful, |
| 21 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 22 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 23 | * Lesser General Public License for more details. |
| 24 | * |
| 25 | * You should have received a copy of the GNU Lesser General Public |
| 26 | * License along with this library; if not, write to the Free Software |
| 27 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 28 | * |
| 29 | * Alternatively, the contents of this file may be used under the terms |
| 30 | * of either the Mozilla Public License Version 1.1, found at |
| 31 | * http://www.mozilla.org/MPL/ (the "MPL") or the GNU General Public |
| 32 | * License Version 2.0, found at http://www.fsf.org/copyleft/gpl.html |
| 33 | * (the "GPL"), in which case the provisions of the MPL or the GPL are |
| 34 | * applicable instead of those above. If you wish to allow use of your |
| 35 | * version of this file only under the terms of one of those two |
| 36 | * licenses (the MPL or the GPL) and not to allow others to use your |
| 37 | * version of this file under the LGPL, indicate your decision by |
| 38 | * deletingthe provisions above and replace them with the notice and |
| 39 | * other provisions required by the MPL or the GPL, as the case may be. |
| 40 | * If you do not delete the provisions above, a recipient may use your |
| 41 | * version of this file under any of the LGPL, the MPL or the GPL. |
| 42 | */ |
| 43 | |
commit-queue@webkit.org | 46c0f52 | 2016-11-13 10:05:43 +0000 | [diff] [blame] | 44 | #pragma once |
simon.fraser@apple.com | 6a1316d | 2008-08-07 21:55:37 +0000 | [diff] [blame] | 45 | |
weinig@apple.com | b0999b8 | 2009-02-04 23:20:07 +0000 | [diff] [blame] | 46 | #include "Length.h" |
| 47 | #include "RenderStyleConstants.h" |
simon.fraser@apple.com | 6a1316d | 2008-08-07 21:55:37 +0000 | [diff] [blame] | 48 | #include "Timer.h" |
| 49 | |
| 50 | namespace WebCore { |
| 51 | |
| 52 | class RenderLayer; |
| 53 | |
zalan@apple.com | 0272a65 | 2016-03-16 01:51:12 +0000 | [diff] [blame] | 54 | // This class handles the auto-scrolling for <marquee> |
cdumez@apple.com | d563e1d | 2014-10-23 04:32:27 +0000 | [diff] [blame] | 55 | class RenderMarquee final { |
ossy@webkit.org | 95c1bc4 | 2011-01-20 16:30:54 +0000 | [diff] [blame] | 56 | WTF_MAKE_NONCOPYABLE(RenderMarquee); WTF_MAKE_FAST_ALLOCATED; |
simon.fraser@apple.com | 6a1316d | 2008-08-07 21:55:37 +0000 | [diff] [blame] | 57 | public: |
commit-queue@webkit.org | 7538c25 | 2010-10-09 02:00:07 +0000 | [diff] [blame] | 58 | explicit RenderMarquee(RenderLayer*); |
cdumez@apple.com | d563e1d | 2014-10-23 04:32:27 +0000 | [diff] [blame] | 59 | ~RenderMarquee(); |
simon.fraser@apple.com | 6a1316d | 2008-08-07 21:55:37 +0000 | [diff] [blame] | 60 | |
| 61 | int speed() const { return m_speed; } |
| 62 | int marqueeSpeed() const; |
| 63 | |
| 64 | EMarqueeDirection reverseDirection() const { return static_cast<EMarqueeDirection>(-direction()); } |
| 65 | EMarqueeDirection direction() const; |
| 66 | |
| 67 | bool isHorizontal() const; |
| 68 | |
| 69 | int computePosition(EMarqueeDirection, bool stopAtClientEdge); |
| 70 | |
| 71 | void setEnd(int end) { m_end = end; } |
| 72 | |
| 73 | void start(); |
| 74 | void suspend(); |
| 75 | void stop(); |
| 76 | |
| 77 | void updateMarqueeStyle(); |
| 78 | void updateMarqueePosition(); |
| 79 | |
| 80 | private: |
andersca@apple.com | 574a745 | 2014-11-21 20:10:13 +0000 | [diff] [blame] | 81 | void timerFired(); |
simon.fraser@apple.com | 6a1316d | 2008-08-07 21:55:37 +0000 | [diff] [blame] | 82 | |
| 83 | RenderLayer* m_layer; |
| 84 | int m_currentLoop; |
| 85 | int m_totalLoops; |
jer.noble@apple.com | 50862fe | 2014-11-06 23:06:03 +0000 | [diff] [blame] | 86 | Timer m_timer; |
simon.fraser@apple.com | 6a1316d | 2008-08-07 21:55:37 +0000 | [diff] [blame] | 87 | int m_start; |
| 88 | int m_end; |
| 89 | int m_speed; |
| 90 | Length m_height; |
| 91 | bool m_reset: 1; |
| 92 | bool m_suspended : 1; |
| 93 | bool m_stopped : 1; |
bfulgham@apple.com | 9c9b8a1 | 2014-06-24 19:49:25 +0000 | [diff] [blame] | 94 | EMarqueeDirection m_direction : 4; // Not unsigned because EMarqueeDirection has negative values |
simon.fraser@apple.com | 6a1316d | 2008-08-07 21:55:37 +0000 | [diff] [blame] | 95 | }; |
| 96 | |
| 97 | } // namespace WebCore |