| 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). | |
| 87 void setSize(const IntSize&); | 86 void setSize(const IntSize&); |
| 88 IntSize size() const { return m_size; } | 87 IntSize size() const { return m_size; } |
| 89 | 88 |
| 90 // Resets the viewport to initial state. | 89 // Resets the viewport to initial state. |
| 91 void reset(); | 90 void reset(); |
| 92 | 91 |
| 93 // 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 |
| 94 // rotation on Android or window resize elsewhere). | 93 // rotation on Android or window resize elsewhere). |
| 95 void mainFrameDidChangeSize(); | 94 void mainFrameDidChangeSize(); |
| 96 | 95 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 111 | 110 |
| 112 // Scroll the main frame and pinch viewport so that the given rect in the | 111 // Scroll the main frame and pinch viewport so that the given rect in the |
| 113 // top-level document is centered in the viewport. This method will avoid | 112 // top-level document is centered in the viewport. This method will avoid |
| 114 // scrolling the pinch viewport unless necessary. | 113 // scrolling the pinch viewport unless necessary. |
| 115 void scrollIntoView(const FloatRect&); | 114 void scrollIntoView(const FloatRect&); |
| 116 | 115 |
| 117 // Clamp the given point, in document coordinates, to the maximum/minimum | 116 // Clamp the given point, in document coordinates, to the maximum/minimum |
| 118 // scroll extents of the viewport within the document. | 117 // scroll extents of the viewport within the document. |
| 119 IntPoint clampDocumentOffsetAtScale(const IntPoint& offset, float scale); | 118 IntPoint clampDocumentOffsetAtScale(const IntPoint& offset, float scale); |
| 120 | 119 |
| 120 // FIXME(bokan): 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. |
| 127 void setTopControlsAdjustment(float); |
| 121 private: | 128 private: |
| 122 // ScrollableArea implementation | 129 // ScrollableArea implementation |
| 123 virtual bool isActive() const override { return false; } | 130 virtual bool isActive() const override { return false; } |
| 124 virtual int scrollSize(ScrollbarOrientation) const override; | 131 virtual int scrollSize(ScrollbarOrientation) const override; |
| 125 virtual bool isScrollCornerVisible() const override { return false; } | 132 virtual bool isScrollCornerVisible() const override { return false; } |
| 126 virtual IntRect scrollCornerRect() const override { return IntRect(); } | 133 virtual IntRect scrollCornerRect() const override { return IntRect(); } |
| 127 virtual IntPoint scrollPosition() const override { return flooredIntPoint(m_
offset); } | 134 virtual IntPoint scrollPosition() const override { return flooredIntPoint(m_
offset); } |
| 128 virtual IntPoint minimumScrollPosition() const override; | 135 virtual IntPoint minimumScrollPosition() const override; |
| 129 virtual IntPoint maximumScrollPosition() const override; | 136 virtual IntPoint maximumScrollPosition() const override; |
| 130 virtual int visibleHeight() const override { return visibleRect().height();
}; | 137 virtual int visibleHeight() const override { return visibleRect().height();
}; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 160 OwnPtr<GraphicsLayer> m_innerViewportScrollLayer; | 167 OwnPtr<GraphicsLayer> m_innerViewportScrollLayer; |
| 161 OwnPtr<GraphicsLayer> m_overlayScrollbarHorizontal; | 168 OwnPtr<GraphicsLayer> m_overlayScrollbarHorizontal; |
| 162 OwnPtr<GraphicsLayer> m_overlayScrollbarVertical; | 169 OwnPtr<GraphicsLayer> m_overlayScrollbarVertical; |
| 163 OwnPtr<blink::WebScrollbarLayer> m_webOverlayScrollbarHorizontal; | 170 OwnPtr<blink::WebScrollbarLayer> m_webOverlayScrollbarHorizontal; |
| 164 OwnPtr<blink::WebScrollbarLayer> m_webOverlayScrollbarVertical; | 171 OwnPtr<blink::WebScrollbarLayer> m_webOverlayScrollbarVertical; |
| 165 | 172 |
| 166 // Offset of the pinch viewport from the main frame's origin, in CSS pixels. | 173 // Offset of the pinch viewport from the main frame's origin, in CSS pixels. |
| 167 FloatPoint m_offset; | 174 FloatPoint m_offset; |
| 168 float m_scale; | 175 float m_scale; |
| 169 IntSize m_size; | 176 IntSize m_size; |
| 177 float m_topControlsAdjustment; |
| 170 }; | 178 }; |
| 171 | 179 |
| 172 } // namespace blink | 180 } // namespace blink |
| 173 | 181 |
| 174 #endif // PinchViewport_h | 182 #endif // PinchViewport_h |
| OLD | NEW |