OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2006, 2008 Apple 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 |
(...skipping 11 matching lines...) Expand all Loading... |
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 #include "config.h" | 26 #include "config.h" |
27 #include "platform/scroll/Scrollbar.h" | 27 #include "platform/scroll/Scrollbar.h" |
28 | 28 |
29 #include <algorithm> | 29 #include <algorithm> |
30 #include "platform/PlatformGestureEvent.h" | 30 #include "platform/PlatformGestureEvent.h" |
31 #include "platform/PlatformMouseEvent.h" | 31 #include "platform/PlatformMouseEvent.h" |
| 32 #include "platform/graphics/paint/CullRect.h" |
32 #include "platform/scroll/ScrollAnimator.h" | 33 #include "platform/scroll/ScrollAnimator.h" |
33 #include "platform/scroll/ScrollableArea.h" | 34 #include "platform/scroll/ScrollableArea.h" |
34 #include "platform/scroll/ScrollbarTheme.h" | 35 #include "platform/scroll/ScrollbarTheme.h" |
35 | 36 |
36 #if ((OS(POSIX) && !OS(MACOSX)) || OS(WIN)) | 37 #if ((OS(POSIX) && !OS(MACOSX)) || OS(WIN)) |
37 // The position of the scrollbar thumb affects the appearance of the steppers, s
o | 38 // The position of the scrollbar thumb affects the appearance of the steppers, s
o |
38 // when the thumb moves, we have to invalidate them for painting. | 39 // when the thumb moves, we have to invalidate them for painting. |
39 #define THUMB_POSITION_AFFECTS_BUTTONS | 40 #define THUMB_POSITION_AFFECTS_BUTTONS |
40 #endif | 41 #endif |
41 | 42 |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 void Scrollbar::updateThumbPosition() | 170 void Scrollbar::updateThumbPosition() |
170 { | 171 { |
171 updateThumb(); | 172 updateThumb(); |
172 } | 173 } |
173 | 174 |
174 void Scrollbar::updateThumbProportion() | 175 void Scrollbar::updateThumbProportion() |
175 { | 176 { |
176 updateThumb(); | 177 updateThumb(); |
177 } | 178 } |
178 | 179 |
179 void Scrollbar::paint(GraphicsContext* context, const IntRect& damageRect) const | 180 void Scrollbar::paint(GraphicsContext* context, const CullRect& cullRect) const |
180 { | 181 { |
181 if (!frameRect().intersects(damageRect)) | 182 if (!cullRect.intersectsCullRect(frameRect())) |
182 return; | 183 return; |
183 | 184 |
184 if (!theme()->paint(this, context, damageRect)) | 185 if (!theme()->paint(this, context, cullRect)) |
185 Widget::paint(context, damageRect); | 186 Widget::paint(context, cullRect); |
186 } | 187 } |
187 | 188 |
188 void Scrollbar::autoscrollTimerFired(Timer<Scrollbar>*) | 189 void Scrollbar::autoscrollTimerFired(Timer<Scrollbar>*) |
189 { | 190 { |
190 autoscrollPressedPart(theme()->autoscrollTimerDelay()); | 191 autoscrollPressedPart(theme()->autoscrollTimerDelay()); |
191 } | 192 } |
192 | 193 |
193 static bool thumbUnderMouse(Scrollbar* scrollbar) | 194 static bool thumbUnderMouse(Scrollbar* scrollbar) |
194 { | 195 { |
195 int thumbPos = scrollbar->theme()->trackPosition(scrollbar) + scrollbar->the
me()->thumbPosition(scrollbar); | 196 int thumbPos = scrollbar->theme()->trackPosition(scrollbar) + scrollbar->the
me()->thumbPosition(scrollbar); |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 if (!m_scrollableArea) | 557 if (!m_scrollableArea) |
557 return 0; | 558 return 0; |
558 | 559 |
559 if (m_orientation == HorizontalScrollbar) | 560 if (m_orientation == HorizontalScrollbar) |
560 return m_scrollableArea->scrollPosition().x() - m_scrollableArea->minimu
mScrollPosition().x(); | 561 return m_scrollableArea->scrollPosition().x() - m_scrollableArea->minimu
mScrollPosition().x(); |
561 | 562 |
562 return m_scrollableArea->scrollPosition().y() - m_scrollableArea->minimumScr
ollPosition().y(); | 563 return m_scrollableArea->scrollPosition().y() - m_scrollableArea->minimumScr
ollPosition().y(); |
563 } | 564 } |
564 | 565 |
565 } // namespace blink | 566 } // namespace blink |
OLD | NEW |