Title: [180474] trunk/Source
Revision
180474
Author
[email protected]
Date
2015-02-20 19:34:09 -0800 (Fri, 20 Feb 2015)

Log Message

Scrollbars and ScrollAnimators must always have a ScrollableArea
https://bugs.webkit.org/show_bug.cgi?id=141855

Reviewed by Simon Fraser.
Source/WebCore:


No change in functionality.
        
Change users of the scrollAnimator() method to expect a reference instead of a pointer. Also get rid of
a number of unnecessary nullptr checks.

* accessibility/AccessibilityScrollbar.cpp:
(WebCore::AccessibilityScrollbar::setValue):
* css/SelectorCheckerTestFunctions.h:
(WebCore::scrollbarMatchesCornerPresentPseudoClass):
* page/FrameView.cpp:
(WebCore::FrameView::createScrollbar):
(WebCore::FrameView::setFixedVisibleContentRect):
* page/scrolling/ScrollingCoordinator.cpp:
(WebCore::ScrollingCoordinator::handleWheelEventPhase):
* platform/PopupMenuClient.h:
* platform/ScrollAnimator.cpp:
(WebCore::ScrollAnimator::ScrollAnimator):
(WebCore::ScrollAnimator::scroll):
(WebCore::ScrollAnimator::handleWheelEvent):
(WebCore::ScrollAnimator::notifyPositionChanged):
(WebCore::ScrollAnimator::updateScrollAnimatorsAndTimers):
* platform/ScrollAnimator.h:
(WebCore::ScrollAnimator::ScrollAnimator::scrollableArea):
* platform/ScrollAnimatorNone.cpp:
* platform/ScrollAnimatorNone.h:
* platform/ScrollView.cpp:
(WebCore::ScrollView::createScrollbar):
* platform/ScrollableArea.cpp:
(WebCore::ScrollableArea::scrollAnimator):
(WebCore::ScrollableArea::scroll):
(WebCore::ScrollableArea::scrollToOffsetWithoutAnimation):
(WebCore::ScrollableArea::notifyScrollPositionChanged):
(WebCore::ScrollableArea::scrollPositionChanged):
(WebCore::ScrollableArea::handleWheelEvent):
(WebCore::ScrollableArea::handleTouchEvent):
(WebCore::ScrollableArea::mouseEnteredScrollbar):
(WebCore::ScrollableArea::mouseExitedScrollbar):
(WebCore::ScrollableArea::didAddScrollbar):
(WebCore::ScrollableArea::willRemoveScrollbar):
(WebCore::ScrollableArea::verticalScrollbarLayerDidChange):
(WebCore::ScrollableArea::horizontalScrollbarLayerDidChange):
* platform/ScrollableArea.h:
* platform/Scrollbar.cpp:
(WebCore::Scrollbar::createNativeScrollbar):
(WebCore::Scrollbar::Scrollbar):
(WebCore::Scrollbar::scrollbarOverlayStyle):
(WebCore::Scrollbar::isScrollableAreaActive):
(WebCore::Scrollbar::offsetDidChange):
(WebCore::Scrollbar::autoscrollPressedPart):
(WebCore::Scrollbar::moveThumb):
(WebCore::Scrollbar::mouseMoved):
(WebCore::Scrollbar::mouseEntered):
(WebCore::Scrollbar::mouseExited):
(WebCore::Scrollbar::mouseUp):
(WebCore::Scrollbar::shouldParticipateInHitTesting):
(WebCore::Scrollbar::isWindowActive):
(WebCore::Scrollbar::invalidateRect):
(WebCore::Scrollbar::convertToContainingView):
(WebCore::Scrollbar::convertFromContainingView):
(WebCore::Scrollbar::supportsUpdateOnSecondaryThread):
* platform/Scrollbar.h:
(WebCore::Scrollbar::scrollableArea):
(WebCore::Scrollbar::disconnectFromScrollableArea): Deleted.
* platform/ios/ScrollAnimatorIOS.mm:
(WebCore::ScrollAnimatorIOS::handleTouchEvent):
(WebCore::ScrollAnimatorIOS::determineScrollableAreaForTouchSequence):
* platform/mac/ScrollAnimatorMac.h:
* platform/mac/ScrollAnimatorMac.mm:
(-[WebScrollbarPainterControllerDelegate scrollerImpPair:setContentAreaNeedsDisplayInRect:]):
(-[WebScrollbarPainterControllerDelegate scrollerImpPair:updateScrollerStyleForNewRecommendedScrollerStyle:]):
(-[WebScrollbarPainterDelegate scrollAnimator]):
(-[WebScrollbarPainterDelegate layer]):
(-[WebScrollbarPainterDelegate mouseLocationInScrollerForScrollerImp:]):
(-[WebScrollbarPainterDelegate setUpAlphaAnimation:scrollerPainter:part:animateAlphaTo:duration:]):
(WebCore::ScrollAnimator::create):
(WebCore::ScrollAnimatorMac::ScrollAnimatorMac):
(WebCore::ScrollAnimatorMac::scroll):
(WebCore::ScrollAnimatorMac::adjustScrollPositionIfNecessary):
(WebCore::ScrollAnimatorMac::adjustScrollPositionToBoundsIfNecessary):
(WebCore::ScrollAnimatorMac::immediateScrollTo):
(WebCore::ScrollAnimatorMac::didAddVerticalScrollbar):
(WebCore::ScrollAnimatorMac::didAddHorizontalScrollbar):
(WebCore::ScrollAnimatorMac::verticalScrollbarLayerDidChange):
(WebCore::ScrollAnimatorMac::horizontalScrollbarLayerDidChange):
(WebCore::ScrollAnimatorMac::notifyContentAreaScrolled):
(WebCore::ScrollAnimatorMac::pinnedInDirection):
(WebCore::ScrollAnimatorMac::isAlreadyPinnedInDirectionOfGesture):
(WebCore::ScrollAnimatorMac::allowsVerticalStretching):
(WebCore::ScrollAnimatorMac::allowsHorizontalStretching):
(WebCore::ScrollAnimatorMac::stretchAmount):
(WebCore::ScrollAnimatorMac::canScrollHorizontally):
(WebCore::ScrollAnimatorMac::canScrollVertically):
(WebCore::ScrollAnimatorMac::absoluteScrollPosition):
(WebCore::ScrollAnimatorMac::immediateScrollByWithoutContentEdgeConstraints):
(WebCore::ScrollAnimatorMac::updateScrollerStyle):
(WebCore::ScrollAnimatorMac::setVisibleScrollerThumbRect):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::RenderLayer):
(WebCore::RenderLayer::createScrollbar):
(WebCore::RenderLayer::destroyScrollbar):
(WebCore::RenderLayer::updateScrollInfoAfterLayout):
* rendering/RenderListBox.cpp:
(WebCore::RenderListBox::createScrollbar):
(WebCore::RenderListBox::destroyScrollbar):
* rendering/RenderMenuList.cpp:
(RenderMenuList::createScrollbar):
* rendering/RenderMenuList.h:
* rendering/RenderScrollbar.cpp:
(WebCore::RenderScrollbar::createCustomScrollbar):
(WebCore::RenderScrollbar::RenderScrollbar):
* rendering/RenderScrollbar.h:
* rendering/RenderSearchField.cpp:
(WebCore::RenderSearchField::createScrollbar):
* rendering/RenderSearchField.h:

Source/WebKit2:

        
Change users of the scrollAnimator() method to expect a reference instead of a pointer.

* WebProcess/Plugins/PDF/PDFPlugin.mm:
(WebKit::PDFPlugin::createScrollbar):
(WebKit::PDFPlugin::destroyScrollbar):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (180473 => 180474)


--- trunk/Source/WebCore/ChangeLog	2015-02-21 02:55:35 UTC (rev 180473)
+++ trunk/Source/WebCore/ChangeLog	2015-02-21 03:34:09 UTC (rev 180474)
@@ -1,3 +1,125 @@
+2015-02-20  Brent Fulgham  <[email protected]>
+
+        Scrollbars and ScrollAnimators must always have a ScrollableArea
+        https://bugs.webkit.org/show_bug.cgi?id=141855
+
+        Reviewed by Simon Fraser.
+
+        No change in functionality.
+        
+        Change users of the scrollAnimator() method to expect a reference instead of a pointer. Also get rid of
+        a number of unnecessary nullptr checks.
+
+        * accessibility/AccessibilityScrollbar.cpp:
+        (WebCore::AccessibilityScrollbar::setValue):
+        * css/SelectorCheckerTestFunctions.h:
+        (WebCore::scrollbarMatchesCornerPresentPseudoClass):
+        * page/FrameView.cpp:
+        (WebCore::FrameView::createScrollbar):
+        (WebCore::FrameView::setFixedVisibleContentRect):
+        * page/scrolling/ScrollingCoordinator.cpp:
+        (WebCore::ScrollingCoordinator::handleWheelEventPhase):
+        * platform/PopupMenuClient.h:
+        * platform/ScrollAnimator.cpp:
+        (WebCore::ScrollAnimator::ScrollAnimator):
+        (WebCore::ScrollAnimator::scroll):
+        (WebCore::ScrollAnimator::handleWheelEvent):
+        (WebCore::ScrollAnimator::notifyPositionChanged):
+        (WebCore::ScrollAnimator::updateScrollAnimatorsAndTimers):
+        * platform/ScrollAnimator.h:
+        (WebCore::ScrollAnimator::ScrollAnimator::scrollableArea):
+        * platform/ScrollAnimatorNone.cpp:
+        * platform/ScrollAnimatorNone.h:
+        * platform/ScrollView.cpp:
+        (WebCore::ScrollView::createScrollbar):
+        * platform/ScrollableArea.cpp:
+        (WebCore::ScrollableArea::scrollAnimator):
+        (WebCore::ScrollableArea::scroll):
+        (WebCore::ScrollableArea::scrollToOffsetWithoutAnimation):
+        (WebCore::ScrollableArea::notifyScrollPositionChanged):
+        (WebCore::ScrollableArea::scrollPositionChanged):
+        (WebCore::ScrollableArea::handleWheelEvent):
+        (WebCore::ScrollableArea::handleTouchEvent):
+        (WebCore::ScrollableArea::mouseEnteredScrollbar):
+        (WebCore::ScrollableArea::mouseExitedScrollbar):
+        (WebCore::ScrollableArea::didAddScrollbar):
+        (WebCore::ScrollableArea::willRemoveScrollbar):
+        (WebCore::ScrollableArea::verticalScrollbarLayerDidChange):
+        (WebCore::ScrollableArea::horizontalScrollbarLayerDidChange):
+        * platform/ScrollableArea.h:
+        * platform/Scrollbar.cpp:
+        (WebCore::Scrollbar::createNativeScrollbar):
+        (WebCore::Scrollbar::Scrollbar):
+        (WebCore::Scrollbar::scrollbarOverlayStyle):
+        (WebCore::Scrollbar::isScrollableAreaActive):
+        (WebCore::Scrollbar::offsetDidChange):
+        (WebCore::Scrollbar::autoscrollPressedPart):
+        (WebCore::Scrollbar::moveThumb):
+        (WebCore::Scrollbar::mouseMoved):
+        (WebCore::Scrollbar::mouseEntered):
+        (WebCore::Scrollbar::mouseExited):
+        (WebCore::Scrollbar::mouseUp):
+        (WebCore::Scrollbar::shouldParticipateInHitTesting):
+        (WebCore::Scrollbar::isWindowActive):
+        (WebCore::Scrollbar::invalidateRect):
+        (WebCore::Scrollbar::convertToContainingView):
+        (WebCore::Scrollbar::convertFromContainingView):
+        (WebCore::Scrollbar::supportsUpdateOnSecondaryThread):
+        * platform/Scrollbar.h:
+        (WebCore::Scrollbar::scrollableArea):
+        (WebCore::Scrollbar::disconnectFromScrollableArea): Deleted.
+        * platform/ios/ScrollAnimatorIOS.mm:
+        (WebCore::ScrollAnimatorIOS::handleTouchEvent):
+        (WebCore::ScrollAnimatorIOS::determineScrollableAreaForTouchSequence):
+        * platform/mac/ScrollAnimatorMac.h:
+        * platform/mac/ScrollAnimatorMac.mm:
+        (-[WebScrollbarPainterControllerDelegate scrollerImpPair:setContentAreaNeedsDisplayInRect:]):
+        (-[WebScrollbarPainterControllerDelegate scrollerImpPair:updateScrollerStyleForNewRecommendedScrollerStyle:]):
+        (-[WebScrollbarPainterDelegate scrollAnimator]):
+        (-[WebScrollbarPainterDelegate layer]):
+        (-[WebScrollbarPainterDelegate mouseLocationInScrollerForScrollerImp:]):
+        (-[WebScrollbarPainterDelegate setUpAlphaAnimation:scrollerPainter:part:animateAlphaTo:duration:]):
+        (WebCore::ScrollAnimator::create):
+        (WebCore::ScrollAnimatorMac::ScrollAnimatorMac):
+        (WebCore::ScrollAnimatorMac::scroll):
+        (WebCore::ScrollAnimatorMac::adjustScrollPositionIfNecessary):
+        (WebCore::ScrollAnimatorMac::adjustScrollPositionToBoundsIfNecessary):
+        (WebCore::ScrollAnimatorMac::immediateScrollTo):
+        (WebCore::ScrollAnimatorMac::didAddVerticalScrollbar):
+        (WebCore::ScrollAnimatorMac::didAddHorizontalScrollbar):
+        (WebCore::ScrollAnimatorMac::verticalScrollbarLayerDidChange):
+        (WebCore::ScrollAnimatorMac::horizontalScrollbarLayerDidChange):
+        (WebCore::ScrollAnimatorMac::notifyContentAreaScrolled):
+        (WebCore::ScrollAnimatorMac::pinnedInDirection):
+        (WebCore::ScrollAnimatorMac::isAlreadyPinnedInDirectionOfGesture):
+        (WebCore::ScrollAnimatorMac::allowsVerticalStretching):
+        (WebCore::ScrollAnimatorMac::allowsHorizontalStretching):
+        (WebCore::ScrollAnimatorMac::stretchAmount):
+        (WebCore::ScrollAnimatorMac::canScrollHorizontally):
+        (WebCore::ScrollAnimatorMac::canScrollVertically):
+        (WebCore::ScrollAnimatorMac::absoluteScrollPosition):
+        (WebCore::ScrollAnimatorMac::immediateScrollByWithoutContentEdgeConstraints):
+        (WebCore::ScrollAnimatorMac::updateScrollerStyle):
+        (WebCore::ScrollAnimatorMac::setVisibleScrollerThumbRect):
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::RenderLayer):
+        (WebCore::RenderLayer::createScrollbar):
+        (WebCore::RenderLayer::destroyScrollbar):
+        (WebCore::RenderLayer::updateScrollInfoAfterLayout):
+        * rendering/RenderListBox.cpp:
+        (WebCore::RenderListBox::createScrollbar):
+        (WebCore::RenderListBox::destroyScrollbar):
+        * rendering/RenderMenuList.cpp:
+        (RenderMenuList::createScrollbar):
+        * rendering/RenderMenuList.h:
+        * rendering/RenderScrollbar.cpp:
+        (WebCore::RenderScrollbar::createCustomScrollbar):
+        (WebCore::RenderScrollbar::RenderScrollbar):
+        * rendering/RenderScrollbar.h:
+        * rendering/RenderSearchField.cpp:
+        (WebCore::RenderSearchField::createScrollbar):
+        * rendering/RenderSearchField.h:
+
 2015-02-20  Enrica Casucci  <[email protected]>
 
         [WK2] Add support for font panel on OS X.

Modified: trunk/Source/WebCore/accessibility/AccessibilityScrollbar.cpp (180473 => 180474)


--- trunk/Source/WebCore/accessibility/AccessibilityScrollbar.cpp	2015-02-21 02:55:35 UTC (rev 180473)
+++ trunk/Source/WebCore/accessibility/AccessibilityScrollbar.cpp	2015-02-21 03:34:09 UTC (rev 180474)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010, 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
@@ -96,11 +96,8 @@
     if (!m_scrollbar)
         return;
     
-    if (!m_scrollbar->scrollableArea())
-        return;
-
     float newValue = value * m_scrollbar->maximum();
-    m_scrollbar->scrollableArea()->scrollToOffsetWithoutAnimation(m_scrollbar->orientation(), newValue);
+    m_scrollbar->scrollableArea().scrollToOffsetWithoutAnimation(m_scrollbar->orientation(), newValue);
 }
     
 } // namespace WebCore

Modified: trunk/Source/WebCore/css/SelectorCheckerTestFunctions.h (180473 => 180474)


--- trunk/Source/WebCore/css/SelectorCheckerTestFunctions.h	2015-02-21 02:55:35 UTC (rev 180473)
+++ trunk/Source/WebCore/css/SelectorCheckerTestFunctions.h	2015-02-21 03:34:09 UTC (rev 180474)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014-2015 Apple Inc. All rights reserved.
  * Copyright (C) 2014 Dhi Aurrahman <[email protected]>
  *
  * Redistribution and use in source and binary forms, with or without
@@ -358,7 +358,7 @@
 
 ALWAYS_INLINE bool scrollbarMatchesCornerPresentPseudoClass(const SelectorChecker::CheckingContext& context)
 {
-    return context.scrollbar && context.scrollbar->scrollableArea()->isScrollCornerVisible();
+    return context.scrollbar && context.scrollbar->scrollableArea().isScrollCornerVisible();
 }
 
 #if ENABLE(FULLSCREEN_API)

Modified: trunk/Source/WebCore/page/FrameView.cpp (180473 => 180474)


--- trunk/Source/WebCore/page/FrameView.cpp	2015-02-21 02:55:35 UTC (rev 180473)
+++ trunk/Source/WebCore/page/FrameView.cpp	2015-02-21 03:34:09 UTC (rev 180474)
@@ -3,7 +3,7 @@
  *                     1999 Lars Knoll <[email protected]>
  *                     1999 Antti Koivisto <[email protected]>
  *                     2000 Dirk Mueller <[email protected]>
- * Copyright (C) 2004-2008, 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2004-2008, 2013-2015 Apple Inc. All rights reserved.
  *           (C) 2006 Graham Dennis ([email protected])
  *           (C) 2006 Alexey Proskuryakov ([email protected])
  * Copyright (C) 2009 Google Inc. All rights reserved.
@@ -542,17 +542,17 @@
     // Try the <body> element first as a scrollbar source.
     HTMLElement* body = doc ? doc->bodyOrFrameset() : nullptr;
     if (body && body->renderer() && body->renderer()->style().hasPseudoStyle(SCROLLBAR))
-        return RenderScrollbar::createCustomScrollbar(this, orientation, body);
+        return RenderScrollbar::createCustomScrollbar(*this, orientation, body);
     
     // If the <body> didn't have a custom style, then the root element might.
     Element* docElement = doc ? doc->documentElement() : nullptr;
     if (docElement && docElement->renderer() && docElement->renderer()->style().hasPseudoStyle(SCROLLBAR))
-        return RenderScrollbar::createCustomScrollbar(this, orientation, docElement);
+        return RenderScrollbar::createCustomScrollbar(*this, orientation, docElement);
         
     // If we have an owning iframe/frame element, then it can set the custom scrollbar also.
     RenderWidget* frameRenderer = frame().ownerRenderer();
     if (frameRenderer && frameRenderer->style().hasPseudoStyle(SCROLLBAR))
-        return RenderScrollbar::createCustomScrollbar(this, orientation, 0, &frame());
+        return RenderScrollbar::createCustomScrollbar(*this, orientation, nullptr, &frame());
     
     // Nobody set a custom style, so we just use a native scrollbar.
     return ScrollView::createScrollbar(orientation);
@@ -2081,7 +2081,7 @@
         if (frame().page()->settings().acceleratedCompositingForFixedPositionEnabled())
             updateCompositingLayersAfterScrolling();
         IntPoint newPosition = scrollPosition();
-        scrollAnimator()->setCurrentPosition(scrollPosition());
+        scrollAnimator().setCurrentPosition(scrollPosition());
         scrollPositionChanged(oldPosition, newPosition);
     }
     if (visibleContentSizeDidChange) {

Modified: trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp (180473 => 180474)


--- trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp	2015-02-21 02:55:35 UTC (rev 180473)
+++ trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp	2015-02-21 03:34:09 UTC (rev 180474)
@@ -289,7 +289,7 @@
     if (!frameView)
         return;
 
-    frameView->scrollAnimator()->handleWheelEventPhase(phase);
+    frameView->scrollAnimator().handleWheelEventPhase(phase);
 }
 #endif
 

Modified: trunk/Source/WebCore/platform/PopupMenuClient.h (180473 => 180474)


--- trunk/Source/WebCore/platform/PopupMenuClient.h	2015-02-21 02:55:35 UTC (rev 180473)
+++ trunk/Source/WebCore/platform/PopupMenuClient.h	2015-02-21 03:34:09 UTC (rev 180474)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
- * Copyright (C) 2006 Apple Inc.
+ * Copyright (C) 2006, 2015 Apple Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -74,7 +74,7 @@
     virtual FontSelector* fontSelector() const = 0;
     virtual HostWindow* hostWindow() const = 0;
 
-    virtual PassRefPtr<Scrollbar> createScrollbar(ScrollableArea*, ScrollbarOrientation, ScrollbarControlSize) = 0;
+    virtual PassRefPtr<Scrollbar> createScrollbar(ScrollableArea&, ScrollbarOrientation, ScrollbarControlSize) = 0;
 };
 
 }

Modified: trunk/Source/WebCore/platform/ScrollAnimator.cpp (180473 => 180474)


--- trunk/Source/WebCore/platform/ScrollAnimator.cpp	2015-02-21 02:55:35 UTC (rev 180473)
+++ trunk/Source/WebCore/platform/ScrollAnimator.cpp	2015-02-21 03:34:09 UTC (rev 180474)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014 Apple Inc.  All rights reserved.
+ * Copyright (C) 2014-2015 Apple Inc.  All rights reserved.
  * Copyright (c) 2010, Google Inc. All rights reserved.
  * 
  * Redistribution and use in source and binary forms, with or without
@@ -41,13 +41,13 @@
 namespace WebCore {
 
 #if !ENABLE(SMOOTH_SCROLLING) && !PLATFORM(IOS)
-PassOwnPtr<ScrollAnimator> ScrollAnimator::create(ScrollableArea* scrollableArea)
+PassOwnPtr<ScrollAnimator> ScrollAnimator::create(ScrollableArea& scrollableArea)
 {
     return adoptPtr(new ScrollAnimator(scrollableArea));
 }
 #endif
 
-ScrollAnimator::ScrollAnimator(ScrollableArea* scrollableArea)
+ScrollAnimator::ScrollAnimator(ScrollableArea& scrollableArea)
     : m_scrollableArea(scrollableArea)
     , m_currentPosX(0)
     , m_currentPosY(0)
@@ -61,7 +61,7 @@
 bool ScrollAnimator::scroll(ScrollbarOrientation orientation, ScrollGranularity, float step, float multiplier)
 {
     float* currentPos = (orientation == HorizontalScrollbar) ? &m_currentPosX : &m_currentPosY;
-    float newPos = std::max(std::min(*currentPos + (step * multiplier), static_cast<float>(m_scrollableArea->scrollSize(orientation))), 0.0f);
+    float newPos = std::max(std::min(*currentPos + (step * multiplier), static_cast<float>(m_scrollableArea.scrollSize(orientation))), 0.0f);
     float delta = *currentPos - newPos;
     if (*currentPos == newPos)
         return false;
@@ -114,8 +114,8 @@
         return true;
 #endif
 
-    Scrollbar* horizontalScrollbar = m_scrollableArea->horizontalScrollbar();
-    Scrollbar* verticalScrollbar = m_scrollableArea->verticalScrollbar();
+    Scrollbar* horizontalScrollbar = m_scrollableArea.horizontalScrollbar();
+    Scrollbar* verticalScrollbar = m_scrollableArea.verticalScrollbar();
 
     // Accept the event if we have a scrollbar in that direction and can still
     // scroll any further.
@@ -125,8 +125,8 @@
     bool handled = false;
 
     ScrollGranularity granularity = ScrollByPixel;
-    IntSize maxForwardScrollDelta = m_scrollableArea->maximumScrollPosition() - m_scrollableArea->scrollPosition();
-    IntSize maxBackwardScrollDelta = m_scrollableArea->scrollPosition() - m_scrollableArea->minimumScrollPosition();
+    IntSize maxForwardScrollDelta = m_scrollableArea.maximumScrollPosition() - m_scrollableArea.scrollPosition();
+    IntSize maxBackwardScrollDelta = m_scrollableArea.scrollPosition() - m_scrollableArea.minimumScrollPosition();
     if ((deltaX < 0 && maxForwardScrollDelta.width() > 0)
         || (deltaX > 0 && maxBackwardScrollDelta.width() > 0)
         || (deltaY < 0 && maxForwardScrollDelta.height() > 0)
@@ -136,7 +136,7 @@
         if (deltaY) {
             if (e.granularity() == ScrollByPageWheelEvent) {
                 bool negative = deltaY < 0;
-                deltaY = Scrollbar::pageStepDelta(m_scrollableArea->visibleHeight());
+                deltaY = Scrollbar::pageStepDelta(m_scrollableArea.visibleHeight());
                 if (negative)
                     deltaY = -deltaY;
             }
@@ -146,7 +146,7 @@
         if (deltaX) {
             if (e.granularity() == ScrollByPageWheelEvent) {
                 bool negative = deltaX < 0;
-                deltaX = Scrollbar::pageStepDelta(m_scrollableArea->visibleWidth());
+                deltaX = Scrollbar::pageStepDelta(m_scrollableArea.visibleWidth());
                 if (negative)
                     deltaX = -deltaX;
             }
@@ -177,22 +177,22 @@
 void ScrollAnimator::notifyPositionChanged(const FloatSize& delta)
 {
     UNUSED_PARAM(delta);
-    m_scrollableArea->setScrollOffsetFromAnimation(IntPoint(m_currentPosX, m_currentPosY));
+    m_scrollableArea.setScrollOffsetFromAnimation(IntPoint(m_currentPosX, m_currentPosY));
 }
 
 #if ENABLE(CSS_SCROLL_SNAP) && PLATFORM(MAC)
 void ScrollAnimator::updateScrollAnimatorsAndTimers()
 {
     // FIXME: Currently, scroll snap animators are recreated even though the snap offsets alone can be updated.
-    if (m_scrollableArea->horizontalSnapOffsets()) {
-        m_horizontalScrollSnapAnimator = std::make_unique<AxisScrollSnapAnimator>(this, m_scrollableArea->horizontalSnapOffsets(), ScrollEventAxis::Horizontal);
+    if (m_scrollableArea.horizontalSnapOffsets()) {
+        m_horizontalScrollSnapAnimator = std::make_unique<AxisScrollSnapAnimator>(this, m_scrollableArea.horizontalSnapOffsets(), ScrollEventAxis::Horizontal);
         m_horizontalScrollSnapTimer = std::make_unique<Timer>(*this, &ScrollAnimator::horizontalScrollSnapTimerFired);
     } else if (m_horizontalScrollSnapAnimator) {
         m_horizontalScrollSnapAnimator = nullptr;
         m_horizontalScrollSnapTimer = nullptr;
     }
-    if (m_scrollableArea->verticalSnapOffsets()) {
-        m_verticalScrollSnapAnimator = std::make_unique<AxisScrollSnapAnimator>(this, m_scrollableArea->verticalSnapOffsets(), ScrollEventAxis::Vertical);
+    if (m_scrollableArea.verticalSnapOffsets()) {
+        m_verticalScrollSnapAnimator = std::make_unique<AxisScrollSnapAnimator>(this, m_scrollableArea.verticalSnapOffsets(), ScrollEventAxis::Vertical);
         m_verticalScrollSnapTimer = std::make_unique<Timer>(*this, &ScrollAnimator::verticalScrollSnapTimerFired);
     } else if (m_verticalScrollSnapAnimator) {
         m_verticalScrollSnapAnimator = nullptr;

Modified: trunk/Source/WebCore/platform/ScrollAnimator.h (180473 => 180474)


--- trunk/Source/WebCore/platform/ScrollAnimator.h	2015-02-21 02:55:35 UTC (rev 180473)
+++ trunk/Source/WebCore/platform/ScrollAnimator.h	2015-02-21 03:34:09 UTC (rev 180474)
@@ -1,6 +1,7 @@
 /*
  * Copyright (c) 2010, Google Inc. All rights reserved.
- * 
+ * Copyright (C) 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 are
  * met:
@@ -56,7 +57,7 @@
 #endif
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    static PassOwnPtr<ScrollAnimator> create(ScrollableArea*);
+    static PassOwnPtr<ScrollAnimator> create(ScrollableArea&);
 
     virtual ~ScrollAnimator();
 
@@ -68,7 +69,7 @@
 
     virtual void scrollToOffsetWithoutAnimation(const FloatPoint&);
 
-    ScrollableArea* scrollableArea() const { return m_scrollableArea; }
+    ScrollableArea& scrollableArea() const { return m_scrollableArea; }
 
     virtual bool handleWheelEvent(const PlatformWheelEvent&);
 
@@ -125,7 +126,7 @@
 #endif
 
 protected:
-    explicit ScrollAnimator(ScrollableArea*);
+    explicit ScrollAnimator(ScrollableArea&);
 
     virtual void notifyPositionChanged(const FloatSize& delta);
 
@@ -135,7 +136,7 @@
     void verticalScrollSnapTimerFired();
 #endif
 
-    ScrollableArea* m_scrollableArea;
+    ScrollableArea& m_scrollableArea;
     float m_currentPosX; // We avoid using a FloatPoint in order to reduce
     float m_currentPosY; // subclass code complexity.
 #if ENABLE(CSS_SCROLL_SNAP) && PLATFORM(MAC)

Modified: trunk/Source/WebCore/platform/ScrollAnimatorNone.cpp (180473 => 180474)


--- trunk/Source/WebCore/platform/ScrollAnimatorNone.cpp	2015-02-21 02:55:35 UTC (rev 180473)
+++ trunk/Source/WebCore/platform/ScrollAnimatorNone.cpp	2015-02-21 03:34:09 UTC (rev 180474)
@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2011, Google Inc. All rights reserved.
+ * Copyright (C) 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 are
@@ -51,9 +52,9 @@
 const double kMinimumTimerInterval = .001;
 const double kZoomTicks = 11;
 
-PassOwnPtr<ScrollAnimator> ScrollAnimator::create(ScrollableArea* scrollableArea)
+PassOwnPtr<ScrollAnimator> ScrollAnimator::create(ScrollableArea& scrollableArea)
 {
-    if (scrollableArea && scrollableArea->scrollAnimatorEnabled())
+    if (scrollableArea.scrollAnimatorEnabled())
         return adoptPtr(new ScrollAnimatorNone(scrollableArea));
     return adoptPtr(new ScrollAnimator(scrollableArea));
 }
@@ -368,7 +369,7 @@
     m_visibleLength = visibleLength;
 }
 
-ScrollAnimatorNone::ScrollAnimatorNone(ScrollableArea* scrollableArea)
+ScrollAnimatorNone::ScrollAnimatorNone(ScrollableArea& scrollableArea)
     : ScrollAnimator(scrollableArea)
     , m_horizontalData(this, &m_currentPosX, scrollableArea->visibleWidth())
     , m_verticalData(this, &m_currentPosY, scrollableArea->visibleHeight())
@@ -405,7 +406,7 @@
 
 bool ScrollAnimatorNone::scroll(ScrollbarOrientation orientation, ScrollGranularity granularity, float step, float multiplier)
 {
-    if (!m_scrollableArea->scrollAnimatorEnabled())
+    if (!m_scrollableArea.scrollAnimatorEnabled())
         return ScrollAnimator::scroll(orientation, granularity, step, multiplier);
 
     // FIXME: get the type passed in. MouseWheel could also be by line, but should still have different
@@ -427,7 +428,7 @@
         return ScrollAnimator::scroll(orientation, granularity, step, multiplier);
 
     // This is an animatable scroll. Set the animation in motion using the appropriate parameters.
-    float scrollableSize = static_cast<float>(m_scrollableArea->scrollSize(orientation));
+    float scrollableSize = static_cast<float>(m_scrollableArea.scrollSize(orientation));
 
     PerAxisData& data = "" == VerticalScrollbar) ? m_verticalData : m_horizontalData;
     bool needToScroll = data.updateDataFromParameters(step, multiplier, scrollableSize, monotonicallyIncreasingTime(), &parameters);
@@ -486,8 +487,8 @@
 
 void ScrollAnimatorNone::updateVisibleLengths()
 {
-    m_horizontalData.updateVisibleLength(scrollableArea()->visibleWidth());
-    m_verticalData.updateVisibleLength(scrollableArea()->visibleHeight());
+    m_horizontalData.updateVisibleLength(scrollableArea().visibleWidth());
+    m_verticalData.updateVisibleLength(scrollableArea().visibleHeight());
 }
 
 #if USE(REQUEST_ANIMATION_FRAME_TIMER)
@@ -532,7 +533,7 @@
 #else
 void ScrollAnimatorNone::startNextTimer()
 {
-    if (scrollableArea()->scheduleAnimation())
+    if (scrollableArea().scheduleAnimation())
         m_animationActive = true;
 }
 #endif

Modified: trunk/Source/WebCore/platform/ScrollAnimatorNone.h (180473 => 180474)


--- trunk/Source/WebCore/platform/ScrollAnimatorNone.h	2015-02-21 02:55:35 UTC (rev 180473)
+++ trunk/Source/WebCore/platform/ScrollAnimatorNone.h	2015-02-21 03:34:09 UTC (rev 180474)
@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2011, Google Inc. All rights reserved.
+ * Copyright (C) 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 are
@@ -52,7 +53,7 @@
 
 class ScrollAnimatorNone : public ScrollAnimator {
 public:
-    explicit ScrollAnimatorNone(ScrollableArea*);
+    explicit ScrollAnimatorNone(ScrollableArea&);
     virtual ~ScrollAnimatorNone();
 
     virtual bool scroll(ScrollbarOrientation, ScrollGranularity, float step, float multiplier);

Modified: trunk/Source/WebCore/platform/ScrollView.cpp (180473 => 180474)


--- trunk/Source/WebCore/platform/ScrollView.cpp	2015-02-21 02:55:35 UTC (rev 180473)
+++ trunk/Source/WebCore/platform/ScrollView.cpp	2015-02-21 03:34:09 UTC (rev 180474)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006, 2007, 2008, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2006, 2007, 2008, 2014-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
@@ -134,7 +134,7 @@
 
 PassRefPtr<Scrollbar> ScrollView::createScrollbar(ScrollbarOrientation orientation)
 {
-    return Scrollbar::createNativeScrollbar(this, orientation, RegularScrollbar);
+    return Scrollbar::createNativeScrollbar(*this, orientation, RegularScrollbar);
 }
 
 void ScrollView::setScrollbarModes(ScrollbarMode horizontalMode, ScrollbarMode verticalMode,

Modified: trunk/Source/WebCore/platform/ScrollableArea.cpp (180473 => 180474)


--- trunk/Source/WebCore/platform/ScrollableArea.cpp	2015-02-21 02:55:35 UTC (rev 180473)
+++ trunk/Source/WebCore/platform/ScrollableArea.cpp	2015-02-21 03:34:09 UTC (rev 180474)
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2010, Google Inc. All rights reserved.
- * Copyright (C) 2008, 2011, 2014 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2008, 2011, 2014-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 are
@@ -70,12 +70,13 @@
 {
 }
 
-ScrollAnimator* ScrollableArea::scrollAnimator() const
+ScrollAnimator& ScrollableArea::scrollAnimator() const
 {
     if (!m_scrollAnimator)
-        m_scrollAnimator = ScrollAnimator::create(const_cast<ScrollableArea*>(this));
+        m_scrollAnimator = ScrollAnimator::create(const_cast<ScrollableArea&>(*this));
 
-    return m_scrollAnimator.get();
+    ASSERT(m_scrollAnimator);
+    return *m_scrollAnimator.get();
 }
 
 void ScrollableArea::setScrollOrigin(const IntPoint& origin)
@@ -127,26 +128,26 @@
         multiplier = -multiplier;
 
     step = adjustScrollStepForFixedContent(step, orientation, granularity);
-    return scrollAnimator()->scroll(orientation, granularity, step, multiplier);
+    return scrollAnimator().scroll(orientation, granularity, step, multiplier);
 }
 
 void ScrollableArea::scrollToOffsetWithoutAnimation(const FloatPoint& offset)
 {
-    scrollAnimator()->scrollToOffsetWithoutAnimation(offset);
+    scrollAnimator().scrollToOffsetWithoutAnimation(offset);
 }
 
 void ScrollableArea::scrollToOffsetWithoutAnimation(ScrollbarOrientation orientation, float offset)
 {
     if (orientation == HorizontalScrollbar)
-        scrollToOffsetWithoutAnimation(FloatPoint(offset, scrollAnimator()->currentPosition().y()));
+        scrollToOffsetWithoutAnimation(FloatPoint(offset, scrollAnimator().currentPosition().y()));
     else
-        scrollToOffsetWithoutAnimation(FloatPoint(scrollAnimator()->currentPosition().x(), offset));
+        scrollToOffsetWithoutAnimation(FloatPoint(scrollAnimator().currentPosition().x(), offset));
 }
 
 void ScrollableArea::notifyScrollPositionChanged(const IntPoint& position)
 {
     scrollPositionChanged(position);
-    scrollAnimator()->setCurrentPosition(position);
+    scrollAnimator().setCurrentPosition(position);
 }
 
 void ScrollableArea::scrollPositionChanged(const IntPoint& position)
@@ -179,7 +180,7 @@
     }
 
     if (scrollPosition() != oldPosition)
-        scrollAnimator()->notifyContentAreaScrolled(scrollPosition() - oldPosition);
+        scrollAnimator().notifyContentAreaScrolled(scrollPosition() - oldPosition);
 }
 
 bool ScrollableArea::handleWheelEvent(const PlatformWheelEvent& wheelEvent)
@@ -187,13 +188,13 @@
     if (!isScrollableOrRubberbandable())
         return false;
 
-    return scrollAnimator()->handleWheelEvent(wheelEvent);
+    return scrollAnimator().handleWheelEvent(wheelEvent);
 }
 
 #if ENABLE(TOUCH_EVENTS)
 bool ScrollableArea::handleTouchEvent(const PlatformTouchEvent& touchEvent)
 {
-    return scrollAnimator()->handleTouchEvent(touchEvent);
+    return scrollAnimator().handleTouchEvent(touchEvent);
 }
 #endif
 
@@ -255,12 +256,12 @@
 
 void ScrollableArea::mouseEnteredScrollbar(Scrollbar* scrollbar) const
 {
-    scrollAnimator()->mouseEnteredScrollbar(scrollbar);
+    scrollAnimator().mouseEnteredScrollbar(scrollbar);
 }
 
 void ScrollableArea::mouseExitedScrollbar(Scrollbar* scrollbar) const
 {
-    scrollAnimator()->mouseExitedScrollbar(scrollbar);
+    scrollAnimator().mouseExitedScrollbar(scrollbar);
 }
 
 void ScrollableArea::contentAreaDidShow() const
@@ -291,9 +292,9 @@
 void ScrollableArea::didAddScrollbar(Scrollbar* scrollbar, ScrollbarOrientation orientation)
 {
     if (orientation == VerticalScrollbar)
-        scrollAnimator()->didAddVerticalScrollbar(scrollbar);
+        scrollAnimator().didAddVerticalScrollbar(scrollbar);
     else
-        scrollAnimator()->didAddHorizontalScrollbar(scrollbar);
+        scrollAnimator().didAddHorizontalScrollbar(scrollbar);
 
     // <rdar://problem/9797253> AppKit resets the scrollbar's style when you attach a scrollbar
     setScrollbarOverlayStyle(scrollbarOverlayStyle());
@@ -302,9 +303,9 @@
 void ScrollableArea::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation orientation)
 {
     if (orientation == VerticalScrollbar)
-        scrollAnimator()->willRemoveVerticalScrollbar(scrollbar);
+        scrollAnimator().willRemoveVerticalScrollbar(scrollbar);
     else
-        scrollAnimator()->willRemoveHorizontalScrollbar(scrollbar);
+        scrollAnimator().willRemoveHorizontalScrollbar(scrollbar);
 }
 
 void ScrollableArea::contentsResized()
@@ -365,12 +366,12 @@
 
 void ScrollableArea::verticalScrollbarLayerDidChange()
 {
-    scrollAnimator()->verticalScrollbarLayerDidChange();
+    scrollAnimator().verticalScrollbarLayerDidChange();
 }
 
 void ScrollableArea::horizontalScrollbarLayerDidChange()
 {
-    scrollAnimator()->horizontalScrollbarLayerDidChange();
+    scrollAnimator().horizontalScrollbarLayerDidChange();
 }
 
 bool ScrollableArea::hasLayerForHorizontalScrollbar() const

Modified: trunk/Source/WebCore/platform/ScrollableArea.h (180473 => 180474)


--- trunk/Source/WebCore/platform/ScrollableArea.h	2015-02-21 02:55:35 UTC (rev 180473)
+++ trunk/Source/WebCore/platform/ScrollableArea.h	2015-02-21 03:34:09 UTC (rev 180474)
@@ -117,7 +117,7 @@
     ScrollbarOverlayStyle scrollbarOverlayStyle() const { return static_cast<ScrollbarOverlayStyle>(m_scrollbarOverlayStyle); }
 
     // This getter will create a ScrollAnimator if it doesn't already exist.
-    WEBCORE_EXPORT ScrollAnimator* scrollAnimator() const;
+    WEBCORE_EXPORT ScrollAnimator& scrollAnimator() const;
 
     // This getter will return null if the ScrollAnimator hasn't been created yet.
     ScrollAnimator* existingScrollAnimator() const { return m_scrollAnimator.get(); }

Modified: trunk/Source/WebCore/platform/Scrollbar.cpp (180473 => 180474)


--- trunk/Source/WebCore/platform/Scrollbar.cpp	2015-02-21 02:55:35 UTC (rev 180473)
+++ trunk/Source/WebCore/platform/Scrollbar.cpp	2015-02-21 03:34:09 UTC (rev 180474)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2004, 2006, 2008, 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
@@ -44,7 +44,7 @@
 namespace WebCore {
 
 #if !PLATFORM(EFL)
-PassRefPtr<Scrollbar> Scrollbar::createNativeScrollbar(ScrollableArea* scrollableArea, ScrollbarOrientation orientation, ScrollbarControlSize size)
+PassRefPtr<Scrollbar> Scrollbar::createNativeScrollbar(ScrollableArea& scrollableArea, ScrollbarOrientation orientation, ScrollbarControlSize size)
 {
     return adoptRef(new Scrollbar(scrollableArea, orientation, size));
 }
@@ -56,7 +56,7 @@
     return maxOverlapBetweenPages;
 }
 
-Scrollbar::Scrollbar(ScrollableArea* scrollableArea, ScrollbarOrientation orientation, ScrollbarControlSize controlSize,
+Scrollbar::Scrollbar(ScrollableArea& scrollableArea, ScrollbarOrientation orientation, ScrollbarControlSize controlSize,
                      ScrollbarTheme* theme, bool isCustomScrollbar)
     : m_scrollableArea(scrollableArea)
     , m_orientation(orientation)
@@ -93,8 +93,7 @@
     int thickness = m_theme->scrollbarThickness(controlSize);
     Widget::setFrameRect(IntRect(0, 0, thickness, thickness));
 
-    if (m_scrollableArea)
-        m_currentPos = static_cast<float>(m_scrollableArea->scrollPosition(this));
+    m_currentPos = static_cast<float>(m_scrollableArea.scrollPosition(this));
 }
 
 Scrollbar::~Scrollbar()
@@ -106,12 +105,12 @@
 
 ScrollbarOverlayStyle Scrollbar::scrollbarOverlayStyle() const
 {
-    return m_scrollableArea ? m_scrollableArea->scrollbarOverlayStyle() : ScrollbarOverlayStyleDefault;
+    return m_scrollableArea.scrollbarOverlayStyle();
 }
 
 bool Scrollbar::isScrollableAreaActive() const
 {
-    return m_scrollableArea && m_scrollableArea->isActive();
+    return m_scrollableArea.isActive();
 }
 
 bool Scrollbar::isScrollViewScrollbar() const
@@ -121,9 +120,7 @@
 
 void Scrollbar::offsetDidChange()
 {
-    ASSERT(m_scrollableArea);
-
-    float position = static_cast<float>(m_scrollableArea->scrollPosition(this));
+    float position = static_cast<float>(m_scrollableArea.scrollPosition(this));
     if (position == m_currentPos)
         return;
 
@@ -211,7 +208,7 @@
     }
 
     // Handle the arrows and track.
-    if (m_scrollableArea && m_scrollableArea->scroll(pressedPartScrollDirection(), pressedPartScrollGranularity()))
+    if (m_scrollableArea.scroll(pressedPartScrollDirection(), pressedPartScrollGranularity()))
         startTimerIfNeeded(delay);
 }
 
@@ -270,22 +267,19 @@
 
 void Scrollbar::moveThumb(int pos, bool draggingDocument)
 {
-    if (!m_scrollableArea)
-        return;
-
     int delta = pos - m_pressedPos;
 
     if (draggingDocument) {
         if (m_draggingDocument)
             delta = pos - m_documentDragPos;
         m_draggingDocument = true;
-        FloatPoint currentPosition = m_scrollableArea->scrollAnimator()->currentPosition();
+        FloatPoint currentPosition = m_scrollableArea.scrollAnimator().currentPosition();
         int destinationPosition = (m_orientation == HorizontalScrollbar ? currentPosition.x() : currentPosition.y()) + delta;
         if (delta > 0)
             destinationPosition = std::min(destinationPosition + delta, maximum());
         else if (delta < 0)
             destinationPosition = std::max(destinationPosition + delta, 0);
-        m_scrollableArea->scrollToOffsetWithoutAnimation(m_orientation, destinationPosition);
+        m_scrollableArea.scrollToOffsetWithoutAnimation(m_orientation, destinationPosition);
         m_documentDragPos = pos;
         return;
     }
@@ -307,7 +301,7 @@
     
     if (delta) {
         float newPosition = static_cast<float>(thumbPos + delta) * maximum() / (trackLen - thumbLen);
-        m_scrollableArea->scrollToOffsetWithoutAnimation(m_orientation, newPosition);
+        m_scrollableArea.scrollToOffsetWithoutAnimation(m_orientation, newPosition);
     }
 }
 
@@ -340,10 +334,9 @@
 bool Scrollbar::mouseMoved(const PlatformMouseEvent& evt)
 {
     if (m_pressedPart == ThumbPart) {
-        if (theme()->shouldSnapBackToDragOrigin(this, evt)) {
-            if (m_scrollableArea)
-                m_scrollableArea->scrollToOffsetWithoutAnimation(m_orientation, m_dragOrigin);
-        } else {
+        if (theme()->shouldSnapBackToDragOrigin(this, evt))
+            m_scrollableArea.scrollToOffsetWithoutAnimation(m_orientation, m_dragOrigin);
+        else {
             moveThumb(m_orientation == HorizontalScrollbar ? 
                       convertFromContainingWindow(evt.position()).x() :
                       convertFromContainingWindow(evt.position()).y(), theme()->shouldDragDocumentInsteadOfThumb(this, evt));
@@ -379,14 +372,12 @@
 
 void Scrollbar::mouseEntered()
 {
-    if (m_scrollableArea)
-        m_scrollableArea->mouseEnteredScrollbar(this);
+    m_scrollableArea.mouseEnteredScrollbar(this);
 }
 
 bool Scrollbar::mouseExited()
 {
-    if (m_scrollableArea)
-        m_scrollableArea->mouseExitedScrollbar(this);
+    m_scrollableArea.mouseExitedScrollbar(this);
     setHoveredPart(NoPart);
     return true;
 }
@@ -398,13 +389,11 @@
     m_draggingDocument = false;
     stopTimerIfNeeded();
 
-    if (m_scrollableArea) {
-        // m_hoveredPart won't be updated until the next mouseMoved or mouseDown, so we have to hit test
-        // to really know if the mouse has exited the scrollbar on a mouseUp.
-        ScrollbarPart part = theme()->hitTest(this, mouseEvent.position());
-        if (part == NoPart)
-            m_scrollableArea->mouseExitedScrollbar(this);
-    }
+    // m_hoveredPart won't be updated until the next mouseMoved or mouseDown, so we have to hit test
+    // to really know if the mouse has exited the scrollbar on a mouseUp.
+    ScrollbarPart part = theme()->hitTest(this, mouseEvent.position());
+    if (part == NoPart)
+        m_scrollableArea.mouseExitedScrollbar(this);
 
     return true;
 }
@@ -498,12 +487,12 @@
     // Non-overlay scrollbars should always participate in hit testing.
     if (!isOverlayScrollbar())
         return true;
-    return m_scrollableArea->scrollAnimator()->shouldScrollbarParticipateInHitTesting(this);
+    return m_scrollableArea.scrollAnimator().shouldScrollbarParticipateInHitTesting(this);
 }
 
 bool Scrollbar::isWindowActive() const
 {
-    return m_scrollableArea && m_scrollableArea->isActive();
+    return m_scrollableArea.isActive();
 }
 
 void Scrollbar::invalidateRect(const IntRect& rect)
@@ -511,40 +500,27 @@
     if (suppressInvalidation())
         return;
 
-    if (m_scrollableArea)
-        m_scrollableArea->invalidateScrollbar(this, rect);
+    m_scrollableArea.invalidateScrollbar(this, rect);
 }
 
 IntRect Scrollbar::convertToContainingView(const IntRect& localRect) const
 {
-    if (m_scrollableArea)
-        return m_scrollableArea->convertFromScrollbarToContainingView(this, localRect);
-
-    return Widget::convertToContainingView(localRect);
+    return m_scrollableArea.convertFromScrollbarToContainingView(this, localRect);
 }
 
 IntRect Scrollbar::convertFromContainingView(const IntRect& parentRect) const
 {
-    if (m_scrollableArea)
-        return m_scrollableArea->convertFromContainingViewToScrollbar(this, parentRect);
-
-    return Widget::convertFromContainingView(parentRect);
+    return m_scrollableArea.convertFromContainingViewToScrollbar(this, parentRect);
 }
 
 IntPoint Scrollbar::convertToContainingView(const IntPoint& localPoint) const
 {
-    if (m_scrollableArea)
-        return m_scrollableArea->convertFromScrollbarToContainingView(this, localPoint);
-
-    return Widget::convertToContainingView(localPoint);
+    return m_scrollableArea.convertFromScrollbarToContainingView(this, localPoint);
 }
 
 IntPoint Scrollbar::convertFromContainingView(const IntPoint& parentPoint) const
 {
-    if (m_scrollableArea)
-        return m_scrollableArea->convertFromContainingViewToScrollbar(this, parentPoint);
-
-    return Widget::convertFromContainingView(parentPoint);
+    return m_scrollableArea.convertFromContainingViewToScrollbar(this, parentPoint);
 }
 
 bool Scrollbar::supportsUpdateOnSecondaryThread() const
@@ -552,8 +528,8 @@
     // It's unfortunate that this needs to be done with an ifdef. Ideally there would be a way to feature-detect
     // the necessary support within AppKit.
 #if ENABLE(ASYNC_SCROLLING) && PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
-    return !m_scrollableArea->forceUpdateScrollbarsOnMainThreadForPerformanceTesting()
-        && (m_scrollableArea->hasLayerForVerticalScrollbar() || m_scrollableArea->hasLayerForHorizontalScrollbar());
+    return !m_scrollableArea.forceUpdateScrollbarsOnMainThreadForPerformanceTesting()
+        && (m_scrollableArea.hasLayerForVerticalScrollbar() || m_scrollableArea.hasLayerForHorizontalScrollbar());
 #else
     return false;
 #endif

Modified: trunk/Source/WebCore/platform/Scrollbar.h (180473 => 180474)


--- trunk/Source/WebCore/platform/Scrollbar.h	2015-02-21 02:55:35 UTC (rev 180473)
+++ trunk/Source/WebCore/platform/Scrollbar.h	2015-02-21 03:34:09 UTC (rev 180474)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2004, 2006, 2014 Apple Inc.  All rights reserved.
+ * Copyright (C) 2004, 2006, 2014-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
@@ -45,7 +45,7 @@
 
 public:
     // Must be implemented by platforms that can't simply use the Scrollbar base class.  Right now the only platform that is not using the base class is GTK.
-    WEBCORE_EXPORT static PassRefPtr<Scrollbar> createNativeScrollbar(ScrollableArea*, ScrollbarOrientation orientation, ScrollbarControlSize size);
+    WEBCORE_EXPORT static PassRefPtr<Scrollbar> createNativeScrollbar(ScrollableArea&, ScrollbarOrientation, ScrollbarControlSize);
 
     virtual ~Scrollbar();
 
@@ -103,8 +103,7 @@
     static int pageStep(int viewWidthOrHeight) { return pageStep(viewWidthOrHeight, viewWidthOrHeight); }
     static float pageStepDelta(int widthOrHeight) { return std::max(std::max(static_cast<float>(widthOrHeight) * Scrollbar::minFractionToStepWhenPaging(), static_cast<float>(widthOrHeight) - Scrollbar::maxOverlapBetweenPages()), 1.0f); }
 
-    void disconnectFromScrollableArea() { m_scrollableArea = 0; }
-    ScrollableArea* scrollableArea() const { return m_scrollableArea; }
+    ScrollableArea& scrollableArea() const { return m_scrollableArea; }
 
     int pressedPos() const { return m_pressedPos; }
 
@@ -159,7 +158,7 @@
     virtual bool supportsUpdateOnSecondaryThread() const override;
 
 protected:
-    Scrollbar(ScrollableArea*, ScrollbarOrientation, ScrollbarControlSize, ScrollbarTheme* = 0, bool isCustomScrollbar = false);
+    Scrollbar(ScrollableArea&, ScrollbarOrientation, ScrollbarControlSize, ScrollbarTheme* = 0, bool isCustomScrollbar = false);
 
     void updateThumb();
     virtual void updateThumbPosition();
@@ -172,7 +171,7 @@
     ScrollDirection pressedPartScrollDirection();
     ScrollGranularity pressedPartScrollGranularity();
 
-    ScrollableArea* m_scrollableArea;
+    ScrollableArea& m_scrollableArea;
     ScrollbarOrientation m_orientation;
     ScrollbarControlSize m_controlSize;
     ScrollbarTheme* m_theme;

Modified: trunk/Source/WebCore/platform/efl/ScrollbarEfl.cpp (180473 => 180474)


--- trunk/Source/WebCore/platform/efl/ScrollbarEfl.cpp	2015-02-21 02:55:35 UTC (rev 180473)
+++ trunk/Source/WebCore/platform/efl/ScrollbarEfl.cpp	2015-02-21 03:34:09 UTC (rev 180474)
@@ -28,15 +28,15 @@
 
 namespace WebCore {
 
-PassRefPtr<Scrollbar> Scrollbar::createNativeScrollbar(ScrollableArea* scrollableArea, ScrollbarOrientation orientation, ScrollbarControlSize size)
+PassRefPtr<Scrollbar> Scrollbar::createNativeScrollbar(ScrollableArea& scrollableArea, ScrollbarOrientation orientation, ScrollbarControlSize size)
 {
     if (Settings::mockScrollbarsEnabled())
         return adoptRef(new Scrollbar(scrollableArea, orientation, size));
 
     return adoptRef(new ScrollbarEfl(scrollableArea, orientation, size));
 }
+ScrollbarEfl::ScrollbarEfl(ScrollableArea& scrollableArea, ScrollbarOrientation orientation, ScrollbarControlSize controlSize)
 
-ScrollbarEfl::ScrollbarEfl(ScrollableArea* scrollableArea, ScrollbarOrientation orientation, ScrollbarControlSize controlSize)
     : Scrollbar(scrollableArea, orientation, controlSize)
 {
 }

Modified: trunk/Source/WebCore/platform/efl/ScrollbarEfl.h (180473 => 180474)


--- trunk/Source/WebCore/platform/efl/ScrollbarEfl.h	2015-02-21 02:55:35 UTC (rev 180473)
+++ trunk/Source/WebCore/platform/efl/ScrollbarEfl.h	2015-02-21 03:34:09 UTC (rev 180474)
@@ -45,7 +45,7 @@
     virtual void invalidate() override;
 
 protected:
-    ScrollbarEfl(ScrollableArea*, ScrollbarOrientation, ScrollbarControlSize);
+    ScrollbarEfl(ScrollableArea&, ScrollbarOrientation, ScrollbarControlSize);
 
     virtual void setParent(ScrollView*) override;
 };

Modified: trunk/Source/WebCore/platform/ios/ScrollAnimatorIOS.h (180473 => 180474)


--- trunk/Source/WebCore/platform/ios/ScrollAnimatorIOS.h	2015-02-21 02:55:35 UTC (rev 180473)
+++ trunk/Source/WebCore/platform/ios/ScrollAnimatorIOS.h	2015-02-21 03:34:09 UTC (rev 180474)
@@ -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
@@ -36,7 +36,7 @@
 
 class ScrollAnimatorIOS : public ScrollAnimator {
 public:
-    ScrollAnimatorIOS(ScrollableArea*);
+    ScrollAnimatorIOS(ScrollableArea&);
     virtual ~ScrollAnimatorIOS();
 
 #if ENABLE(TOUCH_EVENTS)

Modified: trunk/Source/WebCore/platform/ios/ScrollAnimatorIOS.mm (180473 => 180474)


--- trunk/Source/WebCore/platform/ios/ScrollAnimatorIOS.mm	2015-02-21 02:55:35 UTC (rev 180473)
+++ trunk/Source/WebCore/platform/ios/ScrollAnimatorIOS.mm	2015-02-21 03:34:09 UTC (rev 180474)
@@ -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 @@
 
 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 @@
         m_inTouchSequence = false;
         m_scrollableAreaForTouchSequence = 0;
         if (m_startedScroll)
-            scrollableArea()->didEndScroll();
+            scrollableArea().didEndScroll();
         return false;
     }
 
@@ -92,7 +92,7 @@
         m_inTouchSequence = false;
         m_scrollableAreaForTouchSequence = 0;
         if (m_startedScroll)
-            scrollableArea()->didEndScroll();
+            scrollableArea().didEndScroll();
         return false;
     }
     
@@ -105,8 +105,8 @@
         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 @@
         if (!handled)
             return false;
         m_startedScroll = true;
-        scrollableArea()->didStartScroll();
+        scrollableArea().didStartScroll();
     } else if (handled)
-        scrollableArea()->didUpdateScroll();
+        scrollableArea().didUpdateScroll();
     
     return true;
 }
@@ -171,7 +171,7 @@
 {
     ASSERT(!m_scrollableAreaForTouchSequence);
 
-    ScrollableArea* scrollableArea = m_scrollableArea;
+    ScrollableArea* scrollableArea = &m_scrollableArea;
     while (true) {
         if (!scrollableArea->isPinnedInBothDirections(scrollDelta))
             break;

Modified: trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.h (180473 => 180474)


--- trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.h	2015-02-21 02:55:35 UTC (rev 180473)
+++ trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.h	2015-02-21 03:34:09 UTC (rev 180474)
@@ -53,7 +53,7 @@
 class ScrollAnimatorMac : public ScrollAnimator, private ScrollControllerClient {
 
 public:
-    ScrollAnimatorMac(ScrollableArea*);
+    ScrollAnimatorMac(ScrollableArea&);
     virtual ~ScrollAnimatorMac();
 
     void immediateScrollToPointForScrollAnimation(const FloatPoint& newPosition);

Modified: trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm (180473 => 180474)


--- trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm	2015-02-21 02:55:35 UTC (rev 180473)
+++ trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm	2015-02-21 03:34:09 UTC (rev 180474)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2010, 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
@@ -269,7 +269,7 @@
     if ([scrollerImpPair overlayScrollerStateIsLocked])
         return;
 
-    _scrollableArea->scrollAnimator()->contentAreaWillPaint();
+    _scrollableArea->scrollAnimator().contentAreaWillPaint();
 }
 
 - (void)scrollerImpPair:(id)scrollerImpPair updateScrollerStyleForNewRecommendedScrollerStyle:(NSScrollerStyle)newRecommendedScrollerStyle
@@ -279,7 +279,7 @@
 
     [scrollerImpPair setScrollerStyle:newRecommendedScrollerStyle];
 
-    static_cast<ScrollAnimatorMac*>(_scrollableArea->scrollAnimator())->updateScrollerStyle();
+    static_cast<ScrollAnimatorMac&>(_scrollableArea->scrollAnimator()).updateScrollerStyle();
 }
 
 @end
@@ -417,7 +417,7 @@
 
 - (ScrollAnimatorMac*)scrollAnimator
 {
-    return static_cast<ScrollAnimatorMac*>(_scrollbar->scrollableArea()->scrollAnimator());
+    return &static_cast<ScrollAnimatorMac&>(_scrollbar->scrollableArea().scrollAnimator());
 }
 
 - (NSRect)convertRectToBacking:(NSRect)aRect
@@ -440,9 +440,9 @@
 
     GraphicsLayer* layer;
     if (_scrollbar->orientation() == VerticalScrollbar)
-        layer = _scrollbar->scrollableArea()->layerForVerticalScrollbar();
+        layer = _scrollbar->scrollableArea().layerForVerticalScrollbar();
     else
-        layer = _scrollbar->scrollableArea()->layerForHorizontalScrollbar();
+        layer = _scrollbar->scrollableArea().layerForHorizontalScrollbar();
 
     static CALayer *dummyLayer = [[CALayer alloc] init];
     return layer ? layer->platformLayer() : dummyLayer;
@@ -455,7 +455,7 @@
 
     ASSERT_UNUSED(scrollerImp, scrollerImp == scrollbarPainterForScrollbar(_scrollbar));
 
-    return _scrollbar->convertFromContainingView(_scrollbar->scrollableArea()->lastKnownMousePosition());
+    return _scrollbar->convertFromContainingView(_scrollbar->scrollableArea().lastKnownMousePosition());
 }
 
 - (NSRect)convertRectToLayer:(NSRect)rect
@@ -482,7 +482,7 @@
     if ([self scrollAnimator]->scrollbarPaintTimerIsActive() && !mustAnimate)
         return;
 
-    if (_scrollbar->scrollableArea()->shouldSuspendScrollAnimations() && !mustAnimate) {
+    if (_scrollbar->scrollableArea().shouldSuspendScrollAnimations() && !mustAnimate) {
         [self scrollAnimator]->startScrollbarPaintTimer();
         return;
     }
@@ -634,12 +634,12 @@
 
 namespace WebCore {
 
-PassOwnPtr<ScrollAnimator> ScrollAnimator::create(ScrollableArea* scrollableArea)
+PassOwnPtr<ScrollAnimator> ScrollAnimator::create(ScrollableArea& scrollableArea)
 {
     return adoptPtr(new ScrollAnimatorMac(scrollableArea));
 }
 
-ScrollAnimatorMac::ScrollAnimatorMac(ScrollableArea* scrollableArea)
+ScrollAnimatorMac::ScrollAnimatorMac(ScrollableArea& scrollableArea)
     : ScrollAnimator(scrollableArea)
     , m_initialScrollbarPaintTimer(*this, &ScrollAnimatorMac::initialScrollbarPaintTimerFired)
     , m_sendContentAreaScrolledTimer(*this, &ScrollAnimatorMac::sendContentAreaScrolledTimerFired)
@@ -653,7 +653,7 @@
     m_scrollAnimationHelperDelegate = adoptNS([[WebScrollAnimationHelperDelegate alloc] initWithScrollAnimator:this]);
     m_scrollAnimationHelper = adoptNS([[NSClassFromString(@"NSScrollAnimationHelper") alloc] initWithDelegate:m_scrollAnimationHelperDelegate.get()]);
 
-    m_scrollbarPainterControllerDelegate = adoptNS([[WebScrollbarPainterControllerDelegate alloc] initWithScrollableArea:scrollableArea]);
+    m_scrollbarPainterControllerDelegate = adoptNS([[WebScrollbarPainterControllerDelegate alloc] initWithScrollableArea:&scrollableArea]);
     m_scrollbarPainterController = adoptNS([[NSClassFromString(@"NSScrollerImpPair") alloc] init]);
     [m_scrollbarPainterController setDelegate:(id)m_scrollbarPainterControllerDelegate.get()];
     [m_scrollbarPainterController setScrollerStyle:recommendedScrollerStyle()];
@@ -699,14 +699,14 @@
 {
     m_haveScrolledSincePageLoad = true;
 
-    if (!scrollAnimationEnabledForSystem() || !m_scrollableArea->scrollAnimatorEnabled())
+    if (!scrollAnimationEnabledForSystem() || !m_scrollableArea.scrollAnimatorEnabled())
         return ScrollAnimator::scroll(orientation, granularity, step, multiplier);
 
     if (granularity == ScrollByPixel)
         return ScrollAnimator::scroll(orientation, granularity, step, multiplier);
 
     float currentPos = orientation == HorizontalScrollbar ? m_currentPosX : m_currentPosY;
-    float newPos = std::max<float>(std::min<float>(currentPos + (step * multiplier), static_cast<float>(m_scrollableArea->scrollSize(orientation))), 0);
+    float newPos = std::max<float>(std::min<float>(currentPos + (step * multiplier), static_cast<float>(m_scrollableArea.scrollSize(orientation))), 0);
     if (currentPos == newPos)
         return false;
 
@@ -729,25 +729,25 @@
 
 FloatPoint ScrollAnimatorMac::adjustScrollPositionIfNecessary(const FloatPoint& position) const
 {
-    if (!m_scrollableArea->constrainsScrollingToContentEdge())
+    if (!m_scrollableArea.constrainsScrollingToContentEdge())
         return position;
 
-    float newX = std::max<float>(std::min<float>(position.x(), m_scrollableArea->totalContentsSize().width() - m_scrollableArea->visibleWidth()), 0);
-    float newY = std::max<float>(std::min<float>(position.y(), m_scrollableArea->totalContentsSize().height() - m_scrollableArea->visibleHeight()), 0);
+    float newX = std::max<float>(std::min<float>(position.x(), m_scrollableArea.totalContentsSize().width() - m_scrollableArea.visibleWidth()), 0);
+    float newY = std::max<float>(std::min<float>(position.y(), m_scrollableArea.totalContentsSize().height() - m_scrollableArea.visibleHeight()), 0);
 
     return FloatPoint(newX, newY);
 }
 
 void ScrollAnimatorMac::adjustScrollPositionToBoundsIfNecessary()
 {
-    bool currentlyConstrainsToContentEdge = m_scrollableArea->constrainsScrollingToContentEdge();
-    m_scrollableArea->setConstrainsScrollingToContentEdge(true);
+    bool currentlyConstrainsToContentEdge = m_scrollableArea.constrainsScrollingToContentEdge();
+    m_scrollableArea.setConstrainsScrollingToContentEdge(true);
 
     IntPoint currentScrollPosition = absoluteScrollPosition();
     FloatPoint nearestPointWithinBounds = adjustScrollPositionIfNecessary(absoluteScrollPosition());
     immediateScrollBy(nearestPointWithinBounds - currentScrollPosition);
 
-    m_scrollableArea->setConstrainsScrollingToContentEdge(currentlyConstrainsToContentEdge);
+    m_scrollableArea.setConstrainsScrollingToContentEdge(currentlyConstrainsToContentEdge);
 }
 
 void ScrollAnimatorMac::immediateScrollTo(const FloatPoint& newPosition)
@@ -755,7 +755,7 @@
     FloatPoint adjustedPosition = adjustScrollPositionIfNecessary(newPosition);
  
     bool positionChanged = adjustedPosition.x() != m_currentPosX || adjustedPosition.y() != m_currentPosY;
-    if (!positionChanged && !scrollableArea()->scrollOriginChanged())
+    if (!positionChanged && !scrollableArea().scrollOriginChanged())
         return;
 
     FloatSize delta = FloatSize(adjustedPosition.x() - m_currentPosX, adjustedPosition.y() - m_currentPosY);
@@ -942,11 +942,11 @@
     m_verticalScrollbarPainterDelegate = adoptNS([[WebScrollbarPainterDelegate alloc] initWithScrollbar:scrollbar]);
 
     [painter setDelegate:(id)m_verticalScrollbarPainterDelegate.get()];
-    if (GraphicsLayer* layer = scrollbar->scrollableArea()->layerForVerticalScrollbar())
+    if (GraphicsLayer* layer = scrollbar->scrollableArea().layerForVerticalScrollbar())
         [painter setLayer:layer->platformLayer()];
 
     [m_scrollbarPainterController setVerticalScrollerImp:painter];
-    if (scrollableArea()->inLiveResize())
+    if (scrollableArea().inLiveResize())
         [painter setKnobAlpha:1];
 }
 
@@ -974,11 +974,11 @@
     m_horizontalScrollbarPainterDelegate = adoptNS([[WebScrollbarPainterDelegate alloc] initWithScrollbar:scrollbar]);
 
     [painter setDelegate:(id)m_horizontalScrollbarPainterDelegate.get()];
-    if (GraphicsLayer* layer = scrollbar->scrollableArea()->layerForHorizontalScrollbar())
+    if (GraphicsLayer* layer = scrollbar->scrollableArea().layerForHorizontalScrollbar())
         [painter setLayer:layer->platformLayer()];
 
     [m_scrollbarPainterController setHorizontalScrollerImp:painter];
-    if (scrollableArea()->inLiveResize())
+    if (scrollableArea().inLiveResize())
         [painter setKnobAlpha:1];
 }
 
@@ -998,8 +998,8 @@
 
 void ScrollAnimatorMac::verticalScrollbarLayerDidChange()
 {
-    GraphicsLayer* layer = m_scrollableArea->layerForVerticalScrollbar();
-    Scrollbar* scrollbar = m_scrollableArea->verticalScrollbar();
+    GraphicsLayer* layer = m_scrollableArea.layerForVerticalScrollbar();
+    Scrollbar* scrollbar = m_scrollableArea.verticalScrollbar();
     if (!scrollbar)
         return;
 
@@ -1012,8 +1012,8 @@
 
 void ScrollAnimatorMac::horizontalScrollbarLayerDidChange()
 {
-    GraphicsLayer* layer = m_scrollableArea->layerForHorizontalScrollbar();
-    Scrollbar* scrollbar = m_scrollableArea->horizontalScrollbar();
+    GraphicsLayer* layer = m_scrollableArea.layerForHorizontalScrollbar();
+    Scrollbar* scrollbar = m_scrollableArea.horizontalScrollbar();
     if (!scrollbar)
         return;
 
@@ -1048,7 +1048,7 @@
     if ([m_scrollbarPainterController overlayScrollerStateIsLocked])
         return;
 
-    if (m_scrollableArea->isHandlingWheelEvent())
+    if (m_scrollableArea.isHandlingWheelEvent())
         sendContentAreaScrolled(delta);
     else
         sendContentAreaScrolledSoon(delta);
@@ -1109,21 +1109,21 @@
 bool ScrollAnimatorMac::pinnedInDirection(float deltaX, float deltaY)
 {
     FloatSize limitDelta;
-    if (fabsf(deltaY) >= fabsf(deltaX)) {
+    if (std::fabsf(deltaY) >= fabsf(deltaX)) {
         if (deltaY < 0) {
             // We are trying to scroll up.  Make sure we are not pinned to the top
-            limitDelta.setHeight(m_scrollableArea->visibleContentRect().y() + m_scrollableArea->scrollOrigin().y());
+            limitDelta.setHeight(m_scrollableArea.visibleContentRect().y() + m_scrollableArea.scrollOrigin().y());
         } else {
             // We are trying to scroll down.  Make sure we are not pinned to the bottom
-            limitDelta.setHeight(m_scrollableArea->totalContentsSize().height() - (m_scrollableArea->visibleContentRect().maxY() + m_scrollableArea->scrollOrigin().y()));
+            limitDelta.setHeight(m_scrollableArea.totalContentsSize().height() - (m_scrollableArea.visibleContentRect().maxY() + m_scrollableArea.scrollOrigin().y()));
         }
     } else if (deltaX != 0) {
         if (deltaX < 0) {
             // We are trying to scroll left.  Make sure we are not pinned to the left
-            limitDelta.setWidth(m_scrollableArea->visibleContentRect().x() + m_scrollableArea->scrollOrigin().x());
+            limitDelta.setWidth(m_scrollableArea.visibleContentRect().x() + m_scrollableArea.scrollOrigin().x());
         } else {
             // We are trying to scroll right.  Make sure we are not pinned to the right
-            limitDelta.setWidth(m_scrollableArea->totalContentsSize().width() - (m_scrollableArea->visibleContentRect().maxX() + m_scrollableArea->scrollOrigin().x()));
+            limitDelta.setWidth(m_scrollableArea.totalContentsSize().width() - (m_scrollableArea.visibleContentRect().maxX() + m_scrollableArea.scrollOrigin().x()));
         }
     }
     
@@ -1143,9 +1143,9 @@
 {
     switch (axis) {
     case ScrollEventAxis::Vertical:
-        return (wheelEvent.deltaY() > 0 && m_scrollableArea->scrolledToTop()) || (wheelEvent.deltaY() < 0 && m_scrollableArea->scrolledToBottom());
+        return (wheelEvent.deltaY() > 0 && m_scrollableArea.scrolledToTop()) || (wheelEvent.deltaY() < 0 && m_scrollableArea.scrolledToBottom());
     case ScrollEventAxis::Horizontal:
-        return (wheelEvent.deltaX() > 0 && m_scrollableArea->scrolledToLeft()) || (wheelEvent.deltaX() < 0 && m_scrollableArea->scrolledToRight());
+        return (wheelEvent.deltaX() > 0 && m_scrollableArea.scrolledToLeft()) || (wheelEvent.deltaX() < 0 && m_scrollableArea.scrolledToRight());
     }
 
     ASSERT_NOT_REACHED();
@@ -1169,15 +1169,15 @@
 
 bool ScrollAnimatorMac::allowsVerticalStretching(const PlatformWheelEvent& wheelEvent)
 {
-    switch (m_scrollableArea->verticalScrollElasticity()) {
+    switch (m_scrollableArea.verticalScrollElasticity()) {
     case ScrollElasticityAutomatic: {
-        Scrollbar* hScroller = m_scrollableArea->horizontalScrollbar();
-        Scrollbar* vScroller = m_scrollableArea->verticalScrollbar();
+        Scrollbar* hScroller = m_scrollableArea.horizontalScrollbar();
+        Scrollbar* vScroller = m_scrollableArea.verticalScrollbar();
         bool scrollbarsAllowStretching = ((vScroller && vScroller->enabled()) || (!hScroller || !hScroller->enabled()));
-        bool eventPreventsStretching = m_scrollableArea->hasScrollableOrRubberbandableAncestor() && newGestureIsStarting(wheelEvent) && isAlreadyPinnedInDirectionOfGesture(wheelEvent, ScrollEventAxis::Vertical);
+        bool eventPreventsStretching = m_scrollableArea.hasScrollableOrRubberbandableAncestor() && newGestureIsStarting(wheelEvent) && isAlreadyPinnedInDirectionOfGesture(wheelEvent, ScrollEventAxis::Vertical);
 #if ENABLE(CSS_SCROLL_SNAP)
         if (!eventPreventsStretching)
-            eventPreventsStretching = gestureShouldBeginSnap(wheelEvent, m_scrollableArea->verticalSnapOffsets());
+            eventPreventsStretching = gestureShouldBeginSnap(wheelEvent, m_scrollableArea.verticalSnapOffsets());
 #endif
         return scrollbarsAllowStretching && !eventPreventsStretching;
     }
@@ -1193,15 +1193,15 @@
 
 bool ScrollAnimatorMac::allowsHorizontalStretching(const PlatformWheelEvent& wheelEvent)
 {
-    switch (m_scrollableArea->horizontalScrollElasticity()) {
+    switch (m_scrollableArea.horizontalScrollElasticity()) {
     case ScrollElasticityAutomatic: {
-        Scrollbar* hScroller = m_scrollableArea->horizontalScrollbar();
-        Scrollbar* vScroller = m_scrollableArea->verticalScrollbar();
+        Scrollbar* hScroller = m_scrollableArea.horizontalScrollbar();
+        Scrollbar* vScroller = m_scrollableArea.verticalScrollbar();
         bool scrollbarsAllowStretching = ((hScroller && hScroller->enabled()) || (!vScroller || !vScroller->enabled()));
-        bool eventPreventsStretching = m_scrollableArea->hasScrollableOrRubberbandableAncestor() && newGestureIsStarting(wheelEvent) && isAlreadyPinnedInDirectionOfGesture(wheelEvent, ScrollEventAxis::Horizontal);
+        bool eventPreventsStretching = m_scrollableArea.hasScrollableOrRubberbandableAncestor() && newGestureIsStarting(wheelEvent) && isAlreadyPinnedInDirectionOfGesture(wheelEvent, ScrollEventAxis::Horizontal);
 #if ENABLE(CSS_SCROLL_SNAP)
         if (!eventPreventsStretching)
-            eventPreventsStretching = gestureShouldBeginSnap(wheelEvent, m_scrollableArea->horizontalSnapOffsets());
+            eventPreventsStretching = gestureShouldBeginSnap(wheelEvent, m_scrollableArea.horizontalSnapOffsets());
 #endif
         return scrollbarsAllowStretching && !eventPreventsStretching;
     }
@@ -1217,7 +1217,7 @@
 
 IntSize ScrollAnimatorMac::stretchAmount()
 {
-    return m_scrollableArea->overhangAmount();
+    return m_scrollableArea.overhangAmount();
 }
 
 bool ScrollAnimatorMac::pinnedInDirection(const FloatSize& direction)
@@ -1227,7 +1227,7 @@
 
 bool ScrollAnimatorMac::canScrollHorizontally()
 {
-    Scrollbar* scrollbar = m_scrollableArea->horizontalScrollbar();
+    Scrollbar* scrollbar = m_scrollableArea.horizontalScrollbar();
     if (!scrollbar)
         return false;
     return scrollbar->enabled();
@@ -1235,7 +1235,7 @@
 
 bool ScrollAnimatorMac::canScrollVertically()
 {
-    Scrollbar* scrollbar = m_scrollableArea->verticalScrollbar();
+    Scrollbar* scrollbar = m_scrollableArea.verticalScrollbar();
     if (!scrollbar)
         return false;
     return scrollbar->enabled();
@@ -1248,14 +1248,14 @@
 
 IntPoint ScrollAnimatorMac::absoluteScrollPosition()
 {
-    return m_scrollableArea->visibleContentRect().location() + m_scrollableArea->scrollOrigin();
+    return m_scrollableArea.visibleContentRect().location() + m_scrollableArea.scrollOrigin();
 }
 
 void ScrollAnimatorMac::immediateScrollByWithoutContentEdgeConstraints(const FloatSize& delta)
 {
-    m_scrollableArea->setConstrainsScrollingToContentEdge(false);
+    m_scrollableArea.setConstrainsScrollingToContentEdge(false);
     immediateScrollBy(delta);
-    m_scrollableArea->setConstrainsScrollingToContentEdge(true);
+    m_scrollableArea.setConstrainsScrollingToContentEdge(true);
 }
 
 void ScrollAnimatorMac::immediateScrollBy(const FloatSize& delta)
@@ -1304,7 +1304,7 @@
 
     NSScrollerStyle newStyle = [m_scrollbarPainterController scrollerStyle];
 
-    if (Scrollbar* verticalScrollbar = scrollableArea()->verticalScrollbar()) {
+    if (Scrollbar* verticalScrollbar = scrollableArea().verticalScrollbar()) {
         verticalScrollbar->invalidate();
 
         ScrollbarPainter oldVerticalPainter = [m_scrollbarPainterController verticalScrollerImp];
@@ -1322,7 +1322,7 @@
         verticalScrollbar->setFrameRect(IntRect(0, 0, thickness, thickness));
     }
 
-    if (Scrollbar* horizontalScrollbar = scrollableArea()->horizontalScrollbar()) {
+    if (Scrollbar* horizontalScrollbar = scrollableArea().horizontalScrollbar()) {
         horizontalScrollbar->invalidate();
 
         ScrollbarPainter oldHorizontalPainter = [m_scrollbarPainterController horizontalScrollerImp];
@@ -1342,7 +1342,7 @@
 
     // If m_needsScrollerStyleUpdate is true, then the page is restoring from the page cache, and 
     // a relayout will happen on its own. Otherwise, we must initiate a re-layout ourselves.
-    scrollableArea()->scrollbarStyleChanged(newStyle, !m_needsScrollerStyleUpdate);
+    scrollableArea().scrollbarStyleChanged(newStyle, !m_needsScrollerStyleUpdate);
 
     m_needsScrollerStyleUpdate = false;
 }
@@ -1395,13 +1395,13 @@
 void ScrollAnimatorMac::setVisibleScrollerThumbRect(const IntRect& scrollerThumb)
 {
     IntRect rectInViewCoordinates = scrollerThumb;
-    if (Scrollbar* verticalScrollbar = m_scrollableArea->verticalScrollbar())
+    if (Scrollbar* verticalScrollbar = m_scrollableArea.verticalScrollbar())
         rectInViewCoordinates = verticalScrollbar->convertToContainingView(scrollerThumb);
 
     if (rectInViewCoordinates == m_visibleScrollerThumbRect)
         return;
 
-    m_scrollableArea->setVisibleScrollerThumbRect(rectInViewCoordinates);
+    m_scrollableArea.setVisibleScrollerThumbRect(rectInViewCoordinates);
     m_visibleScrollerThumbRect = rectInViewCoordinates;
 }
 

Modified: trunk/Source/WebCore/platform/win/PopupMenuWin.cpp (180473 => 180474)


--- trunk/Source/WebCore/platform/win/PopupMenuWin.cpp	2015-02-21 02:55:35 UTC (rev 180473)
+++ trunk/Source/WebCore/platform/win/PopupMenuWin.cpp	2015-02-21 03:34:09 UTC (rev 180474)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2006, 2007, 2008, 2011, 2015 Apple Inc. All rights reserved.
  * Copyright (C) 2007-2009 Torch Mobile Inc.
  * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
  *
@@ -142,7 +142,7 @@
 
     if (!m_scrollbar && visibleItems() < client()->listSize()) {
         // We need a scroll bar
-        m_scrollbar = client()->createScrollbar(this, VerticalScrollbar, SmallScrollbar);
+        m_scrollbar = client()->createScrollbar(*this, VerticalScrollbar, SmallScrollbar);
         m_scrollbar->styleChanged();
     }
 

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (180473 => 180474)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2015-02-21 02:55:35 UTC (rev 180473)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2015-02-21 03:34:09 UTC (rev 180474)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006-2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2006-2015 Apple Inc. All rights reserved.
  *
  * Portions are Copyright (C) 1998 Netscape Communications Corporation.
  *
@@ -336,7 +336,7 @@
         // We save and restore only the scrollOffset as the other scroll values are recalculated.
         m_scrollOffset = element->savedLayerScrollOffset();
         if (!m_scrollOffset.isZero())
-            scrollAnimator()->setCurrentPosition(FloatPoint(m_scrollOffset.width(), m_scrollOffset.height()));
+            scrollAnimator().setCurrentPosition(FloatPoint(m_scrollOffset.width(), m_scrollOffset.height()));
         element->setSavedLayerScrollOffset(IntSize());
     }
 }
@@ -3065,9 +3065,9 @@
     RenderElement* actualRenderer = rendererForScrollbar(renderer());
     bool hasCustomScrollbarStyle = actualRenderer->isBox() && actualRenderer->style().hasPseudoStyle(SCROLLBAR);
     if (hasCustomScrollbarStyle)
-        widget = RenderScrollbar::createCustomScrollbar(this, orientation, actualRenderer->element());
+        widget = RenderScrollbar::createCustomScrollbar(*this, orientation, actualRenderer->element());
     else {
-        widget = Scrollbar::createNativeScrollbar(this, orientation, RegularScrollbar);
+        widget = Scrollbar::createNativeScrollbar(*this, orientation, RegularScrollbar);
         didAddScrollbar(widget.get(), orientation);
     }
     renderer().view().frameView().addChild(widget.get());
@@ -3084,7 +3084,6 @@
         willRemoveScrollbar(scrollbar.get(), orientation);
 
     scrollbar->removeFromParent();
-    scrollbar->disconnectFromScrollableArea();
     scrollbar = nullptr;
 }
 
@@ -3482,8 +3481,8 @@
     // https://bugs.webkit.org/show_bug.cgi?id=135964
     updateSnapOffsets();
 #if PLATFORM(MAC)
-    if (existingScrollAnimator())
-        scrollAnimator()->updateScrollAnimatorsAndTimers();
+    if (ScrollAnimator* scrollAnimator = existingScrollAnimator())
+        return scrollAnimator->updateScrollAnimatorsAndTimers();
 #endif
 #endif
 }

Modified: trunk/Source/WebCore/rendering/RenderListBox.cpp (180473 => 180474)


--- trunk/Source/WebCore/rendering/RenderListBox.cpp	2015-02-21 02:55:35 UTC (rev 180473)
+++ trunk/Source/WebCore/rendering/RenderListBox.cpp	2015-02-21 03:34:09 UTC (rev 180474)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006, 2007, 2008, 2011, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2006, 2007, 2008, 2011, 2014-2015 Apple Inc. All rights reserved.
  *               2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
  *
  * Redistribution and use in source and binary forms, with or without
@@ -802,9 +802,9 @@
     RefPtr<Scrollbar> widget;
     bool hasCustomScrollbarStyle = style().hasPseudoStyle(SCROLLBAR);
     if (hasCustomScrollbarStyle)
-        widget = RenderScrollbar::createCustomScrollbar(this, VerticalScrollbar, &selectElement());
+        widget = RenderScrollbar::createCustomScrollbar(*this, VerticalScrollbar, &selectElement());
     else {
-        widget = Scrollbar::createNativeScrollbar(this, VerticalScrollbar, theme().scrollbarControlSizeForPart(ListboxPart));
+        widget = Scrollbar::createNativeScrollbar(*this, VerticalScrollbar, theme().scrollbarControlSizeForPart(ListboxPart));
         didAddScrollbar(widget.get(), VerticalScrollbar);
     }
     view().frameView().addChild(widget.get());
@@ -819,8 +819,7 @@
     if (!m_vBar->isCustomScrollbar())
         ScrollableArea::willRemoveScrollbar(m_vBar.get(), VerticalScrollbar);
     m_vBar->removeFromParent();
-    m_vBar->disconnectFromScrollableArea();
-    m_vBar = 0;
+    m_vBar = nullptr;
 }
 
 void RenderListBox::setHasVerticalScrollbar(bool hasScrollbar)

Modified: trunk/Source/WebCore/rendering/RenderMenuList.cpp (180473 => 180474)


--- trunk/Source/WebCore/rendering/RenderMenuList.cpp	2015-02-21 02:55:35 UTC (rev 180473)
+++ trunk/Source/WebCore/rendering/RenderMenuList.cpp	2015-02-21 03:34:09 UTC (rev 180474)
@@ -2,7 +2,7 @@
  * This file is part of the select element renderer in WebCore.
  *
  * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
- * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2015 Apple Inc. All rights reserved.
  *               2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
  *
  * This library is free software; you can redistribute it and/or
@@ -575,7 +575,7 @@
     return view().frameView().hostWindow();
 }
 
-PassRefPtr<Scrollbar> RenderMenuList::createScrollbar(ScrollableArea* scrollableArea, ScrollbarOrientation orientation, ScrollbarControlSize controlSize)
+PassRefPtr<Scrollbar> RenderMenuList::createScrollbar(ScrollableArea& scrollableArea, ScrollbarOrientation orientation, ScrollbarControlSize controlSize)
 {
     RefPtr<Scrollbar> widget;
     bool hasCustomScrollbarStyle = style().hasPseudoStyle(SCROLLBAR);

Modified: trunk/Source/WebCore/rendering/RenderMenuList.h (180473 => 180474)


--- trunk/Source/WebCore/rendering/RenderMenuList.h	2015-02-21 02:55:35 UTC (rev 180473)
+++ trunk/Source/WebCore/rendering/RenderMenuList.h	2015-02-21 03:34:09 UTC (rev 180474)
@@ -2,7 +2,7 @@
  * This file is part of the select element renderer in WebCore.
  *
  * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
- * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2015 Apple Inc. All rights reserved.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -113,7 +113,7 @@
     virtual bool multiple() const override;
     virtual FontSelector* fontSelector() const override;
     virtual HostWindow* hostWindow() const override;
-    virtual PassRefPtr<Scrollbar> createScrollbar(ScrollableArea*, ScrollbarOrientation, ScrollbarControlSize) override;
+    virtual PassRefPtr<Scrollbar> createScrollbar(ScrollableArea&, ScrollbarOrientation, ScrollbarControlSize) override;
 
     virtual bool hasLineIfEmpty() const override { return true; }
 

Modified: trunk/Source/WebCore/rendering/RenderScrollbar.cpp (180473 => 180474)


--- trunk/Source/WebCore/rendering/RenderScrollbar.cpp	2015-02-21 02:55:35 UTC (rev 180473)
+++ trunk/Source/WebCore/rendering/RenderScrollbar.cpp	2015-02-21 03:34:09 UTC (rev 180474)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008, 2009, 2013 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2008, 2009, 2013, 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
@@ -36,12 +36,12 @@
 
 namespace WebCore {
 
-RefPtr<Scrollbar> RenderScrollbar::createCustomScrollbar(ScrollableArea* scrollableArea, ScrollbarOrientation orientation, Element* ownerElement, Frame* owningFrame)
+RefPtr<Scrollbar> RenderScrollbar::createCustomScrollbar(ScrollableArea& scrollableArea, ScrollbarOrientation orientation, Element* ownerElement, Frame* owningFrame)
 {
     return adoptRef(new RenderScrollbar(scrollableArea, orientation, ownerElement, owningFrame));
 }
 
-RenderScrollbar::RenderScrollbar(ScrollableArea* scrollableArea, ScrollbarOrientation orientation, Element* ownerElement, Frame* owningFrame)
+RenderScrollbar::RenderScrollbar(ScrollableArea& scrollableArea, ScrollbarOrientation orientation, Element* ownerElement, Frame* owningFrame)
     : Scrollbar(scrollableArea, orientation, RegularScrollbar, RenderScrollbarTheme::renderScrollbarTheme(), true)
     , m_ownerElement(ownerElement)
     , m_owningFrame(owningFrame)

Modified: trunk/Source/WebCore/rendering/RenderScrollbar.h (180473 => 180474)


--- trunk/Source/WebCore/rendering/RenderScrollbar.h	2015-02-21 02:55:35 UTC (rev 180473)
+++ trunk/Source/WebCore/rendering/RenderScrollbar.h	2015-02-21 03:34:09 UTC (rev 180474)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008, 2009 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2008, 2009, 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
@@ -42,7 +42,7 @@
 class RenderScrollbar final : public Scrollbar {
 public:
     friend class Scrollbar;
-    static RefPtr<Scrollbar> createCustomScrollbar(ScrollableArea*, ScrollbarOrientation, Element*, Frame* owningFrame = nullptr);
+    static RefPtr<Scrollbar> createCustomScrollbar(ScrollableArea&, ScrollbarOrientation, Element*, Frame* owningFrame = nullptr);
     virtual ~RenderScrollbar();
 
     RenderBox* owningRenderer() const;
@@ -62,7 +62,7 @@
     PassRefPtr<RenderStyle> getScrollbarPseudoStyle(ScrollbarPart, PseudoId);
 
 private:
-    RenderScrollbar(ScrollableArea*, ScrollbarOrientation, Element*, Frame*);
+    RenderScrollbar(ScrollableArea&, ScrollbarOrientation, Element*, Frame*);
 
     virtual void setParent(ScrollView*) override;
     virtual void setEnabled(bool) override;

Modified: trunk/Source/WebCore/rendering/RenderSearchField.cpp (180473 => 180474)


--- trunk/Source/WebCore/rendering/RenderSearchField.cpp	2015-02-21 02:55:35 UTC (rev 180473)
+++ trunk/Source/WebCore/rendering/RenderSearchField.cpp	2015-02-21 03:34:09 UTC (rev 180474)
@@ -1,5 +1,5 @@
 /**
- * Copyright (C) 2006, 2007, 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2006, 2007, 2010, 2015 Apple Inc. All rights reserved.
  *           (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/) 
  * Copyright (C) 2010 Google Inc. All rights reserved.
  * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
@@ -342,7 +342,7 @@
     return view().frameView().hostWindow();
 }
 
-PassRefPtr<Scrollbar> RenderSearchField::createScrollbar(ScrollableArea* scrollableArea, ScrollbarOrientation orientation, ScrollbarControlSize controlSize)
+PassRefPtr<Scrollbar> RenderSearchField::createScrollbar(ScrollableArea& scrollableArea, ScrollbarOrientation orientation, ScrollbarControlSize controlSize)
 {
     RefPtr<Scrollbar> widget;
     bool hasCustomScrollbarStyle = style().hasPseudoStyle(SCROLLBAR);

Modified: trunk/Source/WebCore/rendering/RenderSearchField.h (180473 => 180474)


--- trunk/Source/WebCore/rendering/RenderSearchField.h	2015-02-21 02:55:35 UTC (rev 180473)
+++ trunk/Source/WebCore/rendering/RenderSearchField.h	2015-02-21 03:34:09 UTC (rev 180474)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2006, 2007, 2009, 2015 Apple Inc. All rights reserved.
  * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
  * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
  *
@@ -80,7 +80,7 @@
     virtual void setTextFromItem(unsigned listIndex) override;
     virtual FontSelector* fontSelector() const override;
     virtual HostWindow* hostWindow() const override;
-    virtual PassRefPtr<Scrollbar> createScrollbar(ScrollableArea*, ScrollbarOrientation, ScrollbarControlSize) override;
+    virtual PassRefPtr<Scrollbar> createScrollbar(ScrollableArea&, ScrollbarOrientation, ScrollbarControlSize) override;
 
     HTMLElement* resultsButtonElement() const;
     HTMLElement* cancelButtonElement() const;

Modified: trunk/Source/WebKit2/ChangeLog (180473 => 180474)


--- trunk/Source/WebKit2/ChangeLog	2015-02-21 02:55:35 UTC (rev 180473)
+++ trunk/Source/WebKit2/ChangeLog	2015-02-21 03:34:09 UTC (rev 180474)
@@ -1,3 +1,16 @@
+2015-02-20  Brent Fulgham  <[email protected]>
+
+        Scrollbars and ScrollAnimators must always have a ScrollableArea
+        https://bugs.webkit.org/show_bug.cgi?id=141855
+
+        Reviewed by Simon Fraser.
+        
+        Change users of the scrollAnimator() method to expect a reference instead of a pointer.
+
+        * WebProcess/Plugins/PDF/PDFPlugin.mm:
+        (WebKit::PDFPlugin::createScrollbar):
+        (WebKit::PDFPlugin::destroyScrollbar):
+
 2015-02-20  Jessie Berlin  <[email protected]>
 
         Build fix after r180465.

Modified: trunk/Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.mm (180473 => 180474)


--- trunk/Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.mm	2015-02-21 02:55:35 UTC (rev 180473)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.mm	2015-02-21 03:34:09 UTC (rev 180474)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2009, 2011, 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2009, 2011, 2012, 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
@@ -641,7 +641,7 @@
 
 PassRefPtr<Scrollbar> PDFPlugin::createScrollbar(ScrollbarOrientation orientation)
 {
-    RefPtr<Scrollbar> widget = Scrollbar::createNativeScrollbar(this, orientation, RegularScrollbar);
+    RefPtr<Scrollbar> widget = Scrollbar::createNativeScrollbar(*this, orientation, RegularScrollbar);
     if (orientation == HorizontalScrollbar) {
         m_horizontalScrollbarLayer = adoptNS([[WKPDFPluginScrollbarLayer alloc] initWithPDFPlugin:this]);
         [m_containerLayer addSublayer:m_horizontalScrollbarLayer.get()];
@@ -662,8 +662,7 @@
 
     willRemoveScrollbar(scrollbar.get(), orientation);
     scrollbar->removeFromParent();
-    scrollbar->disconnectFromScrollableArea();
-    scrollbar = 0;
+    scrollbar = nullptr;
 
     if (orientation == HorizontalScrollbar) {
         [m_horizontalScrollbarLayer removeFromSuperlayer];
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to