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

Side by Side Diff: Source/web/ResizeViewportAnchor.cpp

Issue 1003323004: Turn ViewportAnchors into stack allocated objects. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « Source/web/ResizeViewportAnchor.h ('k') | Source/web/RotationViewportAnchor.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "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
OLDNEW
« no previous file with comments | « Source/web/ResizeViewportAnchor.h ('k') | Source/web/RotationViewportAnchor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698