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

Side by Side Diff: third_party/WebKit/Source/web/ResizeViewportAnchor.h

Issue 2837503002: Move (Resize|Rotation)ViewportAnchor.* from web/ to core/frame/. (Closed)
Patch Set: Created 3 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
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 ResizeViewportAnchor_h
6 #define ResizeViewportAnchor_h
7
8 #include "core/page/Page.h"
9 #include "platform/heap/Handle.h"
10 #include "platform/scroll/ScrollTypes.h"
11
12 namespace blink {
13
14 class FrameView;
15
16 // This class scrolls the viewports to compensate for bounds clamping caused by
17 // viewport size changes.
18 //
19 // It is needed when the layout viewport grows (causing its own scroll position
20 // to be clamped) and also when it shrinks (causing the visual viewport's scroll
21 // position to be clamped).
22 class ResizeViewportAnchor final
23 : public GarbageCollected<ResizeViewportAnchor> {
24 WTF_MAKE_NONCOPYABLE(ResizeViewportAnchor);
25
26 public:
27 ResizeViewportAnchor(Page& page) : page_(page), scope_count_(0) {}
28
29 class ResizeScope {
30 STACK_ALLOCATED();
31
32 public:
33 explicit ResizeScope(ResizeViewportAnchor& anchor) : anchor_(anchor) {
34 anchor_->BeginScope();
35 }
36 ~ResizeScope() { anchor_->EndScope(); }
37
38 private:
39 Member<ResizeViewportAnchor> anchor_;
40 };
41
42 void ResizeFrameView(IntSize);
43
44 DEFINE_INLINE_TRACE() { visitor->Trace(page_); }
45
46 private:
47 void BeginScope() { scope_count_++; }
48 void EndScope();
49 FrameView* RootFrameView();
50
51 // The amount of resize-induced clamping drift accumulated during the
52 // ResizeScope. Note that this should NOT include other kinds of scrolling
53 // that may occur during layout, such as from ScrollAnchor.
54 ScrollOffset drift_;
55 Member<Page> page_;
56 int scope_count_;
57 };
58
59 } // namespace blink
60
61 #endif // ResizeViewportAnchor_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/BUILD.gn ('k') | third_party/WebKit/Source/web/ResizeViewportAnchor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698