void ScrollingTree::commitNewTreeState(PassOwnPtr<ScrollingStateTree> scrollingStateTree) { bool rootStateNodeChanged = scrollingStateTree->hasNewRootStateNode(); ScrollingStateScrollingNode* rootNode = scrollingStateTree->rootStateNode(); if (rootNode && (rootStateNodeChanged || rootNode->hasChangedProperty(ScrollingStateScrollingNode::WheelEventHandlerCount) || rootNode->hasChangedProperty(ScrollingStateScrollingNode::NonFastScrollableRegion) || rootNode->hasChangedProperty(ScrollingStateNode::ScrollLayer))) { MutexLocker lock(m_mutex); if (rootStateNodeChanged || rootNode->hasChangedProperty(ScrollingStateNode::ScrollLayer)) m_mainFrameScrollPosition = FloatPoint(); if (rootStateNodeChanged || rootNode->hasChangedProperty(ScrollingStateScrollingNode::WheelEventHandlerCount)) m_hasWheelEventHandlers = scrollingStateTree->rootStateNode()->wheelEventHandlerCount(); if (rootStateNodeChanged || rootNode->hasChangedProperty(ScrollingStateScrollingNode::NonFastScrollableRegion)) m_nonFastScrollableRegion = scrollingStateTree->rootStateNode()->nonFastScrollableRegion(); } bool scrollRequestIsProgammatic = rootNode ? rootNode->requestedScrollPositionRepresentsProgrammaticScroll() : false; TemporaryChange<bool> changeHandlingProgrammaticScroll(m_isHandlingProgrammaticScroll, scrollRequestIsProgammatic); removeDestroyedNodes(*scrollingStateTree); updateTreeFromStateNode(rootNode); }
void RemoteScrollingTreeTextStream::dump(const ScrollingStateScrollingNode& node, bool changedPropertiesOnly) { RemoteScrollingTreeTextStream& ts = *this; if (!changedPropertiesOnly || node.hasChangedProperty(ScrollingStateScrollingNode::ViewportSize)) dumpProperty(ts, "viewport-size", node.viewportSize()); if (!changedPropertiesOnly || node.hasChangedProperty(ScrollingStateScrollingNode::TotalContentsSize)) dumpProperty(ts, "total-contents-size", node.totalContentsSize()); if (!changedPropertiesOnly || node.hasChangedProperty(ScrollingStateScrollingNode::ScrollPosition)) dumpProperty(ts, "scroll-position", node.scrollPosition()); if (!changedPropertiesOnly || node.hasChangedProperty(ScrollingStateScrollingNode::ScrollOrigin)) dumpProperty(ts, "scroll-origin", node.scrollOrigin()); if (!changedPropertiesOnly || node.hasChangedProperty(ScrollingStateScrollingNode::FrameScaleFactor)) dumpProperty(ts, "frame-scale-factor", node.frameScaleFactor()); // FIXME: dump nonFastScrollableRegion // FIXME: dump wheelEventHandlerCount // FIXME: dump synchronousScrollingReasons // FIXME: dump scrollableAreaParameters // FIXME: dump scrollBehaviorForFixedElements if (!changedPropertiesOnly || node.hasChangedProperty(ScrollingStateScrollingNode::RequestedScrollPosition)) { dumpProperty(ts, "requested-scroll-position", node.requestedScrollPosition()); dumpProperty(ts, "requested-scroll-position-is-programatic", node.requestedScrollPositionRepresentsProgrammaticScroll()); } if (!changedPropertiesOnly || node.hasChangedProperty(ScrollingStateScrollingNode::HeaderHeight)) dumpProperty(ts, "header-height", node.headerHeight()); if (!changedPropertiesOnly || node.hasChangedProperty(ScrollingStateScrollingNode::FooterHeight)) dumpProperty(ts, "footer-height", node.footerHeight()); if (!changedPropertiesOnly || node.hasChangedProperty(ScrollingStateScrollingNode::TopContentInset)) dumpProperty(ts, "top-content-inset", node.topContentInset()); if (!changedPropertiesOnly || node.hasChangedProperty(ScrollingStateScrollingNode::ScrolledContentsLayer)) dumpProperty(ts, "scrolled-contents-layer", static_cast<GraphicsLayer::PlatformLayerID>(node.scrolledContentsLayer())); if (!changedPropertiesOnly || node.hasChangedProperty(ScrollingStateScrollingNode::CounterScrollingLayer)) dumpProperty(ts, "counter-scrolling-layer", static_cast<GraphicsLayer::PlatformLayerID>(node.counterScrollingLayer())); if (!changedPropertiesOnly || node.hasChangedProperty(ScrollingStateScrollingNode::InsetClipLayer)) dumpProperty(ts, "clip-inset-layer", static_cast<GraphicsLayer::PlatformLayerID>(node.insetClipLayer())); if (!changedPropertiesOnly || node.hasChangedProperty(ScrollingStateScrollingNode::HeaderLayer)) dumpProperty(ts, "header-layer", static_cast<GraphicsLayer::PlatformLayerID>(node.headerLayer())); if (!changedPropertiesOnly || node.hasChangedProperty(ScrollingStateScrollingNode::FooterLayer)) dumpProperty(ts, "footer-layer", static_cast<GraphicsLayer::PlatformLayerID>(node.footerLayer())); }
ScrollingStateScrollingNode::ScrollingStateScrollingNode(const ScrollingStateScrollingNode& stateNode, ScrollingStateTree& adoptiveTree) : ScrollingStateNode(stateNode, adoptiveTree) , m_scrollableAreaSize(stateNode.scrollableAreaSize()) , m_totalContentsSize(stateNode.totalContentsSize()) , m_scrollPosition(stateNode.scrollPosition()) , m_requestedScrollPosition(stateNode.requestedScrollPosition()) , m_scrollOrigin(stateNode.scrollOrigin()) , m_scrollableAreaParameters(stateNode.scrollableAreaParameters()) , m_requestedScrollPositionRepresentsProgrammaticScroll(stateNode.requestedScrollPositionRepresentsProgrammaticScroll()) { }
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()) { }
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())); }
void ScrollingTree::commitNewTreeState(PassOwnPtr<ScrollingStateTree> scrollingStateTree) { ASSERT(ScrollingThread::isCurrentThread()); ScrollingStateScrollingNode* rootNode = scrollingStateTree->rootStateNode(); if (rootNode->hasChangedProperty(ScrollingStateScrollingNode::WheelEventHandlerCount) || rootNode->hasChangedProperty(ScrollingStateScrollingNode::NonFastScrollableRegion) || rootNode->hasChangedProperty(ScrollingStateNode::ScrollLayer)) { MutexLocker lock(m_mutex); if (rootNode->hasChangedProperty(ScrollingStateNode::ScrollLayer)) m_mainFrameScrollPosition = IntPoint(); if (rootNode->hasChangedProperty(ScrollingStateScrollingNode::WheelEventHandlerCount)) m_hasWheelEventHandlers = scrollingStateTree->rootStateNode()->wheelEventHandlerCount(); if (rootNode->hasChangedProperty(ScrollingStateScrollingNode::NonFastScrollableRegion)) m_nonFastScrollableRegion = scrollingStateTree->rootStateNode()->nonFastScrollableRegion(); } TemporaryChange<bool> changeHandlingProgrammaticScroll(m_isHandlingProgrammaticScroll, rootNode->requestedScrollPositionRepresentsProgrammaticScroll()); removeDestroyedNodes(scrollingStateTree.get()); updateTreeFromStateNode(rootNode); }