Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(141)

Side by Side Diff: third_party/WebKit/Source/web/RotationViewportAnchor.cpp

Issue 2184333002: Fix scroll anchoring during viewport resize. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add comment on m_drift Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 inner.setLocation(innerOrigin); 77 inner.setLocation(innerOrigin);
78 } 78 }
79 79
80 } // namespace 80 } // namespace
81 81
82 RotationViewportAnchor::RotationViewportAnchor( 82 RotationViewportAnchor::RotationViewportAnchor(
83 FrameView& rootFrameView, 83 FrameView& rootFrameView,
84 VisualViewport& visualViewport, 84 VisualViewport& visualViewport,
85 const FloatSize& anchorInInnerViewCoords, 85 const FloatSize& anchorInInnerViewCoords,
86 PageScaleConstraintsSet& pageScaleConstraintsSet) 86 PageScaleConstraintsSet& pageScaleConstraintsSet)
87 : ViewportAnchor(rootFrameView, visualViewport) 87 : m_rootFrameView(&rootFrameView)
88 , m_visualViewport(&visualViewport)
88 , m_anchorInInnerViewCoords(anchorInInnerViewCoords) 89 , m_anchorInInnerViewCoords(anchorInInnerViewCoords)
89 , m_pageScaleConstraintsSet(pageScaleConstraintsSet) 90 , m_pageScaleConstraintsSet(pageScaleConstraintsSet)
90 { 91 {
91 setAnchor(); 92 setAnchor();
92 } 93 }
93 94
94 RotationViewportAnchor::~RotationViewportAnchor() 95 RotationViewportAnchor::~RotationViewportAnchor()
95 { 96 {
96 restoreToAnchor(); 97 restoreToAnchor();
97 } 98 }
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 anchorOffsetFromNode.scale(m_anchorInNodeCoords.width(), m_anchorInNodeCoord s.height()); 205 anchorOffsetFromNode.scale(m_anchorInNodeCoords.width(), m_anchorInNodeCoord s.height());
205 FloatPoint anchorPoint = FloatPoint(currentNodeBounds.location()) + anchorOf fsetFromNode; 206 FloatPoint anchorPoint = FloatPoint(currentNodeBounds.location()) + anchorOf fsetFromNode;
206 207
207 // Compute the new origin point relative to the new anchor point 208 // Compute the new origin point relative to the new anchor point
208 FloatSize anchorOffsetFromOrigin = innerSize; 209 FloatSize anchorOffsetFromOrigin = innerSize;
209 anchorOffsetFromOrigin.scale(m_anchorInInnerViewCoords.width(), m_anchorInIn nerViewCoords.height()); 210 anchorOffsetFromOrigin.scale(m_anchorInInnerViewCoords.width(), m_anchorInIn nerViewCoords.height());
210 return anchorPoint - anchorOffsetFromOrigin; 211 return anchorPoint - anchorOffsetFromOrigin;
211 } 212 }
212 213
213 } // namespace blink 214 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/RotationViewportAnchor.h ('k') | third_party/WebKit/Source/web/ViewportAnchor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698