Changeset 107277 in webkit


Ignore:
Timestamp:
Feb 9, 2012 12:44:05 PM (12 years ago)
Author:
andersca@apple.com
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):

Location:
trunk/Source/WebCore
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r107270 r107277  
     12012-02-09  Anders Carlsson  <andersca@apple.com>
     2
     3        The scrolling tree should know more about the scrollbar state
     4        https://bugs.webkit.org/show_bug.cgi?id=78268
     5
     6        Reviewed by Andreas Kling.
     7
     8        With this change, the scroll tree now keeps track of the horizontal scroll elasticity,
     9        the vertical scroll elasticity and whether the page has enabled scrollbars.
     10
     11        This is needed in order to make rubber-banding work correctly when doing fast scrolling.
     12
     13        * page/scrolling/ScrollingCoordinator.cpp:
     14        (WebCore::ScrollingCoordinator::frameViewLayoutUpdated):
     15        * page/scrolling/ScrollingTreeNode.cpp:
     16        (WebCore::ScrollingTreeNode::ScrollingTreeNode):
     17        (WebCore::ScrollingTreeNode::update):
     18        * page/scrolling/ScrollingTreeNode.h:
     19        (ScrollingTreeNode):
     20        * page/scrolling/ScrollingTreeState.cpp:
     21        (WebCore::ScrollingTreeState::ScrollingTreeState):
     22        (WebCore::ScrollingTreeState::setHorizontalScrollElasticity):
     23        (WebCore):
     24        (WebCore::ScrollingTreeState::setVerticalScrollElasticity):
     25        (WebCore::ScrollingTreeState::setHasEnabledHorizontalScrollbar):
     26        (WebCore::ScrollingTreeState::setHasEnabledVerticalScrollbar):
     27        * page/scrolling/ScrollingTreeState.h:
     28        (WebCore::ScrollingTreeState::horizontalScrollElasticity):
     29        (ScrollingTreeState):
     30        (WebCore::ScrollingTreeState::verticalScrollElasticity):
     31        (WebCore::ScrollingTreeState::hasEnabledHorizontalScrollbar):
     32        (WebCore::ScrollingTreeState::hasEnabledVerticalScrollbar):
     33
    1342012-02-09  Xianzhu Wang  <wangxianzhu@chromium.org>
    235
  • trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp

    r107013 r107277  
    116116    }
    117117
     118    m_scrollingTreeState->setHorizontalScrollElasticity(frameView->horizontalScrollElasticity());
     119    m_scrollingTreeState->setVerticalScrollElasticity(frameView->verticalScrollElasticity());
     120    m_scrollingTreeState->setHasEnabledHorizontalScrollbar(frameView->horizontalScrollbar() && frameView->horizontalScrollbar()->enabled());
     121    m_scrollingTreeState->setHasEnabledVerticalScrollbar(frameView->verticalScrollbar() && frameView->verticalScrollbar()->enabled());
     122
    118123    m_scrollingTreeState->setViewportRect(IntRect(IntPoint(), frameView->visibleContentRect().size()));
    119124    m_scrollingTreeState->setContentsSize(frameView->contentsSize());
  • trunk/Source/WebCore/page/scrolling/ScrollingTreeNode.cpp

    r106711 r107277  
    3535ScrollingTreeNode::ScrollingTreeNode(ScrollingTree* scrollingTree)
    3636    : m_scrollingTree(scrollingTree)
     37    , m_horizontalScrollElasticity(ScrollElasticityNone)
     38    , m_verticalScrollElasticity(ScrollElasticityNone)
     39    , m_hasEnabledHorizontalScrollbar(false)
     40    , m_hasEnabledVerticalScrollbar(false)
    3741{
    3842}
     
    4953    if (state->changedProperties() & ScrollingTreeState::ContentsSize)
    5054        m_contentsSize = state->contentsSize();
     55
     56    if (state->changedProperties() & ScrollingTreeState::HorizontalScrollElasticity)
     57        m_horizontalScrollElasticity = state->horizontalScrollElasticity();
     58
     59    if (state->changedProperties() & ScrollingTreeState::VerticalScrollElasticity)
     60        m_verticalScrollElasticity = state->verticalScrollElasticity();
     61
     62    if (state->changedProperties() & ScrollingTreeState::HasEnabledHorizontalScrollbar)
     63        m_hasEnabledHorizontalScrollbar = state->hasEnabledHorizontalScrollbar();
     64
     65    if (state->changedProperties() & ScrollingTreeState::HasEnabledVerticalScrollbar)
     66        m_hasEnabledVerticalScrollbar = state->hasEnabledVerticalScrollbar();
    5167}
    5268
  • trunk/Source/WebCore/page/scrolling/ScrollingTreeNode.h

    r106720 r107277  
    3030
    3131#include "IntRect.h"
     32#include "ScrollTypes.h"
    3233#include <wtf/PassOwnPtr.h>
    3334
     
    5859    IntRect m_viewportRect;
    5960    IntSize m_contentsSize;
     61
     62    ScrollElasticity m_horizontalScrollElasticity;
     63    ScrollElasticity m_verticalScrollElasticity;
     64   
     65    bool m_hasEnabledHorizontalScrollbar;
     66    bool m_hasEnabledVerticalScrollbar;
    6067};
    6168
  • trunk/Source/WebCore/page/scrolling/ScrollingTreeState.cpp

    r107001 r107277  
    3939    : m_changedProperties(0)
    4040    , m_wheelEventHandlerCount(0)
     41    , m_horizontalScrollElasticity(ScrollElasticityNone)
     42    , m_verticalScrollElasticity(ScrollElasticityNone)
     43    , m_hasEnabledHorizontalScrollbar(false)
     44    , m_hasEnabledVerticalScrollbar(false)
    4145{
    4246}
     
    8286}
    8387
     88void ScrollingTreeState::setHorizontalScrollElasticity(ScrollElasticity horizontalScrollElasticity)
     89{
     90    if (m_horizontalScrollElasticity == horizontalScrollElasticity)
     91        return;
     92
     93    m_horizontalScrollElasticity = horizontalScrollElasticity;
     94    m_changedProperties |= HorizontalScrollElasticity;
     95}
     96
     97void ScrollingTreeState::setVerticalScrollElasticity(ScrollElasticity verticalScrollElasticity)
     98{
     99    if (m_verticalScrollElasticity == verticalScrollElasticity)
     100        return;
     101
     102    m_verticalScrollElasticity = verticalScrollElasticity;
     103    m_changedProperties |= VerticalScrollElasticity;
     104}
     105
     106void ScrollingTreeState::setHasEnabledHorizontalScrollbar(bool hasEnabledHorizontalScrollbar)
     107{
     108    if (m_hasEnabledHorizontalScrollbar == hasEnabledHorizontalScrollbar)
     109        return;
     110
     111    m_hasEnabledHorizontalScrollbar = hasEnabledHorizontalScrollbar;
     112    m_changedProperties |= HasEnabledHorizontalScrollbar;
     113}
     114
     115void ScrollingTreeState::setHasEnabledVerticalScrollbar(bool hasEnabledVerticalScrollbar)
     116{
     117    if (m_hasEnabledVerticalScrollbar == hasEnabledVerticalScrollbar)
     118        return;
     119
     120    m_hasEnabledVerticalScrollbar = hasEnabledVerticalScrollbar;
     121    m_changedProperties |= HasEnabledVerticalScrollbar;
     122}
     123
    84124PassOwnPtr<ScrollingTreeState> ScrollingTreeState::commit()
    85125{
  • trunk/Source/WebCore/page/scrolling/ScrollingTreeState.h

    r107001 r107277  
    3232#include "IntRect.h"
    3333#include "Region.h"
     34#include "ScrollTypes.h"
    3435#include <wtf/PassOwnPtr.h>
    3536
     
    5455        NonFastScrollableRegion = 1 << 2,
    5556        WheelEventHandlerCount = 1 << 3,
    56         ScrollLayer = 1 << 4,
     57        HorizontalScrollElasticity = 1 << 4,
     58        VerticalScrollElasticity = 1 << 5,
     59        HasEnabledHorizontalScrollbar = 1 << 6,
     60        HasEnabledVerticalScrollbar = 1 << 7,
     61        ScrollLayer = 1 << 8,
    5762    };
    5863
     
    7176    unsigned wheelEventHandlerCount() const { return m_wheelEventHandlerCount; }
    7277    void setWheelEventHandlerCount(unsigned);
     78
     79    ScrollElasticity horizontalScrollElasticity() const { return m_horizontalScrollElasticity; }
     80    void setHorizontalScrollElasticity(ScrollElasticity);
     81
     82    ScrollElasticity verticalScrollElasticity() const { return m_verticalScrollElasticity; }
     83    void setVerticalScrollElasticity(ScrollElasticity);
     84
     85    bool hasEnabledHorizontalScrollbar() const { return m_hasEnabledHorizontalScrollbar; }
     86    void setHasEnabledHorizontalScrollbar(bool);
     87
     88    bool hasEnabledVerticalScrollbar() const { return m_hasEnabledVerticalScrollbar; }
     89    void setHasEnabledVerticalScrollbar(bool);
    7390
    7491    PlatformLayer* platformScrollLayer() const;
     
    90107    unsigned m_wheelEventHandlerCount;
    91108
     109    ScrollElasticity m_horizontalScrollElasticity;
     110    ScrollElasticity m_verticalScrollElasticity;
     111
     112    bool m_hasEnabledHorizontalScrollbar;
     113    bool m_hasEnabledVerticalScrollbar;
     114
    92115#if PLATFORM(MAC)
    93116    RetainPtr<PlatformLayer> m_platformScrollLayer;
Note: See TracChangeset for help on using the changeset viewer.