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

Unified Diff: Source/core/frame/PinchViewport.h

Issue 225303014: [Pinch-to-zoom] Moved scale factor into PinchViewport (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed layout test breakage Created 6 years, 8 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
« no previous file with comments | « Source/core/frame/FrameView.cpp ('k') | Source/core/frame/PinchViewport.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/frame/PinchViewport.h
diff --git a/Source/core/frame/PinchViewport.h b/Source/core/frame/PinchViewport.h
index 02bc0b8a7c47c59a36318991ae69342afbf0c56a..7f01c13407da09a7530d79dfb89a50768dd6af38 100644
--- a/Source/core/frame/PinchViewport.h
+++ b/Source/core/frame/PinchViewport.h
@@ -31,6 +31,8 @@
#ifndef PinchViewport_h
#define PinchViewport_h
+#include "platform/geometry/FloatPoint.h"
+#include "platform/geometry/FloatRect.h"
#include "platform/geometry/IntSize.h"
#include "platform/graphics/GraphicsLayerClient.h"
#include "platform/scroll/ScrollableArea.h"
@@ -52,7 +54,13 @@ class GraphicsLayer;
class GraphicsLayerFactory;
class IntRect;
class IntSize;
+class LocalFrame;
+// Represents the pinch-to-zoom viewport the user is currently seeing the page through. This
+// class corresponds to the InnerViewport on the compositor. It is a ScrollableArea; it's
+// offset is set through the GraphicsLayer <-> CC sync mechanisms. Its contents is the page's
+// main FrameView, which corresponds to the outer viewport. The inner viewport is always contained
+// in the outer viewport and can pan within it.
class PinchViewport FINAL : public GraphicsLayerClient, public ScrollableArea {
public:
PinchViewport(FrameHost&);
@@ -64,20 +72,24 @@ public:
return m_innerViewportContainerLayer.get();
}
- void setLocation(const IntPoint&);
- void setSize(const IntSize&);
+ void setLocation(const FloatPoint&);
+ void mainFrameDidChangeSize();
+
+ void setScale(float);
+ float scale() const { return m_scale; }
void registerLayersWithTreeView(blink::WebLayerTreeView*) const;
void clearLayersForTreeView(blink::WebLayerTreeView*) const;
- IntRect visibleRect() const { return m_visibleRect; }
+ // The portion of the unzoomed frame visible in the inner "pinch" viewport, in partial CSS pixels.
+ FloatRect visibleRect() const;
private:
// ScrollableArea implementation
virtual bool isActive() const OVERRIDE { return false; }
virtual int scrollSize(ScrollbarOrientation) const OVERRIDE;
virtual bool isScrollCornerVisible() const OVERRIDE { return false; }
virtual IntRect scrollCornerRect() const OVERRIDE { return IntRect(); }
- virtual IntPoint scrollPosition() const OVERRIDE { return visibleRect().location(); }
+ virtual IntPoint scrollPosition() const OVERRIDE { return flooredIntPoint(m_offset); }
virtual IntPoint minimumScrollPosition() const OVERRIDE;
virtual IntPoint maximumScrollPosition() const OVERRIDE;
virtual int visibleHeight() const OVERRIDE { return visibleRect().height(); };
@@ -101,6 +113,9 @@ private:
virtual String debugName(const GraphicsLayer*) OVERRIDE;
void setupScrollbar(blink::WebScrollbar::Orientation);
+ FloatPoint clampOffsetToBoundaries(const FloatPoint&);
+
+ LocalFrame* mainFrame() const;
FrameHost& m_frameHost;
OwnPtr<GraphicsLayer> m_innerViewportContainerLayer;
@@ -111,7 +126,9 @@ private:
OwnPtr<blink::WebScrollbarLayer> m_webOverlayScrollbarHorizontal;
OwnPtr<blink::WebScrollbarLayer> m_webOverlayScrollbarVertical;
- IntRect m_visibleRect;
+ // Offset of the pinch viewport from the main frame's origin, in CSS pixels.
+ FloatPoint m_offset;
+ float m_scale;
};
} // namespace WebCore
« no previous file with comments | « Source/core/frame/FrameView.cpp ('k') | Source/core/frame/PinchViewport.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698