| 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 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 | 524 |
| 524 void ScrollableArea::cancelProgrammaticScrollAnimation() | 525 void ScrollableArea::cancelProgrammaticScrollAnimation() |
| 525 { | 526 { |
| 526 if (ProgrammaticScrollAnimator* programmaticScrollAnimator = existingProgram
maticScrollAnimator()) | 527 if (ProgrammaticScrollAnimator* programmaticScrollAnimator = existingProgram
maticScrollAnimator()) |
| 527 programmaticScrollAnimator->cancelAnimation(); | 528 programmaticScrollAnimator->cancelAnimation(); |
| 528 } | 529 } |
| 529 | 530 |
| 530 bool ScrollableArea::shouldScrollOnMainThread() const | 531 bool ScrollableArea::shouldScrollOnMainThread() const |
| 531 { | 532 { |
| 532 if (GraphicsLayer* layer = layerForScrolling()) { | 533 if (GraphicsLayer* layer = layerForScrolling()) { |
| 533 return layer->platformLayer()->shouldScrollOnMainThread(); | 534 uint32_t reasons = layer->platformLayer()->mainThreadScrollingReasons(); |
| 535 // Should scroll on main thread unless the reason is the one that is set |
| 536 // by the ScrollAnimator, in which case, the animation can still be |
| 537 // scheduled on the compositor. |
| 538 // TODO(ymalik): We have a non-transient "main thread scrolling reason" |
| 539 // that doesn't actually cause shouldScrollOnMainThread() to be true. |
| 540 // This is confusing and should be cleaned up. |
| 541 return !!(reasons & ~MainThreadScrollingReason::kAnimatingScrollOnMainTh
read); |
| 534 } | 542 } |
| 535 return true; | 543 return true; |
| 536 } | 544 } |
| 537 | 545 |
| 538 DoubleRect ScrollableArea::visibleContentRectDouble(IncludeScrollbarsInRect scro
llbarInclusion) const | 546 DoubleRect ScrollableArea::visibleContentRectDouble(IncludeScrollbarsInRect scro
llbarInclusion) const |
| 539 { | 547 { |
| 540 return visibleContentRect(scrollbarInclusion); | 548 return visibleContentRect(scrollbarInclusion); |
| 541 } | 549 } |
| 542 | 550 |
| 543 IntRect ScrollableArea::visibleContentRect(IncludeScrollbarsInRect scrollbarIncl
usion) const | 551 IntRect ScrollableArea::visibleContentRect(IncludeScrollbarsInRect scrollbarIncl
usion) const |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 609 std::max(0, size.height() - horizontalScrollbarHeight)); | 617 std::max(0, size.height() - horizontalScrollbarHeight)); |
| 610 } | 618 } |
| 611 | 619 |
| 612 DEFINE_TRACE(ScrollableArea) | 620 DEFINE_TRACE(ScrollableArea) |
| 613 { | 621 { |
| 614 visitor->trace(m_scrollAnimator); | 622 visitor->trace(m_scrollAnimator); |
| 615 visitor->trace(m_programmaticScrollAnimator); | 623 visitor->trace(m_programmaticScrollAnimator); |
| 616 } | 624 } |
| 617 | 625 |
| 618 } // namespace blink | 626 } // namespace blink |
| OLD | NEW |