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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
47 static const int kPixelsPerLineStep = 40; | 47 static const int kPixelsPerLineStep = 40; |
48 static const float kMinFractionToStepWhenPaging = 0.875f; | 48 static const float kMinFractionToStepWhenPaging = 0.875f; |
49 | 49 |
50 namespace blink { | 50 namespace blink { |
51 | 51 |
52 struct SameSizeAsScrollableArea { | 52 struct SameSizeAsScrollableArea { |
53 virtual ~SameSizeAsScrollableArea(); | 53 virtual ~SameSizeAsScrollableArea(); |
54 #if ENABLE(ASSERT) && ENABLE(OILPAN) | 54 #if ENABLE(ASSERT) && ENABLE(OILPAN) |
55 VerifyEagerFinalization verifyEager; | 55 VerifyEagerFinalization verifyEager; |
56 #endif | 56 #endif |
57 void* pointer; | 57 OwnPtrWillBeMember<void*> pointer[2]; |
58 unsigned bitfields : 16; | 58 unsigned bitfields : 16; |
59 IntPoint origin; | 59 IntPoint origin; |
60 }; | 60 }; |
61 | 61 |
62 static_assert(sizeof(ScrollableArea) == sizeof(SameSizeAsScrollableArea), "Scrol lableArea should stay small"); | 62 static_assert(sizeof(ScrollableArea) == sizeof(SameSizeAsScrollableArea), "Scrol lableArea should stay small"); |
63 | 63 |
64 int ScrollableArea::pixelsPerLineStep() | 64 int ScrollableArea::pixelsPerLineStep() |
65 { | 65 { |
66 return kPixelsPerLineStep; | 66 return kPixelsPerLineStep; |
67 } | 67 } |
(...skipping 18 matching lines...) Expand all Loading... | |
86 , m_scrollCornerNeedsPaintInvalidation(false) | 86 , m_scrollCornerNeedsPaintInvalidation(false) |
87 { | 87 { |
88 } | 88 } |
89 | 89 |
90 ScrollableArea::~ScrollableArea() | 90 ScrollableArea::~ScrollableArea() |
91 { | 91 { |
92 } | 92 } |
93 | 93 |
94 void ScrollableArea::clearScrollAnimators() | 94 void ScrollableArea::clearScrollAnimators() |
95 { | 95 { |
96 m_animators.clear(); | 96 #if OS(MACOSX) && ENABLE(OILPAN) |
peria
2015/12/03 13:42:08
This clearing is added to make the probability to
haraken
2015/12/03 14:48:47
Add something to make the likelihood small sounds
| |
97 if (m_scrollAnimator) | |
98 m_scrollAnimator->cleanup(); | |
99 #endif | |
100 m_scrollAnimator.clear(); | |
101 m_programmaticScrollAnimator.clear(); | |
97 } | 102 } |
98 | 103 |
99 ScrollAnimatorBase* ScrollableArea::scrollAnimator() const | 104 ScrollAnimatorBase* ScrollableArea::scrollAnimator() const |
100 { | 105 { |
101 if (!m_animators) | 106 if (!m_scrollAnimator) |
102 m_animators = adoptPtr(new ScrollableAreaAnimators); | 107 m_scrollAnimator = ScrollAnimatorBase::create(const_cast<ScrollableArea* >(this)); |
103 | 108 |
104 if (!m_animators->scrollAnimator) | 109 return m_scrollAnimator.get(); |
105 m_animators->scrollAnimator = ScrollAnimatorBase::create(const_cast<Scro llableArea*>(this)); | |
106 | |
107 return m_animators->scrollAnimator.get(); | |
108 } | 110 } |
109 | 111 |
110 ProgrammaticScrollAnimator* ScrollableArea::programmaticScrollAnimator() const | 112 ProgrammaticScrollAnimator* ScrollableArea::programmaticScrollAnimator() const |
111 { | 113 { |
112 if (!m_animators) | 114 if (!m_programmaticScrollAnimator) |
113 m_animators = adoptPtr(new ScrollableAreaAnimators); | 115 m_programmaticScrollAnimator = ProgrammaticScrollAnimator::create(const_ cast<ScrollableArea*>(this)); |
114 | 116 |
115 if (!m_animators->programmaticScrollAnimator) | 117 return m_programmaticScrollAnimator.get(); |
116 m_animators->programmaticScrollAnimator = ProgrammaticScrollAnimator::cr eate(const_cast<ScrollableArea*>(this)); | |
117 | |
118 return m_animators->programmaticScrollAnimator.get(); | |
119 } | 118 } |
120 | 119 |
121 void ScrollableArea::setScrollOrigin(const IntPoint& origin) | 120 void ScrollableArea::setScrollOrigin(const IntPoint& origin) |
122 { | 121 { |
123 if (m_scrollOrigin != origin) { | 122 if (m_scrollOrigin != origin) { |
124 m_scrollOrigin = origin; | 123 m_scrollOrigin = origin; |
125 m_scrollOriginChanged = true; | 124 m_scrollOriginChanged = true; |
126 } | 125 } |
127 } | 126 } |
128 | 127 |
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
577 if (Scrollbar* verticalBar = verticalScrollbar()) | 576 if (Scrollbar* verticalBar = verticalScrollbar()) |
578 verticalScrollbarWidth = !verticalBar->isOverlayScrollbar() ? verticalBa r->width() : 0; | 577 verticalScrollbarWidth = !verticalBar->isOverlayScrollbar() ? verticalBa r->width() : 0; |
579 if (Scrollbar* horizontalBar = horizontalScrollbar()) | 578 if (Scrollbar* horizontalBar = horizontalScrollbar()) |
580 horizontalScrollbarHeight = !horizontalBar->isOverlayScrollbar() ? horiz ontalBar->height() : 0; | 579 horizontalScrollbarHeight = !horizontalBar->isOverlayScrollbar() ? horiz ontalBar->height() : 0; |
581 | 580 |
582 return IntSize(std::max(0, size.width() - verticalScrollbarWidth), | 581 return IntSize(std::max(0, size.width() - verticalScrollbarWidth), |
583 std::max(0, size.height() - horizontalScrollbarHeight)); | 582 std::max(0, size.height() - horizontalScrollbarHeight)); |
584 | 583 |
585 } | 584 } |
586 | 585 |
586 DEFINE_TRACE(ScrollableArea) | |
587 { | |
588 visitor->trace(m_scrollAnimator); | |
589 visitor->trace(m_programmaticScrollAnimator); | |
590 } | |
591 | |
587 } // namespace blink | 592 } // namespace blink |
OLD | NEW |