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

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

Issue 1913843004: Implementing document.setRootScroller API for main thread scrolling. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@overscrollController
Patch Set: Rebase and remove whitespace in Document.idl Created 4 years, 7 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef RootScroller_h
6 #define RootScroller_h
7
8 #include "core/CoreExport.h"
9 #include "platform/heap/Handle.h"
10
11 namespace blink {
12
13 class Element;
14 class FrameHost;
15 class ViewportScrollCallback;
16
17 // This class manages the root scroller associated with the top-level document.
18 // The root scroller causes top controls movement, overscroll effects and
19 // prevents chaining up further in the DOM. It can be set using
20 // document.setRootScroller. By default, the rootScroller is the
21 // documentElement.
22 //
23 // Not all elements can be set as the root scroller. A valid element must be
24 // in the top-level document and must have a LayoutObject that is at least a
25 // LayoutBlockFlow or LayoutIFrame. In addition, only the top-level document can
26 // set a non-default root scroller.
27 class CORE_EXPORT RootScroller : public GarbageCollected<RootScroller> {
28 public:
29 static RootScroller* create(FrameHost& frameHost)
30 {
31 return new RootScroller(frameHost);
32 }
33
34 // This method returns true if the element was set as the root scroller. If
35 // the element isn't eligible to be the root scroller or we're in some bad
36 // state, the method returns false without changing the current root
37 // scroller.
38 bool set(Element&);
39
40 // Returns the element currently set as the root scroller.
41 Element* get() const;
42
43 // This class needs to be informed of changes in layout so that it can
44 // determine if the current scroller is still valid or if it must be
45 // replaced by the defualt root scroller.
46 void didUpdateTopDocumentLayout();
47
48 DECLARE_TRACE();
49
50 private:
51 RootScroller(FrameHost&);
52
53 bool isValid(Element&) const;
54 void resetToDefault();
55 void createApplyScrollIfNeeded();
56
57 WeakMember<FrameHost> m_frameHost;
58 Member<ViewportScrollCallback> m_viewportApplyScroll;
59
60 WeakMember<Element> m_rootScroller;
61 };
62
63 } // namespace blink
64
65 #endif // RootScroller_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698