| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 #include "web/ResizeViewportAnchor.h" | 6 #include "web/ResizeViewportAnchor.h" |
| 7 | 7 |
| 8 #include "core/frame/FrameView.h" | 8 #include "core/frame/FrameView.h" |
| 9 #include "core/frame/PinchViewport.h" | 9 #include "core/frame/PinchViewport.h" |
| 10 #include "platform/geometry/DoublePoint.h" | 10 #include "platform/geometry/DoublePoint.h" |
| 11 #include "platform/geometry/DoubleSize.h" | 11 #include "platform/geometry/DoubleSize.h" |
| 12 #include "platform/geometry/FloatSize.h" | 12 #include "platform/geometry/FloatSize.h" |
| 13 | 13 |
| 14 namespace blink { | 14 namespace blink { |
| 15 | 15 |
| 16 ResizeViewportAnchor::ResizeViewportAnchor(FrameView& rootFrameView, PinchViewpo
rt& pinchViewport) | 16 ResizeViewportAnchor::ResizeViewportAnchor(FrameView& rootFrameView, PinchViewpo
rt& pinchViewport) |
| 17 : ViewportAnchor(rootFrameView, pinchViewport) { } | 17 : ViewportAnchor(rootFrameView, pinchViewport) |
| 18 | 18 , m_pinchViewportInDocument(m_pinchViewport->visibleRectInDocument().locatio
n()) |
| 19 | |
| 20 void ResizeViewportAnchor::setAnchor() | |
| 21 { | 19 { |
| 22 m_pinchViewportInDocument = m_pinchViewport.visibleRectInDocument().location
(); | |
| 23 } | 20 } |
| 24 | 21 |
| 25 void ResizeViewportAnchor::restoreToAnchor() | 22 ResizeViewportAnchor::~ResizeViewportAnchor() |
| 26 { | 23 { |
| 27 FloatSize delta = m_pinchViewportInDocument - m_pinchViewport.visibleRectInD
ocument().location(); | 24 FloatSize delta = m_pinchViewportInDocument - m_pinchViewport->visibleRectIn
Document().location(); |
| 28 | 25 |
| 29 DoublePoint targetFrameViewPosition = m_rootFrameView.scrollPositionDouble()
+ DoubleSize(delta); | 26 DoublePoint targetFrameViewPosition = m_rootFrameView->scrollPositionDouble(
) + DoubleSize(delta); |
| 30 m_rootFrameView.setScrollPosition(targetFrameViewPosition); | 27 m_rootFrameView->setScrollPosition(targetFrameViewPosition); |
| 31 | 28 |
| 32 DoubleSize remainder = targetFrameViewPosition - m_rootFrameView.scrollPosit
ionDouble(); | 29 DoubleSize remainder = targetFrameViewPosition - m_rootFrameView->scrollPosi
tionDouble(); |
| 33 m_pinchViewport.move(toFloatSize(remainder)); | 30 m_pinchViewport->move(toFloatSize(remainder)); |
| 34 } | 31 } |
| 35 | 32 |
| 36 } // namespace blink | 33 } // namespace blink |
| OLD | NEW |