Title: [107277] trunk/Source/WebCore
Revision
107277
Author
[email protected]
Date
2012-02-09 12:44:05 -0800 (Thu, 09 Feb 2012)

Log Message

The scrolling tree should know more about the scrollbar state
https://bugs.webkit.org/show_bug.cgi?id=78268

Reviewed by Andreas Kling.

With this change, the scroll tree now keeps track of the horizontal scroll elasticity,
the vertical scroll elasticity and whether the page has enabled scrollbars.

This is needed in order to make rubber-banding work correctly when doing fast scrolling.

* page/scrolling/ScrollingCoordinator.cpp:
(WebCore::ScrollingCoordinator::frameViewLayoutUpdated):
* page/scrolling/ScrollingTreeNode.cpp:
(WebCore::ScrollingTreeNode::ScrollingTreeNode):
(WebCore::ScrollingTreeNode::update):
* page/scrolling/ScrollingTreeNode.h:
(ScrollingTreeNode):
* page/scrolling/ScrollingTreeState.cpp:
(WebCore::ScrollingTreeState::ScrollingTreeState):
(WebCore::ScrollingTreeState::setHorizontalScrollElasticity):
(WebCore):
(WebCore::ScrollingTreeState::setVerticalScrollElasticity):
(WebCore::ScrollingTreeState::setHasEnabledHorizontalScrollbar):
(WebCore::ScrollingTreeState::setHasEnabledVerticalScrollbar):
* page/scrolling/ScrollingTreeState.h:
(WebCore::ScrollingTreeState::horizontalScrollElasticity):
(ScrollingTreeState):
(WebCore::ScrollingTreeState::verticalScrollElasticity):
(WebCore::ScrollingTreeState::hasEnabledHorizontalScrollbar):
(WebCore::ScrollingTreeState::hasEnabledVerticalScrollbar):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (107276 => 107277)


--- trunk/Source/WebCore/ChangeLog	2012-02-09 20:43:02 UTC (rev 107276)
+++ trunk/Source/WebCore/ChangeLog	2012-02-09 20:44:05 UTC (rev 107277)
@@ -1,3 +1,36 @@
+2012-02-09  Anders Carlsson  <[email protected]>
+
+        The scrolling tree should know more about the scrollbar state
+        https://bugs.webkit.org/show_bug.cgi?id=78268
+
+        Reviewed by Andreas Kling.
+
+        With this change, the scroll tree now keeps track of the horizontal scroll elasticity,
+        the vertical scroll elasticity and whether the page has enabled scrollbars.
+
+        This is needed in order to make rubber-banding work correctly when doing fast scrolling.
+
+        * page/scrolling/ScrollingCoordinator.cpp:
+        (WebCore::ScrollingCoordinator::frameViewLayoutUpdated):
+        * page/scrolling/ScrollingTreeNode.cpp:
+        (WebCore::ScrollingTreeNode::ScrollingTreeNode):
+        (WebCore::ScrollingTreeNode::update):
+        * page/scrolling/ScrollingTreeNode.h:
+        (ScrollingTreeNode):
+        * page/scrolling/ScrollingTreeState.cpp:
+        (WebCore::ScrollingTreeState::ScrollingTreeState):
+        (WebCore::ScrollingTreeState::setHorizontalScrollElasticity):
+        (WebCore):
+        (WebCore::ScrollingTreeState::setVerticalScrollElasticity):
+        (WebCore::ScrollingTreeState::setHasEnabledHorizontalScrollbar):
+        (WebCore::ScrollingTreeState::setHasEnabledVerticalScrollbar):
+        * page/scrolling/ScrollingTreeState.h:
+        (WebCore::ScrollingTreeState::horizontalScrollElasticity):
+        (ScrollingTreeState):
+        (WebCore::ScrollingTreeState::verticalScrollElasticity):
+        (WebCore::ScrollingTreeState::hasEnabledHorizontalScrollbar):
+        (WebCore::ScrollingTreeState::hasEnabledVerticalScrollbar):
+
 2012-02-09  Xianzhu Wang  <[email protected]>
 
         Unnecessary and incorrect invalidation about composited fixed-position layers

Modified: trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp (107276 => 107277)


--- trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp	2012-02-09 20:43:02 UTC (rev 107276)
+++ trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp	2012-02-09 20:44:05 UTC (rev 107277)
@@ -115,6 +115,11 @@
         }
     }
 
+    m_scrollingTreeState->setHorizontalScrollElasticity(frameView->horizontalScrollElasticity());
+    m_scrollingTreeState->setVerticalScrollElasticity(frameView->verticalScrollElasticity());
+    m_scrollingTreeState->setHasEnabledHorizontalScrollbar(frameView->horizontalScrollbar() && frameView->horizontalScrollbar()->enabled());
+    m_scrollingTreeState->setHasEnabledVerticalScrollbar(frameView->verticalScrollbar() && frameView->verticalScrollbar()->enabled());
+
     m_scrollingTreeState->setViewportRect(IntRect(IntPoint(), frameView->visibleContentRect().size()));
     m_scrollingTreeState->setContentsSize(frameView->contentsSize());
     m_scrollingTreeState->setNonFastScrollableRegion(nonScrollableRegion);

Modified: trunk/Source/WebCore/page/scrolling/ScrollingTreeNode.cpp (107276 => 107277)


--- trunk/Source/WebCore/page/scrolling/ScrollingTreeNode.cpp	2012-02-09 20:43:02 UTC (rev 107276)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTreeNode.cpp	2012-02-09 20:44:05 UTC (rev 107277)
@@ -34,6 +34,10 @@
 
 ScrollingTreeNode::ScrollingTreeNode(ScrollingTree* scrollingTree)
     : m_scrollingTree(scrollingTree)
+    , m_horizontalScrollElasticity(ScrollElasticityNone)
+    , m_verticalScrollElasticity(ScrollElasticityNone)
+    , m_hasEnabledHorizontalScrollbar(false)
+    , m_hasEnabledVerticalScrollbar(false)
 {
 }
 
@@ -48,6 +52,18 @@
 
     if (state->changedProperties() & ScrollingTreeState::ContentsSize)
         m_contentsSize = state->contentsSize();
+
+    if (state->changedProperties() & ScrollingTreeState::HorizontalScrollElasticity)
+        m_horizontalScrollElasticity = state->horizontalScrollElasticity();
+
+    if (state->changedProperties() & ScrollingTreeState::VerticalScrollElasticity)
+        m_verticalScrollElasticity = state->verticalScrollElasticity();
+
+    if (state->changedProperties() & ScrollingTreeState::HasEnabledHorizontalScrollbar)
+        m_hasEnabledHorizontalScrollbar = state->hasEnabledHorizontalScrollbar();
+
+    if (state->changedProperties() & ScrollingTreeState::HasEnabledVerticalScrollbar)
+        m_hasEnabledVerticalScrollbar = state->hasEnabledVerticalScrollbar();
 }
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/page/scrolling/ScrollingTreeNode.h (107276 => 107277)


--- trunk/Source/WebCore/page/scrolling/ScrollingTreeNode.h	2012-02-09 20:43:02 UTC (rev 107276)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTreeNode.h	2012-02-09 20:44:05 UTC (rev 107277)
@@ -29,6 +29,7 @@
 #if ENABLE(THREADED_SCROLLING)
 
 #include "IntRect.h"
+#include "ScrollTypes.h"
 #include <wtf/PassOwnPtr.h>
 
 namespace WebCore {
@@ -57,6 +58,12 @@
 
     IntRect m_viewportRect;
     IntSize m_contentsSize;
+
+    ScrollElasticity m_horizontalScrollElasticity;
+    ScrollElasticity m_verticalScrollElasticity;
+    
+    bool m_hasEnabledHorizontalScrollbar;
+    bool m_hasEnabledVerticalScrollbar;
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/page/scrolling/ScrollingTreeState.cpp (107276 => 107277)


--- trunk/Source/WebCore/page/scrolling/ScrollingTreeState.cpp	2012-02-09 20:43:02 UTC (rev 107276)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTreeState.cpp	2012-02-09 20:44:05 UTC (rev 107277)
@@ -38,6 +38,10 @@
 ScrollingTreeState::ScrollingTreeState()
     : m_changedProperties(0)
     , m_wheelEventHandlerCount(0)
+    , m_horizontalScrollElasticity(ScrollElasticityNone)
+    , m_verticalScrollElasticity(ScrollElasticityNone)
+    , m_hasEnabledHorizontalScrollbar(false)
+    , m_hasEnabledVerticalScrollbar(false)
 {
 }
 
@@ -81,6 +85,42 @@
     m_changedProperties |= WheelEventHandlerCount;
 }
 
+void ScrollingTreeState::setHorizontalScrollElasticity(ScrollElasticity horizontalScrollElasticity)
+{
+    if (m_horizontalScrollElasticity == horizontalScrollElasticity)
+        return;
+
+    m_horizontalScrollElasticity = horizontalScrollElasticity;
+    m_changedProperties |= HorizontalScrollElasticity;
+}
+
+void ScrollingTreeState::setVerticalScrollElasticity(ScrollElasticity verticalScrollElasticity)
+{
+    if (m_verticalScrollElasticity == verticalScrollElasticity)
+        return;
+
+    m_verticalScrollElasticity = verticalScrollElasticity;
+    m_changedProperties |= VerticalScrollElasticity;
+}
+
+void ScrollingTreeState::setHasEnabledHorizontalScrollbar(bool hasEnabledHorizontalScrollbar)
+{
+    if (m_hasEnabledHorizontalScrollbar == hasEnabledHorizontalScrollbar)
+        return;
+
+    m_hasEnabledHorizontalScrollbar = hasEnabledHorizontalScrollbar;
+    m_changedProperties |= HasEnabledHorizontalScrollbar;
+}
+
+void ScrollingTreeState::setHasEnabledVerticalScrollbar(bool hasEnabledVerticalScrollbar)
+{
+    if (m_hasEnabledVerticalScrollbar == hasEnabledVerticalScrollbar)
+        return;
+
+    m_hasEnabledVerticalScrollbar = hasEnabledVerticalScrollbar;
+    m_changedProperties |= HasEnabledVerticalScrollbar;
+}
+
 PassOwnPtr<ScrollingTreeState> ScrollingTreeState::commit()
 {
     OwnPtr<ScrollingTreeState> treeState = adoptPtr(new ScrollingTreeState(*this));

Modified: trunk/Source/WebCore/page/scrolling/ScrollingTreeState.h (107276 => 107277)


--- trunk/Source/WebCore/page/scrolling/ScrollingTreeState.h	2012-02-09 20:43:02 UTC (rev 107276)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTreeState.h	2012-02-09 20:44:05 UTC (rev 107277)
@@ -31,6 +31,7 @@
 #include "GraphicsLayer.h"
 #include "IntRect.h"
 #include "Region.h"
+#include "ScrollTypes.h"
 #include <wtf/PassOwnPtr.h>
 
 #if PLATFORM(MAC)
@@ -53,7 +54,11 @@
         ContentsSize = 1 << 1,
         NonFastScrollableRegion = 1 << 2,
         WheelEventHandlerCount = 1 << 3,
-        ScrollLayer = 1 << 4,
+        HorizontalScrollElasticity = 1 << 4,
+        VerticalScrollElasticity = 1 << 5,
+        HasEnabledHorizontalScrollbar = 1 << 6,
+        HasEnabledVerticalScrollbar = 1 << 7,
+        ScrollLayer = 1 << 8,
     };
 
     bool hasChangedProperties() const { return m_changedProperties; }
@@ -71,6 +76,18 @@
     unsigned wheelEventHandlerCount() const { return m_wheelEventHandlerCount; }
     void setWheelEventHandlerCount(unsigned);
 
+    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);
+
     PlatformLayer* platformScrollLayer() const;
     void setScrollLayer(const GraphicsLayer*);
 
@@ -89,6 +106,12 @@
 
     unsigned m_wheelEventHandlerCount;
 
+    ScrollElasticity m_horizontalScrollElasticity;
+    ScrollElasticity m_verticalScrollElasticity;
+
+    bool m_hasEnabledHorizontalScrollbar;
+    bool m_hasEnabledVerticalScrollbar;
+
 #if PLATFORM(MAC)
     RetainPtr<PlatformLayer> m_platformScrollLayer;
 #endif
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to