Title: [111896] trunk/Source/WebCore
Revision
111896
Author
[email protected]
Date
2012-03-23 13:36:31 -0700 (Fri, 23 Mar 2012)

Log Message

https://bugs.webkit.org/show_bug.cgi?id=82083
Too many ScrollAnimators are allocated on pages with frames

Reviewed by Geoffrey Garen.

This patch adds a new getter to ScrollableArea called 
getExistingScrollAnimator() unlike scrollAnimator() this new function will 
just return null if there is not already a ScrollAnimator. Callers should use 
this new function when they have business with ScrollAnimator that does not 
need to do anything when there are no scrollbars.
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::transitionToCommitted):
* page/EventHandler.cpp:
(WebCore::EventHandler::handleGestureTapDown):
* page/FrameView.cpp:
(WebCore::FrameView::setAnimatorsAreActive):
* platform/ScrollView.cpp:
(WebCore::ScrollView::updateScrollbars):
* platform/ScrollableArea.cpp:
(WebCore::ScrollableArea::willStartLiveResize):
(WebCore::ScrollableArea::willEndLiveResize):
(WebCore::ScrollableArea::contentAreaWillPaint):
(WebCore::ScrollableArea::mouseEnteredContentArea):
(WebCore::ScrollableArea::mouseExitedContentArea):
(WebCore::ScrollableArea::mouseMovedInContentArea):
(WebCore::ScrollableArea::contentAreaDidShow):
(WebCore::ScrollableArea::contentAreaDidHide):
(WebCore::ScrollableArea::willRemoveHorizontalScrollbar):
(WebCore::ScrollableArea::contentsResized):
(WebCore::ScrollableArea::serviceScrollAnimations):
* platform/ScrollableArea.h:
(ScrollableArea):
(WebCore::ScrollableArea::getExistingScrollAnimator):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (111895 => 111896)


--- trunk/Source/WebCore/ChangeLog	2012-03-23 20:26:17 UTC (rev 111895)
+++ trunk/Source/WebCore/ChangeLog	2012-03-23 20:36:31 UTC (rev 111896)
@@ -1,3 +1,39 @@
+2012-03-23  Beth Dakin  <[email protected]>
+
+        https://bugs.webkit.org/show_bug.cgi?id=82083
+        Too many ScrollAnimators are allocated on pages with frames
+
+        Reviewed by Geoffrey Garen.
+
+        This patch adds a new getter to ScrollableArea called 
+        getExistingScrollAnimator() unlike scrollAnimator() this new function will 
+        just return null if there is not already a ScrollAnimator. Callers should use 
+        this new function when they have business with ScrollAnimator that does not 
+        need to do anything when there are no scrollbars.
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::transitionToCommitted):
+        * page/EventHandler.cpp:
+        (WebCore::EventHandler::handleGestureTapDown):
+        * page/FrameView.cpp:
+        (WebCore::FrameView::setAnimatorsAreActive):
+        * platform/ScrollView.cpp:
+        (WebCore::ScrollView::updateScrollbars):
+        * platform/ScrollableArea.cpp:
+        (WebCore::ScrollableArea::willStartLiveResize):
+        (WebCore::ScrollableArea::willEndLiveResize):
+        (WebCore::ScrollableArea::contentAreaWillPaint):
+        (WebCore::ScrollableArea::mouseEnteredContentArea):
+        (WebCore::ScrollableArea::mouseExitedContentArea):
+        (WebCore::ScrollableArea::mouseMovedInContentArea):
+        (WebCore::ScrollableArea::contentAreaDidShow):
+        (WebCore::ScrollableArea::contentAreaDidHide):
+        (WebCore::ScrollableArea::willRemoveHorizontalScrollbar):
+        (WebCore::ScrollableArea::contentsResized):
+        (WebCore::ScrollableArea::serviceScrollAnimations):
+        * platform/ScrollableArea.h:
+        (ScrollableArea):
+        (WebCore::ScrollableArea::getExistingScrollAnimator):
+
 2012-03-23  Eric Carlson  <[email protected]>
 
         Deal with DOM modifications when evaluating source elements.

Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (111895 => 111896)


--- trunk/Source/WebCore/loader/FrameLoader.cpp	2012-03-23 20:26:17 UTC (rev 111895)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp	2012-03-23 20:36:31 UTC (rev 111896)
@@ -1825,8 +1825,10 @@
     if (m_state != FrameStateProvisional)
         return;
 
-    if (m_frame->view())
-        m_frame->view()->scrollAnimator()->cancelAnimations();
+    if (FrameView* view = m_frame->view()) {
+        if (ScrollAnimator* scrollAnimator = view->getExistingScrollAnimator())
+            scrollAnimator->cancelAnimations();
+    }
 
     m_client->setCopiesOnScroll();
     history()->updateForCommit();

Modified: trunk/Source/WebCore/page/EventHandler.cpp (111895 => 111896)


--- trunk/Source/WebCore/page/EventHandler.cpp	2012-03-23 20:26:17 UTC (rev 111895)
+++ trunk/Source/WebCore/page/EventHandler.cpp	2012-03-23 20:36:31 UTC (rev 111896)
@@ -2379,7 +2379,8 @@
     FrameView* view = m_frame->view();
     if (!view)
         return false;
-    view->scrollAnimator()->cancelAnimations();
+    if (ScrollAnimator* scrollAnimator = view->getExistingScrollAnimator())
+        scrollAnimator->cancelAnimations();
     const FrameView::ScrollableAreaSet* areas = view->scrollableAreas();
     if (!areas)
         return false;

Modified: trunk/Source/WebCore/page/FrameView.cpp (111895 => 111896)


--- trunk/Source/WebCore/page/FrameView.cpp	2012-03-23 20:26:17 UTC (rev 111895)
+++ trunk/Source/WebCore/page/FrameView.cpp	2012-03-23 20:36:31 UTC (rev 111896)
@@ -2644,7 +2644,8 @@
     if (!page)
         return;
 
-    scrollAnimator()->setIsActive();
+    if (ScrollAnimator* scrollAnimator = getExistingScrollAnimator())
+        scrollAnimator->setIsActive();
 
     if (!m_scrollableAreas)
         return;

Modified: trunk/Source/WebCore/platform/ScrollView.cpp (111895 => 111896)


--- trunk/Source/WebCore/platform/ScrollView.cpp	2012-03-23 20:26:17 UTC (rev 111895)
+++ trunk/Source/WebCore/platform/ScrollView.cpp	2012-03-23 20:36:31 UTC (rev 111896)
@@ -593,8 +593,10 @@
 
     IntPoint adjustedScrollPosition = IntPoint(desiredOffset);
 
-    if (!scrollAnimator()->isRubberBandInProgress())
-        adjustedScrollPosition = adjustScrollPositionWithinRange(adjustedScrollPosition);
+    if (ScrollAnimator* scrollAnimator = getExistingScrollAnimator()) {
+        if (!scrollAnimator->isRubberBandInProgress())
+            adjustedScrollPosition = adjustScrollPositionWithinRange(adjustedScrollPosition);
+    }
 
     if (adjustedScrollPosition != scrollPosition() || scrollOriginChanged()) {
         ScrollableArea::scrollToOffsetWithoutAnimation(adjustedScrollPosition + IntSize(scrollOrigin().x(), scrollOrigin().y()));

Modified: trunk/Source/WebCore/platform/ScrollableArea.cpp (111895 => 111896)


--- trunk/Source/WebCore/platform/ScrollableArea.cpp	2012-03-23 20:26:17 UTC (rev 111895)
+++ trunk/Source/WebCore/platform/ScrollableArea.cpp	2012-03-23 20:36:31 UTC (rev 111896)
@@ -185,7 +185,8 @@
     if (m_inLiveResize)
         return;
     m_inLiveResize = true;
-    scrollAnimator()->willStartLiveResize();
+    if (ScrollAnimator* scrollAnimator = getExistingScrollAnimator())
+        scrollAnimator->willStartLiveResize();
 }
 
 void ScrollableArea::willEndLiveResize()
@@ -193,27 +194,32 @@
     if (!m_inLiveResize)
         return;
     m_inLiveResize = false;
-    scrollAnimator()->willEndLiveResize();
+    if (ScrollAnimator* scrollAnimator = getExistingScrollAnimator())
+        scrollAnimator->willEndLiveResize();
 }    
 
 void ScrollableArea::contentAreaWillPaint() const
 {
-    scrollAnimator()->contentAreaWillPaint();
+    if (ScrollAnimator* scrollAnimator = getExistingScrollAnimator())
+        scrollAnimator->contentAreaWillPaint();
 }
 
 void ScrollableArea::mouseEnteredContentArea() const
 {
-    scrollAnimator()->mouseEnteredContentArea();
+    if (ScrollAnimator* scrollAnimator = getExistingScrollAnimator())
+        scrollAnimator->mouseEnteredContentArea();
 }
 
 void ScrollableArea::mouseExitedContentArea() const
 {
-    scrollAnimator()->mouseEnteredContentArea();
+    if (ScrollAnimator* scrollAnimator = getExistingScrollAnimator())
+        scrollAnimator->mouseEnteredContentArea();
 }
 
 void ScrollableArea::mouseMovedInContentArea() const
 {
-    scrollAnimator()->mouseMovedInContentArea();
+    if (ScrollAnimator* scrollAnimator = getExistingScrollAnimator())
+        scrollAnimator->mouseMovedInContentArea();
 }
 
 void ScrollableArea::mouseEnteredScrollbar(Scrollbar* scrollbar) const
@@ -228,12 +234,14 @@
 
 void ScrollableArea::contentAreaDidShow() const
 {
-    scrollAnimator()->contentAreaDidShow();
+    if (ScrollAnimator* scrollAnimator = getExistingScrollAnimator())
+        scrollAnimator->contentAreaDidShow();
 }
 
 void ScrollableArea::contentAreaDidHide() const
 {
-    scrollAnimator()->contentAreaDidHide();
+    if (ScrollAnimator* scrollAnimator = getExistingScrollAnimator())
+        scrollAnimator->contentAreaDidHide();
 }
 
 void ScrollableArea::didAddVerticalScrollbar(Scrollbar* scrollbar)
@@ -257,14 +265,15 @@
     setScrollbarOverlayStyle(scrollbarOverlayStyle());
 }
 
-void ScrollableArea::contentsResized()
+void ScrollableArea::willRemoveHorizontalScrollbar(Scrollbar* scrollbar)
 {
-    scrollAnimator()->contentsResized();
+    scrollAnimator()->willRemoveHorizontalScrollbar(scrollbar);
 }
 
-void ScrollableArea::willRemoveHorizontalScrollbar(Scrollbar* scrollbar)
+void ScrollableArea::contentsResized()
 {
-    scrollAnimator()->willRemoveHorizontalScrollbar(scrollbar);
+    if (ScrollAnimator* scrollAnimator = getExistingScrollAnimator())
+        scrollAnimator->contentsResized();
 }
 
 bool ScrollableArea::hasOverlayScrollbars() const
@@ -348,7 +357,8 @@
 
 void ScrollableArea::serviceScrollAnimations()
 {
-    scrollAnimator()->serviceScrollAnimations();
+    if (ScrollAnimator* scrollAnimator = getExistingScrollAnimator())
+        scrollAnimator->serviceScrollAnimations();
 }
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/platform/ScrollableArea.h (111895 => 111896)


--- trunk/Source/WebCore/platform/ScrollableArea.h	2012-03-23 20:26:17 UTC (rev 111895)
+++ trunk/Source/WebCore/platform/ScrollableArea.h	2012-03-23 20:36:31 UTC (rev 111896)
@@ -92,7 +92,12 @@
     virtual void setScrollbarOverlayStyle(ScrollbarOverlayStyle);
     ScrollbarOverlayStyle scrollbarOverlayStyle() const { return static_cast<ScrollbarOverlayStyle>(m_scrollbarOverlayStyle); }
 
+    // This getter will create a ScrollAnimator if it doesn't already exist.
     ScrollAnimator* scrollAnimator() const;
+
+    // This getter will return null if the ScrollAnimator hasn't been created yet.
+    ScrollAnimator* getExistingScrollAnimator() const { return m_scrollAnimator.get(); }
+
     const IntPoint& scrollOrigin() const { return m_scrollOrigin; }
     bool scrollOriginChanged() const { return m_scrollOriginChanged; }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to