Index: third_party/WebKit/Source/core/page/scrolling/RootScroller.h |
diff --git a/third_party/WebKit/Source/core/page/scrolling/RootScroller.h b/third_party/WebKit/Source/core/page/scrolling/RootScroller.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..4897fc15230596cda5f0fdcf719c98632b2d92c6 |
--- /dev/null |
+++ b/third_party/WebKit/Source/core/page/scrolling/RootScroller.h |
@@ -0,0 +1,65 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef RootScroller_h |
+#define RootScroller_h |
+ |
+#include "core/CoreExport.h" |
+#include "platform/heap/Handle.h" |
+ |
+namespace blink { |
+ |
+class Element; |
+class FrameHost; |
+class ViewportScrollCallback; |
+ |
+// This class manages the root scroller associated with the top-level document. |
+// The root scroller is the one that causes top controls movement, overscroll |
tdresser
2016/04/26 20:43:50
"is the one that" -> ""
bokan
2016/04/26 23:06:23
Done.
|
+// effects and prevents chaining up further in the DOM. It can be set using |
+// document.setRootScroller. By default, the rootScroller is the |
+// documentElement. |
+// |
+// Not all elements ca be set as the root scroller. A valid element must be a |
tdresser
2016/04/26 20:43:50
can -> can
bokan
2016/04/26 23:06:23
Done.
|
+// in the top-level document, must have a LayoutObject that is at least a |
tdresser
2016/04/26 20:43:50
, must -> and must
bokan
2016/04/26 23:06:23
Done.
|
+// LayoutBlockFlow or LayoutIFrame. In addition, only the top-level document can |
+// set a non-default root scroller. |
+class CORE_EXPORT RootScroller : public GarbageCollected<RootScroller> { |
+public: |
+ static RootScroller* create(FrameHost& frameHost) |
+ { |
+ return new RootScroller(frameHost); |
+ } |
+ |
+ // This method returns true if the element was set as the root scroller. If |
+ // the element isn't eligable to be the root scroller or we're in some bad |
tdresser
2016/04/26 20:43:50
eligible
bokan
2016/04/26 23:06:23
Done.
|
+ // state, the method returns false without changing the current root |
+ // scroller. |
+ bool set(Element&); |
+ |
+ // Returns the element currently set as the root scroller. |
+ Element* getCurrent() const; |
tdresser
2016/04/26 20:43:50
The asymmetry between set and getCurrent is a bit
bokan
2016/04/26 23:06:23
Done.
|
+ |
+ // This class needs to be informed of changes in layout so that it can |
+ // determine if the current scroller is still valid or if it must be |
+ // replaced by the defualt root scroller. |
+ void didUpdateTopDocumentLayout(); |
+ |
+ DECLARE_TRACE(); |
+ |
+private: |
+ RootScroller(FrameHost&); |
+ |
+ bool isValid(Element&) const; |
+ void resetToDefault(); |
+ void createApplyScrollIfNeeded(); |
+ |
+ WeakMember<FrameHost> m_frameHost; |
+ Member<ViewportScrollCallback> m_viewportApplyScroll; |
+ |
+ WeakMember<Element> m_currentRootScroller; |
tdresser
2016/04/26 20:43:50
I'm not sure the "current" adds any useful informa
bokan
2016/04/26 23:06:23
Done.
|
+}; |
+ |
+} // namespace blink |
+ |
+#endif // RootScroller_h |