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

Unified Diff: ios/web/web_state/js/resources/scroll_workaround.js

Issue 2807213003: Move stringify, form, navigation and scroll methods out of core.js. (Closed)
Patch Set: Re-upload patch after rebase-update in local branch Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ios/web/web_state/js/resources/navigation.js ('k') | ios/web/web_state/js/resources/web_bundle.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/web/web_state/js/resources/scroll_workaround.js
diff --git a/ios/web/web_state/js/resources/scroll_workaround.js b/ios/web/web_state/js/resources/scroll_workaround.js
new file mode 100644
index 0000000000000000000000000000000000000000..a4ef6d57e968dcb3f475552e9dfce4db508da571
--- /dev/null
+++ b/ios/web/web_state/js/resources/scroll_workaround.js
@@ -0,0 +1,38 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+/**
+ * @fileoverview APIs used for the scroll workaround. See crbug.com/554257.
+ */
+
+goog.provide('__crWeb.scrollWorkaround');
+
+/** Beginning of anonymous object */
+(function() {
+
+ /** @private */
+ var webViewScrollViewIsDragging_ = false;
+
+ /**
+ * Tracks whether user is in the middle of scrolling/dragging. If user is
+ * scrolling, ignore window.scrollTo() until user stops scrolling.
+ */
+ __gCrWeb['setWebViewScrollViewIsDragging'] = function(state) {
+ webViewScrollViewIsDragging_ = state;
+ };
+
+ /** @private */
+ var originalWindowScrollTo_ = window.scrollTo;
+
+ /**
+ * Wraps the original window.scrollTo() to suppress it as long as
+ * webViewScrollViewIsDragging is true.
+ */
+ window.scrollTo = function(x, y) {
+ if (webViewScrollViewIsDragging_)
+ return;
+ originalWindowScrollTo_(x, y);
+ };
+
+}()) // End of anonymouse object
« no previous file with comments | « ios/web/web_state/js/resources/navigation.js ('k') | ios/web/web_state/js/resources/web_bundle.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698