OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 18 matching lines...) Expand all Loading... |
29 #include "platform/PlatformMouseEvent.h" | 29 #include "platform/PlatformMouseEvent.h" |
30 #include "platform/graphics/GraphicsContext.h" | 30 #include "platform/graphics/GraphicsContext.h" |
31 #include "platform/scroll/ScrollbarThemeClient.h" | 31 #include "platform/scroll/ScrollbarThemeClient.h" |
32 #include "platform/transforms/TransformationMatrix.h" | 32 #include "platform/transforms/TransformationMatrix.h" |
33 #include "public/platform/Platform.h" | 33 #include "public/platform/Platform.h" |
34 #include "public/platform/WebRect.h" | 34 #include "public/platform/WebRect.h" |
35 #include "public/platform/WebThemeEngine.h" | 35 #include "public/platform/WebThemeEngine.h" |
36 | 36 |
37 #include <algorithm> | 37 #include <algorithm> |
38 | 38 |
39 using namespace std; | |
40 | |
41 namespace blink { | 39 namespace blink { |
42 | 40 |
43 ScrollbarThemeOverlay::ScrollbarThemeOverlay(int thumbThickness, int scrollbarMa
rgin, HitTestBehavior allowHitTest, Color color) | 41 ScrollbarThemeOverlay::ScrollbarThemeOverlay(int thumbThickness, int scrollbarMa
rgin, HitTestBehavior allowHitTest, Color color) |
44 : ScrollbarTheme() | 42 : ScrollbarTheme() |
45 , m_thumbThickness(thumbThickness) | 43 , m_thumbThickness(thumbThickness) |
46 , m_scrollbarMargin(scrollbarMargin) | 44 , m_scrollbarMargin(scrollbarMargin) |
47 , m_allowHitTest(allowHitTest) | 45 , m_allowHitTest(allowHitTest) |
48 , m_color(color) | 46 , m_color(color) |
49 , m_useSolidColor(true) | 47 , m_useSolidColor(true) |
50 { | 48 { |
(...skipping 30 matching lines...) Expand all Loading... |
81 | 79 |
82 int ScrollbarThemeOverlay::thumbLength(ScrollbarThemeClient* scrollbar) | 80 int ScrollbarThemeOverlay::thumbLength(ScrollbarThemeClient* scrollbar) |
83 { | 81 { |
84 int trackLen = trackLength(scrollbar); | 82 int trackLen = trackLength(scrollbar); |
85 | 83 |
86 if (!scrollbar->totalSize()) | 84 if (!scrollbar->totalSize()) |
87 return trackLen; | 85 return trackLen; |
88 | 86 |
89 float proportion = static_cast<float>(scrollbar->visibleSize()) / scrollbar-
>totalSize(); | 87 float proportion = static_cast<float>(scrollbar->visibleSize()) / scrollbar-
>totalSize(); |
90 int length = round(proportion * trackLen); | 88 int length = round(proportion * trackLen); |
91 length = min(max(length, minimumThumbLength(scrollbar)), trackLen); | 89 length = std::min(std::max(length, minimumThumbLength(scrollbar)), trackLen)
; |
92 return length; | 90 return length; |
93 } | 91 } |
94 | 92 |
95 bool ScrollbarThemeOverlay::hasThumb(ScrollbarThemeClient* scrollbar) | 93 bool ScrollbarThemeOverlay::hasThumb(ScrollbarThemeClient* scrollbar) |
96 { | 94 { |
97 return true; | 95 return true; |
98 } | 96 } |
99 | 97 |
100 IntRect ScrollbarThemeOverlay::backButtonRect(ScrollbarThemeClient*, ScrollbarPa
rt, bool) | 98 IntRect ScrollbarThemeOverlay::backButtonRect(ScrollbarThemeClient*, ScrollbarPa
rt, bool) |
101 { | 99 { |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 | 153 |
156 ScrollbarPart ScrollbarThemeOverlay::hitTest(ScrollbarThemeClient* scrollbar, co
nst IntPoint& position) | 154 ScrollbarPart ScrollbarThemeOverlay::hitTest(ScrollbarThemeClient* scrollbar, co
nst IntPoint& position) |
157 { | 155 { |
158 if (m_allowHitTest == DisallowHitTest) | 156 if (m_allowHitTest == DisallowHitTest) |
159 return NoPart; | 157 return NoPart; |
160 | 158 |
161 return ScrollbarTheme::hitTest(scrollbar, position); | 159 return ScrollbarTheme::hitTest(scrollbar, position); |
162 } | 160 } |
163 | 161 |
164 } // namespace blink | 162 } // namespace blink |
OLD | NEW |