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

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: Remove dependency on content_common from cc for access to kEnablePinchZoomInCompositor. 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 158825)
+++ cc/CCLayerTreeHostImpl.h (working copy)
@@ -44,6 +44,61 @@
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)
aelias_OOO_until_Jul13 2012/09/26 23:15:09 Move this constructor to the .cpp file.
Jeff Timanus 2012/10/01 21:42:36 Done.
+ , m_pageScaleDelta(1)
+ , m_sentPageScaleDelta(1)
+ , m_minPageScaleFactor(0)
aelias_OOO_until_Jul13 2012/09/26 23:15:09 Hmm, this default of zero is not very sane particu
Jeff Timanus 2012/10/01 21:42:36 I tried to make this change, but it introduced sub
+ , m_maxPageScaleFactor(0) { }
+
+ float totalPageScaleFactor() const;
+
+ void setPageScaleFactor(float factor) { m_pageScaleFactor = factor; }
+ float pageScaleFactor() const { return m_pageScaleFactor; }
+
+ void setPageScaleDelta(float delta);
+ float pageScaleDelta() const { return m_pageScaleDelta; }
+
+ float minPageScaleFactor() const { return m_minPageScaleFactor; }
+ float maxPageScaleFactor() const { return m_maxPageScaleFactor; }
+
+ void setSentPageScaleDelta(float delta) { m_sentPageScaleDelta = delta; }
+ float sentPageScaleDelta() const { return m_sentPageScaleDelta; }
+
+ // Returns true if the passed parameters were different from those previously
+ // cached.
+ bool setPageScaleFactorAndLimits(float pageScaleFactor,
+ float minPageScaleFactor,
+ float maxPageScaleFactor);
+
+ // 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;
+ float m_pageScaleDelta;
+ float m_sentPageScaleDelta;
+ float m_maxPageScaleFactor;
+ float m_minPageScaleFactor;
+
+ FloatPoint m_pinchViewportScrollDelta;
+ FloatSize m_unpinchedBounds;
aelias_OOO_until_Jul13 2012/09/26 23:15:09 Rename this to "m_unpinchedViewportSize" since it'
Jeff Timanus 2012/10/01 21:42:36 Done.
+};
+
// CCLayerTreeHostImpl owns the CCLayerImpl tree as well as associated rendering state
class CCLayerTreeHostImpl : public CCInputHandlerClient,
public CCRendererClient,
@@ -152,10 +207,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;
+ 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 +228,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,11 +325,6 @@
bool m_contentsTexturesPurged;
size_t m_memoryAllocationLimitBytes;
- float m_pageScale;
- float m_pageScaleDelta;
- float m_sentPageScaleDelta;
- float m_minPageScale, m_maxPageScale;
-
SkColor m_backgroundColor;
bool m_hasTransparentBackground;
@@ -291,6 +344,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