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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 FloatRect visibleRect() const; | 126 FloatRect visibleRect() const; |
127 | 127 |
128 // The viewport rect relative to the document origin, in partial CSS pixels. | 128 // The viewport rect relative to the document origin, in partial CSS pixels. |
129 // FIXME: This should be a DoubleRect since scroll offsets are now doubles. | 129 // FIXME: This should be a DoubleRect since scroll offsets are now doubles. |
130 FloatRect visibleRectInDocument() const; | 130 FloatRect visibleRectInDocument() const; |
131 | 131 |
132 // Convert the given rect in the main FrameView's coordinates into a rect | 132 // Convert the given rect in the main FrameView's coordinates into a rect |
133 // in the viewport. The given and returned rects are in CSS pixels, meaning | 133 // in the viewport. The given and returned rects are in CSS pixels, meaning |
134 // scale isn't applied. | 134 // scale isn't applied. |
135 FloatRect mainViewToViewportCSSPixels(const FloatRect&) const; | 135 FloatRect mainViewToViewportCSSPixels(const FloatRect&) const; |
| 136 FloatPoint viewportCSSPixelsToRootFrame(const FloatPoint&) const; |
136 | 137 |
137 // Scroll the main frame and pinch viewport so that the given rect in the | 138 // Scroll the main frame and pinch viewport so that the given rect in the |
138 // top-level document is centered in the viewport. This method will avoid | 139 // top-level document is centered in the viewport. This method will avoid |
139 // scrolling the pinch viewport unless necessary. | 140 // scrolling the pinch viewport unless necessary. |
140 void scrollIntoView(const LayoutRect&); | 141 void scrollIntoView(const LayoutRect&); |
141 | 142 |
142 // Clamp the given point, in document coordinates, to the maximum/minimum | 143 // Clamp the given point, in document coordinates, to the maximum/minimum |
143 // scroll extents of the viewport within the document. | 144 // scroll extents of the viewport within the document. |
144 IntPoint clampDocumentOffsetAtScale(const IntPoint& offset, float scale); | 145 IntPoint clampDocumentOffsetAtScale(const IntPoint& offset, float scale); |
145 | 146 |
146 // FIXME: This is kind of a hack. Ideally, we would just resize the | 147 // FIXME: This is kind of a hack. Ideally, we would just resize the |
147 // viewports to account for top controls. However, FrameView includes much | 148 // viewports to account for top controls. However, FrameView includes much |
148 // more than just scrolling so we can't simply resize it without incurring | 149 // more than just scrolling so we can't simply resize it without incurring |
149 // all sorts of side-effects. Until we can seperate out the scrollability | 150 // all sorts of side-effects. Until we can seperate out the scrollability |
150 // aspect from FrameView, we use this method to let PinchViewport make the | 151 // aspect from FrameView, we use this method to let PinchViewport make the |
151 // necessary adjustments so that we don't incorrectly clamp scroll offsets | 152 // necessary adjustments so that we don't incorrectly clamp scroll offsets |
152 // coming from the compositor. crbug.com/422328 | 153 // coming from the compositor. crbug.com/422328 |
153 void setTopControlsAdjustment(float); | 154 void setTopControlsAdjustment(float); |
154 | 155 |
155 // Adjust the viewport's offset so that it remains bounded by the outer | 156 // Adjust the viewport's offset so that it remains bounded by the outer |
156 // viepwort. | 157 // viepwort. |
157 void clampToBoundaries(); | 158 void clampToBoundaries(); |
| 159 |
| 160 FloatRect viewportToRootFrame(const FloatRect&) const; |
| 161 IntRect viewportToRootFrame(const IntRect&) const; |
| 162 FloatRect rootFrameToViewport(const FloatRect&) const; |
| 163 IntRect rootFrameToViewport(const IntRect&) const; |
| 164 |
| 165 FloatPoint viewportToRootFrame(const FloatPoint&) const; |
| 166 FloatPoint rootFrameToViewport(const FloatPoint&) const; |
| 167 IntPoint viewportToRootFrame(const IntPoint&) const; |
| 168 IntPoint rootFrameToViewport(const IntPoint&) const; |
158 private: | 169 private: |
159 explicit PinchViewport(FrameHost&); | 170 explicit PinchViewport(FrameHost&); |
160 | 171 |
161 // ScrollableArea implementation | 172 // ScrollableArea implementation |
162 virtual bool shouldUseIntegerScrollOffset() const override; | 173 virtual bool shouldUseIntegerScrollOffset() const override; |
163 virtual bool isActive() const override { return false; } | 174 virtual bool isActive() const override { return false; } |
164 virtual int scrollSize(ScrollbarOrientation) const override; | 175 virtual int scrollSize(ScrollbarOrientation) const override; |
165 virtual bool isScrollCornerVisible() const override { return false; } | 176 virtual bool isScrollCornerVisible() const override { return false; } |
166 virtual IntRect scrollCornerRect() const override { return IntRect(); } | 177 virtual IntRect scrollCornerRect() const override { return IntRect(); } |
167 virtual IntPoint scrollPosition() const override { return flooredIntPoint(m_
offset); } | 178 virtual IntPoint scrollPosition() const override { return flooredIntPoint(m_
offset); } |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 // Offset of the pinch viewport from the main frame's origin, in CSS pixels. | 224 // Offset of the pinch viewport from the main frame's origin, in CSS pixels. |
214 FloatPoint m_offset; | 225 FloatPoint m_offset; |
215 float m_scale; | 226 float m_scale; |
216 IntSize m_size; | 227 IntSize m_size; |
217 float m_topControlsAdjustment; | 228 float m_topControlsAdjustment; |
218 }; | 229 }; |
219 | 230 |
220 } // namespace blink | 231 } // namespace blink |
221 | 232 |
222 #endif // PinchViewport_h | 233 #endif // PinchViewport_h |
OLD | NEW |