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

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

Issue 1013833003: Show Pages in chrome://md-settings (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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/settings_main/settings_main.js
diff --git a/chrome/browser/resources/settings/settings_main/settings_main.js b/chrome/browser/resources/settings/settings_main/settings_main.js
index 582cfb479449cc78c056e188355e2cedabf33dba..dc7c897d8b5dbc20049714e72cac8b1e99e0a465 100644
--- a/chrome/browser/resources/settings/settings_main/settings_main.js
+++ b/chrome/browser/resources/settings/settings_main/settings_main.js
@@ -53,13 +53,21 @@ Polymer('cr-settings-main', {
/** @override */
ready: function() {
+ // Observe the core-animated-pages to keep this.pages in sync.
var observer = new MutationObserver(this.pageContainerUpdated_.bind(this));
observer.observe(this.$.pageContainer,
/** @type {MutationObserverInit} */ {
childList: true,
});
this.pages = this.$.pageContainer.items;
- this.ensureSelection_();
+
+ if (this.pages.length) {
+ this.ensureSelection_();
+ // Size the container once the selected page becomes visible.
+ this.async(function() {
+ this.sizeToPage_(this.$.pageContainer.selectedItem);
+ }.bind(this));
Jeremy Klein 2015/03/18 00:12:05 this.async already binds to this: https://www.pol
michaelpg 2015/03/18 01:40:09 Acknowledged.
+ }
},
/**
@@ -76,6 +84,18 @@ Polymer('cr-settings-main', {
},
/**
+ * Updates the height style for core-animated-pages using the page's
Jeremy Klein 2015/03/18 00:12:05 Is this really necessary? Does the core-animated-p
michaelpg 2015/03/18 01:40:09 This was my attempt to keep <paper-shadow> outside
+ * scrollHeight.
+ *
+ * @param {HTMLElement} page
+ * @private
+ */
+ sizeToPage_: function(page) {
+ if (page)
Kyle Horimoto 2015/03/17 23:53:48 When would page be falsey?
+ this.$.pageContainer.style.height = page.scrollHeight + 'px';
Kyle Horimoto 2015/03/17 23:53:48 Can you add a comment explaining this? It's not cl
+ },
+
+ /**
* Updates the list of pages using the pages in core-animated-pages.
*
* @private
@@ -84,4 +104,14 @@ Polymer('cr-settings-main', {
this.pages = this.$.pageContainer.items;
this.ensureSelection_();
},
+
+ /**
+ * Updates the height of the core-animated-pages. Necessary because the
+ * pages are position: absolute, so the container won't size to the page.
Jeremy Klein 2015/03/18 00:12:05 It seems like the intended design here is to have
michaelpg 2015/03/18 00:18:00 I can't find a demo where the actual height of the
+ *
+ * @private
+ */
+ pageTransitionPrepared_: function() {
+ this.sizeToPage_(this.$.pageContainer.selectedItem);
+ },
});

Powered by Google App Engine
This is Rietveld 408576698