OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2010, Google Inc. All rights reserved. | 2 * Copyright (c) 2010, Google Inc. All rights reserved. |
3 * Copyright (C) 2008, 2011 Apple Inc. All Rights Reserved. | 3 * Copyright (C) 2008, 2011 Apple Inc. All Rights Reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 if (ProgrammaticScrollAnimator* programmaticScrollAnimator = existingProgram
maticScrollAnimator()) | 413 if (ProgrammaticScrollAnimator* programmaticScrollAnimator = existingProgram
maticScrollAnimator()) |
414 programmaticScrollAnimator->tickAnimation(monotonicTime); | 414 programmaticScrollAnimator->tickAnimation(monotonicTime); |
415 } | 415 } |
416 | 416 |
417 void ScrollableArea::cancelProgrammaticScrollAnimation() | 417 void ScrollableArea::cancelProgrammaticScrollAnimation() |
418 { | 418 { |
419 if (ProgrammaticScrollAnimator* programmaticScrollAnimator = existingProgram
maticScrollAnimator()) | 419 if (ProgrammaticScrollAnimator* programmaticScrollAnimator = existingProgram
maticScrollAnimator()) |
420 programmaticScrollAnimator->cancelAnimation(); | 420 programmaticScrollAnimator->cancelAnimation(); |
421 } | 421 } |
422 | 422 |
423 IntRect ScrollableArea::visibleContentRect(IncludeScrollbarsInRect scrollbarIncl
usion) const | |
424 { | |
425 return IntRect(scrollPosition().x(), | |
426 scrollPosition().y(), | |
427 std::max(0, visibleWidth()), | |
428 std::max(0, visibleHeight())); | |
429 } | |
430 | |
431 IntPoint ScrollableArea::clampScrollPosition(const IntPoint& scrollPosition) con
st | 423 IntPoint ScrollableArea::clampScrollPosition(const IntPoint& scrollPosition) con
st |
432 { | 424 { |
433 return scrollPosition.shrunkTo(maximumScrollPosition()).expandedTo(minimumSc
rollPosition()); | 425 return scrollPosition.shrunkTo(maximumScrollPosition()).expandedTo(minimumSc
rollPosition()); |
434 } | 426 } |
435 | 427 |
436 int ScrollableArea::lineStep(ScrollbarOrientation) const | 428 int ScrollableArea::lineStep(ScrollbarOrientation) const |
437 { | 429 { |
438 return pixelsPerLineStep(); | 430 return pixelsPerLineStep(); |
439 } | 431 } |
440 | 432 |
441 int ScrollableArea::pageStep(ScrollbarOrientation orientation) const | |
442 { | |
443 int length = (orientation == HorizontalScrollbar) ? visibleWidth() : visible
Height(); | |
444 int minPageStep = static_cast<float>(length) * minFractionToStepWhenPaging()
; | |
445 int pageStep = std::max(minPageStep, length - maxOverlapBetweenPages()); | |
446 | |
447 return std::max(pageStep, 1); | |
448 } | |
449 | |
450 int ScrollableArea::documentStep(ScrollbarOrientation orientation) const | 433 int ScrollableArea::documentStep(ScrollbarOrientation orientation) const |
451 { | 434 { |
452 return scrollSize(orientation); | 435 return scrollSize(orientation); |
453 } | 436 } |
454 | 437 |
455 float ScrollableArea::pixelStep(ScrollbarOrientation) const | 438 float ScrollableArea::pixelStep(ScrollbarOrientation) const |
456 { | 439 { |
457 return 1; | 440 return 1; |
458 } | 441 } |
459 | 442 |
460 } // namespace blink | 443 } // namespace blink |
OLD | NEW |