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

Side by Side Diff: Source/web/RotationViewportAnchor.h

Issue 1003323004: Turn ViewportAnchors into stack allocated objects. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « Source/web/ResizeViewportAnchor.cpp ('k') | Source/web/RotationViewportAnchor.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 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 RotationViewportAnchor_h 5 #ifndef RotationViewportAnchor_h
6 #define RotationViewportAnchor_h 6 #define RotationViewportAnchor_h
7 7
8 #include "platform/geometry/FloatSize.h" 8 #include "platform/geometry/FloatSize.h"
9 #include "platform/geometry/IntPoint.h" 9 #include "platform/geometry/IntPoint.h"
10 #include "platform/geometry/IntRect.h" 10 #include "platform/geometry/IntRect.h"
11 #include "platform/geometry/LayoutRect.h" 11 #include "platform/geometry/LayoutRect.h"
12 #include "platform/heap/Handle.h" 12 #include "platform/heap/Handle.h"
13 #include "web/ViewportAnchor.h" 13 #include "web/ViewportAnchor.h"
14 #include "wtf/RefCounted.h"
15 14
16 namespace blink { 15 namespace blink {
17 16
18 class FrameView; 17 class FrameView;
19 class Node; 18 class Node;
20 class PageScaleConstraintsSet; 19 class PageScaleConstraintsSet;
21 class PinchViewport; 20 class PinchViewport;
22 21
23 // The rotation anchor provides a way to anchor a viewport origin to a DOM node. 22 // The rotation anchor provides a way to anchor a viewport origin to a DOM node.
24 // In particular, the user supplies an anchor point (in view coordinates, e.g., 23 // In particular, the user supplies an anchor point (in view coordinates, e.g.,
25 // (0, 0) == viewport origin, (0.5, 0) == viewport top center). The anchor point 24 // (0, 0) == viewport origin, (0.5, 0) == viewport top center). The anchor point
26 // tracks the underlying DOM node; as the node moves or the view is resized, the 25 // tracks the underlying DOM node; as the node moves or the view is resized, the
27 // viewport anchor maintains its orientation relative to the node, and the 26 // viewport anchor maintains its orientation relative to the node, and the
28 // viewport origin maintains its orientation relative to the anchor. If there is 27 // viewport origin maintains its orientation relative to the anchor. If there is
29 // no node or it is lost during the resize, we fall back to the resize anchor 28 // no node or it is lost during the resize, we fall back to the resize anchor
30 // logic. 29 // logic.
31 class RotationViewportAnchor : public ViewportAnchor { 30 class RotationViewportAnchor : public ViewportAnchor {
31 STACK_ALLOCATED();
32 public: 32 public:
33 RotationViewportAnchor( 33 RotationViewportAnchor(FrameView& rootFrameView, PinchViewport&, const Float Size& anchorInInnerViewCoords, PageScaleConstraintsSet&);
34 FrameView& rootFrameView, 34 ~RotationViewportAnchor();
35 PinchViewport&,
36 const FloatSize& anchorInInnerViewCoords,
37 PageScaleConstraintsSet&);
38 virtual ~RotationViewportAnchor() { }
39
40 virtual void setAnchor();
41 virtual void restoreToAnchor();
42 35
43 private: 36 private:
37 void setAnchor();
38 void restoreToAnchor();
39
44 FloatPoint getInnerOrigin(const FloatSize& innerSize) const; 40 FloatPoint getInnerOrigin(const FloatSize& innerSize) const;
45 41
46 void computeOrigins(const FloatSize& innerSize, 42 void computeOrigins(const FloatSize& innerSize, IntPoint& mainFrameOffset, F loatPoint& pinchViewportOffset) const;
47 IntPoint& mainFrameOffset, FloatPoint& pinchViewportOffset) const;
48 43
49 float m_oldPageScaleFactor; 44 float m_oldPageScaleFactor;
50 float m_oldMinimumPageScaleFactor; 45 float m_oldMinimumPageScaleFactor;
51 46
52 // Inner viewport origin in the reference frame of the document in CSS pixel s 47 // Inner viewport origin in the reference frame of the document in CSS pixel s
53 FloatPoint m_pinchViewportInDocument; 48 FloatPoint m_pinchViewportInDocument;
54 49
55 // Inner viewport origin in the reference frame of the outer viewport 50 // Inner viewport origin in the reference frame of the outer viewport
56 // normalized to the outer viewport size. 51 // normalized to the outer viewport size.
57 FloatSize m_normalizedPinchViewportOffset; 52 FloatSize m_normalizedPinchViewportOffset;
58 53
59 RefPtrWillBePersistent<Node> m_anchorNode; 54 RefPtrWillBeMember<Node> m_anchorNode;
60 LayoutRect m_anchorNodeBounds; 55 LayoutRect m_anchorNodeBounds;
61 56
62 FloatSize m_anchorInInnerViewCoords; 57 FloatSize m_anchorInInnerViewCoords;
63 FloatSize m_anchorInNodeCoords; 58 FloatSize m_anchorInNodeCoords;
64 59
65 PageScaleConstraintsSet& m_pageScaleConstraintsSet; 60 PageScaleConstraintsSet& m_pageScaleConstraintsSet;
66 }; 61 };
67 62
68 } // namespace blink 63 } // namespace blink
69 64
70 #endif 65 #endif // RotationViewportAnchor_h
OLDNEW
« no previous file with comments | « Source/web/ResizeViewportAnchor.cpp ('k') | Source/web/RotationViewportAnchor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698