Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(164)

Side by Side Diff: third_party/WebKit/Source/platform/scroll/ScrollbarTheme.cpp

Issue 2467693002: Implement overlay scrollbar fade out for non-composited scrollers. (Closed)
Patch Set: sigh....git cl format Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 // On Mac, fading is controlled by the painting code in ScrollAnimatorMac.
238 return 0.0;
239 }
240
241 double ScrollbarTheme::overlayScrollbarFadeOutDurationSeconds() const {
242 // On Mac, fading is controlled by the painting code in ScrollAnimatorMac.
243 return 0.0;
244 }
245
236 int ScrollbarTheme::thumbPosition(const ScrollbarThemeClient& scrollbar, 246 int ScrollbarTheme::thumbPosition(const ScrollbarThemeClient& scrollbar,
237 float scrollPosition) { 247 float scrollPosition) {
238 if (scrollbar.enabled()) { 248 if (scrollbar.enabled()) {
239 float size = scrollbar.totalSize() - scrollbar.visibleSize(); 249 float size = scrollbar.totalSize() - scrollbar.visibleSize();
240 // Avoid doing a floating point divide by zero and return 1 when 250 // Avoid doing a floating point divide by zero and return 1 when
241 // usedTotalSize == visibleSize. 251 // usedTotalSize == visibleSize.
242 if (!size) 252 if (!size)
243 return 0; 253 return 0;
244 float pos = std::max(0.0f, scrollPosition) * 254 float pos = std::max(0.0f, scrollPosition) *
245 (trackLength(scrollbar) - thumbLength(scrollbar)) / size; 255 (trackLength(scrollbar) - thumbLength(scrollbar)) / size;
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 return DisplayItem::kScrollbarBackTrack; 391 return DisplayItem::kScrollbarBackTrack;
382 case ForwardTrackPart: 392 case ForwardTrackPart:
383 return DisplayItem::kScrollbarForwardTrack; 393 return DisplayItem::kScrollbarForwardTrack;
384 default: 394 default:
385 ASSERT_NOT_REACHED(); 395 ASSERT_NOT_REACHED();
386 return DisplayItem::kScrollbarBackTrack; 396 return DisplayItem::kScrollbarBackTrack;
387 } 397 }
388 } 398 }
389 399
390 } // namespace blink 400 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698