| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 } | 48 } |
| 49 | 49 |
| 50 namespace blink { | 50 namespace blink { |
| 51 | 51 |
| 52 class FrameHost; | 52 class FrameHost; |
| 53 class GraphicsContext; | 53 class GraphicsContext; |
| 54 class GraphicsLayer; | 54 class GraphicsLayer; |
| 55 class IntRect; | 55 class IntRect; |
| 56 class IntSize; | 56 class IntSize; |
| 57 class LocalFrame; | 57 class LocalFrame; |
| 58 class ScrollAndScaleEmulator; |
| 58 | 59 |
| 59 // Represents the visual viewport the user is currently seeing the page through.
This | 60 // Represents the visual viewport the user is currently seeing the page through.
This |
| 60 // class corresponds to the InnerViewport on the compositor. It is a ScrollableA
rea; it's | 61 // 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 | 62 // 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 | 63 // 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. | 64 // in the outer viewport and can pan within it. |
| 64 class CORE_EXPORT VisualViewport final | 65 class CORE_EXPORT VisualViewport final |
| 65 : public GarbageCollectedFinalized<VisualViewport> | 66 : public GarbageCollectedFinalized<VisualViewport> |
| 66 , public GraphicsLayerClient | 67 , public GraphicsLayerClient |
| 67 , public ScrollableArea { | 68 , public ScrollableArea { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 void initializeScrollbars(); | 102 void initializeScrollbars(); |
| 102 | 103 |
| 103 // Sets the location of the visual viewport relative to the outer viewport.
The | 104 // Sets the location of the visual viewport relative to the outer viewport.
The |
| 104 // coordinates are in partial CSS pixels. | 105 // coordinates are in partial CSS pixels. |
| 105 void setLocation(const FloatPoint&); | 106 void setLocation(const FloatPoint&); |
| 106 // FIXME: This should be called moveBy | 107 // FIXME: This should be called moveBy |
| 107 void move(const FloatPoint&); | 108 void move(const FloatPoint&); |
| 108 void move(const FloatSize&); | 109 void move(const FloatSize&); |
| 109 FloatPoint location() const { return m_offset; } | 110 FloatPoint location() const { return m_offset; } |
| 110 | 111 |
| 112 // Override the scroll location and scale with values from the emulator. Pas
sing |nullptr| clears override. |
| 113 void setScrollAndScaleEmulator(ScrollAndScaleEmulator*); |
| 114 |
| 111 // Sets the size of the inner viewport when unscaled in CSS pixels. | 115 // Sets the size of the inner viewport when unscaled in CSS pixels. |
| 112 void setSize(const IntSize&); | 116 void setSize(const IntSize&); |
| 113 IntSize size() const { return m_size; } | 117 IntSize size() const { return m_size; } |
| 114 | 118 |
| 115 // Gets the scaled size, i.e. the viewport in root view space. | 119 // Gets the scaled size, i.e. the viewport in root view space. |
| 116 FloatSize visibleSize() const; | 120 FloatSize visibleSize() const; |
| 117 | 121 |
| 118 // Resets the viewport to initial state. | 122 // Resets the viewport to initial state. |
| 119 void reset(); | 123 void reset(); |
| 120 | 124 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 bool shouldUseIntegerScrollOffset() const override; | 186 bool shouldUseIntegerScrollOffset() const override; |
| 183 void setScrollPosition(const DoublePoint&, ScrollType, ScrollBehavior = Scro
llBehaviorInstant) override; | 187 void setScrollPosition(const DoublePoint&, ScrollType, ScrollBehavior = Scro
llBehaviorInstant) override; |
| 184 LayoutRect visualRectForScrollbarParts() const override { ASSERT_NOT_REACHED
(); return LayoutRect(); } | 188 LayoutRect visualRectForScrollbarParts() const override { ASSERT_NOT_REACHED
(); return LayoutRect(); } |
| 185 bool isActive() const override { return false; } | 189 bool isActive() const override { return false; } |
| 186 int scrollSize(ScrollbarOrientation) const override; | 190 int scrollSize(ScrollbarOrientation) const override; |
| 187 bool isScrollCornerVisible() const override { return false; } | 191 bool isScrollCornerVisible() const override { return false; } |
| 188 IntRect scrollCornerRect() const override { return IntRect(); } | 192 IntRect scrollCornerRect() const override { return IntRect(); } |
| 189 IntPoint scrollPosition() const override { return flooredIntPoint(m_offset);
} | 193 IntPoint scrollPosition() const override { return flooredIntPoint(m_offset);
} |
| 190 DoublePoint scrollPositionDouble() const override { return m_offset; } | 194 DoublePoint scrollPositionDouble() const override { return m_offset; } |
| 191 IntPoint minimumScrollPosition() const override; | 195 IntPoint minimumScrollPosition() const override; |
| 196 DoublePoint minimumScrollPositionDouble() const override; |
| 192 IntPoint maximumScrollPosition() const override; | 197 IntPoint maximumScrollPosition() const override; |
| 193 DoublePoint maximumScrollPositionDouble() const override; | 198 DoublePoint maximumScrollPositionDouble() const override; |
| 194 int visibleHeight() const override { return visibleRect().height(); } | 199 int visibleHeight() const override { return visibleRect().height(); } |
| 195 int visibleWidth() const override { return visibleRect().width(); } | 200 int visibleWidth() const override { return visibleRect().width(); } |
| 196 IntSize contentsSize() const override; | 201 IntSize contentsSize() const override; |
| 197 bool scrollbarsCanBeActive() const override { return false; } | 202 bool scrollbarsCanBeActive() const override { return false; } |
| 198 IntRect scrollableAreaBoundingBox() const override; | 203 IntRect scrollableAreaBoundingBox() const override; |
| 199 bool userInputScrollable(ScrollbarOrientation) const override { return true;
} | 204 bool userInputScrollable(ScrollbarOrientation) const override { return true;
} |
| 200 bool shouldPlaceVerticalScrollbarOnLeft() const override { return false; } | 205 bool shouldPlaceVerticalScrollbarOnLeft() const override { return false; } |
| 201 bool scrollAnimatorEnabled() const override; | 206 bool scrollAnimatorEnabled() const override; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 | 245 |
| 241 // GraphicsLayerClient implementation. | 246 // GraphicsLayerClient implementation. |
| 242 bool needsRepaint(const GraphicsLayer&) const { ASSERT_NOT_REACHED(); return
true; } | 247 bool needsRepaint(const GraphicsLayer&) const { ASSERT_NOT_REACHED(); return
true; } |
| 243 IntRect computeInterestRect(const GraphicsLayer*, const IntRect&) const; | 248 IntRect computeInterestRect(const GraphicsLayer*, const IntRect&) const; |
| 244 void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPain
tingPhase, const IntRect&) const override; | 249 void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPain
tingPhase, const IntRect&) const override; |
| 245 String debugName(const GraphicsLayer*) const override; | 250 String debugName(const GraphicsLayer*) const override; |
| 246 | 251 |
| 247 void setupScrollbar(WebScrollbar::Orientation); | 252 void setupScrollbar(WebScrollbar::Orientation); |
| 248 FloatPoint clampOffsetToBoundaries(const FloatPoint&); | 253 FloatPoint clampOffsetToBoundaries(const FloatPoint&); |
| 249 | 254 |
| 255 // Calculate the physical minimum/maximum scroll positions without any overr
ides applied. |
| 256 DoublePoint calculateMinimumScrollPositionDouble() const; |
| 257 DoublePoint calculateMaximumScrollPositionDouble() const; |
| 258 |
| 250 LocalFrame* mainFrame() const; | 259 LocalFrame* mainFrame() const; |
| 251 | 260 |
| 252 FrameHost& frameHost() const | 261 FrameHost& frameHost() const |
| 253 { | 262 { |
| 254 ASSERT(m_frameHost); | 263 ASSERT(m_frameHost); |
| 255 return *m_frameHost; | 264 return *m_frameHost; |
| 256 } | 265 } |
| 257 | 266 |
| 258 Member<FrameHost> m_frameHost; | 267 Member<FrameHost> m_frameHost; |
| 259 std::unique_ptr<GraphicsLayer> m_rootTransformLayer; | 268 std::unique_ptr<GraphicsLayer> m_rootTransformLayer; |
| 260 std::unique_ptr<GraphicsLayer> m_innerViewportContainerLayer; | 269 std::unique_ptr<GraphicsLayer> m_innerViewportContainerLayer; |
| 261 std::unique_ptr<GraphicsLayer> m_overscrollElasticityLayer; | 270 std::unique_ptr<GraphicsLayer> m_overscrollElasticityLayer; |
| 262 std::unique_ptr<GraphicsLayer> m_pageScaleLayer; | 271 std::unique_ptr<GraphicsLayer> m_pageScaleLayer; |
| 263 std::unique_ptr<GraphicsLayer> m_innerViewportScrollLayer; | 272 std::unique_ptr<GraphicsLayer> m_innerViewportScrollLayer; |
| 264 std::unique_ptr<GraphicsLayer> m_overlayScrollbarHorizontal; | 273 std::unique_ptr<GraphicsLayer> m_overlayScrollbarHorizontal; |
| 265 std::unique_ptr<GraphicsLayer> m_overlayScrollbarVertical; | 274 std::unique_ptr<GraphicsLayer> m_overlayScrollbarVertical; |
| 266 std::unique_ptr<WebScrollbarLayer> m_webOverlayScrollbarHorizontal; | 275 std::unique_ptr<WebScrollbarLayer> m_webOverlayScrollbarHorizontal; |
| 267 std::unique_ptr<WebScrollbarLayer> m_webOverlayScrollbarVertical; | 276 std::unique_ptr<WebScrollbarLayer> m_webOverlayScrollbarVertical; |
| 268 | 277 |
| 269 // Offset of the visual viewport from the main frame's origin, in CSS pixels
. | 278 // Offset of the visual viewport from the main frame's origin, in CSS pixels
. |
| 270 FloatPoint m_offset; | 279 FloatPoint m_offset; |
| 271 float m_scale; | 280 float m_scale; |
| 272 IntSize m_size; | 281 IntSize m_size; |
| 273 float m_topControlsAdjustment; | 282 float m_topControlsAdjustment; |
| 274 float m_maxPageScale; | 283 float m_maxPageScale; |
| 275 bool m_trackPinchZoomStatsForPage; | 284 bool m_trackPinchZoomStatsForPage; |
| 285 |
| 286 Member<ScrollAndScaleEmulator> m_scrollAndScaleEmulator; |
| 276 }; | 287 }; |
| 277 | 288 |
| 278 } // namespace blink | 289 } // namespace blink |
| 279 | 290 |
| 280 #endif // VisualViewport_h | 291 #endif // VisualViewport_h |
| OLD | NEW |