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

Unified Diff: cc/CCLayerTreeHostImpl.h

Issue 10916279: Chromium compositor change implementing page-scale driven pinch-zoom. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Rebaseline to 158365. Created 8 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 side-by-side diff with in-line comments
Download patch
Index: cc/CCLayerTreeHostImpl.h
===================================================================
--- cc/CCLayerTreeHostImpl.h (revision 158365)
+++ cc/CCLayerTreeHostImpl.h (working copy)
@@ -44,6 +44,34 @@
virtual void releaseContentsTexturesOnImplThread() = 0;
};
+// CCPinchZoomViewport models the bounds and offset of the viewport that is used during a pinch-zoom operation.
+// It tracks the layout-space dimensions of the viewport before any applied scale, and then tracks the layout-space
+// coordinates of the viewport respecting the pinch settings.
+class CCPinchZoomViewport {
+public:
+ CCPinchZoomViewport() : m_pageScaleFactor(1) { }
+
+ void setTotalPageScaleFactor(float factor) { m_pageScaleFactor = factor; }
+
+ // Returns the bounds and offset of the scaled and translated viewport to use for pinch-zoom.
+ FloatRect bounds() const;
+ const FloatPoint& scrollDelta() const { return m_pinchViewportScrollDelta; }
+
+ const FloatSize& unpinchedBounds() const { return m_unpinchedBounds; }
+ void setUnpinchedBounds(const FloatSize& bounds) { m_unpinchedBounds = bounds; }
+
+ // Apply the scroll offset in layout space to the offset of the pinch-zoom viewport. The viewport cannot be
+ // scrolled outside of the unpinched bounds. Returns the component of the scroll that is un-applied due to
+ // this constraint.
+ FloatSize applyScroll(FloatSize&);
+
+private:
+ float m_pageScaleFactor;
+ FloatPoint m_pinchViewportScrollDelta;
+
+ FloatSize m_unpinchedBounds;
+};
+
// CCLayerTreeHostImpl owns the CCLayerImpl tree as well as associated rendering state
class CCLayerTreeHostImpl : public CCInputHandlerClient,
public CCRendererClient,
@@ -152,10 +180,11 @@
float deviceScaleFactor() const { return m_deviceScaleFactor; }
void setDeviceScaleFactor(float);
- float pageScale() const { return m_pageScale; }
- void setPageScaleFactorAndLimits(float pageScale, float minPageScale, float maxPageScale);
+ float pageScaleFactor() const { return m_pageScaleFactor; }
+ void setPageScaleFactorAndLimits(float pageScaleFactor, float minPageScaleFactor, float maxPageScaleFactor);
PassOwnPtr<CCScrollAndScaleSet> processScrollDeltas();
+ WebKit::WebTransformationMatrix implTransform() const;
void startPageScaleAnimation(const IntSize& tragetPosition, bool useAnchor, float scale, double durationSec);
@@ -172,6 +201,8 @@
void renderingStats(CCRenderingStats&) const;
+ void updateRootScrollLayerImplTransform();
+
CCFrameRateCounter* fpsCounter() const { return m_fpsCounter.get(); }
CCDebugRectHistory* debugRectHistory() const { return m_debugRectHistory.get(); }
CCResourceProvider* resourceProvider() const { return m_resourceProvider.get(); }
@@ -267,10 +298,10 @@
bool m_contentsTexturesPurged;
size_t m_memoryAllocationLimitBytes;
- float m_pageScale;
+ float m_pageScaleFactor;
float m_pageScaleDelta;
float m_sentPageScaleDelta;
- float m_minPageScale, m_maxPageScale;
+ float m_minPageScaleFactor, m_maxPageScaleFactor;
SkColor m_backgroundColor;
bool m_hasTransparentBackground;
@@ -291,6 +322,8 @@
// rendering and input event hit testing.
CCLayerList m_renderSurfaceLayerList;
+ CCPinchZoomViewport m_pinchZoomViewport;
+
OwnPtr<CCFrameRateCounter> m_fpsCounter;
OwnPtr<CCDebugRectHistory> m_debugRectHistory;
};

Powered by Google App Engine
This is Rietveld 408576698