Chromium Code Reviews| 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; |