diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
commit | 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch) | |
tree | 46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/WebCore/page/scrolling/ScrollingStateScrollingNode.h | |
parent | 32761a6cee1d0dee366b885b7b9c777e67885688 (diff) | |
download | WebKitGtk-tarball-master.tar.gz |
webkitgtk-2.16.5HEADwebkitgtk-2.16.5master
Diffstat (limited to 'Source/WebCore/page/scrolling/ScrollingStateScrollingNode.h')
-rw-r--r-- | Source/WebCore/page/scrolling/ScrollingStateScrollingNode.h | 163 |
1 files changed, 66 insertions, 97 deletions
diff --git a/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.h b/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.h index 14be04b97..628c34f7f 100644 --- a/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.h +++ b/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Apple Inc. All rights reserved. + * Copyright (C) 2012, 2014-2015 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -23,142 +23,111 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef ScrollingStateScrollingNode_h -#define ScrollingStateScrollingNode_h +#pragma once #if ENABLE(ASYNC_SCROLLING) || USE(COORDINATED_GRAPHICS) -#include "GraphicsLayer.h" -#include "IntRect.h" -#include "Region.h" +#include "ScrollSnapOffsetsInfo.h" #include "ScrollTypes.h" -#include "ScrollbarThemeComposite.h" #include "ScrollingCoordinator.h" #include "ScrollingStateNode.h" -#include <wtf/PassOwnPtr.h> namespace WebCore { -class Scrollbar; - -class ScrollingStateScrollingNode final : public ScrollingStateNode { +class ScrollingStateScrollingNode : public ScrollingStateNode { public: - static PassOwnPtr<ScrollingStateScrollingNode> create(ScrollingStateTree&, ScrollingNodeID); - - virtual PassOwnPtr<ScrollingStateNode> clone(ScrollingStateTree&); - virtual ~ScrollingStateScrollingNode(); enum ChangedProperty { - ViewportRect = NumStateNodeBits, + ScrollableAreaSize = NumStateNodeBits, TotalContentsSize, + ReachableContentsSize, + ScrollPosition, ScrollOrigin, ScrollableAreaParams, - FrameScaleFactor, - NonFastScrollableRegion, - WheelEventHandlerCount, - ReasonsForSynchronousScrolling, RequestedScrollPosition, - CounterScrollingLayer, - HeaderHeight, - FooterHeight, - HeaderLayer, - FooterLayer, - PainterForScrollbar, - BehaviorForFixedElements + NumScrollingStateNodeBits, +#if ENABLE(CSS_SCROLL_SNAP) + HorizontalSnapOffsets, + VerticalSnapOffsets, + HorizontalSnapOffsetRanges, + VerticalSnapOffsetRanges, + CurrentHorizontalSnapOffsetIndex, + CurrentVerticalSnapOffsetIndex, +#endif + ExpectsWheelEventTestTrigger, }; - const IntRect& viewportRect() const { return m_viewportRect; } - void setViewportRect(const IntRect&); - - const IntSize& totalContentsSize() const { return m_totalContentsSize; } - void setTotalContentsSize(const IntSize&); - - const IntPoint& scrollOrigin() const { return m_scrollOrigin; } - void setScrollOrigin(const IntPoint&); + const FloatSize& scrollableAreaSize() const { return m_scrollableAreaSize; } + WEBCORE_EXPORT void setScrollableAreaSize(const FloatSize&); - float frameScaleFactor() const { return m_frameScaleFactor; } - void setFrameScaleFactor(float); + const FloatSize& totalContentsSize() const { return m_totalContentsSize; } + WEBCORE_EXPORT void setTotalContentsSize(const FloatSize&); - const Region& nonFastScrollableRegion() const { return m_nonFastScrollableRegion; } - void setNonFastScrollableRegion(const Region&); + const FloatSize& reachableContentsSize() const { return m_reachableContentsSize; } + WEBCORE_EXPORT void setReachableContentsSize(const FloatSize&); - unsigned wheelEventHandlerCount() const { return m_wheelEventHandlerCount; } - void setWheelEventHandlerCount(unsigned); + const FloatPoint& scrollPosition() const { return m_scrollPosition; } + WEBCORE_EXPORT void setScrollPosition(const FloatPoint&); - SynchronousScrollingReasons synchronousScrollingReasons() const { return m_synchronousScrollingReasons; } - void setSynchronousScrollingReasons(SynchronousScrollingReasons); - - const ScrollableAreaParameters& scrollableAreaParameters() const { return m_scrollableAreaParameters; } - void setScrollableAreaParameters(const ScrollableAreaParameters& params); - - ScrollBehaviorForFixedElements scrollBehaviorForFixedElements() const { return m_behaviorForFixed; } - void setScrollBehaviorForFixedElements(ScrollBehaviorForFixedElements); - - const IntPoint& requestedScrollPosition() const { return m_requestedScrollPosition; } - void setRequestedScrollPosition(const IntPoint&, bool representsProgrammaticScroll); + const IntPoint& scrollOrigin() const { return m_scrollOrigin; } + WEBCORE_EXPORT void setScrollOrigin(const IntPoint&); - int headerHeight() const { return m_headerHeight; } - void setHeaderHeight(int); +#if ENABLE(CSS_SCROLL_SNAP) + const Vector<float>& horizontalSnapOffsets() const { return m_snapOffsetsInfo.horizontalSnapOffsets; } + WEBCORE_EXPORT void setHorizontalSnapOffsets(const Vector<float>&); - int footerHeight() const { return m_footerHeight; } - void setFooterHeight(int); + const Vector<float>& verticalSnapOffsets() const { return m_snapOffsetsInfo.verticalSnapOffsets; } + WEBCORE_EXPORT void setVerticalSnapOffsets(const Vector<float>&); - // This is a layer moved in the opposite direction to scrolling, for example for background-attachment:fixed - const LayerRepresentation& counterScrollingLayer() const { return m_counterScrollingLayer; } - void setCounterScrollingLayer(const LayerRepresentation&); + const Vector<ScrollOffsetRange<float>>& horizontalSnapOffsetRanges() const { return m_snapOffsetsInfo.horizontalSnapOffsetRanges; } + WEBCORE_EXPORT void setHorizontalSnapOffsetRanges(const Vector<ScrollOffsetRange<float>>&); - // The header and footer layers scroll vertically with the page, they should remain fixed when scrolling horizontally. - const LayerRepresentation& headerLayer() const { return m_headerLayer; } - void setHeaderLayer(const LayerRepresentation&); + const Vector<ScrollOffsetRange<float>>& verticalSnapOffsetRanges() const { return m_snapOffsetsInfo.verticalSnapOffsetRanges; } + WEBCORE_EXPORT void setVerticalSnapOffsetRanges(const Vector<ScrollOffsetRange<float>>&); - // The header and footer layers scroll vertically with the page, they should remain fixed when scrolling horizontally. - const LayerRepresentation& footerLayer() const { return m_footerLayer; } - void setFooterLayer(const LayerRepresentation&); + unsigned currentHorizontalSnapPointIndex() const { return m_currentHorizontalSnapPointIndex; } + WEBCORE_EXPORT void setCurrentHorizontalSnapPointIndex(unsigned); -#if PLATFORM(MAC) && !PLATFORM(IOS) - ScrollbarPainter verticalScrollbarPainter() const { return m_verticalScrollbarPainter.get(); } - ScrollbarPainter horizontalScrollbarPainter() const { return m_horizontalScrollbarPainter.get(); } + unsigned currentVerticalSnapPointIndex() const { return m_currentVerticalSnapPointIndex; } + WEBCORE_EXPORT void setCurrentVerticalSnapPointIndex(unsigned); #endif - void setScrollbarPaintersFromScrollbars(Scrollbar* verticalScrollbar, Scrollbar* horizontalScrollbar); + const ScrollableAreaParameters& scrollableAreaParameters() const { return m_scrollableAreaParameters; } + WEBCORE_EXPORT void setScrollableAreaParameters(const ScrollableAreaParameters& params); + + const FloatPoint& requestedScrollPosition() const { return m_requestedScrollPosition; } bool requestedScrollPositionRepresentsProgrammaticScroll() const { return m_requestedScrollPositionRepresentsProgrammaticScroll; } + WEBCORE_EXPORT void setRequestedScrollPosition(const FloatPoint&, bool representsProgrammaticScroll); - virtual void dumpProperties(TextStream&, int indent) const override; + bool expectsWheelEventTestTrigger() const { return m_expectsWheelEventTestTrigger; } + WEBCORE_EXPORT void setExpectsWheelEventTestTrigger(bool); -private: - ScrollingStateScrollingNode(ScrollingStateTree&, ScrollingNodeID); +protected: + ScrollingStateScrollingNode(ScrollingStateTree&, ScrollingNodeType, ScrollingNodeID); ScrollingStateScrollingNode(const ScrollingStateScrollingNode&, ScrollingStateTree&); - LayerRepresentation m_counterScrollingLayer; - LayerRepresentation m_headerLayer; - LayerRepresentation m_footerLayer; - -#if PLATFORM(MAC) && !PLATFORM(IOS) - RetainPtr<ScrollbarPainter> m_verticalScrollbarPainter; - RetainPtr<ScrollbarPainter> m_horizontalScrollbarPainter; -#endif - - IntRect m_viewportRect; - IntSize m_totalContentsSize; - IntPoint m_scrollOrigin; + void dumpProperties(TextStream&, int indent, ScrollingStateTreeAsTextBehavior) const override; +private: + FloatSize m_scrollableAreaSize; + FloatSize m_totalContentsSize; + FloatSize m_reachableContentsSize; + FloatPoint m_scrollPosition; + FloatPoint m_requestedScrollPosition; + IntPoint m_scrollOrigin; +#if ENABLE(CSS_SCROLL_SNAP) + ScrollSnapOffsetsInfo<float> m_snapOffsetsInfo; + unsigned m_currentHorizontalSnapPointIndex { 0 }; + unsigned m_currentVerticalSnapPointIndex { 0 }; +#endif ScrollableAreaParameters m_scrollableAreaParameters; - Region m_nonFastScrollableRegion; - float m_frameScaleFactor; - unsigned m_wheelEventHandlerCount; - SynchronousScrollingReasons m_synchronousScrollingReasons; - ScrollBehaviorForFixedElements m_behaviorForFixed; - int m_headerHeight; - int m_footerHeight; - IntPoint m_requestedScrollPosition; - bool m_requestedScrollPositionRepresentsProgrammaticScroll; + bool m_requestedScrollPositionRepresentsProgrammaticScroll { false }; + bool m_expectsWheelEventTestTrigger { false }; }; -SCROLLING_STATE_NODE_TYPE_CASTS(ScrollingStateScrollingNode, nodeType() == ScrollingNode); - } // namespace WebCore -#endif // ENABLE(ASYNC_SCROLLING) || USE(COORDINATED_GRAPHICS) +SPECIALIZE_TYPE_TRAITS_SCROLLING_STATE_NODE(ScrollingStateScrollingNode, isScrollingNode()) -#endif // ScrollingStateScrollingNode_h +#endif // ENABLE(ASYNC_SCROLLING) || USE(COORDINATED_GRAPHICS) |