void ScrollingTreeScrollingNode::updateBeforeChildren(ScrollingStateNode* stateNode)
{
    ScrollingStateScrollingNode* state = toScrollingStateScrollingNode(stateNode);

    if (state->hasChangedProperty(ScrollingStateScrollingNode::ViewportRect))
        m_viewportRect = state->viewportRect();

    if (state->hasChangedProperty(ScrollingStateScrollingNode::TotalContentsSize)) {
        if (scrollingTree().isRubberBandInProgress())
            m_totalContentsSizeForRubberBand = m_totalContentsSize;
        else
            m_totalContentsSizeForRubberBand = state->totalContentsSize();
        m_totalContentsSize = state->totalContentsSize();
    }

    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();

    if (state->hasChangedProperty(ScrollingStateScrollingNode::FooterHeight))
        m_footerHeight = state->footerHeight();

    if (state->hasChangedProperty(ScrollingStateScrollingNode::BehaviorForFixedElements))
        m_behaviorForFixed = state->scrollBehaviorForFixedElements();
}
Exemplo n.º 2
0
ScrollingStateScrollingNode::ScrollingStateScrollingNode(const ScrollingStateScrollingNode& stateNode)
    : ScrollingStateNode(stateNode)
    , m_changedProperties(stateNode.changedProperties())
    , m_viewportRect(stateNode.viewportRect())
    , m_contentsSize(stateNode.contentsSize())
    , m_nonFastScrollableRegion(stateNode.nonFastScrollableRegion())
    , 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_requestedScrollPosition(stateNode.requestedScrollPosition())
    , m_scrollOrigin(stateNode.scrollOrigin())
{
}