Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(53)

Side by Side Diff: Source/core/frame/PinchViewport.h

Issue 584833003: Made double-tap zoom work in pinch virtual viewport mode. (Blink-side) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: TODO->FIXME Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | Source/core/frame/PinchViewport.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 void setSize(const IntSize&); 87 void setSize(const IntSize&);
88 IntSize size() const { return m_size; } 88 IntSize size() const { return m_size; }
89 89
90 // Resets the viewport to initial state. 90 // Resets the viewport to initial state.
91 void reset(); 91 void reset();
92 92
93 // Let the viewport know that the main frame changed size (either through sc reen 93 // Let the viewport know that the main frame changed size (either through sc reen
94 // rotation on Android or window resize elsewhere). 94 // rotation on Android or window resize elsewhere).
95 void mainFrameDidChangeSize(); 95 void mainFrameDidChangeSize();
96 96
97 // Sets scale and location in one operation, preventing intermediate clampin g.
98 void setScaleAndLocation(float, const FloatPoint&);
esprehn 2014/09/23 00:53:12 add argument names.
bokan 2014/09/23 12:42:23 Done.
97 void setScale(float); 99 void setScale(float);
98 float scale() const { return m_scale; } 100 float scale() const { return m_scale; }
99 101
100 void registerLayersWithTreeView(blink::WebLayerTreeView*) const; 102 void registerLayersWithTreeView(blink::WebLayerTreeView*) const;
101 void clearLayersForTreeView(blink::WebLayerTreeView*) const; 103 void clearLayersForTreeView(blink::WebLayerTreeView*) const;
102 104
103 // The portion of the unzoomed frame visible in the inner "pinch" viewport, 105 // The portion of the unzoomed frame visible in the inner "pinch" viewport,
104 // in partial CSS pixels. Relative to the main frame. 106 // in partial CSS pixels. Relative to the main frame.
105 FloatRect visibleRect() const; 107 FloatRect visibleRect() const;
106 108
107 // The viewport rect relative to the document origin, in partial CSS pixels. 109 // The viewport rect relative to the document origin, in partial CSS pixels.
108 FloatRect visibleRectInDocument() const; 110 FloatRect visibleRectInDocument() const;
109 111
110 // Scroll the main frame and pinch viewport so that the given rect in the 112 // Scroll the main frame and pinch viewport so that the given rect in the
111 // 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
112 // scrolling the pinch viewport unless necessary. 114 // scrolling the pinch viewport unless necessary.
113 void scrollIntoView(const FloatRect&); 115 void scrollIntoView(const FloatRect&);
116
117 // Clamp the given point, in document coordinates, to the maximum/minimum
118 // scroll extents of the viewport within the document.
119 IntPoint clampDocumentOffsetAtScale(const IntPoint&, float);
esprehn 2014/09/23 00:53:12 ditto
bokan 2014/09/23 12:42:23 Done.
120
114 private: 121 private:
115 // ScrollableArea implementation 122 // ScrollableArea implementation
116 virtual bool isActive() const OVERRIDE { return false; } 123 virtual bool isActive() const OVERRIDE { return false; }
117 virtual int scrollSize(ScrollbarOrientation) const OVERRIDE; 124 virtual int scrollSize(ScrollbarOrientation) const OVERRIDE;
118 virtual bool isScrollCornerVisible() const OVERRIDE { return false; } 125 virtual bool isScrollCornerVisible() const OVERRIDE { return false; }
119 virtual IntRect scrollCornerRect() const OVERRIDE { return IntRect(); } 126 virtual IntRect scrollCornerRect() const OVERRIDE { return IntRect(); }
120 virtual IntPoint scrollPosition() const OVERRIDE { return flooredIntPoint(m_ offset); } 127 virtual IntPoint scrollPosition() const OVERRIDE { return flooredIntPoint(m_ offset); }
121 virtual IntPoint minimumScrollPosition() const OVERRIDE; 128 virtual IntPoint minimumScrollPosition() const OVERRIDE;
122 virtual IntPoint maximumScrollPosition() const OVERRIDE; 129 virtual IntPoint maximumScrollPosition() const OVERRIDE;
123 virtual int visibleHeight() const OVERRIDE { return visibleRect().height(); }; 130 virtual int visibleHeight() const OVERRIDE { return visibleRect().height(); };
(...skipping 11 matching lines...) Expand all
135 virtual GraphicsLayer* layerForHorizontalScrollbar() const OVERRIDE; 142 virtual GraphicsLayer* layerForHorizontalScrollbar() const OVERRIDE;
136 virtual GraphicsLayer* layerForVerticalScrollbar() const OVERRIDE; 143 virtual GraphicsLayer* layerForVerticalScrollbar() const OVERRIDE;
137 144
138 // GraphicsLayerClient implementation. 145 // GraphicsLayerClient implementation.
139 virtual void notifyAnimationStarted(const GraphicsLayer*, double monotonicTi me) OVERRIDE; 146 virtual void notifyAnimationStarted(const GraphicsLayer*, double monotonicTi me) OVERRIDE;
140 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;
141 virtual String debugName(const GraphicsLayer*) OVERRIDE; 148 virtual String debugName(const GraphicsLayer*) OVERRIDE;
142 149
143 void setupScrollbar(blink::WebScrollbar::Orientation); 150 void setupScrollbar(blink::WebScrollbar::Orientation);
144 FloatPoint clampOffsetToBoundaries(const FloatPoint&); 151 FloatPoint clampOffsetToBoundaries(const FloatPoint&);
152 void clampToBoundaries();
145 153
146 LocalFrame* mainFrame() const; 154 LocalFrame* mainFrame() const;
147 155
148 FrameHost& m_frameHost; 156 FrameHost& m_frameHost;
149 OwnPtr<GraphicsLayer> m_rootTransformLayer; 157 OwnPtr<GraphicsLayer> m_rootTransformLayer;
150 OwnPtr<GraphicsLayer> m_innerViewportContainerLayer; 158 OwnPtr<GraphicsLayer> m_innerViewportContainerLayer;
151 OwnPtr<GraphicsLayer> m_pageScaleLayer; 159 OwnPtr<GraphicsLayer> m_pageScaleLayer;
152 OwnPtr<GraphicsLayer> m_innerViewportScrollLayer; 160 OwnPtr<GraphicsLayer> m_innerViewportScrollLayer;
153 OwnPtr<GraphicsLayer> m_overlayScrollbarHorizontal; 161 OwnPtr<GraphicsLayer> m_overlayScrollbarHorizontal;
154 OwnPtr<GraphicsLayer> m_overlayScrollbarVertical; 162 OwnPtr<GraphicsLayer> m_overlayScrollbarVertical;
155 OwnPtr<blink::WebScrollbarLayer> m_webOverlayScrollbarHorizontal; 163 OwnPtr<blink::WebScrollbarLayer> m_webOverlayScrollbarHorizontal;
156 OwnPtr<blink::WebScrollbarLayer> m_webOverlayScrollbarVertical; 164 OwnPtr<blink::WebScrollbarLayer> m_webOverlayScrollbarVertical;
157 165
158 // 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.
159 FloatPoint m_offset; 167 FloatPoint m_offset;
160 float m_scale; 168 float m_scale;
161 IntSize m_size; 169 IntSize m_size;
162 }; 170 };
163 171
164 } // namespace blink 172 } // namespace blink
165 173
166 #endif // PinchViewport_h 174 #endif // PinchViewport_h
OLDNEW
« no previous file with comments | « no previous file | Source/core/frame/PinchViewport.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698