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

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: Rebase Created 5 years, 9 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/PinchViewport.h ('k') | Source/core/frame/SmartClip.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/frame/PinchViewport.cpp
diff --git a/Source/core/frame/PinchViewport.cpp b/Source/core/frame/PinchViewport.cpp
index b4923e0252129d413f53d9325cb02f8271e64813..07ebc3877c1e595e803d88251e9559a57f759edc 100644
--- a/Source/core/frame/PinchViewport.cpp
+++ b/Source/core/frame/PinchViewport.cpp
@@ -164,6 +164,14 @@ FloatRect PinchViewport::mainViewToViewportCSSPixels(const FloatRect& rect) cons
return rectInViewport;
}
+FloatPoint PinchViewport::viewportCSSPixelsToRootFrame(const FloatPoint& point) const
+{
+ // Note, this is in CSS Pixels so we don't apply scale.
+ FloatPoint pointInRootFrame = point;
+ pointInRootFrame.moveBy(location());
+ return pointInRootFrame;
+}
+
void PinchViewport::scrollIntoView(const LayoutRect& rect)
{
if (!mainFrame() || !mainFrame()->view())
@@ -616,6 +624,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?
+ 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;
« no previous file with comments | « Source/core/frame/PinchViewport.h ('k') | Source/core/frame/SmartClip.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698