| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 class GraphicsLayerFactory; | 54 class GraphicsLayerFactory; |
| 55 class IntRect; | 55 class IntRect; |
| 56 class IntSize; | 56 class IntSize; |
| 57 class LocalFrame; | 57 class LocalFrame; |
| 58 | 58 |
| 59 // Represents the pinch-to-zoom viewport the user is currently seeing the page t
hrough. This | 59 // Represents the pinch-to-zoom viewport the user is currently seeing the page t
hrough. This |
| 60 // class corresponds to the InnerViewport on the compositor. It is a ScrollableA
rea; it's | 60 // class corresponds to the InnerViewport on the compositor. It is a ScrollableA
rea; it's |
| 61 // offset is set through the GraphicsLayer <-> CC sync mechanisms. Its contents
is the page's | 61 // offset is set through the GraphicsLayer <-> CC sync mechanisms. Its contents
is the page's |
| 62 // main FrameView, which corresponds to the outer viewport. The inner viewport i
s always contained | 62 // main FrameView, which corresponds to the outer viewport. The inner viewport i
s always contained |
| 63 // in the outer viewport and can pan within it. | 63 // in the outer viewport and can pan within it. |
| 64 class PinchViewport FINAL : public GraphicsLayerClient, public ScrollableArea { | 64 class PinchViewport final : public GraphicsLayerClient, public ScrollableArea { |
| 65 public: | 65 public: |
| 66 explicit PinchViewport(FrameHost&); | 66 explicit PinchViewport(FrameHost&); |
| 67 virtual ~PinchViewport(); | 67 virtual ~PinchViewport(); |
| 68 | 68 |
| 69 void attachToLayerTree(GraphicsLayer*, GraphicsLayerFactory*); | 69 void attachToLayerTree(GraphicsLayer*, GraphicsLayerFactory*); |
| 70 GraphicsLayer* rootGraphicsLayer() | 70 GraphicsLayer* rootGraphicsLayer() |
| 71 { | 71 { |
| 72 return m_rootTransformLayer.get(); | 72 return m_rootTransformLayer.get(); |
| 73 } | 73 } |
| 74 GraphicsLayer* containerLayer() | 74 GraphicsLayer* containerLayer() |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 // 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 |
| 114 // scrolling the pinch viewport unless necessary. | 114 // scrolling the pinch viewport unless necessary. |
| 115 void scrollIntoView(const FloatRect&); | 115 void scrollIntoView(const FloatRect&); |
| 116 | 116 |
| 117 // Clamp the given point, in document coordinates, to the maximum/minimum | 117 // Clamp the given point, in document coordinates, to the maximum/minimum |
| 118 // scroll extents of the viewport within the document. | 118 // scroll extents of the viewport within the document. |
| 119 IntPoint clampDocumentOffsetAtScale(const IntPoint& offset, float scale); | 119 IntPoint clampDocumentOffsetAtScale(const IntPoint& offset, float scale); |
| 120 | 120 |
| 121 private: | 121 private: |
| 122 // ScrollableArea implementation | 122 // ScrollableArea implementation |
| 123 virtual bool isActive() const OVERRIDE { return false; } | 123 virtual bool isActive() const override { return false; } |
| 124 virtual int scrollSize(ScrollbarOrientation) const OVERRIDE; | 124 virtual int scrollSize(ScrollbarOrientation) const override; |
| 125 virtual bool isScrollCornerVisible() const OVERRIDE { return false; } | 125 virtual bool isScrollCornerVisible() const override { return false; } |
| 126 virtual IntRect scrollCornerRect() const OVERRIDE { return IntRect(); } | 126 virtual IntRect scrollCornerRect() const override { return IntRect(); } |
| 127 virtual IntPoint scrollPosition() const OVERRIDE { return flooredIntPoint(m_
offset); } | 127 virtual IntPoint scrollPosition() const override { return flooredIntPoint(m_
offset); } |
| 128 virtual IntPoint minimumScrollPosition() const OVERRIDE; | 128 virtual IntPoint minimumScrollPosition() const override; |
| 129 virtual IntPoint maximumScrollPosition() const OVERRIDE; | 129 virtual IntPoint maximumScrollPosition() const override; |
| 130 virtual int visibleHeight() const OVERRIDE { return visibleRect().height();
}; | 130 virtual int visibleHeight() const override { return visibleRect().height();
}; |
| 131 virtual int visibleWidth() const OVERRIDE { return visibleRect().width(); }; | 131 virtual int visibleWidth() const override { return visibleRect().width(); }; |
| 132 virtual IntSize contentsSize() const OVERRIDE; | 132 virtual IntSize contentsSize() const override; |
| 133 virtual bool scrollbarsCanBeActive() const OVERRIDE { return false; } | 133 virtual bool scrollbarsCanBeActive() const override { return false; } |
| 134 virtual IntRect scrollableAreaBoundingBox() const OVERRIDE; | 134 virtual IntRect scrollableAreaBoundingBox() const override; |
| 135 virtual bool userInputScrollable(ScrollbarOrientation) const OVERRIDE { retu
rn true; } | 135 virtual bool userInputScrollable(ScrollbarOrientation) const override { retu
rn true; } |
| 136 virtual bool shouldPlaceVerticalScrollbarOnLeft() const OVERRIDE { return fa
lse; } | 136 virtual bool shouldPlaceVerticalScrollbarOnLeft() const override { return fa
lse; } |
| 137 virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&) OVERRIDE; | 137 virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&) override; |
| 138 virtual void invalidateScrollCornerRect(const IntRect&) OVERRIDE { } | 138 virtual void invalidateScrollCornerRect(const IntRect&) override { } |
| 139 virtual void setScrollOffset(const IntPoint&) OVERRIDE; | 139 virtual void setScrollOffset(const IntPoint&) override; |
| 140 virtual GraphicsLayer* layerForContainer() const OVERRIDE; | 140 virtual GraphicsLayer* layerForContainer() const override; |
| 141 virtual GraphicsLayer* layerForScrolling() const OVERRIDE; | 141 virtual GraphicsLayer* layerForScrolling() const override; |
| 142 virtual GraphicsLayer* layerForHorizontalScrollbar() const OVERRIDE; | 142 virtual GraphicsLayer* layerForHorizontalScrollbar() const override; |
| 143 virtual GraphicsLayer* layerForVerticalScrollbar() const OVERRIDE; | 143 virtual GraphicsLayer* layerForVerticalScrollbar() const override; |
| 144 | 144 |
| 145 // GraphicsLayerClient implementation. | 145 // GraphicsLayerClient implementation. |
| 146 virtual void notifyAnimationStarted(const GraphicsLayer*, double monotonicTi
me) OVERRIDE; | 146 virtual void notifyAnimationStarted(const GraphicsLayer*, double monotonicTi
me) override; |
| 147 virtual void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsL
ayerPaintingPhase, const IntRect& inClip) OVERRIDE; | 147 virtual void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsL
ayerPaintingPhase, const IntRect& inClip) override; |
| 148 virtual String debugName(const GraphicsLayer*) OVERRIDE; | 148 virtual String debugName(const GraphicsLayer*) override; |
| 149 | 149 |
| 150 void setupScrollbar(blink::WebScrollbar::Orientation); | 150 void setupScrollbar(blink::WebScrollbar::Orientation); |
| 151 FloatPoint clampOffsetToBoundaries(const FloatPoint&); | 151 FloatPoint clampOffsetToBoundaries(const FloatPoint&); |
| 152 void clampToBoundaries(); | 152 void clampToBoundaries(); |
| 153 | 153 |
| 154 LocalFrame* mainFrame() const; | 154 LocalFrame* mainFrame() const; |
| 155 | 155 |
| 156 FrameHost& m_frameHost; | 156 FrameHost& m_frameHost; |
| 157 OwnPtr<GraphicsLayer> m_rootTransformLayer; | 157 OwnPtr<GraphicsLayer> m_rootTransformLayer; |
| 158 OwnPtr<GraphicsLayer> m_innerViewportContainerLayer; | 158 OwnPtr<GraphicsLayer> m_innerViewportContainerLayer; |
| 159 OwnPtr<GraphicsLayer> m_pageScaleLayer; | 159 OwnPtr<GraphicsLayer> m_pageScaleLayer; |
| 160 OwnPtr<GraphicsLayer> m_innerViewportScrollLayer; | 160 OwnPtr<GraphicsLayer> m_innerViewportScrollLayer; |
| 161 OwnPtr<GraphicsLayer> m_overlayScrollbarHorizontal; | 161 OwnPtr<GraphicsLayer> m_overlayScrollbarHorizontal; |
| 162 OwnPtr<GraphicsLayer> m_overlayScrollbarVertical; | 162 OwnPtr<GraphicsLayer> m_overlayScrollbarVertical; |
| 163 OwnPtr<blink::WebScrollbarLayer> m_webOverlayScrollbarHorizontal; | 163 OwnPtr<blink::WebScrollbarLayer> m_webOverlayScrollbarHorizontal; |
| 164 OwnPtr<blink::WebScrollbarLayer> m_webOverlayScrollbarVertical; | 164 OwnPtr<blink::WebScrollbarLayer> m_webOverlayScrollbarVertical; |
| 165 | 165 |
| 166 // 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. |
| 167 FloatPoint m_offset; | 167 FloatPoint m_offset; |
| 168 float m_scale; | 168 float m_scale; |
| 169 IntSize m_size; | 169 IntSize m_size; |
| 170 }; | 170 }; |
| 171 | 171 |
| 172 } // namespace blink | 172 } // namespace blink |
| 173 | 173 |
| 174 #endif // PinchViewport_h | 174 #endif // PinchViewport_h |
| OLD | NEW |