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 "web/RotationViewportAnchor.h" | 5 #include "web/RotationViewportAnchor.h" |
6 | 6 |
7 #include "core/dom/ContainerNode.h" | 7 #include "core/dom/ContainerNode.h" |
8 #include "core/dom/Node.h" | 8 #include "core/dom/Node.h" |
9 #include "core/frame/FrameView.h" | 9 #include "core/frame/FrameView.h" |
10 #include "core/frame/LocalFrame.h" | 10 #include "core/frame/LocalFrame.h" |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 | 107 |
108 IntRect outerViewRect = | 108 IntRect outerViewRect = |
109 layoutViewport().visibleContentRect(IncludeScrollbars); | 109 layoutViewport().visibleContentRect(IncludeScrollbars); |
110 IntRect innerViewRect = | 110 IntRect innerViewRect = |
111 enclosedIntRect(rootFrameViewport->visibleContentRectDouble()); | 111 enclosedIntRect(rootFrameViewport->visibleContentRectDouble()); |
112 | 112 |
113 m_oldPageScaleFactor = m_visualViewport->scale(); | 113 m_oldPageScaleFactor = m_visualViewport->scale(); |
114 m_oldMinimumPageScaleFactor = | 114 m_oldMinimumPageScaleFactor = |
115 m_pageScaleConstraintsSet.finalConstraints().minimumScale; | 115 m_pageScaleConstraintsSet.finalConstraints().minimumScale; |
116 | 116 |
117 // Save the absolute location in case we won't find the anchor node, we'll fal
l back to that. | 117 // Save the absolute location in case we won't find the anchor node, we'll |
| 118 // fall back to that. |
118 m_visualViewportInDocument = | 119 m_visualViewportInDocument = |
119 FloatPoint(rootFrameViewport->visibleContentRectDouble().location()); | 120 FloatPoint(rootFrameViewport->visibleContentRectDouble().location()); |
120 | 121 |
121 m_anchorNode.clear(); | 122 m_anchorNode.clear(); |
122 m_anchorNodeBounds = LayoutRect(); | 123 m_anchorNodeBounds = LayoutRect(); |
123 m_anchorInNodeCoords = FloatSize(); | 124 m_anchorInNodeCoords = FloatSize(); |
124 m_normalizedVisualViewportOffset = FloatSize(); | 125 m_normalizedVisualViewportOffset = FloatSize(); |
125 | 126 |
126 if (innerViewRect.isEmpty()) | 127 if (innerViewRect.isEmpty()) |
127 return; | 128 return; |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 anchorOffsetFromNode; | 247 anchorOffsetFromNode; |
247 | 248 |
248 // Compute the new origin point relative to the new anchor point | 249 // Compute the new origin point relative to the new anchor point |
249 FloatSize anchorOffsetFromOrigin = innerSize; | 250 FloatSize anchorOffsetFromOrigin = innerSize; |
250 anchorOffsetFromOrigin.scale(m_anchorInInnerViewCoords.width(), | 251 anchorOffsetFromOrigin.scale(m_anchorInInnerViewCoords.width(), |
251 m_anchorInInnerViewCoords.height()); | 252 m_anchorInInnerViewCoords.height()); |
252 return anchorPoint - anchorOffsetFromOrigin; | 253 return anchorPoint - anchorOffsetFromOrigin; |
253 } | 254 } |
254 | 255 |
255 } // namespace blink | 256 } // namespace blink |
OLD | NEW |