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

Unified Diff: third_party/polymer/v1_0/components-chromium/app-layout/app-drawer-layout/app-drawer-layout-extracted.js

Issue 1984963002: Roll Polymer elements (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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: third_party/polymer/v1_0/components-chromium/app-layout/app-drawer-layout/app-drawer-layout-extracted.js
diff --git a/third_party/polymer/v1_0/components-chromium/app-layout/app-drawer-layout/app-drawer-layout-extracted.js b/third_party/polymer/v1_0/components-chromium/app-layout/app-drawer-layout/app-drawer-layout-extracted.js
new file mode 100644
index 0000000000000000000000000000000000000000..e303e94855a2460d4811c14ef5c232d90650ca78
--- /dev/null
+++ b/third_party/polymer/v1_0/components-chromium/app-layout/app-drawer-layout/app-drawer-layout-extracted.js
@@ -0,0 +1,90 @@
+Polymer({
+ is: 'app-drawer-layout',
+
+ behaviors: [
+ Polymer.IronResizableBehavior
+ ],
+
+ properties: {
+ /**
+ * If true, ignore `responsiveWidth` setting and force the narrow layout.
+ */
+ forceNarrow: {
+ type: Boolean,
+ value: false
+ },
+
+ /**
+ * If the viewport's width is smaller than this value, the panel will change to narrow layout.
+ * In the mode the drawer will be closed.
+ */
+ responsiveWidth: {
+ type: String,
+ value: '640px'
+ },
+
+ _narrow: Boolean
+ },
+
+ listeners: {
+ 'tap': '_tapHandler',
+ 'app-drawer-reset-layout': 'resetLayout'
+ },
+
+ observers: [
+ 'resetLayout(_narrow, isAttached)'
+ ],
+
+ /**
+ * A reference to the app-drawer element.
+ *
+ * @property drawer
+ */
+ get drawer() {
+ return Polymer.dom(this.$.drawerContent).getDistributedNodes()[0];
+ },
+
+ _tapHandler: function(e) {
+ var target = Polymer.dom(e).localTarget;
+ if (target && target.hasAttribute('drawer-toggle')) {
+ this.drawer.toggle();
+ }
+ },
+
+ resetLayout: function() {
+ this.debounce('_resetLayout', function() {
+ if (!this.isAttached) {
+ return;
+ }
+
+ var drawer = this.drawer;
+ var drawerWidth = this.drawer.getWidth();
+ var contentContainer = this.$.contentContainer;
+
+ if (this._narrow) {
+ drawer.opened = drawer.persistent = false;
+ contentContainer.classList.add('narrow');
+
+ contentContainer.style.marginLeft = '';
+ contentContainer.style.marginRight = '';
+ } else {
+ drawer.opened = drawer.persistent = true;
+ contentContainer.classList.remove('narrow');
+
+ if (drawer.position == 'right') {
+ contentContainer.style.marginLeft = '';
+ contentContainer.style.marginRight = drawerWidth + 'px';
+ } else {
+ contentContainer.style.marginLeft = drawerWidth + 'px';
+ contentContainer.style.marginRight = '';
+ }
+ }
+
+ this.notifyResize();
+ });
+ },
+
+ _computeMediaQuery: function(forceNarrow, responsiveWidth) {
+ return forceNarrow ? '(min-width: 0px)' : '(max-width: ' + responsiveWidth + ')';
+ }
+ });

Powered by Google App Engine
This is Rietveld 408576698