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

Side by Side Diff: third_party/WebKit/Source/core/frame/VisualViewport.cpp

Issue 1509783002: Revert of Remove invert viewport scroll order setting from Blink (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 /* 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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 246
247 // Keep the center-of-pinch anchor in a stable position over the course 247 // Keep the center-of-pinch anchor in a stable position over the course
248 // of the magnify. 248 // of the magnify.
249 FloatPoint anchorAtOldScale = anchor.scaledBy(1.f / oldPageScale); 249 FloatPoint anchorAtOldScale = anchor.scaledBy(1.f / oldPageScale);
250 FloatPoint anchorAtNewScale = anchor.scaledBy(1.f / newPageScale); 250 FloatPoint anchorAtNewScale = anchor.scaledBy(1.f / newPageScale);
251 FloatSize anchorDelta = anchorAtOldScale - anchorAtNewScale; 251 FloatSize anchorDelta = anchorAtOldScale - anchorAtNewScale;
252 252
253 // First try to use the anchor's delta to scroll the FrameView. 253 // First try to use the anchor's delta to scroll the FrameView.
254 FloatSize anchorDeltaUnusedByScroll = anchorDelta; 254 FloatSize anchorDeltaUnusedByScroll = anchorDelta;
255 255
256 if (!frameHost().settings().invertViewportScrollOrder()) {
257 FrameView* view = mainFrame()->view();
258 DoublePoint oldPosition = view->scrollPositionDouble();
259 view->scrollBy(DoubleSize(anchorDelta.width(), anchorDelta.height()), Us erScroll);
260 DoublePoint newPosition = view->scrollPositionDouble();
261 anchorDeltaUnusedByScroll -= toFloatSize(newPosition - oldPosition);
262 }
263
256 // Manually bubble any remaining anchor delta up to the visual viewport. 264 // Manually bubble any remaining anchor delta up to the visual viewport.
257 FloatPoint newLocation(location() + anchorDeltaUnusedByScroll); 265 FloatPoint newLocation(location() + anchorDeltaUnusedByScroll);
258 setScaleAndLocation(newPageScale, newLocation); 266 setScaleAndLocation(newPageScale, newLocation);
259 return true; 267 return true;
260 } 268 }
261 269
262 // Modifies the top of the graphics layer tree to add layers needed to support 270 // Modifies the top of the graphics layer tree to add layers needed to support
263 // the inner/outer viewport fixed-position model for pinch zoom. When finished, 271 // the inner/outer viewport fixed-position model for pinch zoom. When finished,
264 // the tree will look like this (with * denoting added layers): 272 // the tree will look like this (with * denoting added layers):
265 // 273 //
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
728 } else if (graphicsLayer == m_rootTransformLayer) { 736 } else if (graphicsLayer == m_rootTransformLayer) {
729 name = "Root Transform Layer"; 737 name = "Root Transform Layer";
730 } else { 738 } else {
731 ASSERT_NOT_REACHED(); 739 ASSERT_NOT_REACHED();
732 } 740 }
733 741
734 return name; 742 return name;
735 } 743 }
736 744
737 } // namespace blink 745 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/Settings.in ('k') | third_party/WebKit/Source/web/WebSettingsImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698