Scrollbars and ScrollAnimators must always have a ScrollableArea
[WebKit-https.git] / Source / WebCore / platform / ios / ScrollAnimatorIOS.mm
index 908b306..0e1a4cf 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2011, 2015 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -40,12 +40,12 @@ using namespace WebCore;
 
 namespace WebCore {
 
-PassOwnPtr<ScrollAnimator> ScrollAnimator::create(ScrollableArea* scrollableArea)
+PassOwnPtr<ScrollAnimator> ScrollAnimator::create(ScrollableArea& scrollableArea)
 {
     return adoptPtr(new ScrollAnimatorIOS(scrollableArea));
 }
 
-ScrollAnimatorIOS::ScrollAnimatorIOS(ScrollableArea* scrollableArea)
+ScrollAnimatorIOS::ScrollAnimatorIOS(ScrollableArea& scrollableArea)
     : ScrollAnimator(scrollableArea)
 #if ENABLE(TOUCH_EVENTS)
     , m_touchScrollAxisLatch(AxisLatchNotComputed)
@@ -82,7 +82,7 @@ bool ScrollAnimatorIOS::handleTouchEvent(const PlatformTouchEvent& touchEvent)
         m_inTouchSequence = false;
         m_scrollableAreaForTouchSequence = 0;
         if (m_startedScroll)
-            scrollableArea()->didEndScroll();
+            scrollableArea().didEndScroll();
         return false;
     }
 
@@ -92,7 +92,7 @@ bool ScrollAnimatorIOS::handleTouchEvent(const PlatformTouchEvent& touchEvent)
         m_inTouchSequence = false;
         m_scrollableAreaForTouchSequence = 0;
         if (m_startedScroll)
-            scrollableArea()->didEndScroll();
+            scrollableArea().didEndScroll();
         return false;
     }
     
@@ -105,8 +105,8 @@ bool ScrollAnimatorIOS::handleTouchEvent(const PlatformTouchEvent& touchEvent)
         determineScrollableAreaForTouchSequence(touchDelta);
 
     if (!m_committedToScrollAxis) {
-        bool horizontallyScrollable = m_scrollableArea->scrollSize(HorizontalScrollbar);
-        bool verticallyScrollable = m_scrollableArea->scrollSize(VerticalScrollbar);
+        bool horizontallyScrollable = m_scrollableArea.scrollSize(HorizontalScrollbar);
+        bool verticallyScrollable = m_scrollableArea.scrollSize(VerticalScrollbar);
 
         if (!horizontallyScrollable && !verticallyScrollable)
             return false;
@@ -160,9 +160,9 @@ bool ScrollAnimatorIOS::handleTouchEvent(const PlatformTouchEvent& touchEvent)
         if (!handled)
             return false;
         m_startedScroll = true;
-        scrollableArea()->didStartScroll();
+        scrollableArea().didStartScroll();
     } else if (handled)
-        scrollableArea()->didUpdateScroll();
+        scrollableArea().didUpdateScroll();
     
     return true;
 }
@@ -171,7 +171,7 @@ void ScrollAnimatorIOS::determineScrollableAreaForTouchSequence(const IntSize& s
 {
     ASSERT(!m_scrollableAreaForTouchSequence);
 
-    ScrollableArea* scrollableArea = m_scrollableArea;
+    ScrollableArea* scrollableArea = &m_scrollableArea;
     while (true) {
         if (!scrollableArea->isPinnedInBothDirections(scrollDelta))
             break;