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

Side by Side Diff: chrome/browser/resources/md_bookmarks/folder_node.js

Issue 2733123003: [MD Bookmarks] Make folder nodes extend their whole width. (Closed)
Patch Set: address comments Created 3 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 Polymer({ 5 Polymer({
6 is: 'bookmarks-folder-node', 6 is: 'bookmarks-folder-node',
7 7
8 behaviors: [ 8 behaviors: [
9 bookmarks.StoreClient, 9 bookmarks.StoreClient,
10 ], 10 ],
11 11
12 properties: { 12 properties: {
13 itemId: { 13 itemId: {
14 type: String, 14 type: String,
15 observer: 'updateFromStore', 15 observer: 'updateFromStore',
16 }, 16 },
17 17
18 depth: {
19 type: Number,
20 observer: 'depthChanged_',
21 },
22
18 /** @type {BookmarkNode} */ 23 /** @type {BookmarkNode} */
19 item: Object, 24 item: Object,
20 25
21 isClosed: Boolean, 26 isClosed: Boolean,
22 27
23 selectedFolder: String, 28 selectedFolder: String,
24 29
25 isSelectedFolder: { 30 isSelectedFolder: {
26 type: Boolean, 31 type: Boolean,
27 value: false, 32 value: false,
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 72
68 /** 73 /**
69 * Occurs when the drop down arrow is tapped. 74 * Occurs when the drop down arrow is tapped.
70 * @private 75 * @private
71 */ 76 */
72 toggleFolder_: function() { 77 toggleFolder_: function() {
73 this.dispatch( 78 this.dispatch(
74 bookmarks.actions.changeFolderOpen(this.item.id, this.isClosed)); 79 bookmarks.actions.changeFolderOpen(this.item.id, this.isClosed));
75 }, 80 },
76 81
82 /**
83 * @private
84 * @param {string} itemId
85 * @param {string} selectedFolder
86 * @return {boolean}
87 */
77 computeIsSelected_: function(itemId, selectedFolder) { 88 computeIsSelected_: function(itemId, selectedFolder) {
78 return itemId == selectedFolder; 89 return itemId == selectedFolder;
79 }, 90 },
80 91
81 /** 92 /**
82 * @private 93 * @private
83 * @return {boolean} 94 * @return {boolean}
84 */ 95 */
85 hasChildFolder_: function() { 96 hasChildFolder_: function() {
86 for (var i = 0; i < this.item.children.length; i++) { 97 for (var i = 0; i < this.item.children.length; i++) {
87 var child = this.getState().nodes[this.item.children[i]]; 98 var child = this.getState().nodes[this.item.children[i]];
88 if (!child.url) 99 if (!child.url)
89 return true; 100 return true;
90 } 101 }
91 return false; 102 return false;
92 }, 103 },
93 104
105 /** @private */
106 depthChanged_: function() {
107 this.style.setProperty('--node-depth', this.depth);
tsergeant 2017/03/08 23:26:17 aaaaaahhhhhhh (relatedly: CSS custom properties a
108 },
109
110 /**
111 * @private
112 * @return {number}
113 */
114 getChildDepth_: function() {
115 return this.depth + 1;
116 },
117
94 /** 118 /**
95 * @param {string} itemId 119 * @param {string} itemId
96 * @private 120 * @private
97 * @return {boolean} 121 * @return {boolean}
98 */ 122 */
99 isFolder_: function(itemId) { 123 isFolder_: function(itemId) {
100 return !this.getState().nodes[itemId].url; 124 return !this.getState().nodes[itemId].url;
101 } 125 }
102 }); 126 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698