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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 int ScrollbarThemeOverlay::scrollbarMargin() const | 66 int ScrollbarThemeOverlay::scrollbarMargin() const |
67 { | 67 { |
68 return m_scrollbarMargin; | 68 return m_scrollbarMargin; |
69 } | 69 } |
70 | 70 |
71 bool ScrollbarThemeOverlay::usesOverlayScrollbars() const | 71 bool ScrollbarThemeOverlay::usesOverlayScrollbars() const |
72 { | 72 { |
73 return true; | 73 return true; |
74 } | 74 } |
75 | 75 |
76 int ScrollbarThemeOverlay::thumbPosition(const ScrollbarThemeClient& scrollbar) | 76 int ScrollbarThemeOverlay::thumbPosition(const ScrollbarThemeClient& scrollbar,
float scrollPosition) |
77 { | 77 { |
78 if (!scrollbar.totalSize()) | 78 if (!scrollbar.totalSize()) |
79 return 0; | 79 return 0; |
80 | 80 |
81 int trackLen = trackLength(scrollbar); | 81 int trackLen = trackLength(scrollbar); |
82 float proportion = static_cast<float>(scrollbar.currentPos()) / scrollbar.to
talSize(); | 82 float proportion = static_cast<float>(scrollPosition) / scrollbar.totalSize(
); |
83 return round(proportion * trackLen); | 83 return round(proportion * trackLen); |
84 } | 84 } |
85 | 85 |
86 int ScrollbarThemeOverlay::thumbLength(const ScrollbarThemeClient& scrollbar) | 86 int ScrollbarThemeOverlay::thumbLength(const ScrollbarThemeClient& scrollbar) |
87 { | 87 { |
88 int trackLen = trackLength(scrollbar); | 88 int trackLen = trackLength(scrollbar); |
89 | 89 |
90 if (!scrollbar.totalSize()) | 90 if (!scrollbar.totalSize()) |
91 return trackLen; | 91 return trackLen; |
92 | 92 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 return ScrollbarTheme::hitTest(scrollbar, position); | 171 return ScrollbarTheme::hitTest(scrollbar, position); |
172 } | 172 } |
173 | 173 |
174 ScrollbarThemeOverlay& ScrollbarThemeOverlay::mobileTheme() | 174 ScrollbarThemeOverlay& ScrollbarThemeOverlay::mobileTheme() |
175 { | 175 { |
176 DEFINE_STATIC_LOCAL(ScrollbarThemeOverlay, theme, (3, 3, ScrollbarThemeOverl
ay::DisallowHitTest, Color(128, 128, 128, 128))); | 176 DEFINE_STATIC_LOCAL(ScrollbarThemeOverlay, theme, (3, 3, ScrollbarThemeOverl
ay::DisallowHitTest, Color(128, 128, 128, 128))); |
177 return theme; | 177 return theme; |
178 } | 178 } |
179 | 179 |
180 } // namespace blink | 180 } // namespace blink |
OLD | NEW |