Package up some data about scrollability into a struct for use in the scrolling tree
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 16 Dec 2013 19:57:27 +0000 (19:57 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 16 Dec 2013 19:57:27 +0000 (19:57 +0000)
https://bugs.webkit.org/show_bug.cgi?id=125792

Reviewed by Beth Dakin.

Both scrolling state nodes and scrolling nodes share a set of parameters
relating to scrollability and rubberbanding, so package them into a struct
for re-use. Send the struct wholesale to the scrolling thread.

* page/scrolling/ScrollingCoordinator.h:
(WebCore::ScrollableAreaParameters::ScrollableAreaParameters): New struct.
(WebCore::ScrollableAreaParameters::operator==):
* page/scrolling/ScrollingStateScrollingNode.cpp:
(WebCore::ScrollingStateScrollingNode::ScrollingStateScrollingNode): Reordering.
(WebCore::ScrollingStateScrollingNode::setScrollOrigin): Moved.
(WebCore::ScrollingStateScrollingNode::setScrollableAreaParameters): Set the parameters all at once.
(WebCore::ScrollingStateScrollingNode::setRequestedScrollPosition):
* page/scrolling/ScrollingStateScrollingNode.h: Getters access the struct. Reorder member variables.
* page/scrolling/ScrollingTreeScrollingNode.cpp:
(WebCore::ScrollingTreeScrollingNode::ScrollingTreeScrollingNode):
(WebCore::ScrollingTreeScrollingNode::updateBeforeChildren):
* page/scrolling/ScrollingTreeScrollingNode.h:
(WebCore::ScrollingTreeScrollingNode::scrollOrigin):
(WebCore::ScrollingTreeScrollingNode::horizontalScrollElasticity):
(WebCore::ScrollingTreeScrollingNode::verticalScrollElasticity):
(WebCore::ScrollingTreeScrollingNode::hasEnabledHorizontalScrollbar):
(WebCore::ScrollingTreeScrollingNode::hasEnabledVerticalScrollbar):
(WebCore::ScrollingTreeScrollingNode::canHaveScrollbars):
* page/scrolling/mac/ScrollingCoordinatorMac.h:
* page/scrolling/mac/ScrollingCoordinatorMac.mm: Removed setScrollParametersForNode().
(WebCore::ScrollingCoordinatorMac::frameViewLayoutUpdated): Set the params in this
function. Reordering.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@160652 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/page/scrolling/ScrollingCoordinator.h
Source/WebCore/page/scrolling/ScrollingStateScrollingNode.cpp
Source/WebCore/page/scrolling/ScrollingStateScrollingNode.h
Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp
Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h
Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.h
Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.mm

index 8aa75c4..42c5b8d 100644 (file)
@@ -1,3 +1,38 @@
+2013-12-16  Simon Fraser  <simon.fraser@apple.com>
+
+        Package up some data about scrollability into a struct for use in the scrolling tree
+        https://bugs.webkit.org/show_bug.cgi?id=125792
+
+        Reviewed by Beth Dakin.
+
+        Both scrolling state nodes and scrolling nodes share a set of parameters
+        relating to scrollability and rubberbanding, so package them into a struct
+        for re-use. Send the struct wholesale to the scrolling thread.
+
+        * page/scrolling/ScrollingCoordinator.h:
+        (WebCore::ScrollableAreaParameters::ScrollableAreaParameters): New struct.
+        (WebCore::ScrollableAreaParameters::operator==):
+        * page/scrolling/ScrollingStateScrollingNode.cpp:
+        (WebCore::ScrollingStateScrollingNode::ScrollingStateScrollingNode): Reordering.
+        (WebCore::ScrollingStateScrollingNode::setScrollOrigin): Moved.
+        (WebCore::ScrollingStateScrollingNode::setScrollableAreaParameters): Set the parameters all at once.
+        (WebCore::ScrollingStateScrollingNode::setRequestedScrollPosition):
+        * page/scrolling/ScrollingStateScrollingNode.h: Getters access the struct. Reorder member variables.
+        * page/scrolling/ScrollingTreeScrollingNode.cpp:
+        (WebCore::ScrollingTreeScrollingNode::ScrollingTreeScrollingNode):
+        (WebCore::ScrollingTreeScrollingNode::updateBeforeChildren):
+        * page/scrolling/ScrollingTreeScrollingNode.h:
+        (WebCore::ScrollingTreeScrollingNode::scrollOrigin):
+        (WebCore::ScrollingTreeScrollingNode::horizontalScrollElasticity):
+        (WebCore::ScrollingTreeScrollingNode::verticalScrollElasticity):
+        (WebCore::ScrollingTreeScrollingNode::hasEnabledHorizontalScrollbar):
+        (WebCore::ScrollingTreeScrollingNode::hasEnabledVerticalScrollbar):
+        (WebCore::ScrollingTreeScrollingNode::canHaveScrollbars):
+        * page/scrolling/mac/ScrollingCoordinatorMac.h:
+        * page/scrolling/mac/ScrollingCoordinatorMac.mm: Removed setScrollParametersForNode().
+        (WebCore::ScrollingCoordinatorMac::frameViewLayoutUpdated): Set the params in this
+        function. Reordering.
+
 2013-12-16  Sam Weinig  <sam@webkit.org>
 
         CTTE: Convert more of SVG to use references
index b771d03..0041ad9 100644 (file)
@@ -69,6 +69,37 @@ enum SetOrSyncScrollingLayerPosition {
     SyncScrollingLayerPosition
 };
 
+struct ScrollableAreaParameters {
+    ScrollElasticity horizontalScrollElasticity;
+    ScrollElasticity verticalScrollElasticity;
+
+    ScrollbarMode horizontalScrollbarMode;
+    ScrollbarMode verticalScrollbarMode;
+
+    bool hasEnabledHorizontalScrollbar;
+    bool hasEnabledVerticalScrollbar;
+    
+    ScrollableAreaParameters()
+        : horizontalScrollElasticity(ScrollElasticityNone)
+        , verticalScrollElasticity(ScrollElasticityNone)
+        , horizontalScrollbarMode(ScrollbarAuto)
+        , verticalScrollbarMode(ScrollbarAuto)
+        , hasEnabledHorizontalScrollbar(false)
+        , hasEnabledVerticalScrollbar(false)
+    {
+    }
+
+    bool operator==(const ScrollableAreaParameters& other) const
+    {
+        return horizontalScrollElasticity == other.horizontalScrollElasticity
+            && verticalScrollElasticity == other.verticalScrollElasticity
+            && horizontalScrollbarMode == other.horizontalScrollbarMode
+            && verticalScrollbarMode == other.verticalScrollbarMode
+            && hasEnabledHorizontalScrollbar == other.hasEnabledHorizontalScrollbar
+            && hasEnabledVerticalScrollbar == other.hasEnabledVerticalScrollbar;
+    }
+};
+
 class ScrollingCoordinator : public ThreadSafeRefCounted<ScrollingCoordinator> {
 public:
     static PassRefPtr<ScrollingCoordinator> create(Page*);
index 95dc644..88acf84 100644 (file)
@@ -51,16 +51,10 @@ ScrollingStateScrollingNode::ScrollingStateScrollingNode(ScrollingStateTree* sta
     , m_frameScaleFactor(1)
     , m_wheelEventHandlerCount(0)
     , m_shouldUpdateScrollLayerPositionOnMainThread(0)
-    , m_horizontalScrollElasticity(ScrollElasticityNone)
-    , m_verticalScrollElasticity(ScrollElasticityNone)
-    , m_hasEnabledHorizontalScrollbar(false)
-    , m_hasEnabledVerticalScrollbar(false)
-    , m_requestedScrollPositionRepresentsProgrammaticScroll(false)
-    , m_horizontalScrollbarMode(ScrollbarAuto)
-    , m_verticalScrollbarMode(ScrollbarAuto)
     , m_behaviorForFixed(StickToDocumentBounds)
     , m_headerHeight(0)
     , m_footerHeight(0)
+    , m_requestedScrollPositionRepresentsProgrammaticScroll(false)
 {
 }
 
@@ -72,22 +66,17 @@ ScrollingStateScrollingNode::ScrollingStateScrollingNode(const ScrollingStateScr
 #endif
     , m_viewportRect(stateNode.viewportRect())
     , m_totalContentsSize(stateNode.totalContentsSize())
-    , m_frameScaleFactor(stateNode.frameScaleFactor())
+    , m_scrollOrigin(stateNode.scrollOrigin())
+    , m_scrollableAreaParameters(stateNode.scrollableAreaParameters())
     , m_nonFastScrollableRegion(stateNode.nonFastScrollableRegion())
+    , m_frameScaleFactor(stateNode.frameScaleFactor())
     , m_wheelEventHandlerCount(stateNode.wheelEventHandlerCount())
     , m_shouldUpdateScrollLayerPositionOnMainThread(stateNode.shouldUpdateScrollLayerPositionOnMainThread())
-    , m_horizontalScrollElasticity(stateNode.horizontalScrollElasticity())
-    , m_verticalScrollElasticity(stateNode.verticalScrollElasticity())
-    , m_hasEnabledHorizontalScrollbar(stateNode.hasEnabledHorizontalScrollbar())
-    , m_hasEnabledVerticalScrollbar(stateNode.hasEnabledVerticalScrollbar())
-    , m_requestedScrollPositionRepresentsProgrammaticScroll(stateNode.requestedScrollPositionRepresentsProgrammaticScroll())
-    , m_horizontalScrollbarMode(stateNode.horizontalScrollbarMode())
-    , m_verticalScrollbarMode(stateNode.verticalScrollbarMode())
     , m_behaviorForFixed(stateNode.scrollBehaviorForFixedElements())
-    , m_requestedScrollPosition(stateNode.requestedScrollPosition())
-    , m_scrollOrigin(stateNode.scrollOrigin())
     , m_headerHeight(stateNode.headerHeight())
     , m_footerHeight(stateNode.footerHeight())
+    , m_requestedScrollPosition(stateNode.requestedScrollPosition())
+    , m_requestedScrollPositionRepresentsProgrammaticScroll(stateNode.requestedScrollPositionRepresentsProgrammaticScroll())
 {
     setCounterScrollingLayer(stateNode.counterScrollingLayer());
     setHeaderLayer(stateNode.headerLayer());
@@ -123,6 +112,26 @@ void ScrollingStateScrollingNode::setTotalContentsSize(const IntSize& totalConte
     m_scrollingStateTree->setHasChangedProperties(true);
 }
 
+void ScrollingStateScrollingNode::setScrollOrigin(const IntPoint& scrollOrigin)
+{
+    if (m_scrollOrigin == scrollOrigin)
+        return;
+
+    m_scrollOrigin = scrollOrigin;
+    setPropertyChanged(ScrollOrigin);
+    m_scrollingStateTree->setHasChangedProperties(true);
+}
+
+void ScrollingStateScrollingNode::setScrollableAreaParameters(const ScrollableAreaParameters& parameters)
+{
+    if (m_scrollableAreaParameters == parameters)
+        return;
+
+    m_scrollableAreaParameters = parameters;
+    setPropertyChanged(ScrollableAreaParams);
+    m_scrollingStateTree->setHasChangedProperties(true);
+}
+
 void ScrollingStateScrollingNode::setFrameScaleFactor(float scaleFactor)
 {
     if (m_frameScaleFactor == scaleFactor)
@@ -164,66 +173,6 @@ void ScrollingStateScrollingNode::setShouldUpdateScrollLayerPositionOnMainThread
     m_scrollingStateTree->setHasChangedProperties(true);
 }
 
-void ScrollingStateScrollingNode::setHorizontalScrollElasticity(ScrollElasticity horizontalScrollElasticity)
-{
-    if (m_horizontalScrollElasticity == horizontalScrollElasticity)
-        return;
-
-    m_horizontalScrollElasticity = horizontalScrollElasticity;
-    setPropertyChanged(HorizontalScrollElasticity);
-    m_scrollingStateTree->setHasChangedProperties(true);
-}
-
-void ScrollingStateScrollingNode::setVerticalScrollElasticity(ScrollElasticity verticalScrollElasticity)
-{
-    if (m_verticalScrollElasticity == verticalScrollElasticity)
-        return;
-
-    m_verticalScrollElasticity = verticalScrollElasticity;
-    setPropertyChanged(VerticalScrollElasticity);
-    m_scrollingStateTree->setHasChangedProperties(true);
-}
-
-void ScrollingStateScrollingNode::setHasEnabledHorizontalScrollbar(bool hasEnabledHorizontalScrollbar)
-{
-    if (m_hasEnabledHorizontalScrollbar == hasEnabledHorizontalScrollbar)
-        return;
-
-    m_hasEnabledHorizontalScrollbar = hasEnabledHorizontalScrollbar;
-    setPropertyChanged(HasEnabledHorizontalScrollbar);
-    m_scrollingStateTree->setHasChangedProperties(true);
-}
-
-void ScrollingStateScrollingNode::setHasEnabledVerticalScrollbar(bool hasEnabledVerticalScrollbar)
-{
-    if (m_hasEnabledVerticalScrollbar == hasEnabledVerticalScrollbar)
-        return;
-
-    m_hasEnabledVerticalScrollbar = hasEnabledVerticalScrollbar;
-    setPropertyChanged(HasEnabledVerticalScrollbar);
-    m_scrollingStateTree->setHasChangedProperties(true);
-}
-
-void ScrollingStateScrollingNode::setHorizontalScrollbarMode(ScrollbarMode horizontalScrollbarMode)
-{
-    if (m_horizontalScrollbarMode == horizontalScrollbarMode)
-        return;
-
-    m_horizontalScrollbarMode = horizontalScrollbarMode;
-    setPropertyChanged(HorizontalScrollbarMode);
-    m_scrollingStateTree->setHasChangedProperties(true);
-}
-
-void ScrollingStateScrollingNode::setVerticalScrollbarMode(ScrollbarMode verticalScrollbarMode)
-{
-    if (m_verticalScrollbarMode == verticalScrollbarMode)
-        return;
-
-    m_verticalScrollbarMode = verticalScrollbarMode;
-    setPropertyChanged(VerticalScrollbarMode);
-    m_scrollingStateTree->setHasChangedProperties(true);
-}
-
 void ScrollingStateScrollingNode::setScrollBehaviorForFixedElements(ScrollBehaviorForFixedElements behaviorForFixed)
 {
     if (m_behaviorForFixed == behaviorForFixed)
@@ -242,16 +191,6 @@ void ScrollingStateScrollingNode::setRequestedScrollPosition(const IntPoint& req
     m_scrollingStateTree->setHasChangedProperties(true);
 }
 
-void ScrollingStateScrollingNode::setScrollOrigin(const IntPoint& scrollOrigin)
-{
-    if (m_scrollOrigin == scrollOrigin)
-        return;
-
-    m_scrollOrigin = scrollOrigin;
-    setPropertyChanged(ScrollOrigin);
-    m_scrollingStateTree->setHasChangedProperties(true);
-}
-
 void ScrollingStateScrollingNode::setHeaderHeight(int headerHeight)
 {
     if (m_headerHeight == headerHeight)
index 8c3111f..5e414dd 100644 (file)
@@ -51,17 +51,12 @@ public:
     enum ChangedProperty {
         ViewportRect = NumStateNodeBits,
         TotalContentsSize,
+        ScrollOrigin,
+        ScrollableAreaParams,
         FrameScaleFactor,
         NonFastScrollableRegion,
         WheelEventHandlerCount,
         ShouldUpdateScrollLayerPositionOnMainThread,
-        HorizontalScrollElasticity,
-        VerticalScrollElasticity,
-        HasEnabledHorizontalScrollbar,
-        HasEnabledVerticalScrollbar,
-        HorizontalScrollbarMode,
-        VerticalScrollbarMode,
-        ScrollOrigin,
         RequestedScrollPosition,
         CounterScrollingLayer,
         HeaderHeight,
@@ -78,6 +73,9 @@ public:
     const IntSize& totalContentsSize() const { return m_totalContentsSize; }
     void setTotalContentsSize(const IntSize&);
 
+    const IntPoint& scrollOrigin() const { return m_scrollOrigin; }
+    void setScrollOrigin(const IntPoint&);
+
     float frameScaleFactor() const { return m_frameScaleFactor; }
     void setFrameScaleFactor(float);
 
@@ -90,23 +88,8 @@ public:
     MainThreadScrollingReasons shouldUpdateScrollLayerPositionOnMainThread() const { return m_shouldUpdateScrollLayerPositionOnMainThread; }
     void setShouldUpdateScrollLayerPositionOnMainThread(MainThreadScrollingReasons);
 
-    ScrollElasticity horizontalScrollElasticity() const { return m_horizontalScrollElasticity; }
-    void setHorizontalScrollElasticity(ScrollElasticity);
-
-    ScrollElasticity verticalScrollElasticity() const { return m_verticalScrollElasticity; }
-    void setVerticalScrollElasticity(ScrollElasticity);
-
-    bool hasEnabledHorizontalScrollbar() const { return m_hasEnabledHorizontalScrollbar; }
-    void setHasEnabledHorizontalScrollbar(bool);
-
-    bool hasEnabledVerticalScrollbar() const { return m_hasEnabledVerticalScrollbar; }
-    void setHasEnabledVerticalScrollbar(bool);
-
-    ScrollbarMode horizontalScrollbarMode() const { return m_horizontalScrollbarMode; }
-    void setHorizontalScrollbarMode(ScrollbarMode);
-
-    ScrollbarMode verticalScrollbarMode() const { return m_verticalScrollbarMode; }
-    void setVerticalScrollbarMode(ScrollbarMode);
+    const ScrollableAreaParameters& scrollableAreaParameters() const { return m_scrollableAreaParameters; }
+    void setScrollableAreaParameters(const ScrollableAreaParameters& params);
 
     ScrollBehaviorForFixedElements scrollBehaviorForFixedElements() const { return m_behaviorForFixed; }
     void setScrollBehaviorForFixedElements(ScrollBehaviorForFixedElements);
@@ -114,9 +97,6 @@ public:
     const IntPoint& requestedScrollPosition() const { return m_requestedScrollPosition; }
     void setRequestedScrollPosition(const IntPoint&, bool representsProgrammaticScroll);
 
-    const IntPoint& scrollOrigin() const { return m_scrollOrigin; }
-    void setScrollOrigin(const IntPoint&);
-
     int headerHeight() const { return m_headerHeight; }
     void setHeaderHeight(int);
 
@@ -164,35 +144,21 @@ private:
     ScrollbarPainter m_verticalScrollbarPainter;
     ScrollbarPainter m_horizontalScrollbarPainter;
 #endif
-    
+
     IntRect m_viewportRect;
     IntSize m_totalContentsSize;
+    IntPoint m_scrollOrigin;
     
-    float m_frameScaleFactor;
-
+    ScrollableAreaParameters m_scrollableAreaParameters;
     Region m_nonFastScrollableRegion;
-
+    float m_frameScaleFactor;
     unsigned m_wheelEventHandlerCount;
-
     MainThreadScrollingReasons m_shouldUpdateScrollLayerPositionOnMainThread;
-
-    ScrollElasticity m_horizontalScrollElasticity;
-    ScrollElasticity m_verticalScrollElasticity;
-
-    bool m_hasEnabledHorizontalScrollbar;
-    bool m_hasEnabledVerticalScrollbar;
-    bool m_requestedScrollPositionRepresentsProgrammaticScroll;
-
-    ScrollbarMode m_horizontalScrollbarMode;
-    ScrollbarMode m_verticalScrollbarMode;
-
     ScrollBehaviorForFixedElements m_behaviorForFixed;
-
-    IntPoint m_requestedScrollPosition;
-    IntPoint m_scrollOrigin;
-
     int m_headerHeight;
     int m_footerHeight;
+    IntPoint m_requestedScrollPosition;
+    bool m_requestedScrollPositionRepresentsProgrammaticScroll;
 };
 
 SCROLLING_STATE_NODE_TYPE_CASTS(ScrollingStateScrollingNode, isScrollingNode());
index 77ad1db..e455f40 100644 (file)
@@ -36,15 +36,9 @@ namespace WebCore {
 ScrollingTreeScrollingNode::ScrollingTreeScrollingNode(ScrollingTree& scrollingTree, ScrollingNodeID nodeID)
     : ScrollingTreeNode(scrollingTree, nodeID)
     , m_frameScaleFactor(1)
-    , m_shouldUpdateScrollLayerPositionOnMainThread(0)
-    , m_horizontalScrollElasticity(ScrollElasticityNone)
-    , m_verticalScrollElasticity(ScrollElasticityNone)
-    , m_hasEnabledHorizontalScrollbar(false)
-    , m_hasEnabledVerticalScrollbar(false)
-    , m_horizontalScrollbarMode(ScrollbarAuto)
-    , m_verticalScrollbarMode(ScrollbarAuto)
     , m_headerHeight(0)
     , m_footerHeight(0)
+    , m_shouldUpdateScrollLayerPositionOnMainThread(0)
     , m_behaviorForFixed(StickToDocumentBounds)
 {
 }
@@ -68,33 +62,18 @@ void ScrollingTreeScrollingNode::updateBeforeChildren(ScrollingStateNode* stateN
         m_totalContentsSize = state->totalContentsSize();
     }
 
+    if (state->hasChangedProperty(ScrollingStateScrollingNode::ScrollOrigin))
+        m_scrollOrigin = state->scrollOrigin();
+
+    if (state->hasChangedProperty(ScrollingStateScrollingNode::ScrollableAreaParams))
+        m_scrollableAreaParameters = state->scrollableAreaParameters();
+
     if (state->hasChangedProperty(ScrollingStateScrollingNode::FrameScaleFactor))
         m_frameScaleFactor = state->frameScaleFactor();
 
     if (state->hasChangedProperty(ScrollingStateScrollingNode::ShouldUpdateScrollLayerPositionOnMainThread))
         m_shouldUpdateScrollLayerPositionOnMainThread = state->shouldUpdateScrollLayerPositionOnMainThread();
 
-    if (state->hasChangedProperty(ScrollingStateScrollingNode::HorizontalScrollElasticity))
-        m_horizontalScrollElasticity = state->horizontalScrollElasticity();
-
-    if (state->hasChangedProperty(ScrollingStateScrollingNode::VerticalScrollElasticity))
-        m_verticalScrollElasticity = state->verticalScrollElasticity();
-
-    if (state->hasChangedProperty(ScrollingStateScrollingNode::HasEnabledHorizontalScrollbar))
-        m_hasEnabledHorizontalScrollbar = state->hasEnabledHorizontalScrollbar();
-
-    if (state->hasChangedProperty(ScrollingStateScrollingNode::HasEnabledVerticalScrollbar))
-        m_hasEnabledVerticalScrollbar = state->hasEnabledVerticalScrollbar();
-
-    if (state->hasChangedProperty(ScrollingStateScrollingNode::HorizontalScrollbarMode))
-        m_horizontalScrollbarMode = state->horizontalScrollbarMode();
-
-    if (state->hasChangedProperty(ScrollingStateScrollingNode::VerticalScrollbarMode))
-        m_verticalScrollbarMode = state->verticalScrollbarMode();
-
-    if (state->hasChangedProperty(ScrollingStateScrollingNode::ScrollOrigin))
-        m_scrollOrigin = state->scrollOrigin();
-
     if (state->hasChangedProperty(ScrollingStateScrollingNode::HeaderHeight))
         m_headerHeight = state->headerHeight();
 
index 026d65d..f4e8037 100644 (file)
@@ -60,6 +60,7 @@ protected:
 
     const IntRect& viewportRect() const { return m_viewportRect; }
     const IntSize& totalContentsSize() const { return m_totalContentsSize; }
+    const IntPoint& scrollOrigin() const { return m_scrollOrigin; }
 
     // If the totalContentsSize changes in the middle of a rubber-band, we still want to use the old totalContentsSize for the sake of
     // computing the stretchAmount(). Using the old value will keep the animation smooth. When there is no rubber-band in progress at
@@ -69,15 +70,13 @@ protected:
 
     float frameScaleFactor() const { return m_frameScaleFactor; }
 
-    ScrollElasticity horizontalScrollElasticity() const { return m_horizontalScrollElasticity; }
-    ScrollElasticity verticalScrollElasticity() const { return m_verticalScrollElasticity; }
-
-    bool hasEnabledHorizontalScrollbar() const { return m_hasEnabledHorizontalScrollbar; }
-    bool hasEnabledVerticalScrollbar() const { return m_hasEnabledVerticalScrollbar; }
+    ScrollElasticity horizontalScrollElasticity() const { return m_scrollableAreaParameters.horizontalScrollElasticity; }
+    ScrollElasticity verticalScrollElasticity() const { return m_scrollableAreaParameters.verticalScrollElasticity; }
 
-    bool canHaveScrollbars() const { return m_horizontalScrollbarMode != ScrollbarAlwaysOff || m_verticalScrollbarMode != ScrollbarAlwaysOff; }
+    bool hasEnabledHorizontalScrollbar() const { return m_scrollableAreaParameters.hasEnabledHorizontalScrollbar; }
+    bool hasEnabledVerticalScrollbar() const { return m_scrollableAreaParameters.hasEnabledVerticalScrollbar; }
 
-    const IntPoint& scrollOrigin() const { return m_scrollOrigin; }
+    bool canHaveScrollbars() const { return m_scrollableAreaParameters.horizontalScrollbarMode != ScrollbarAlwaysOff || m_scrollableAreaParameters.verticalScrollbarMode != ScrollbarAlwaysOff; }
 
     int headerHeight() const { return m_headerHeight; }
     int footerHeight() const { return m_footerHeight; }
@@ -90,22 +89,14 @@ private:
     IntSize m_totalContentsSizeForRubberBand;
     IntPoint m_scrollOrigin;
     
-    float m_frameScaleFactor;
-
-    MainThreadScrollingReasons m_shouldUpdateScrollLayerPositionOnMainThread;
-
-    ScrollElasticity m_horizontalScrollElasticity;
-    ScrollElasticity m_verticalScrollElasticity;
+    ScrollableAreaParameters m_scrollableAreaParameters;
     
-    bool m_hasEnabledHorizontalScrollbar;
-    bool m_hasEnabledVerticalScrollbar;
-
-    ScrollbarMode m_horizontalScrollbarMode;
-    ScrollbarMode m_verticalScrollbarMode;
+    float m_frameScaleFactor;
 
     int m_headerHeight;
     int m_footerHeight;
 
+    MainThreadScrollingReasons m_shouldUpdateScrollLayerPositionOnMainThread;
     ScrollBehaviorForFixedElements m_behaviorForFixed;
 };
 
index 3a50fee..6b033fe 100644 (file)
@@ -97,28 +97,6 @@ private:
 
     void ensureRootStateNodeForFrameView(FrameView*);
 
-    struct ScrollParameters {
-        ScrollElasticity horizontalScrollElasticity;
-        ScrollElasticity verticalScrollElasticity;
-
-        bool hasEnabledHorizontalScrollbar;
-        bool hasEnabledVerticalScrollbar;
-
-        ScrollbarMode horizontalScrollbarMode;
-        ScrollbarMode verticalScrollbarMode;
-
-        IntPoint scrollOrigin;
-
-        IntRect viewportRect;
-        IntSize totalContentsSize;
-        
-        float frameScaleFactor;
-
-        int headerHeight;
-        int footerHeight;
-    };
-
-    void setScrollParametersForNode(const ScrollParameters&, ScrollingStateScrollingNode*);
     void setScrollLayerForNode(GraphicsLayer*, ScrollingStateNode*);
     void setCounterScrollingLayerForNode(GraphicsLayer*, ScrollingStateScrollingNode*);
     void setHeaderLayerForNode(GraphicsLayer*, ScrollingStateScrollingNode*);
@@ -128,7 +106,6 @@ private:
     void setWheelEventHandlerCountForNode(unsigned, ScrollingStateScrollingNode*);
     void setScrollBehaviorForFixedElementsForNode(ScrollBehaviorForFixedElements, ScrollingStateScrollingNode*);
 
-
     void updateMainFrameScrollLayerPosition();
 
     void scheduleTreeStateCommit();
index 24efdbd..ccfccca 100644 (file)
@@ -135,7 +135,15 @@ void ScrollingCoordinatorMac::frameViewLayoutUpdated(FrameView* frameView)
     Scrollbar* horizontalScrollbar = frameView->horizontalScrollbar();
     setScrollbarPaintersFromScrollbarsForNode(verticalScrollbar, horizontalScrollbar, node);
 
-    ScrollParameters scrollParameters;
+    node->setFrameScaleFactor(frameView->frame().frameScaleFactor());
+    node->setHeaderHeight(frameView->headerHeight());
+    node->setFooterHeight(frameView->footerHeight());
+
+    node->setScrollOrigin(frameView->scrollOrigin());
+    node->setViewportRect(IntRect(IntPoint(), frameView->visibleContentRect().size()));
+    node->setTotalContentsSize(frameView->totalContentsSize());
+
+    ScrollableAreaParameters scrollParameters;
     scrollParameters.horizontalScrollElasticity = frameView->horizontalScrollElasticity();
     scrollParameters.verticalScrollElasticity = frameView->verticalScrollElasticity();
     scrollParameters.hasEnabledHorizontalScrollbar = horizontalScrollbar && horizontalScrollbar->enabled();
@@ -143,14 +151,8 @@ void ScrollingCoordinatorMac::frameViewLayoutUpdated(FrameView* frameView)
     scrollParameters.horizontalScrollbarMode = frameView->horizontalScrollbarMode();
     scrollParameters.verticalScrollbarMode = frameView->verticalScrollbarMode();
 
-    scrollParameters.scrollOrigin = frameView->scrollOrigin();
-    scrollParameters.viewportRect = IntRect(IntPoint(), frameView->visibleContentRect().size());
-    scrollParameters.totalContentsSize = frameView->totalContentsSize();
-    scrollParameters.frameScaleFactor = frameView->frame().frameScaleFactor();
-    scrollParameters.headerHeight = frameView->headerHeight();
-    scrollParameters.footerHeight = frameView->footerHeight();
-
-    setScrollParametersForNode(scrollParameters, node);
+    node->setScrollableAreaParameters(scrollParameters);
+    scheduleTreeStateCommit();
 }
 
 void ScrollingCoordinatorMac::recomputeWheelEventHandlerCountForFrameView(FrameView* frameView)
@@ -298,25 +300,6 @@ void ScrollingCoordinatorMac::setNonFastScrollableRegionForNode(const Region& re
     scheduleTreeStateCommit();
 }
 
-void ScrollingCoordinatorMac::setScrollParametersForNode(const ScrollParameters& scrollParameters, ScrollingStateScrollingNode* node)
-{
-    node->setHorizontalScrollElasticity(scrollParameters.horizontalScrollElasticity);
-    node->setVerticalScrollElasticity(scrollParameters.verticalScrollElasticity);
-    node->setHasEnabledHorizontalScrollbar(scrollParameters.hasEnabledHorizontalScrollbar);
-    node->setHasEnabledVerticalScrollbar(scrollParameters.hasEnabledVerticalScrollbar);
-    node->setHorizontalScrollbarMode(scrollParameters.horizontalScrollbarMode);
-    node->setVerticalScrollbarMode(scrollParameters.verticalScrollbarMode);
-
-    node->setScrollOrigin(scrollParameters.scrollOrigin);
-    node->setViewportRect(scrollParameters.viewportRect);
-    node->setTotalContentsSize(scrollParameters.totalContentsSize);
-    node->setFrameScaleFactor(scrollParameters.frameScaleFactor);
-    node->setHeaderHeight(scrollParameters.headerHeight);
-    node->setFooterHeight(scrollParameters.footerHeight);
-
-    scheduleTreeStateCommit();
-}
-
 void ScrollingCoordinatorMac::setWheelEventHandlerCountForNode(unsigned wheelEventHandlerCount, ScrollingStateScrollingNode* node)
 {
     node->setWheelEventHandlerCount(wheelEventHandlerCount);