OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2006 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2004, 2006 Apple Computer, 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
11 * documentation and/or other materials provided with the distribution. | 11 * documentation and/or other materials provided with the distribution. |
12 * | 12 * |
13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY | 13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY |
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR | 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR |
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 */ | 24 */ |
25 | 25 |
26 #ifndef Scrollbar_h | 26 #ifndef Scrollbar_h |
27 #define Scrollbar_h | 27 #define Scrollbar_h |
28 | 28 |
29 #include "platform/FrameViewBase.h" | |
30 #include "platform/Timer.h" | 29 #include "platform/Timer.h" |
31 #include "platform/graphics/paint/DisplayItem.h" | 30 #include "platform/graphics/paint/DisplayItem.h" |
32 #include "platform/heap/Handle.h" | 31 #include "platform/heap/Handle.h" |
33 #include "platform/scroll/ScrollTypes.h" | 32 #include "platform/scroll/ScrollTypes.h" |
34 #include "platform/scroll/ScrollbarThemeClient.h" | 33 #include "platform/scroll/ScrollbarThemeClient.h" |
35 #include "platform/wtf/MathExtras.h" | 34 #include "platform/wtf/MathExtras.h" |
36 | 35 |
37 namespace blink { | 36 namespace blink { |
38 | 37 |
39 class CullRect; | 38 class CullRect; |
(...skipping 28 matching lines...) Expand all Loading... |
68 ~Scrollbar() override; | 67 ~Scrollbar() override; |
69 | 68 |
70 // ScrollbarThemeClient implementation. | 69 // ScrollbarThemeClient implementation. |
71 int X() const override { return frame_rect_.X(); } | 70 int X() const override { return frame_rect_.X(); } |
72 int Y() const override { return frame_rect_.Y(); } | 71 int Y() const override { return frame_rect_.Y(); } |
73 int Width() const override { return frame_rect_.Width(); } | 72 int Width() const override { return frame_rect_.Width(); } |
74 int Height() const override { return frame_rect_.Height(); } | 73 int Height() const override { return frame_rect_.Height(); } |
75 IntSize Size() const override { return frame_rect_.Size(); } | 74 IntSize Size() const override { return frame_rect_.Size(); } |
76 IntPoint Location() const override { return frame_rect_.Location(); } | 75 IntPoint Location() const override { return frame_rect_.Location(); } |
77 | 76 |
78 virtual void SetParent(FrameViewBase* parent) { parent_ = parent; } | |
79 FrameViewBase* Parent() const { return parent_; } | |
80 | |
81 void SetFrameRect(const IntRect&); | 77 void SetFrameRect(const IntRect&); |
82 IntRect FrameRect() const override { return frame_rect_; } | 78 IntRect FrameRect() const override { return frame_rect_; } |
83 | 79 |
84 ScrollbarOverlayColorTheme GetScrollbarOverlayColorTheme() const override; | 80 ScrollbarOverlayColorTheme GetScrollbarOverlayColorTheme() const override; |
85 void GetTickmarks(Vector<IntRect>&) const override; | 81 void GetTickmarks(Vector<IntRect>&) const override; |
86 bool IsScrollableAreaActive() const override; | 82 bool IsScrollableAreaActive() const override; |
87 | 83 |
88 IntPoint ConvertFromRootFrame( | 84 IntPoint ConvertFromRootFrame(const IntPoint&) const override; |
89 const IntPoint& point_in_root_frame) const override; | |
90 | 85 |
91 bool IsCustomScrollbar() const override { return false; } | 86 bool IsCustomScrollbar() const override { return false; } |
92 ScrollbarOrientation Orientation() const override { return orientation_; } | 87 ScrollbarOrientation Orientation() const override { return orientation_; } |
93 bool IsLeftSideVerticalScrollbar() const override; | 88 bool IsLeftSideVerticalScrollbar() const override; |
94 | 89 |
95 int Value() const override { return lroundf(current_pos_); } | 90 int Value() const override { return lroundf(current_pos_); } |
96 float CurrentPos() const override { return current_pos_; } | 91 float CurrentPos() const override { return current_pos_; } |
97 int VisibleSize() const override { return visible_size_; } | 92 int VisibleSize() const override { return visible_size_; } |
98 int TotalSize() const override { return total_size_; } | 93 int TotalSize() const override { return total_size_; } |
99 int Maximum() const override { return total_size_ - visible_size_; } | 94 int Maximum() const override { return total_size_ - visible_size_; } |
(...skipping 10 matching lines...) Expand all Loading... |
110 // This returns device-scale-factor-aware pixel value. | 105 // This returns device-scale-factor-aware pixel value. |
111 // e.g. 15 in dsf=1.0, 30 in dsf=2.0. | 106 // e.g. 15 in dsf=1.0, 30 in dsf=2.0. |
112 // This returns 0 for overlay scrollbars. | 107 // This returns 0 for overlay scrollbars. |
113 // See also ScrolbarTheme::scrollbatThickness(). | 108 // See also ScrolbarTheme::scrollbatThickness(). |
114 int ScrollbarThickness() const; | 109 int ScrollbarThickness() const; |
115 | 110 |
116 // Called by the ScrollableArea when the scroll offset changes. | 111 // Called by the ScrollableArea when the scroll offset changes. |
117 // Will trigger paint invalidation if required. | 112 // Will trigger paint invalidation if required. |
118 void OffsetDidChange(); | 113 void OffsetDidChange(); |
119 | 114 |
120 void DisconnectFromScrollableArea(); | 115 virtual void DisconnectFromScrollableArea(); |
121 ScrollableArea* GetScrollableArea() const { return scrollable_area_; } | 116 ScrollableArea* GetScrollableArea() const { return scrollable_area_; } |
122 | 117 |
123 int PressedPos() const { return pressed_pos_; } | 118 int PressedPos() const { return pressed_pos_; } |
124 | 119 |
125 virtual void SetHoveredPart(ScrollbarPart); | 120 virtual void SetHoveredPart(ScrollbarPart); |
126 virtual void SetPressedPart(ScrollbarPart); | 121 virtual void SetPressedPart(ScrollbarPart); |
127 | 122 |
128 void SetProportion(int visible_size, int total_size); | 123 void SetProportion(int visible_size, int total_size); |
129 void SetPressedPos(int p) { pressed_pos_ = p; } | 124 void SetPressedPos(int p) { pressed_pos_ = p; } |
130 | 125 |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 } | 240 } |
246 | 241 |
247 float ScrollableAreaCurrentPos() const; | 242 float ScrollableAreaCurrentPos() const; |
248 float ScrollableAreaTargetPos() const; | 243 float ScrollableAreaTargetPos() const; |
249 bool ThumbWillBeUnderMouse() const; | 244 bool ThumbWillBeUnderMouse() const; |
250 | 245 |
251 int theme_scrollbar_thickness_; | 246 int theme_scrollbar_thickness_; |
252 bool track_needs_repaint_; | 247 bool track_needs_repaint_; |
253 bool thumb_needs_repaint_; | 248 bool thumb_needs_repaint_; |
254 LayoutRect visual_rect_; | 249 LayoutRect visual_rect_; |
255 Member<FrameViewBase> parent_; | |
256 IntRect frame_rect_; | 250 IntRect frame_rect_; |
257 }; | 251 }; |
258 | 252 |
259 } // namespace blink | 253 } // namespace blink |
260 | 254 |
261 #endif // Scrollbar_h | 255 #endif // Scrollbar_h |
OLD | NEW |