| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 /** |
| 6 * @fileoverview APIs used for the scroll workaround. See crbug.com/554257. |
| 7 */ |
| 8 |
| 9 goog.provide('__crWeb.scrollWorkaround'); |
| 10 |
| 11 /** Beginning of anonymous object */ |
| 12 (function() { |
| 13 |
| 14 /** @private */ |
| 15 var webViewScrollViewIsDragging_ = false; |
| 16 |
| 17 /** |
| 18 * Tracks whether user is in the middle of scrolling/dragging. If user is |
| 19 * scrolling, ignore window.scrollTo() until user stops scrolling. |
| 20 */ |
| 21 __gCrWeb['setWebViewScrollViewIsDragging'] = function(state) { |
| 22 webViewScrollViewIsDragging_ = state; |
| 23 }; |
| 24 |
| 25 /** @private */ |
| 26 var originalWindowScrollTo_ = window.scrollTo; |
| 27 |
| 28 /** |
| 29 * Wraps the original window.scrollTo() to suppress it as long as |
| 30 * webViewScrollViewIsDragging is true. |
| 31 */ |
| 32 window.scrollTo = function(x, y) { |
| 33 if (webViewScrollViewIsDragging_) |
| 34 return; |
| 35 originalWindowScrollTo_(x, y); |
| 36 }; |
| 37 |
| 38 }()) // End of anonymouse object |
| OLD | NEW |