OLD | NEW |
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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 return m_innerViewportContainerLayer.get(); | 76 return m_innerViewportContainerLayer.get(); |
77 } | 77 } |
78 | 78 |
79 // Sets the location of the inner viewport relative to the outer viewport. T
he | 79 // Sets the location of the inner viewport relative to the outer viewport. T
he |
80 // coordinates are in partial CSS pixels. | 80 // coordinates are in partial CSS pixels. |
81 void setLocation(const FloatPoint&); | 81 void setLocation(const FloatPoint&); |
82 void move(const FloatPoint&); | 82 void move(const FloatPoint&); |
83 FloatPoint location() const { return m_offset; } | 83 FloatPoint location() const { return m_offset; } |
84 | 84 |
85 // Sets the size of the inner viewport when unscaled in CSS pixels. | 85 // Sets the size of the inner viewport when unscaled in CSS pixels. |
| 86 // This will be clamped to the size of the outer viewport (the main frame). |
86 void setSize(const IntSize&); | 87 void setSize(const IntSize&); |
87 IntSize size() const { return m_size; } | 88 IntSize size() const { return m_size; } |
88 | 89 |
89 // Resets the viewport to initial state. | 90 // Resets the viewport to initial state. |
90 void reset(); | 91 void reset(); |
91 | 92 |
92 // Let the viewport know that the main frame changed size (either through sc
reen | 93 // Let the viewport know that the main frame changed size (either through sc
reen |
93 // rotation on Android or window resize elsewhere). | 94 // rotation on Android or window resize elsewhere). |
94 void mainFrameDidChangeSize(); | 95 void mainFrameDidChangeSize(); |
95 | 96 |
(...skipping 14 matching lines...) Expand all Loading... |
110 | 111 |
111 // Scroll the main frame and pinch viewport so that the given rect in the | 112 // Scroll the main frame and pinch viewport so that the given rect in the |
112 // top-level document is centered in the viewport. This method will avoid | 113 // top-level document is centered in the viewport. This method will avoid |
113 // scrolling the pinch viewport unless necessary. | 114 // scrolling the pinch viewport unless necessary. |
114 void scrollIntoView(const FloatRect&); | 115 void scrollIntoView(const FloatRect&); |
115 | 116 |
116 // Clamp the given point, in document coordinates, to the maximum/minimum | 117 // Clamp the given point, in document coordinates, to the maximum/minimum |
117 // scroll extents of the viewport within the document. | 118 // scroll extents of the viewport within the document. |
118 IntPoint clampDocumentOffsetAtScale(const IntPoint& offset, float scale); | 119 IntPoint clampDocumentOffsetAtScale(const IntPoint& offset, float scale); |
119 | 120 |
120 // FIXME: This is kind of a hack. Ideally, we would just resize the | |
121 // viewports to account for top controls. However, FrameView includes much | |
122 // more than just scrolling so we can't simply resize it without incurring | |
123 // all sorts of side-effects. Until we can seperate out the scrollability | |
124 // aspect from FrameView, we use this method to let PinchViewport make the | |
125 // necessary adjustments so that we don't incorrectly clamp scroll offsets | |
126 // coming from the compositor. crbug.com/422328 | |
127 void setTopControlsAdjustment(float); | |
128 private: | 121 private: |
129 // ScrollableArea implementation | 122 // ScrollableArea implementation |
130 virtual bool isActive() const override { return false; } | 123 virtual bool isActive() const override { return false; } |
131 virtual int scrollSize(ScrollbarOrientation) const override; | 124 virtual int scrollSize(ScrollbarOrientation) const override; |
132 virtual bool isScrollCornerVisible() const override { return false; } | 125 virtual bool isScrollCornerVisible() const override { return false; } |
133 virtual IntRect scrollCornerRect() const override { return IntRect(); } | 126 virtual IntRect scrollCornerRect() const override { return IntRect(); } |
134 virtual IntPoint scrollPosition() const override { return flooredIntPoint(m_
offset); } | 127 virtual IntPoint scrollPosition() const override { return flooredIntPoint(m_
offset); } |
135 virtual IntPoint minimumScrollPosition() const override; | 128 virtual IntPoint minimumScrollPosition() const override; |
136 virtual IntPoint maximumScrollPosition() const override; | 129 virtual IntPoint maximumScrollPosition() const override; |
137 virtual int visibleHeight() const override { return visibleRect().height();
}; | 130 virtual int visibleHeight() const override { return visibleRect().height();
}; |
(...skipping 29 matching lines...) Expand all Loading... |
167 OwnPtr<GraphicsLayer> m_innerViewportScrollLayer; | 160 OwnPtr<GraphicsLayer> m_innerViewportScrollLayer; |
168 OwnPtr<GraphicsLayer> m_overlayScrollbarHorizontal; | 161 OwnPtr<GraphicsLayer> m_overlayScrollbarHorizontal; |
169 OwnPtr<GraphicsLayer> m_overlayScrollbarVertical; | 162 OwnPtr<GraphicsLayer> m_overlayScrollbarVertical; |
170 OwnPtr<blink::WebScrollbarLayer> m_webOverlayScrollbarHorizontal; | 163 OwnPtr<blink::WebScrollbarLayer> m_webOverlayScrollbarHorizontal; |
171 OwnPtr<blink::WebScrollbarLayer> m_webOverlayScrollbarVertical; | 164 OwnPtr<blink::WebScrollbarLayer> m_webOverlayScrollbarVertical; |
172 | 165 |
173 // Offset of the pinch viewport from the main frame's origin, in CSS pixels. | 166 // Offset of the pinch viewport from the main frame's origin, in CSS pixels. |
174 FloatPoint m_offset; | 167 FloatPoint m_offset; |
175 float m_scale; | 168 float m_scale; |
176 IntSize m_size; | 169 IntSize m_size; |
177 float m_topControlsAdjustment; | |
178 }; | 170 }; |
179 | 171 |
180 } // namespace blink | 172 } // namespace blink |
181 | 173 |
182 #endif // PinchViewport_h | 174 #endif // PinchViewport_h |
OLD | NEW |