Chromium Code Reviews| Index: Source/platform/scroll/Scrollbar.cpp |
| diff --git a/Source/platform/scroll/Scrollbar.cpp b/Source/platform/scroll/Scrollbar.cpp |
| index 11f7ed5ca5eeed11edf6e44eea06df07058146a4..e5e99b8bdcb44e3f30fbebb68ace031b481e293c 100644 |
| --- a/Source/platform/scroll/Scrollbar.cpp |
| +++ b/Source/platform/scroll/Scrollbar.cpp |
| @@ -42,9 +42,9 @@ |
| namespace blink { |
| -PassRefPtr<Scrollbar> Scrollbar::create(ScrollableArea* scrollableArea, ScrollbarOrientation orientation, ScrollbarControlSize size) |
| +PassRefPtrWillBeRawPtr<Scrollbar> Scrollbar::create(ScrollableArea* scrollableArea, ScrollbarOrientation orientation, ScrollbarControlSize size) |
| { |
| - return adoptRef(new Scrollbar(scrollableArea, orientation, size)); |
| + return adoptRefWillBeNoop(new Scrollbar(scrollableArea, orientation, size)); |
| } |
| Scrollbar::Scrollbar(ScrollableArea* scrollableArea, ScrollbarOrientation orientation, ScrollbarControlSize controlSize, ScrollbarTheme* theme) |
| @@ -80,6 +80,11 @@ Scrollbar::Scrollbar(ScrollableArea* scrollableArea, ScrollbarOrientation orient |
| Widget::setFrameRect(IntRect(0, 0, thickness, thickness)); |
| m_currentPos = scrollableAreaCurrentPos(); |
| + |
| +#if ENABLE(OILPAN) |
| + if (m_scrollableArea) |
| + m_animator = m_scrollableArea->scrollAnimator(); |
|
haraken
2014/10/10 02:50:32
Sorry, I got confused with this again.
The scroll
sof
2014/10/10 05:22:19
It _might_ be on the heap, we don't know (i.e., a
|
| +#endif |
| } |
| Scrollbar::~Scrollbar() |
| @@ -87,6 +92,17 @@ Scrollbar::~Scrollbar() |
| stopTimerIfNeeded(); |
| m_theme->unregisterScrollbar(this); |
| + |
| +#if ENABLE(OILPAN) |
| + if (!m_animator) |
| + return; |
| + |
| + ASSERT(m_scrollableArea); |
| + if (m_orientation == VerticalScrollbar) |
| + m_animator->willRemoveVerticalScrollbar(this); |
| + else |
| + m_animator->willRemoveHorizontalScrollbar(this); |
| +#endif |
| } |
| ScrollbarOverlayStyle Scrollbar::scrollbarOverlayStyle() const |
| @@ -132,6 +148,14 @@ void Scrollbar::offsetDidChange() |
| setPressedPos(m_pressedPos + theme()->thumbPosition(this) - oldThumbPosition); |
| } |
| +void Scrollbar::disconnectFromScrollableArea() |
| +{ |
| + m_scrollableArea = nullptr; |
| +#if ENABLE(OILPAN) |
| + m_animator = nullptr; |
| +#endif |
| +} |
| + |
| void Scrollbar::setProportion(int visibleSize, int totalSize) |
| { |
| if (visibleSize == m_visibleSize && totalSize == m_totalSize) |