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 PersistentWillBeMember<void*> persistent; |
57 void* pointer; | 58 void* pointer; |
58 unsigned bitfields : 16; | 59 unsigned bitfields : 16; |
59 IntPoint origin; | 60 IntPoint origin; |
60 }; | 61 }; |
61 | 62 |
62 static_assert(sizeof(ScrollableArea) == sizeof(SameSizeAsScrollableArea), "Scrol
lableArea should stay small"); | 63 static_assert(sizeof(ScrollableArea) == sizeof(SameSizeAsScrollableArea), "Scrol
lableArea should stay small"); |
63 | 64 |
64 int ScrollableArea::pixelsPerLineStep() | 65 int ScrollableArea::pixelsPerLineStep() |
65 { | 66 { |
66 return kPixelsPerLineStep; | 67 return kPixelsPerLineStep; |
(...skipping 19 matching lines...) Expand all Loading... |
86 , m_scrollCornerNeedsPaintInvalidation(false) | 87 , m_scrollCornerNeedsPaintInvalidation(false) |
87 { | 88 { |
88 } | 89 } |
89 | 90 |
90 ScrollableArea::~ScrollableArea() | 91 ScrollableArea::~ScrollableArea() |
91 { | 92 { |
92 } | 93 } |
93 | 94 |
94 void ScrollableArea::clearScrollAnimators() | 95 void ScrollableArea::clearScrollAnimators() |
95 { | 96 { |
96 m_animators.clear(); | 97 m_scrollAnimator.clear(); |
| 98 m_programmaticScrollAnimator.clear(); |
97 } | 99 } |
98 | 100 |
99 ScrollAnimatorBase* ScrollableArea::scrollAnimator() const | 101 ScrollAnimatorBase* ScrollableArea::scrollAnimator() const |
100 { | 102 { |
101 if (!m_animators) | 103 if (!m_scrollAnimator) |
102 m_animators = adoptPtr(new ScrollableAreaAnimators); | 104 m_scrollAnimator = ScrollAnimatorBase::create(const_cast<ScrollableArea*
>(this)); |
103 | 105 |
104 if (!m_animators->scrollAnimator) | 106 return m_scrollAnimator.get(); |
105 m_animators->scrollAnimator = ScrollAnimatorBase::create(const_cast<Scro
llableArea*>(this)); | |
106 | |
107 return m_animators->scrollAnimator.get(); | |
108 } | 107 } |
109 | 108 |
110 ProgrammaticScrollAnimator* ScrollableArea::programmaticScrollAnimator() const | 109 ProgrammaticScrollAnimator* ScrollableArea::programmaticScrollAnimator() const |
111 { | 110 { |
112 if (!m_animators) | 111 if (!m_programmaticScrollAnimator) |
113 m_animators = adoptPtr(new ScrollableAreaAnimators); | 112 m_programmaticScrollAnimator = ProgrammaticScrollAnimator::create(const_
cast<ScrollableArea*>(this)); |
114 | 113 |
115 if (!m_animators->programmaticScrollAnimator) | 114 return m_programmaticScrollAnimator.get(); |
116 m_animators->programmaticScrollAnimator = ProgrammaticScrollAnimator::cr
eate(const_cast<ScrollableArea*>(this)); | |
117 | |
118 return m_animators->programmaticScrollAnimator.get(); | |
119 } | 115 } |
120 | 116 |
121 void ScrollableArea::setScrollOrigin(const IntPoint& origin) | 117 void ScrollableArea::setScrollOrigin(const IntPoint& origin) |
122 { | 118 { |
123 if (m_scrollOrigin != origin) { | 119 if (m_scrollOrigin != origin) { |
124 m_scrollOrigin = origin; | 120 m_scrollOrigin = origin; |
125 m_scrollOriginChanged = true; | 121 m_scrollOriginChanged = true; |
126 } | 122 } |
127 } | 123 } |
128 | 124 |
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
577 if (Scrollbar* verticalBar = verticalScrollbar()) | 573 if (Scrollbar* verticalBar = verticalScrollbar()) |
578 verticalScrollbarWidth = !verticalBar->isOverlayScrollbar() ? verticalBa
r->width() : 0; | 574 verticalScrollbarWidth = !verticalBar->isOverlayScrollbar() ? verticalBa
r->width() : 0; |
579 if (Scrollbar* horizontalBar = horizontalScrollbar()) | 575 if (Scrollbar* horizontalBar = horizontalScrollbar()) |
580 horizontalScrollbarHeight = !horizontalBar->isOverlayScrollbar() ? horiz
ontalBar->height() : 0; | 576 horizontalScrollbarHeight = !horizontalBar->isOverlayScrollbar() ? horiz
ontalBar->height() : 0; |
581 | 577 |
582 return IntSize(std::max(0, size.width() - verticalScrollbarWidth), | 578 return IntSize(std::max(0, size.width() - verticalScrollbarWidth), |
583 std::max(0, size.height() - horizontalScrollbarHeight)); | 579 std::max(0, size.height() - horizontalScrollbarHeight)); |
584 | 580 |
585 } | 581 } |
586 | 582 |
| 583 DEFINE_TRACE(ScrollableArea) |
| 584 { |
| 585 visitor->trace(m_scrollAnimator); |
| 586 visitor->trace(m_programmaticScrollAnimator); |
| 587 } |
| 588 |
587 } // namespace blink | 589 } // namespace blink |
OLD | NEW |