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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 void setSize(const IntSize&); | 86 void setSize(const IntSize&); |
87 IntSize size() const { return m_size; } | 87 IntSize size() const { return m_size; } |
88 | 88 |
89 // Resets the viewport to initial state. | 89 // Resets the viewport to initial state. |
90 void reset(); | 90 void reset(); |
91 | 91 |
92 // Let the viewport know that the main frame changed size (either through sc
reen | 92 // Let the viewport know that the main frame changed size (either through sc
reen |
93 // rotation on Android or window resize elsewhere). | 93 // rotation on Android or window resize elsewhere). |
94 void mainFrameDidChangeSize(); | 94 void mainFrameDidChangeSize(); |
95 | 95 |
| 96 // Sets scale without ensuring the viewport is within its bounds. Useful for |
| 97 // situations when scale and offset are changing at the same time, e.g. duri
ng |
| 98 // a compositor commit. |
| 99 void setScaleWithoutClampingViewportOffset(float); |
96 void setScale(float); | 100 void setScale(float); |
97 float scale() const { return m_scale; } | 101 float scale() const { return m_scale; } |
98 | 102 |
99 void registerLayersWithTreeView(blink::WebLayerTreeView*) const; | 103 void registerLayersWithTreeView(blink::WebLayerTreeView*) const; |
100 void clearLayersForTreeView(blink::WebLayerTreeView*) const; | 104 void clearLayersForTreeView(blink::WebLayerTreeView*) const; |
101 | 105 |
102 // The portion of the unzoomed frame visible in the inner "pinch" viewport, | 106 // The portion of the unzoomed frame visible in the inner "pinch" viewport, |
103 // in partial CSS pixels. Relative to the main frame. | 107 // in partial CSS pixels. Relative to the main frame. |
104 FloatRect visibleRect() const; | 108 FloatRect visibleRect() const; |
105 | 109 |
106 // The viewport rect relative to the document origin, in partial CSS pixels. | 110 // The viewport rect relative to the document origin, in partial CSS pixels. |
107 FloatRect visibleRectInDocument() const; | 111 FloatRect visibleRectInDocument() const; |
108 | 112 |
109 // Scroll the main frame and pinch viewport so that the given rect in the | 113 // Scroll the main frame and pinch viewport so that the given rect in the |
110 // top-level document is centered in the viewport. This method will avoid | 114 // top-level document is centered in the viewport. This method will avoid |
111 // scrolling the pinch viewport unless necessary. | 115 // scrolling the pinch viewport unless necessary. |
112 void scrollIntoView(const FloatRect&); | 116 void scrollIntoView(const FloatRect&); |
| 117 |
| 118 // Clamp the given point, in document coordinates, to the maximum/minimum |
| 119 // scroll extents of the viewport within the document. |
| 120 IntPoint clampDocumentOffsetAtScale(const IntPoint&, float); |
| 121 |
113 private: | 122 private: |
114 // ScrollableArea implementation | 123 // ScrollableArea implementation |
115 virtual bool isActive() const OVERRIDE { return false; } | 124 virtual bool isActive() const OVERRIDE { return false; } |
116 virtual int scrollSize(ScrollbarOrientation) const OVERRIDE; | 125 virtual int scrollSize(ScrollbarOrientation) const OVERRIDE; |
117 virtual bool isScrollCornerVisible() const OVERRIDE { return false; } | 126 virtual bool isScrollCornerVisible() const OVERRIDE { return false; } |
118 virtual IntRect scrollCornerRect() const OVERRIDE { return IntRect(); } | 127 virtual IntRect scrollCornerRect() const OVERRIDE { return IntRect(); } |
119 virtual IntPoint scrollPosition() const OVERRIDE { return flooredIntPoint(m_
offset); } | 128 virtual IntPoint scrollPosition() const OVERRIDE { return flooredIntPoint(m_
offset); } |
120 virtual IntPoint minimumScrollPosition() const OVERRIDE; | 129 virtual IntPoint minimumScrollPosition() const OVERRIDE; |
121 virtual IntPoint maximumScrollPosition() const OVERRIDE; | 130 virtual IntPoint maximumScrollPosition() const OVERRIDE; |
122 virtual int visibleHeight() const OVERRIDE { return visibleRect().height();
}; | 131 virtual int visibleHeight() const OVERRIDE { return visibleRect().height();
}; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 | 165 |
157 // 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. |
158 FloatPoint m_offset; | 167 FloatPoint m_offset; |
159 float m_scale; | 168 float m_scale; |
160 IntSize m_size; | 169 IntSize m_size; |
161 }; | 170 }; |
162 | 171 |
163 } // namespace blink | 172 } // namespace blink |
164 | 173 |
165 #endif // PinchViewport_h | 174 #endif // PinchViewport_h |
OLD | NEW |