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

Unified Diff: chrome/browser/resources/settings/global_scroll_target_behavior.js

Issue 1914653002: Make lists in the passwords section aware of the scroll target. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make Global Created 4 years, 2 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
Index: chrome/browser/resources/settings/global_scroll_target_behavior.js
diff --git a/chrome/browser/resources/settings/global_scroll_target_behavior.js b/chrome/browser/resources/settings/global_scroll_target_behavior.js
new file mode 100644
index 0000000000000000000000000000000000000000..0870c0f26cb989aa0c821306b05ccb8d20790fdc
--- /dev/null
+++ b/chrome/browser/resources/settings/global_scroll_target_behavior.js
@@ -0,0 +1,53 @@
+// Copyright 2016 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 A helper object to be used when an iron-list needs to be aware
+ * of a global scroll target.
+ */
+
+/**
+ * Global object to hold the scroll target.
+ * @type {{scrollTarget: (HTMLElement|undefined)}}
+ */
+global.settingsScrollTargetData = {};
+
+/** @polymerBehavior */
+var GlobalScrollTargetBehavior = {
+ properties: {
+ /**
+ * Read only property for the scroll target.
+ * @type {HTMLElement}
+ */
+ scrollTarget: {
+ type: Object,
+ computed: 'getScrollTarget_(globalData_.scrollTarget)',
+ },
+
+ /**
+ * Reference to the global data. This allows Polymer style data binding.
+ * @type {{scrollTarget: (HTMLElement|undefined)}}
+ * @private
+ */
+ globalData_: Object,
michaelpg 2016/10/18 21:58:00 i'd suggest: globalData_: { type: Object, val
hcarmona 2016/10/19 18:53:34 Acknowledged.
+ },
+
+ /** @override */
+ ready: function() {
+ this.globalData_ = global.settingsScrollTargetData;
+ },
+
+ /** @param {HTMLElement} value */
+ setGlobalScrollTarget: function(value) {
+ this.globalData_.scrollTarget = value;
michaelpg 2016/10/18 21:58:00 This doesn't actually propagate. It may work, but
hcarmona 2016/10/19 18:53:34 --------------------------------------------------
michaelpg 2016/10/19 19:50:08 No, but we should make that assumption explicit (w
hcarmona 2016/10/20 14:27:43 Done.
+ },
+
+ /**
+ * @return {HTMLElement|undefined}
+ * @private
+ */
+ getScrollTarget_: function() {
+ return this.globalData_.scrollTarget;
+ },
+};

Powered by Google App Engine
This is Rietveld 408576698