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

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

Issue 967213004: Removed FrameView's windowToContents and contentsToWindow methods. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 10 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: Source/core/frame/PinchViewport.cpp
diff --git a/Source/core/frame/PinchViewport.cpp b/Source/core/frame/PinchViewport.cpp
index 7e406ba1cb79539d04e7fa5f6be1b319d79f9196..a1e615cdfbd123ce7ea94721ebf75fc2e96906e8 100644
--- a/Source/core/frame/PinchViewport.cpp
+++ b/Source/core/frame/PinchViewport.cpp
@@ -592,6 +592,62 @@ void PinchViewport::clampToBoundaries()
setLocation(m_offset);
}
+FloatRect PinchViewport::viewportToRootFrame(const FloatRect& rectInViewport) const
+{
+ FloatRect rectInRootFrame = rectInViewport;
+ rectInRootFrame.scale(1 / scale());
+ rectInRootFrame.moveBy(location());
+ return rectInRootFrame;
+}
+
+IntRect PinchViewport::viewportToRootFrame(const IntRect& rectInViewport) const
+{
+ // FIXME: How to snap to pixels?
Rick Byers 2015/03/05 17:56:20 The only right answer here is probably to update a
bokan 2015/03/06 21:54:37 I'm of the opposite viewpoint. I think we should c
Rick Byers 2015/03/07 15:44:08 Interesting. You should have a chat with eae@ - h
+ return enclosingIntRect(viewportToRootFrame(FloatRect(rectInViewport)));
+}
+
+FloatRect PinchViewport::rootFrameToViewport(const FloatRect& rectInRootFrame) const
+{
+ FloatRect rectInViewport = rectInRootFrame;
+ rectInViewport.moveBy(-location());
+ rectInViewport.scale(scale());
+ return rectInViewport;
+}
+
+IntRect PinchViewport::rootFrameToViewport(const IntRect& rectInRootFrame) const
+{
+ // FIXME: How to snap to pixels?
+ return enclosingIntRect(rootFrameToViewport(FloatRect(rectInRootFrame)));
+}
+
+FloatPoint PinchViewport::viewportToRootFrame(const FloatPoint& pointInViewport) const
+{
+ FloatPoint pointInRootFrame = pointInViewport;
+ pointInRootFrame.scale(1 / scale(), 1 / scale());
+ pointInRootFrame.moveBy(location());
+ return pointInRootFrame;
+}
+
+FloatPoint PinchViewport::rootFrameToViewport(const FloatPoint& pointInRootFrame) const
+{
+ FloatPoint pointInViewport = pointInRootFrame;
+ pointInViewport.moveBy(-location());
+ pointInViewport.scale(scale(), scale());
+ return pointInViewport;
+}
+
+IntPoint PinchViewport::viewportToRootFrame(const IntPoint& pointInViewport) const
+{
+ // FIXME: How to snap to pixels?
+ return flooredIntPoint(FloatPoint(viewportToRootFrame(FloatPoint(pointInViewport))));
+}
+
+IntPoint PinchViewport::rootFrameToViewport(const IntPoint& pointInRootFrame) const
+{
+ // FIXME: How to snap to pixels?
+ return flooredIntPoint(FloatPoint(rootFrameToViewport(FloatPoint(pointInRootFrame))));
+}
+
String PinchViewport::debugName(const GraphicsLayer* graphicsLayer)
{
String name;

Powered by Google App Engine
This is Rietveld 408576698