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

Side by Side Diff: third_party/WebKit/Source/core/page/scrolling/RootScrollerController.h

Issue 2289833002: Disable clipping on root scroller's ancestors. (Closed)
Patch Set: Undo changes to REF and moved comment Created 4 years, 3 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef RootScrollerController_h 5 #ifndef RootScrollerController_h
6 #define RootScrollerController_h 6 #define RootScrollerController_h
7 7
8 #include "core/CoreExport.h" 8 #include "core/CoreExport.h"
9 #include "platform/heap/Handle.h" 9 #include "platform/heap/Handle.h"
10 10
11 namespace blink { 11 namespace blink {
12 12
13 class Document; 13 class Document;
14 class Element; 14 class Element;
15 class GraphicsLayer; 15 class GraphicsLayer;
16 class PaintLayer;
16 class ScrollableArea; 17 class ScrollableArea;
17 class ScrollStateCallback; 18 class ScrollStateCallback;
18 19
19 // Manages the root scroller associated with a given document. The root 20 // Manages the root scroller associated with a given document. The root
20 // scroller causes top controls movement, overscroll effects and prevents 21 // scroller causes top controls movement, overscroll effects and prevents
21 // chaining scrolls up further in the DOM. It can be set from script using 22 // chaining scrolls up further in the DOM. It can be set from script using
22 // document.setRootScroller. 23 // document.setRootScroller.
23 // 24 //
24 // There are two notions of a root scroller in this class: m_rootScroller and 25 // There are two notions of a root scroller in this class: m_rootScroller and
25 // m_effectiveRootScroller. The former is the Element that was set as the root 26 // m_effectiveRootScroller. The former is the Element that was set as the root
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 // element. 83 // element.
83 virtual GraphicsLayer* rootScrollerLayer(); 84 virtual GraphicsLayer* rootScrollerLayer();
84 85
85 // Returns true if the given ScrollStateCallback is the 86 // Returns true if the given ScrollStateCallback is the
86 // ViewportScrollCallback managed by this class. 87 // ViewportScrollCallback managed by this class.
87 // TODO(bokan): Temporarily needed to allow ScrollCustomization to 88 // TODO(bokan): Temporarily needed to allow ScrollCustomization to
88 // differentiate between real custom callback and the built-in viewport 89 // differentiate between real custom callback and the built-in viewport
89 // apply scroll. crbug.com/623079. 90 // apply scroll. crbug.com/623079.
90 virtual bool isViewportScrollCallback(const ScrollStateCallback*) const; 91 virtual bool isViewportScrollCallback(const ScrollStateCallback*) const;
91 92
93 PaintLayer* rootScrollerPaintLayer() const;
94
92 protected: 95 protected:
93 RootScrollerController(Document&); 96 RootScrollerController(Document&);
94 97
95 // Called when the root scroller of any descendant frames changes. This 98 // Called when the root scroller of any descendant frames changes. This
96 // will only ever be called on the top document's RootScrollerController. 99 // will only ever be called on the top document's RootScrollerController.
97 virtual void globalRootScrollerMayHaveChanged(); 100 virtual void globalRootScrollerMayHaveChanged();
98 101
99 // Returns the ScrollableArea to use to scroll the given Element. 102 // Returns the ScrollableArea to use to scroll the given Element.
100 ScrollableArea* scrollableAreaFor(const Element&) const; 103 ScrollableArea* scrollableAreaFor(const Element&) const;
101 104
102 // The owning Document whose root scroller this object manages. 105 // The owning Document whose root scroller this object manages.
103 WeakMember<Document> m_document; 106 WeakMember<Document> m_document;
104 107
105 private: 108 private:
106 109
110 // Sets needsCompositingInputsUpdate on the given layer and all ancestors.
111 void setNeedsCompositingInputsUpdateOnAncestorChain(PaintLayer*);
112
107 // Ensures the effective root scroller is currently valid and replaces it 113 // Ensures the effective root scroller is currently valid and replaces it
108 // with the default if not. 114 // with the default if not.
109 void recomputeEffectiveRootScroller(); 115 void recomputeEffectiveRootScroller();
110 116
111 // Determines whether the given element meets the criteria to become the 117 // Determines whether the given element meets the criteria to become the
112 // effective root scroller. 118 // effective root scroller.
113 bool isValidRootScroller(const Element&) const; 119 bool isValidRootScroller(const Element&) const;
114 120
115 // Returns the Element that should be used if the currently set 121 // Returns the Element that should be used if the currently set
116 // m_rootScroller isn't valid to be a root scroller. 122 // m_rootScroller isn't valid to be a root scroller.
117 Element* defaultEffectiveRootScroller(); 123 Element* defaultEffectiveRootScroller();
118 124
119 // The Element that was set from script as rootScroller for this Document. 125 // The Element that was set from script as rootScroller for this Document.
120 // Depending on its validity to be the root scroller (e.g. a display: none 126 // Depending on its validity to be the root scroller (e.g. a display: none
121 // element isn't a valid root scroller), this may not actually be the 127 // element isn't a valid root scroller), this may not actually be the
122 // Element being used as the root scroller. 128 // Element being used as the root scroller.
123 WeakMember<Element> m_rootScroller; 129 WeakMember<Element> m_rootScroller;
124 130
125 // The element currently being used as the root scroller in this Document. 131 // The element currently being used as the root scroller in this Document.
126 // If the m_rootScroller is valid this will point to it. Otherwise, it'll 132 // If the m_rootScroller is valid this will point to it. Otherwise, it'll
127 // use a default Element. 133 // use a default Element.
128 WeakMember<Element> m_effectiveRootScroller; 134 WeakMember<Element> m_effectiveRootScroller;
129 }; 135 };
130 136
131 } // namespace blink 137 } // namespace blink
132 138
133 #endif // RootScrollerController_h 139 #endif // RootScrollerController_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698