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

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: 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') | Source/web/WebViewImpl.cpp » ('J')
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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
OLDNEW
« no previous file with comments | « no previous file | Source/core/frame/PinchViewport.cpp » ('j') | Source/web/WebViewImpl.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698