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, ScrollingStateTree& adoptiveTree)
    : ScrollingStateNode(stateNode, adoptiveTree)
#if PLATFORM(MAC)
    , m_verticalScrollbarPainter(stateNode.verticalScrollbarPainter())
    , m_horizontalScrollbarPainter(stateNode.horizontalScrollbarPainter())
#endif
    , m_viewportSize(stateNode.viewportSize())
    , m_totalContentsSize(stateNode.totalContentsSize())
    , m_scrollPosition(stateNode.scrollPosition())
    , m_scrollOrigin(stateNode.scrollOrigin())
    , m_scrollableAreaParameters(stateNode.scrollableAreaParameters())
    , m_nonFastScrollableRegion(stateNode.nonFastScrollableRegion())
    , m_frameScaleFactor(stateNode.frameScaleFactor())
    , m_wheelEventHandlerCount(stateNode.wheelEventHandlerCount())
    , m_synchronousScrollingReasons(stateNode.synchronousScrollingReasons())
    , m_behaviorForFixed(stateNode.scrollBehaviorForFixedElements())
    , m_headerHeight(stateNode.headerHeight())
    , m_footerHeight(stateNode.footerHeight())
    , m_requestedScrollPosition(stateNode.requestedScrollPosition())
    , m_requestedScrollPositionRepresentsProgrammaticScroll(stateNode.requestedScrollPositionRepresentsProgrammaticScroll())
    , m_topContentInset(stateNode.topContentInset())
{
    if (hasChangedProperty(ScrolledContentsLayer))
        setScrolledContentsLayer(stateNode.scrolledContentsLayer().toRepresentation(adoptiveTree.preferredLayerRepresentation()));

    if (hasChangedProperty(CounterScrollingLayer))
        setCounterScrollingLayer(stateNode.counterScrollingLayer().toRepresentation(adoptiveTree.preferredLayerRepresentation()));

    if (hasChangedProperty(InsetClipLayer))
        setInsetClipLayer(stateNode.insetClipLayer().toRepresentation(adoptiveTree.preferredLayerRepresentation()));

    if (hasChangedProperty(ContentShadowLayer))
        setContentShadowLayer(stateNode.contentShadowLayer().toRepresentation(adoptiveTree.preferredLayerRepresentation()));

    if (hasChangedProperty(HeaderLayer))
        setHeaderLayer(stateNode.headerLayer().toRepresentation(adoptiveTree.preferredLayerRepresentation()));

    if (hasChangedProperty(FooterLayer))
        setFooterLayer(stateNode.footerLayer().toRepresentation(adoptiveTree.preferredLayerRepresentation()));
}