Chromium Code Reviews| 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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 267 return (pos < 1 && pos > 0) ? 1 : pos; | 267 return (pos < 1 && pos > 0) ? 1 : pos; |
| 268 } | 268 } |
| 269 return 0; | 269 return 0; |
| 270 } | 270 } |
| 271 | 271 |
| 272 int ScrollbarTheme::thumbLength(ScrollbarThemeClient* scrollbar) | 272 int ScrollbarTheme::thumbLength(ScrollbarThemeClient* scrollbar) |
| 273 { | 273 { |
| 274 if (!scrollbar->enabled()) | 274 if (!scrollbar->enabled()) |
| 275 return 0; | 275 return 0; |
| 276 | 276 |
| 277 // It is safe to compute the overhang by adding the result from the main | |
| 278 // thread overscroll mode (first) // and then adding the result from | |
|
Ken Russell (switch to Gerrit)
2014/12/22 23:46:08
Reformat this comment.
ccameron
2014/12/22 23:57:23
Done.
| |
| 279 // compositor thread overscroll (second) because the modes are mutually | |
| 280 // exclusive modes (determining which mode is in use here will require lots | |
|
Ken Russell (switch to Gerrit)
2014/12/22 23:46:08
"modes are mutually exclusive"
ccameron
2014/12/22 23:57:23
Done.
| |
| 281 // of temporary plumbing, and the main thread mode is to be deleted). | |
| 277 float overhang = 0; | 282 float overhang = 0; |
| 278 if (scrollbar->currentPos() < 0) | 283 if (scrollbar->currentPos() < 0) |
| 279 overhang = -scrollbar->currentPos(); | 284 overhang = -scrollbar->currentPos(); |
| 280 else if (scrollbar->visibleSize() + scrollbar->currentPos() > scrollbar->tot alSize()) | 285 else if (scrollbar->visibleSize() + scrollbar->currentPos() > scrollbar->tot alSize()) |
| 281 overhang = scrollbar->currentPos() + scrollbar->visibleSize() - scrollba r->totalSize(); | 286 overhang = scrollbar->currentPos() + scrollbar->visibleSize() - scrollba r->totalSize(); |
| 287 overhang += fabsf(scrollbar->elasticOverscroll()); | |
| 282 float proportion = 0.0f; | 288 float proportion = 0.0f; |
| 283 float totalSize = usedTotalSize(scrollbar); | 289 float totalSize = usedTotalSize(scrollbar); |
| 284 if (totalSize > 0.0f) { | 290 if (totalSize > 0.0f) { |
| 285 proportion = (scrollbar->visibleSize() - overhang) / totalSize; | 291 proportion = (scrollbar->visibleSize() - overhang) / totalSize; |
| 286 } | 292 } |
| 287 int trackLen = trackLength(scrollbar); | 293 int trackLen = trackLength(scrollbar); |
| 288 int length = round(proportion * trackLen); | 294 int length = round(proportion * trackLen); |
| 289 length = std::max(length, minimumThumbLength(scrollbar)); | 295 length = std::max(length, minimumThumbLength(scrollbar)); |
| 290 if (length > trackLen) | 296 if (length > trackLen) |
| 291 length = 0; // Once the thumb is below the track length, it just goes aw ay (to make more room for the track). | 297 length = 0; // Once the thumb is below the track length, it just goes aw ay (to make more room for the track). |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 364 { | 370 { |
| 365 gMockScrollbarsEnabled = flag; | 371 gMockScrollbarsEnabled = flag; |
| 366 } | 372 } |
| 367 | 373 |
| 368 bool ScrollbarTheme::mockScrollbarsEnabled() | 374 bool ScrollbarTheme::mockScrollbarsEnabled() |
| 369 { | 375 { |
| 370 return gMockScrollbarsEnabled; | 376 return gMockScrollbarsEnabled; |
| 371 } | 377 } |
| 372 | 378 |
| 373 } // namespace blink | 379 } // namespace blink |
| OLD | NEW |