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 19 matching lines...) Expand all Loading... |
30 */ | 30 */ |
31 | 31 |
32 #include "platform/scroll/ScrollableArea.h" | 32 #include "platform/scroll/ScrollableArea.h" |
33 | 33 |
34 #include "platform/HostWindow.h" | 34 #include "platform/HostWindow.h" |
35 #include "platform/Logging.h" | 35 #include "platform/Logging.h" |
36 #include "platform/geometry/DoubleRect.h" | 36 #include "platform/geometry/DoubleRect.h" |
37 #include "platform/geometry/FloatPoint.h" | 37 #include "platform/geometry/FloatPoint.h" |
38 #include "platform/geometry/LayoutRect.h" | 38 #include "platform/geometry/LayoutRect.h" |
39 #include "platform/graphics/GraphicsLayer.h" | 39 #include "platform/graphics/GraphicsLayer.h" |
| 40 #include "platform/scroll/MainThreadScrollingReason.h" |
40 #include "platform/scroll/ProgrammaticScrollAnimator.h" | 41 #include "platform/scroll/ProgrammaticScrollAnimator.h" |
41 #include "platform/scroll/ScrollbarTheme.h" | 42 #include "platform/scroll/ScrollbarTheme.h" |
42 #include "wtf/PassOwnPtr.h" | 43 #include "wtf/PassOwnPtr.h" |
43 | 44 |
44 #include "platform/TraceEvent.h" | 45 #include "platform/TraceEvent.h" |
45 | 46 |
46 static const int kPixelsPerLineStep = 40; | 47 static const int kPixelsPerLineStep = 40; |
47 static const float kMinFractionToStepWhenPaging = 0.875f; | 48 static const float kMinFractionToStepWhenPaging = 0.875f; |
48 | 49 |
49 namespace blink { | 50 namespace blink { |
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 | 520 |
520 void ScrollableArea::cancelProgrammaticScrollAnimation() | 521 void ScrollableArea::cancelProgrammaticScrollAnimation() |
521 { | 522 { |
522 if (ProgrammaticScrollAnimator* programmaticScrollAnimator = existingProgram
maticScrollAnimator()) | 523 if (ProgrammaticScrollAnimator* programmaticScrollAnimator = existingProgram
maticScrollAnimator()) |
523 programmaticScrollAnimator->cancelAnimation(); | 524 programmaticScrollAnimator->cancelAnimation(); |
524 } | 525 } |
525 | 526 |
526 bool ScrollableArea::shouldScrollOnMainThread() const | 527 bool ScrollableArea::shouldScrollOnMainThread() const |
527 { | 528 { |
528 if (GraphicsLayer* layer = layerForScrolling()) { | 529 if (GraphicsLayer* layer = layerForScrolling()) { |
529 return layer->platformLayer()->shouldScrollOnMainThread(); | 530 uint32_t reasons = layer->platformLayer()->mainThreadScrollingReasons(); |
| 531 // Should scroll on main thread unless the reason is the one that is set |
| 532 // by the ScrollAnimator, in which case, the animation can still be |
| 533 // scheduled on the compositor. |
| 534 // TODO(ymalik): We have a non-transient "main thread scrolling reason" |
| 535 // that doesn't actually cause shouldScrollOnMainThread() to be true. |
| 536 // This is confusing and should be cleaned up. |
| 537 return !!(reasons & ~MainThreadScrollingReason::kAnimatingScollOnMainThr
ead); |
530 } | 538 } |
531 return true; | 539 return true; |
532 } | 540 } |
533 | 541 |
534 DoubleRect ScrollableArea::visibleContentRectDouble(IncludeScrollbarsInRect scro
llbarInclusion) const | 542 DoubleRect ScrollableArea::visibleContentRectDouble(IncludeScrollbarsInRect scro
llbarInclusion) const |
535 { | 543 { |
536 return visibleContentRect(scrollbarInclusion); | 544 return visibleContentRect(scrollbarInclusion); |
537 } | 545 } |
538 | 546 |
539 IntRect ScrollableArea::visibleContentRect(IncludeScrollbarsInRect scrollbarIncl
usion) const | 547 IntRect ScrollableArea::visibleContentRect(IncludeScrollbarsInRect scrollbarIncl
usion) const |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
603 std::max(0, size.height() - horizontalScrollbarHeight)); | 611 std::max(0, size.height() - horizontalScrollbarHeight)); |
604 } | 612 } |
605 | 613 |
606 DEFINE_TRACE(ScrollableArea) | 614 DEFINE_TRACE(ScrollableArea) |
607 { | 615 { |
608 visitor->trace(m_scrollAnimator); | 616 visitor->trace(m_scrollAnimator); |
609 visitor->trace(m_programmaticScrollAnimator); | 617 visitor->trace(m_programmaticScrollAnimator); |
610 } | 618 } |
611 | 619 |
612 } // namespace blink | 620 } // namespace blink |
OLD | NEW |