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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 RotationViewportAnchor::~RotationViewportAnchor() | 94 RotationViewportAnchor::~RotationViewportAnchor() |
95 { | 95 { |
96 restoreToAnchor(); | 96 restoreToAnchor(); |
97 } | 97 } |
98 | 98 |
99 void RotationViewportAnchor::setAnchor() | 99 void RotationViewportAnchor::setAnchor() |
100 { | 100 { |
101 // FIXME: Scroll offsets are now fractional (DoublePoint and FloatPoint for
the FrameView and VisualViewport | 101 // FIXME: Scroll offsets are now fractional (DoublePoint and FloatPoint for
the FrameView and VisualViewport |
102 // respectively. This path should be rewritten without pixel snapping
. | 102 // respectively. This path should be rewritten without pixel snapping
. |
103 IntRect outerViewRect = m_rootFrameView->layoutViewportScrollableArea()->vis
ibleContentRect(IncludeScrollbars); | 103 IntRect outerViewRect = m_rootFrameView->layoutViewportScrollableArea()->vis
ibleContentRect(IncludeScrollbars); |
104 IntRect innerViewRect = enclosedIntRect(m_rootFrameView->scrollableArea()->v
isibleContentRectDouble()); | 104 IntRect innerViewRect = enclosedIntRect(m_rootFrameView->getScrollableArea()
->visibleContentRectDouble()); |
105 | 105 |
106 m_oldPageScaleFactor = m_visualViewport->scale(); | 106 m_oldPageScaleFactor = m_visualViewport->scale(); |
107 m_oldMinimumPageScaleFactor = m_pageScaleConstraintsSet.finalConstraints().m
inimumScale; | 107 m_oldMinimumPageScaleFactor = m_pageScaleConstraintsSet.finalConstraints().m
inimumScale; |
108 | 108 |
109 // Save the absolute location in case we won't find the anchor node, we'll f
all back to that. | 109 // Save the absolute location in case we won't find the anchor node, we'll f
all back to that. |
110 m_visualViewportInDocument = FloatPoint(m_rootFrameView->scrollableArea()->v
isibleContentRectDouble().location()); | 110 m_visualViewportInDocument = FloatPoint(m_rootFrameView->getScrollableArea()
->visibleContentRectDouble().location()); |
111 | 111 |
112 m_anchorNode.clear(); | 112 m_anchorNode.clear(); |
113 m_anchorNodeBounds = LayoutRect(); | 113 m_anchorNodeBounds = LayoutRect(); |
114 m_anchorInNodeCoords = FloatSize(); | 114 m_anchorInNodeCoords = FloatSize(); |
115 m_normalizedVisualViewportOffset = FloatSize(); | 115 m_normalizedVisualViewportOffset = FloatSize(); |
116 | 116 |
117 if (innerViewRect.isEmpty()) | 117 if (innerViewRect.isEmpty()) |
118 return; | 118 return; |
119 | 119 |
120 // Preserve origins at the absolute screen origin | 120 // Preserve origins at the absolute screen origin |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 anchorOffsetFromNode.scale(m_anchorInNodeCoords.width(), m_anchorInNodeCoord
s.height()); | 204 anchorOffsetFromNode.scale(m_anchorInNodeCoords.width(), m_anchorInNodeCoord
s.height()); |
205 FloatPoint anchorPoint = FloatPoint(currentNodeBounds.location()) + anchorOf
fsetFromNode; | 205 FloatPoint anchorPoint = FloatPoint(currentNodeBounds.location()) + anchorOf
fsetFromNode; |
206 | 206 |
207 // Compute the new origin point relative to the new anchor point | 207 // Compute the new origin point relative to the new anchor point |
208 FloatSize anchorOffsetFromOrigin = innerSize; | 208 FloatSize anchorOffsetFromOrigin = innerSize; |
209 anchorOffsetFromOrigin.scale(m_anchorInInnerViewCoords.width(), m_anchorInIn
nerViewCoords.height()); | 209 anchorOffsetFromOrigin.scale(m_anchorInInnerViewCoords.width(), m_anchorInIn
nerViewCoords.height()); |
210 return anchorPoint - anchorOffsetFromOrigin; | 210 return anchorPoint - anchorOffsetFromOrigin; |
211 } | 211 } |
212 | 212 |
213 } // namespace blink | 213 } // namespace blink |
OLD | NEW |