OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
73 | 73 |
74 m_theme->registerScrollbar(this); | 74 m_theme->registerScrollbar(this); |
75 | 75 |
76 // FIXME: This is ugly and would not be necessary if we fix cross-platform c ode to actually query for | 76 // FIXME: This is ugly and would not be necessary if we fix cross-platform c ode to actually query for |
77 // scrollbar thickness and use it when sizing scrollbars (rather than leavin g one dimension of the scrollbar | 77 // scrollbar thickness and use it when sizing scrollbars (rather than leavin g one dimension of the scrollbar |
78 // alone when sizing). | 78 // alone when sizing). |
79 int thickness = m_theme->scrollbarThickness(controlSize); | 79 int thickness = m_theme->scrollbarThickness(controlSize); |
80 Widget::setFrameRect(IntRect(0, 0, thickness, thickness)); | 80 Widget::setFrameRect(IntRect(0, 0, thickness, thickness)); |
81 | 81 |
82 m_currentPos = scrollableAreaCurrentPos(); | 82 m_currentPos = scrollableAreaCurrentPos(); |
83 | |
84 #if ENABLE(OILPAN) | |
85 if (m_scrollableArea) | |
86 m_animator = m_scrollableArea->scrollAnimator(); | |
87 #endif | |
88 } | 83 } |
89 | 84 |
90 Scrollbar::~Scrollbar() | 85 Scrollbar::~Scrollbar() |
haraken
2015/06/29 15:20:22
Can we add ASSERT(!m_scrollableArea) to verify tha
sof
2015/06/29 15:59:42
It doesn't hold in all cases, and I didn't see the
haraken
2015/06/30 10:30:35
It doesn't hold in non-oilpan or/and oilpan? In oi
sof
2015/06/30 11:34:08
It holds in neither setting; with non-Oilpan, the
| |
91 { | 86 { |
92 stopTimerIfNeeded(); | 87 m_theme->unregisterScrollbar(this); |
88 } | |
93 | 89 |
94 m_theme->unregisterScrollbar(this); | 90 DEFINE_TRACE(Scrollbar) |
95 | 91 { |
96 #if ENABLE(OILPAN) | 92 visitor->trace(m_scrollableArea); |
97 if (!m_animator) | 93 Widget::trace(visitor); |
98 return; | |
99 | |
100 ASSERT(m_scrollableArea); | |
101 if (m_orientation == VerticalScrollbar) | |
102 m_animator->willRemoveVerticalScrollbar(this); | |
103 else | |
104 m_animator->willRemoveHorizontalScrollbar(this); | |
haraken
2015/06/29 15:20:22
Help me understand: Who calls these willRemoveScro
sof
2015/06/29 15:59:41
The ScrollableAreas will now enforce this, as they
| |
105 #endif | |
106 } | 94 } |
107 | 95 |
108 void Scrollbar::setFrameRect(const IntRect& frameRect) | 96 void Scrollbar::setFrameRect(const IntRect& frameRect) |
109 { | 97 { |
110 if (frameRect == this->frameRect()) | 98 if (frameRect == this->frameRect()) |
111 return; | 99 return; |
112 | 100 |
113 invalidate(); | 101 invalidate(); |
114 Widget::setFrameRect(frameRect); | 102 Widget::setFrameRect(frameRect); |
115 invalidate(); | 103 invalidate(); |
(...skipping 30 matching lines...) Expand all Loading... | |
146 if (position == m_currentPos) | 134 if (position == m_currentPos) |
147 return; | 135 return; |
148 | 136 |
149 int oldThumbPosition = theme()->thumbPosition(this); | 137 int oldThumbPosition = theme()->thumbPosition(this); |
150 m_currentPos = position; | 138 m_currentPos = position; |
151 updateThumbPosition(); | 139 updateThumbPosition(); |
152 if (m_pressedPart == ThumbPart) | 140 if (m_pressedPart == ThumbPart) |
153 setPressedPos(m_pressedPos + theme()->thumbPosition(this) - oldThumbPosi tion); | 141 setPressedPos(m_pressedPos + theme()->thumbPosition(this) - oldThumbPosi tion); |
154 } | 142 } |
155 | 143 |
156 void Scrollbar::disconnectFromScrollableArea() | 144 void Scrollbar::disconnectFromScrollableArea() |
haraken
2015/06/29 15:20:22
In oilpan, do we need to call Scrollbar::disconnec
sof
2015/06/29 15:59:41
yes, I think we can get rid of this step once we s
| |
157 { | 145 { |
158 m_scrollableArea = nullptr; | 146 m_scrollableArea = nullptr; |
sof
2015/06/30 11:34:08
Made clearing conditional on !ENABLE(OILPAN) + add
| |
159 #if ENABLE(OILPAN) | |
160 m_animator = nullptr; | |
161 #endif | |
162 } | 147 } |
163 | 148 |
164 void Scrollbar::setProportion(int visibleSize, int totalSize) | 149 void Scrollbar::setProportion(int visibleSize, int totalSize) |
165 { | 150 { |
166 if (visibleSize == m_visibleSize && totalSize == m_totalSize) | 151 if (visibleSize == m_visibleSize && totalSize == m_totalSize) |
167 return; | 152 return; |
168 | 153 |
169 m_visibleSize = visibleSize; | 154 m_visibleSize = visibleSize; |
170 m_totalSize = totalSize; | 155 m_totalSize = totalSize; |
171 | 156 |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
565 if (!m_scrollableArea) | 550 if (!m_scrollableArea) |
566 return 0; | 551 return 0; |
567 | 552 |
568 if (m_orientation == HorizontalScrollbar) | 553 if (m_orientation == HorizontalScrollbar) |
569 return m_scrollableArea->scrollPosition().x() - m_scrollableArea->minimu mScrollPosition().x(); | 554 return m_scrollableArea->scrollPosition().x() - m_scrollableArea->minimu mScrollPosition().x(); |
570 | 555 |
571 return m_scrollableArea->scrollPosition().y() - m_scrollableArea->minimumScr ollPosition().y(); | 556 return m_scrollableArea->scrollPosition().y() - m_scrollableArea->minimumScr ollPosition().y(); |
572 } | 557 } |
573 | 558 |
574 } // namespace blink | 559 } // namespace blink |
OLD | NEW |