OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2010, Google Inc. All rights reserved. | 2 * Copyright (c) 2010, Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 23 matching lines...) Expand all Loading... |
34 #include "ScrollTypes.h" | 34 #include "ScrollTypes.h" |
35 | 35 |
36 namespace WebCore { | 36 namespace WebCore { |
37 | 37 |
38 class ScrollbarClient; | 38 class ScrollbarClient; |
39 | 39 |
40 class ScrollAnimator { | 40 class ScrollAnimator { |
41 public: | 41 public: |
42 static ScrollAnimator* create(ScrollbarClient*); | 42 static ScrollAnimator* create(ScrollbarClient*); |
43 | 43 |
44 ScrollAnimator(ScrollbarClient* client) : m_client(client) { } | 44 ScrollAnimator(ScrollbarClient* client); |
45 virtual ~ScrollAnimator() { } | 45 virtual ~ScrollAnimator(); |
46 | 46 |
47 // Computes a scroll destination for the given parameters. Returns false if | 47 // Computes a scroll destination for the given parameters. Returns false if |
48 // already at the destination. Otherwise, starts scrolling towards the | 48 // already at the destination. Otherwise, starts scrolling towards the |
49 // destination and returns true. Scrolling may be immediate or animated. | 49 // destination and returns true. Scrolling may be immediate or animated. |
50 // The base class implementation always scrolls immediately, never animates. | 50 // The base class implementation always scrolls immediately, never animates. |
51 virtual bool scroll(ScrollbarOrientation, ScrollGranularity, float step, flo
at multiplier); | 51 virtual bool scroll(ScrollbarOrientation, ScrollGranularity, float step, flo
at multiplier); |
52 | 52 |
53 // Stops any animation in the given direction and updates the ScrollAnimator | 53 // Stops any animation in the given direction and updates the ScrollAnimator |
54 // with the current scroll position. This does not cause a callback to the | 54 // with the current scroll position. This does not cause a callback to the |
55 // ScrollbarClient. | 55 // ScrollbarClient. |
56 virtual void setScrollPositionAndStopAnimation(ScrollbarOrientation, float); | 56 virtual void setScrollPositionAndStopAnimation(ScrollbarOrientation, float); |
57 | 57 |
58 protected: | 58 protected: |
59 ScrollbarClient* m_client; | 59 ScrollbarClient* m_client; |
60 float m_currentPosX; // We avoid using a FloatPoint in order to reduce | 60 float m_currentPosX; // We avoid using a FloatPoint in order to reduce |
61 float m_currentPosY; // subclass code complexity. | 61 float m_currentPosY; // subclass code complexity. |
62 }; | 62 }; |
63 | 63 |
64 } // namespace WebCore | 64 } // namespace WebCore |
65 #endif | 65 #endif |
OLD | NEW |