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

Side by Side Diff: Source/core/frame/PinchViewport.h

Issue 643473002: Made top controls work with virtual viewport pinch-to-zoom. (Blink) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed mac breakage (UseMockScrollbars) Created 6 years, 2 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
« no previous file with comments | « Source/core/frame/FrameView.cpp ('k') | Source/core/frame/PinchViewport.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 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 return m_innerViewportContainerLayer.get(); 80 return m_innerViewportContainerLayer.get();
81 } 81 }
82 82
83 // Sets the location of the inner viewport relative to the outer viewport. T he 83 // Sets the location of the inner viewport relative to the outer viewport. T he
84 // coordinates are in partial CSS pixels. 84 // coordinates are in partial CSS pixels.
85 void setLocation(const FloatPoint&); 85 void setLocation(const FloatPoint&);
86 void move(const FloatPoint&); 86 void move(const FloatPoint&);
87 FloatPoint location() const { return m_offset; } 87 FloatPoint location() const { return m_offset; }
88 88
89 // Sets the size of the inner viewport when unscaled in CSS pixels. 89 // Sets the size of the inner viewport when unscaled in CSS pixels.
90 // This will be clamped to the size of the outer viewport (the main frame).
91 void setSize(const IntSize&); 90 void setSize(const IntSize&);
92 IntSize size() const { return m_size; } 91 IntSize size() const { return m_size; }
93 92
94 // Resets the viewport to initial state. 93 // Resets the viewport to initial state.
95 void reset(); 94 void reset();
96 95
97 // Let the viewport know that the main frame changed size (either through sc reen 96 // Let the viewport know that the main frame changed size (either through sc reen
98 // rotation on Android or window resize elsewhere). 97 // rotation on Android or window resize elsewhere).
99 void mainFrameDidChangeSize(); 98 void mainFrameDidChangeSize();
100 99
(...skipping 14 matching lines...) Expand all
115 114
116 // Scroll the main frame and pinch viewport so that the given rect in the 115 // Scroll the main frame and pinch viewport so that the given rect in the
117 // top-level document is centered in the viewport. This method will avoid 116 // top-level document is centered in the viewport. This method will avoid
118 // scrolling the pinch viewport unless necessary. 117 // scrolling the pinch viewport unless necessary.
119 void scrollIntoView(const FloatRect&); 118 void scrollIntoView(const FloatRect&);
120 119
121 // Clamp the given point, in document coordinates, to the maximum/minimum 120 // Clamp the given point, in document coordinates, to the maximum/minimum
122 // scroll extents of the viewport within the document. 121 // scroll extents of the viewport within the document.
123 IntPoint clampDocumentOffsetAtScale(const IntPoint& offset, float scale); 122 IntPoint clampDocumentOffsetAtScale(const IntPoint& offset, float scale);
124 123
124 // FIXME: This is kind of a hack. Ideally, we would just resize the
125 // viewports to account for top controls. However, FrameView includes much
126 // more than just scrolling so we can't simply resize it without incurring
127 // all sorts of side-effects. Until we can seperate out the scrollability
128 // aspect from FrameView, we use this method to let PinchViewport make the
129 // necessary adjustments so that we don't incorrectly clamp scroll offsets
130 // coming from the compositor. crbug.com/422328
131 void setTopControlsAdjustment(float);
125 private: 132 private:
126 explicit PinchViewport(FrameHost&); 133 explicit PinchViewport(FrameHost&);
127 134
128 // ScrollableArea implementation 135 // ScrollableArea implementation
129 virtual bool isActive() const override { return false; } 136 virtual bool isActive() const override { return false; }
130 virtual int scrollSize(ScrollbarOrientation) const override; 137 virtual int scrollSize(ScrollbarOrientation) const override;
131 virtual bool isScrollCornerVisible() const override { return false; } 138 virtual bool isScrollCornerVisible() const override { return false; }
132 virtual IntRect scrollCornerRect() const override { return IntRect(); } 139 virtual IntRect scrollCornerRect() const override { return IntRect(); }
133 virtual IntPoint scrollPosition() const override { return flooredIntPoint(m_ offset); } 140 virtual IntPoint scrollPosition() const override { return flooredIntPoint(m_ offset); }
134 virtual IntPoint minimumScrollPosition() const override; 141 virtual IntPoint minimumScrollPosition() const override;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 OwnPtr<GraphicsLayer> m_innerViewportScrollLayer; 179 OwnPtr<GraphicsLayer> m_innerViewportScrollLayer;
173 OwnPtr<GraphicsLayer> m_overlayScrollbarHorizontal; 180 OwnPtr<GraphicsLayer> m_overlayScrollbarHorizontal;
174 OwnPtr<GraphicsLayer> m_overlayScrollbarVertical; 181 OwnPtr<GraphicsLayer> m_overlayScrollbarVertical;
175 OwnPtr<blink::WebScrollbarLayer> m_webOverlayScrollbarHorizontal; 182 OwnPtr<blink::WebScrollbarLayer> m_webOverlayScrollbarHorizontal;
176 OwnPtr<blink::WebScrollbarLayer> m_webOverlayScrollbarVertical; 183 OwnPtr<blink::WebScrollbarLayer> m_webOverlayScrollbarVertical;
177 184
178 // Offset of the pinch viewport from the main frame's origin, in CSS pixels. 185 // Offset of the pinch viewport from the main frame's origin, in CSS pixels.
179 FloatPoint m_offset; 186 FloatPoint m_offset;
180 float m_scale; 187 float m_scale;
181 IntSize m_size; 188 IntSize m_size;
189 float m_topControlsAdjustment;
182 }; 190 };
183 191
184 } // namespace blink 192 } // namespace blink
185 193
186 #endif // PinchViewport_h 194 #endif // PinchViewport_h
OLDNEW
« no previous file with comments | « Source/core/frame/FrameView.cpp ('k') | Source/core/frame/PinchViewport.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698