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

Side by Side Diff: sky/engine/platform/scroll/ScrollableArea.cpp

Issue 711483003: Deduplicate part of RenderLayerScrollableArea/ScrollableArea. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 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
« no previous file with comments | « sky/engine/platform/scroll/ScrollableArea.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « sky/engine/platform/scroll/ScrollableArea.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698