Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(115)

Side by Side Diff: Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.h

Issue 13665002: Fold ScrollingCoordinatorChromium into ScrollingCoordinator and devirtualize (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 /*
2 * Copyright (C) 2012 Apple Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23 * THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26 #ifndef ScrollingCoordinatorMac_h
27 #define ScrollingCoordinatorMac_h
28
29 #if ENABLE(THREADED_SCROLLING)
30
31 #include "ScrollingCoordinator.h"
32
33 namespace WebCore {
34
35 class ScrollingStateNode;
36 class ScrollingStateScrollingNode;
37 class ScrollingStateTree;
38
39 class ScrollingCoordinatorMac : public ScrollingCoordinator {
40 public:
41 explicit ScrollingCoordinatorMac(Page*);
42 virtual ~ScrollingCoordinatorMac();
43
44 virtual void pageDestroyed();
45
46 virtual ScrollingTree* scrollingTree() const;
47 virtual void commitTreeStateIfNeeded();
48
49 // Should be called whenever the given frame view has been laid out.
50 virtual void frameViewLayoutUpdated(FrameView*);
51
52 // Should be called whenever the root layer for the given frame view changes .
53 virtual void frameViewRootLayerDidChange(FrameView*);
54
55 // Should be called whenever the scrollbar layer for the given scrollable ar ea changes.
56 virtual void scrollableAreaScrollbarLayerDidChange(ScrollableArea*, Scrollba rOrientation);
57
58 // Requests that the scrolling coordinator updates the scroll position of th e given frame view. If this function returns true, it means that the
59 // position will be updated asynchronously. If it returns false, the caller should update the scrolling position itself.
60 virtual bool requestScrollPositionUpdate(FrameView*, const IntPoint&);
61
62 // Handle the wheel event on the scrolling thread. Returns whether the event was handled or not.
63 virtual bool handleWheelEvent(FrameView*, const PlatformWheelEvent&);
64
65 // These functions are used to indicate that a layer should be (or should no t longer be) represented by a node
66 // in the scrolling tree.
67 virtual ScrollingNodeID attachToStateTree(ScrollingNodeType, ScrollingNodeID newNodeID, ScrollingNodeID parentID);
68 virtual void detachFromStateTree(ScrollingNodeID);
69
70 // This function wipes out the current tree.
71 virtual void clearStateTree();
72
73 virtual String scrollingStateTreeAsText() const OVERRIDE;
74
75 virtual bool isRubberBandInProgress() const OVERRIDE;
76 virtual bool rubberBandsAtBottom() const OVERRIDE;
77 virtual void setRubberBandsAtBottom(bool) OVERRIDE;
78 virtual bool rubberBandsAtTop() const OVERRIDE;
79 virtual void setRubberBandsAtTop(bool) OVERRIDE;
80
81 private:
82 // Return whether this scrolling coordinator can keep fixed position layers fixed to their
83 // containers while scrolling.
84 virtual bool supportsFixedPositionLayers() const OVERRIDE { return true; }
85
86 // This function will update the ScrollingStateNode for the given viewport c onstrained object.
87 virtual void updateViewportConstrainedNode(ScrollingNodeID, const ViewportCo nstraints&, GraphicsLayer*) OVERRIDE;
88
89 virtual void updateScrollingNode(ScrollingNodeID, GraphicsLayer* scrollLayer , GraphicsLayer* counterScrollingLayer) OVERRIDE;
90
91 // Called to synch the GraphicsLayer positions for child layers when their C ALayers have been moved by the scrolling thread.
92 virtual void syncChildPositions(const LayoutRect& viewportRect) OVERRIDE;
93
94 virtual void recomputeWheelEventHandlerCountForFrameView(FrameView*);
95 virtual void setShouldUpdateScrollLayerPositionOnMainThread(MainThreadScroll ingReasons);
96
97 virtual bool hasVisibleSlowRepaintViewportConstrainedObjects(FrameView*) con st { return false; }
98
99 void ensureRootStateNodeForFrameView(FrameView*);
100
101 struct ScrollParameters {
102 ScrollElasticity horizontalScrollElasticity;
103 ScrollElasticity verticalScrollElasticity;
104
105 bool hasEnabledHorizontalScrollbar;
106 bool hasEnabledVerticalScrollbar;
107
108 ScrollbarMode horizontalScrollbarMode;
109 ScrollbarMode verticalScrollbarMode;
110
111 IntPoint scrollOrigin;
112
113 IntRect viewportRect;
114 IntSize totalContentsSize;
115
116 float frameScaleFactor;
117
118 int headerHeight;
119 int footerHeight;
120 };
121
122 void setScrollParametersForNode(const ScrollParameters&, ScrollingStateScrol lingNode*);
123 void setScrollLayerForNode(GraphicsLayer*, ScrollingStateNode*);
124 void setCounterScrollingLayerForNode(GraphicsLayer*, ScrollingStateScrolling Node*);
125 void setNonFastScrollableRegionForNode(const Region&, ScrollingStateScrollin gNode*);
126 void setWheelEventHandlerCountForNode(unsigned, ScrollingStateScrollingNode* );
127
128 void updateMainFrameScrollLayerPosition();
129
130 void scheduleTreeStateCommit();
131
132 void scrollingStateTreeCommitterTimerFired(Timer<ScrollingCoordinatorMac>*);
133 void commitTreeState();
134
135 OwnPtr<ScrollingStateTree> m_scrollingStateTree;
136 RefPtr<ScrollingTree> m_scrollingTree;
137 Timer<ScrollingCoordinatorMac> m_scrollingStateTreeCommitterTimer;
138 };
139
140 } // namespace WebCore
141
142 #endif // ENABLE(THREADED_SCROLLING)
143
144 #endif // ScrollingCoordinatorMac_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698