OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2011 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2011 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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
226 bool ScrollbarTheme::shouldSnapBackToDragOrigin( | 226 bool ScrollbarTheme::shouldSnapBackToDragOrigin( |
227 const ScrollbarThemeClient& scrollbar, | 227 const ScrollbarThemeClient& scrollbar, |
228 const PlatformMouseEvent& evt) { | 228 const PlatformMouseEvent& evt) { |
229 IntPoint mousePosition = scrollbar.convertFromRootFrame(evt.position()); | 229 IntPoint mousePosition = scrollbar.convertFromRootFrame(evt.position()); |
230 mousePosition.move(scrollbar.x(), scrollbar.y()); | 230 mousePosition.move(scrollbar.x(), scrollbar.y()); |
231 return Platform::current()->scrollbarBehavior()->shouldSnapBackToDragOrigin( | 231 return Platform::current()->scrollbarBehavior()->shouldSnapBackToDragOrigin( |
232 mousePosition, trackRect(scrollbar), | 232 mousePosition, trackRect(scrollbar), |
233 scrollbar.orientation() == HorizontalScrollbar); | 233 scrollbar.orientation() == HorizontalScrollbar); |
234 } | 234 } |
235 | 235 |
236 double ScrollbarTheme::overlayScrollbarFadeOutDelaySeconds() const { | |
237 DCHECK(usesOverlayScrollbars()); | |
238 #if !OS(MACOSX) | |
skobes
2016/11/02 21:02:43
Override in ScrollbarThemeMac instead of using #if
bokan
2016/11/02 22:41:57
Can't since WebThemeEngine.h is conditionally incl
| |
239 return Platform::current() | |
240 ->themeEngine() | |
241 ->getOverlayScrollbarFadeOutDelaySeconds(); | |
242 #else | |
243 // On Mac, fading is controlled by the painting code in ScrollAnimatorMac. | |
244 return 0.0; | |
245 #endif | |
246 } | |
247 | |
248 double ScrollbarTheme::overlayScrollbarFadeOutDurationSeconds() const { | |
249 DCHECK(usesOverlayScrollbars()); | |
250 #if !OS(MACOSX) | |
251 return Platform::current() | |
252 ->themeEngine() | |
253 ->getOverlayScrollbarFadeOutDurationSeconds(); | |
254 #else | |
255 // On Mac, fading is controlled by the painting code in ScrollAnimatorMac. | |
256 return 0.0; | |
257 #endif | |
258 } | |
259 | |
236 int ScrollbarTheme::thumbPosition(const ScrollbarThemeClient& scrollbar, | 260 int ScrollbarTheme::thumbPosition(const ScrollbarThemeClient& scrollbar, |
237 float scrollPosition) { | 261 float scrollPosition) { |
238 if (scrollbar.enabled()) { | 262 if (scrollbar.enabled()) { |
239 float size = scrollbar.totalSize() - scrollbar.visibleSize(); | 263 float size = scrollbar.totalSize() - scrollbar.visibleSize(); |
240 // Avoid doing a floating point divide by zero and return 1 when | 264 // Avoid doing a floating point divide by zero and return 1 when |
241 // usedTotalSize == visibleSize. | 265 // usedTotalSize == visibleSize. |
242 if (!size) | 266 if (!size) |
243 return 0; | 267 return 0; |
244 float pos = std::max(0.0f, scrollPosition) * | 268 float pos = std::max(0.0f, scrollPosition) * |
245 (trackLength(scrollbar) - thumbLength(scrollbar)) / size; | 269 (trackLength(scrollbar) - thumbLength(scrollbar)) / size; |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
381 return DisplayItem::kScrollbarBackTrack; | 405 return DisplayItem::kScrollbarBackTrack; |
382 case ForwardTrackPart: | 406 case ForwardTrackPart: |
383 return DisplayItem::kScrollbarForwardTrack; | 407 return DisplayItem::kScrollbarForwardTrack; |
384 default: | 408 default: |
385 ASSERT_NOT_REACHED(); | 409 ASSERT_NOT_REACHED(); |
386 return DisplayItem::kScrollbarBackTrack; | 410 return DisplayItem::kScrollbarBackTrack; |
387 } | 411 } |
388 } | 412 } |
389 | 413 |
390 } // namespace blink | 414 } // namespace blink |
OLD | NEW |