| 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/RotationViewportAnchor.h" | 6 #include "web/RotationViewportAnchor.h" |
| 7 | 7 |
| 8 #include "core/dom/ContainerNode.h" | 8 #include "core/dom/ContainerNode.h" |
| 9 #include "core/dom/Node.h" | 9 #include "core/dom/Node.h" |
| 10 #include "core/frame/FrameView.h" | 10 #include "core/frame/FrameView.h" |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 newPageScaleFactor = m_pageScaleConstraintsSet.finalConstraints().clampToCon
straints(newPageScaleFactor); | 153 newPageScaleFactor = m_pageScaleConstraintsSet.finalConstraints().clampToCon
straints(newPageScaleFactor); |
| 154 | 154 |
| 155 FloatSize pinchViewportSize = m_pinchViewport->size(); | 155 FloatSize pinchViewportSize = m_pinchViewport->size(); |
| 156 pinchViewportSize.scale(1 / newPageScaleFactor); | 156 pinchViewportSize.scale(1 / newPageScaleFactor); |
| 157 | 157 |
| 158 IntPoint mainFrameOrigin; | 158 IntPoint mainFrameOrigin; |
| 159 FloatPoint pinchViewportOrigin; | 159 FloatPoint pinchViewportOrigin; |
| 160 | 160 |
| 161 computeOrigins(pinchViewportSize, mainFrameOrigin, pinchViewportOrigin); | 161 computeOrigins(pinchViewportSize, mainFrameOrigin, pinchViewportOrigin); |
| 162 | 162 |
| 163 m_rootFrameView->setScrollOffset(mainFrameOrigin); | 163 m_rootFrameView->setScrollPosition(mainFrameOrigin, ProgrammaticScroll); |
| 164 | 164 |
| 165 // Set scale before location, since location can be clamped on setting scale
. | 165 // Set scale before location, since location can be clamped on setting scale
. |
| 166 m_pinchViewport->setScale(newPageScaleFactor); | 166 m_pinchViewport->setScale(newPageScaleFactor); |
| 167 m_pinchViewport->setLocation(pinchViewportOrigin); | 167 m_pinchViewport->setLocation(pinchViewportOrigin); |
| 168 } | 168 } |
| 169 | 169 |
| 170 void RotationViewportAnchor::computeOrigins(const FloatSize& innerSize, IntPoint
& mainFrameOffset, FloatPoint& pinchViewportOffset) const | 170 void RotationViewportAnchor::computeOrigins(const FloatSize& innerSize, IntPoint
& mainFrameOffset, FloatPoint& pinchViewportOffset) const |
| 171 { | 171 { |
| 172 IntSize outerSize = m_rootFrameView->visibleContentRect().size(); | 172 IntSize outerSize = m_rootFrameView->visibleContentRect().size(); |
| 173 | 173 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 anchorOffsetFromNode.scale(m_anchorInNodeCoords.width(), m_anchorInNodeCoord
s.height()); | 205 anchorOffsetFromNode.scale(m_anchorInNodeCoords.width(), m_anchorInNodeCoord
s.height()); |
| 206 FloatPoint anchorPoint = FloatPoint(currentNodeBounds.location()) + anchorOf
fsetFromNode; | 206 FloatPoint anchorPoint = FloatPoint(currentNodeBounds.location()) + anchorOf
fsetFromNode; |
| 207 | 207 |
| 208 // Compute the new origin point relative to the new anchor point | 208 // Compute the new origin point relative to the new anchor point |
| 209 FloatSize anchorOffsetFromOrigin = innerSize; | 209 FloatSize anchorOffsetFromOrigin = innerSize; |
| 210 anchorOffsetFromOrigin.scale(m_anchorInInnerViewCoords.width(), m_anchorInIn
nerViewCoords.height()); | 210 anchorOffsetFromOrigin.scale(m_anchorInInnerViewCoords.width(), m_anchorInIn
nerViewCoords.height()); |
| 211 return anchorPoint - anchorOffsetFromOrigin; | 211 return anchorPoint - anchorOffsetFromOrigin; |
| 212 } | 212 } |
| 213 | 213 |
| 214 } // namespace blink | 214 } // namespace blink |
| OLD | NEW |