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

Side by Side Diff: third_party/WebKit/Source/core/frame/TopControls.h

Issue 2443613002: Rename classes related to top controls (Closed)
Patch Set: fix test Created 4 years, 1 month 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 2015 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 TopControls_h
6 #define TopControls_h
7
8 #include "core/CoreExport.h"
9 #include "platform/heap/Handle.h"
10 #include "public/platform/WebTopControlsState.h"
11
12 namespace blink {
13 class FrameHost;
14 class FloatSize;
15
16 // This class encapsulate data and logic required to show/hide top controls
17 // duplicating cc::TopControlsManager behaviour. Top controls' self-animation
18 // to completion is still handled by compositor and kicks in when scrolling is
19 // complete (i.e, upon ScrollEnd or FlingEnd).
20 class CORE_EXPORT TopControls final : public GarbageCollected<TopControls> {
21 public:
22 static TopControls* create(const FrameHost& host) {
23 return new TopControls(host);
24 }
25
26 DECLARE_TRACE();
27
28 // The amount that the viewport was shrunk by to accommodate the top
29 // controls.
30 float layoutHeight();
31 // The amount that top controls are currently shown.
32 float contentOffset();
33
34 float height() const { return m_height; }
35 bool shrinkViewport() const { return m_shrinkViewport; }
36 void setHeight(float height, bool shrinkViewport);
37
38 float shownRatio() const { return m_shownRatio; }
39 void setShownRatio(float);
40
41 void updateConstraintsAndState(WebTopControlsState constraints,
42 WebTopControlsState current,
43 bool animate);
44
45 void scrollBegin();
46
47 // Scrolls top controls vertically if possible and returns the remaining
48 // scroll amount.
49 FloatSize scrollBy(FloatSize scrollDelta);
50
51 private:
52 explicit TopControls(const FrameHost&);
53 void resetBaseline();
54
55 Member<const FrameHost> m_frameHost;
56
57 // The top controls height regardless of whether it is visible or not.
58 float m_height;
59
60 // The top controls shown amount (normalized from 0 to 1) since the last
61 // compositor commit. This value is updated from two sources:
62 // (1) compositor (impl) thread at the beginning of frame if it has
63 // scrolled top controls since last commit.
64 // (2) blink (main) thread updates this value if it scrolls top controls
65 // when responding to gesture scroll events.
66 // This value is reflected in web layer tree and is synced with compositor
67 // during the commit.
68 float m_shownRatio;
69
70 // Content offset when last re-baseline occurred.
71 float m_baselineContentOffset;
72
73 // Accumulated scroll delta since last re-baseline.
74 float m_accumulatedScrollDelta;
75
76 // If this is true, then the embedder shrunk the WebView size by the top
77 // controls height.
78 bool m_shrinkViewport;
79
80 // Constraints on the top controls state
81 WebTopControlsState m_permittedState;
82 };
83 } // namespace blink
84
85 #endif // TopControls_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/FrameView.cpp ('k') | third_party/WebKit/Source/core/frame/TopControls.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698