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

Side by Side 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, 6 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 unified diff | Download patch
OLDNEW
(Empty)
1 Polymer({
2 is: 'app-drawer-layout',
3
4 behaviors: [
5 Polymer.IronResizableBehavior
6 ],
7
8 properties: {
9 /**
10 * If true, ignore `responsiveWidth` setting and force the narrow layout .
11 */
12 forceNarrow: {
13 type: Boolean,
14 value: false
15 },
16
17 /**
18 * If the viewport's width is smaller than this value, the panel will ch ange to narrow layout.
19 * In the mode the drawer will be closed.
20 */
21 responsiveWidth: {
22 type: String,
23 value: '640px'
24 },
25
26 _narrow: Boolean
27 },
28
29 listeners: {
30 'tap': '_tapHandler',
31 'app-drawer-reset-layout': 'resetLayout'
32 },
33
34 observers: [
35 'resetLayout(_narrow, isAttached)'
36 ],
37
38 /**
39 * A reference to the app-drawer element.
40 *
41 * @property drawer
42 */
43 get drawer() {
44 return Polymer.dom(this.$.drawerContent).getDistributedNodes()[0];
45 },
46
47 _tapHandler: function(e) {
48 var target = Polymer.dom(e).localTarget;
49 if (target && target.hasAttribute('drawer-toggle')) {
50 this.drawer.toggle();
51 }
52 },
53
54 resetLayout: function() {
55 this.debounce('_resetLayout', function() {
56 if (!this.isAttached) {
57 return;
58 }
59
60 var drawer = this.drawer;
61 var drawerWidth = this.drawer.getWidth();
62 var contentContainer = this.$.contentContainer;
63
64 if (this._narrow) {
65 drawer.opened = drawer.persistent = false;
66 contentContainer.classList.add('narrow');
67
68 contentContainer.style.marginLeft = '';
69 contentContainer.style.marginRight = '';
70 } else {
71 drawer.opened = drawer.persistent = true;
72 contentContainer.classList.remove('narrow');
73
74 if (drawer.position == 'right') {
75 contentContainer.style.marginLeft = '';
76 contentContainer.style.marginRight = drawerWidth + 'px';
77 } else {
78 contentContainer.style.marginLeft = drawerWidth + 'px';
79 contentContainer.style.marginRight = '';
80 }
81 }
82
83 this.notifyResize();
84 });
85 },
86
87 _computeMediaQuery: function(forceNarrow, responsiveWidth) {
88 return forceNarrow ? '(min-width: 0px)' : '(max-width: ' + responsiveWid th + ')';
89 }
90 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698