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

Side by Side Diff: Source/core/frame/PinchViewport.cpp

Issue 1202763005: Scroll only visual viewport during OSX pinch gesture behind flag. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 6 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
« no previous file with comments | « no previous file | Source/core/frame/Settings.in » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 return false; 232 return false;
233 233
234 // Keep the center-of-pinch anchor in a stable position over the course 234 // Keep the center-of-pinch anchor in a stable position over the course
235 // of the magnify. 235 // of the magnify.
236 FloatPoint anchorAtOldScale = anchor.scaledBy(1.f / oldPageScale); 236 FloatPoint anchorAtOldScale = anchor.scaledBy(1.f / oldPageScale);
237 FloatPoint anchorAtNewScale = anchor.scaledBy(1.f / newPageScale); 237 FloatPoint anchorAtNewScale = anchor.scaledBy(1.f / newPageScale);
238 FloatSize anchorDelta = anchorAtOldScale - anchorAtNewScale; 238 FloatSize anchorDelta = anchorAtOldScale - anchorAtNewScale;
239 239
240 // First try to use the anchor's delta to scroll the FrameView. 240 // First try to use the anchor's delta to scroll the FrameView.
241 FloatSize anchorDeltaUnusedByScroll = anchorDelta; 241 FloatSize anchorDeltaUnusedByScroll = anchorDelta;
242 FrameView* view = mainFrame()->view(); 242
243 DoublePoint oldPosition = view->scrollPositionDouble(); 243 if (!frameHost().settings().invertViewportScrollOrder()) {
244 view->scrollBy(DoubleSize(anchorDelta.width(), anchorDelta.height()), UserSc roll); 244 FrameView* view = mainFrame()->view();
245 DoublePoint newPosition = view->scrollPositionDouble(); 245 DoublePoint oldPosition = view->scrollPositionDouble();
246 anchorDeltaUnusedByScroll = anchorDelta - toFloatSize(newPosition - oldPosit ion); 246 view->scrollBy(DoubleSize(anchorDelta.width(), anchorDelta.height()), Us erScroll);
247 DoublePoint newPosition = view->scrollPositionDouble();
248 anchorDeltaUnusedByScroll -= toFloatSize(newPosition - oldPosition);
249 }
247 250
248 // Manually bubble any remaining anchor delta up to the pinch viewport. 251 // Manually bubble any remaining anchor delta up to the pinch viewport.
249 FloatPoint newLocation(location() + anchorDeltaUnusedByScroll); 252 FloatPoint newLocation(location() + anchorDeltaUnusedByScroll);
250 setScaleAndLocation(newPageScale, newLocation); 253 setScaleAndLocation(newPageScale, newLocation);
251 return true; 254 return true;
252 } 255 }
253 256
254 // Modifies the top of the graphics layer tree to add layers needed to support 257 // Modifies the top of the graphics layer tree to add layers needed to support
255 // the inner/outer viewport fixed-position model for pinch zoom. When finished, 258 // the inner/outer viewport fixed-position model for pinch zoom. When finished,
256 // the tree will look like this (with * denoting added layers): 259 // the tree will look like this (with * denoting added layers):
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
650 } else if (graphicsLayer == m_rootTransformLayer) { 653 } else if (graphicsLayer == m_rootTransformLayer) {
651 name = "Root Transform Layer"; 654 name = "Root Transform Layer";
652 } else { 655 } else {
653 ASSERT_NOT_REACHED(); 656 ASSERT_NOT_REACHED();
654 } 657 }
655 658
656 return name; 659 return name;
657 } 660 }
658 661
659 } // namespace blink 662 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | Source/core/frame/Settings.in » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698