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

Side by Side Diff: third_party/polymer/v1_0/components/paper-toolbar/paper-toolbar.html

Issue 1187823002: Update Polymer components and re-run reproduce.sh (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 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
1 <!-- 1 <!--
2 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. 2 Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
3 This code may only be used under the BSD style license found at http://polymer.g ithub.io/LICENSE.txt 3 This code may only be used under the BSD style license found at http://polymer.g ithub.io/LICENSE.txt
4 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt 4 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
5 The complete set of contributors may be found at http://polymer.github.io/CONTRI BUTORS.txt 5 The complete set of contributors may be found at http://polymer.github.io/CONTRI BUTORS.txt
6 Code distributed by Google as part of the polymer project is also 6 Code distributed by Google as part of the polymer project is also
7 subject to an additional IP rights grant found at http://polymer.github.io/PATEN TS.txt 7 subject to an additional IP rights grant found at http://polymer.github.io/PATEN TS.txt
8 --> 8 -->
9 9
10 <link rel="import" href="../polymer/polymer.html"> 10 <link rel="import" href="../polymer/polymer.html">
11 <link rel="import" href="../paper-styles/paper-styles.html"> 11 <link rel="import" href="../paper-styles/paper-styles.html">
12 12
13 <!-- 13 <!--
14 `paper-toolbar` is a horizontal bar containing items that can be used for 14 `paper-toolbar` is a horizontal bar containing items that can be used for
15 label, navigation, search and actions. The items place inside the 15 label, navigation, search and actions. The items place inside the
16 `paper-toolbar` are projected into a `class="horizontal center layout"` containe r inside of 16 `paper-toolbar` are projected into a `class="horizontal center layout"` containe r inside of
17 `paper-toolbar`'s Shadow DOM. You can use flex attributes to control the items' 17 `paper-toolbar`'s Shadow DOM. You can use flex attributes to control the items'
18 sizing. 18 sizing.
19 19
20 Example: 20 Example:
21 21
22 <paper-toolbar> 22 <paper-toolbar>
23 <paper-icon-button icon="menu" on-tap="menuAction"></paper-icon-button> 23 <paper-icon-button icon="menu" on-tap="menuAction"></paper-icon-button>
24 <div title>Title</div> 24 <div class="title">Title</div>
25 <paper-icon-button icon="more" on-tap="moreAction"></paper-icon-button> 25 <paper-icon-button icon="more-vert" on-tap="moreAction"></paper-icon-butto n>
26 </paper-toolbar> 26 </paper-toolbar>
27 27
28 `paper-toolbar` has a standard height, but can made be taller by setting `tall` 28 `paper-toolbar` has a standard height, but can made be taller by setting `tall`
29 class on the `paper-toolbar`. This will make the toolbar 3x the normal height. 29 class on the `paper-toolbar`. This will make the toolbar 3x the normal height.
30 30
31 <paper-toolbar class="tall"> 31 <paper-toolbar class="tall">
32 <paper-icon-button icon="menu"></paper-icon-button> 32 <paper-icon-button icon="menu"></paper-icon-button>
33 </paper-toolbar> 33 </paper-toolbar>
34 34
35 Apply `medium-tall` class to make the toolbar medium tall. This will make the 35 Apply `medium-tall` class to make the toolbar medium tall. This will make the
36 toolbar 2x the normal height. 36 toolbar 2x the normal height.
37 37
38 <paper-toolbar class="medium-tall"> 38 <paper-toolbar class="medium-tall">
39 <paper-icon-button icon="menu"></paper-icon-button> 39 <paper-icon-button icon="menu"></paper-icon-button>
40 </paper-toolbar> 40 </paper-toolbar>
41 41
42 When `tall`, items can pin to either the top (default), middle or bottom. Use 42 When `tall`, items can pin to either the top (default), middle or bottom. Use
43 `middle` class for middle content and `bottom` class for bottom content. 43 `middle` class for middle content and `bottom` class for bottom content.
44 44
45 <paper-toolbar class="tall"> 45 <paper-toolbar class="tall">
46 <paper-icon-button icon="menu"></paper-icon-button> 46 <paper-icon-button icon="menu"></paper-icon-button>
47 <div title class="middle">Middle Title</div> 47 <div class="middle title">Middle Title</div>
48 <div title class="bottom">Bottom Title</div> 48 <div class="bottom title">Bottom Title</div>
49 </paper-toolbar> 49 </paper-toolbar>
50 50
51 For `medium-tall` toolbar, the middle and bottom contents overlap and are 51 For `medium-tall` toolbar, the middle and bottom contents overlap and are
52 pinned to the bottom. But `middleJustify` and `bottomJustify` attributes are 52 pinned to the bottom. But `middleJustify` and `bottomJustify` attributes are
53 still honored separately. 53 still honored separately.
54 54
55 ### Styling 55 ### Styling
56 56
57 The following custom properties and mixins are available for styling: 57 The following custom properties and mixins are available for styling:
58 58
59 Custom property | Description | Default 59 Custom property | Description | Default
60 ----------------|-------------|---------- 60 ----------------|-------------|----------
61 `--paper-toolbar-background` | Toolbar background color | `--default-primary -color` 61 `--paper-toolbar-background` | Toolbar background color | `--default-primary -color`
62 `--paper-toolbar-color` | Toolbar foreground color | `--text-primary-co lor` 62 `--paper-toolbar-color` | Toolbar foreground color | `--text-primary-co lor`
63 `--paper-toolbar` | Mixin applied to the toolbar | `{}` 63 `--paper-toolbar` | Mixin applied to the toolbar | `{}`
64 64
65 ### Accessibility 65 ### Accessibility
66 66
67 `<paper-toolbar>` has `role="toolbar"` by default. Any elements with the `title` attribute will 67 `<paper-toolbar>` has `role="toolbar"` by default. Any elements with the class ` title` will
68 be used as the label of the toolbar via `aria-labelledby`. 68 be used as the label of the toolbar via `aria-labelledby`.
69 69
70 @demo demo/index.html 70 @demo demo/index.html
71 --> 71 -->
72 72
73 <dom-module id="paper-toolbar"> 73 <dom-module id="paper-toolbar">
74 74
75 <style> 75 <style>
76 :host { 76 :host {
77 /* technical */ 77 /* technical */
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 height: 168px; 126 height: 168px;
127 } 127 }
128 128
129 .toolbar-tools { 129 .toolbar-tools {
130 height: 56px; 130 height: 56px;
131 } 131 }
132 } 132 }
133 133
134 #topBar { 134 #topBar {
135 position: relative; 135 position: relative;
136 z-index: 1;
137 } 136 }
138 137
139 /* middle bar */ 138 /* middle bar */
140 #middleBar { 139 #middleBar {
141 position: absolute; 140 position: absolute;
142 top: 0; 141 top: 0;
143 right: 0; 142 right: 0;
144 left: 0; 143 left: 0;
145 z-index: 2;
146 } 144 }
147 145
148 :host(.tall) #middleBar, 146 :host(.tall) #middleBar,
149 :host(.medium-tall) #middleBar { 147 :host(.medium-tall) #middleBar {
150 -webkit-transform: translateY(100%); 148 -webkit-transform: translateY(100%);
151 transform: translateY(100%); 149 transform: translateY(100%);
152 } 150 }
153 151
154 /* bottom bar */ 152 /* bottom bar */
155 #bottomBar { 153 #bottomBar {
156 position: absolute; 154 position: absolute;
157 right: 0; 155 right: 0;
158 bottom: 0; 156 bottom: 0;
159 left: 0; 157 left: 0;
160 z-index: 1;
161 } 158 }
162 159
163 /* 160 /*
164 * make elements (e.g. buttons) respond to mouse/touch events 161 * make elements (e.g. buttons) respond to mouse/touch events
165 * 162 *
166 * `.toolbar-tools` disables touch events so multiple toolbars can stack and not 163 * `.toolbar-tools` disables touch events so multiple toolbars can stack and not
167 * absorb events. All children must have pointer events re-enabled to work a s 164 * absorb events. All children must have pointer events re-enabled to work a s
168 * expected. 165 * expected.
169 */ 166 */
170 .toolbar-tools > ::content > *:not([disabled]) { 167 .toolbar-tools > ::content > *:not([disabled]) {
171 pointer-events: auto; 168 pointer-events: auto;
172 } 169 }
173 170
174 .toolbar-tools > ::content [title] { 171 .toolbar-tools > ::content .title {
175 @apply(--paper-font-title); 172 @apply(--paper-font-title);
176 @apply(--layout-flex); 173 @apply(--layout-flex);
177 174
175 pointer-events: none;
178 text-overflow: ellipsis; 176 text-overflow: ellipsis;
179 white-space: nowrap; 177 white-space: nowrap;
180 overflow: hidden; 178 overflow: hidden;
181 179
182 /* 180 /*
183 * Polymer/polymer/issues/1525 181 * Polymer/polymer/issues/1525
184 * --paper-font-title defines a `font-weight` 182 * --paper-font-title defines a `font-weight`
185 * let's override its value, but we need `important!` 183 * let's override its value, but we need `important!`
186 * because all mixins are resolved in rule's selector that has higher prec edence 184 * because all mixins are resolved in rule's selector that has higher prec edence
187 * than the current selector. 185 * than the current selector.
188 */ 186 */
189 font-weight: 400 !important; 187 font-weight: 400 !important;
190 } 188 }
191 189
192 /** 190 /**
193 * TODO: Refactor these selectors 191 * TODO: Refactor these selectors
194 * Work in progress. 192 * Work in progress.
195 */ 193 */
196 .toolbar-tools > ::content paper-icon-button[icon=menu] { 194 .toolbar-tools > ::content paper-icon-button[icon=menu] {
197 margin-left: -8px;
198 margin-right: 24px; 195 margin-right: 24px;
199 } 196 }
200 197
201 .toolbar-tools > ::content paper-icon-button + paper-icon-button { 198 .toolbar-tools > ::content > .title,
202 margin-right: -8px; 199 .toolbar-tools > ::content[select=".middle"] > .title,
203 } 200 .toolbar-tools > ::content[select=".bottom"] > .title {
204
205 .toolbar-tools > ::content > [title],
206 .toolbar-tools > ::content[select=".middle"] > [title],
207 .toolbar-tools > ::content[select=".bottom"] > [title] {
208 margin-left: 56px; 201 margin-left: 56px;
209 } 202 }
210 203
211 .toolbar-tools > ::content > paper-icon-button + [title], 204 .toolbar-tools > ::content > paper-icon-button + .title,
212 .toolbar-tools > ::content[select=".middle"] paper-icon-button + [title], 205 .toolbar-tools > ::content[select=".middle"] paper-icon-button + .title,
213 .toolbar-tools > ::content[select=".bottom"] paper-icon-button + [title] { 206 .toolbar-tools > ::content[select=".bottom"] paper-icon-button + .title {
214 margin-left: 0; 207 margin-left: 0;
215 } 208 }
216 </style> 209 </style>
217 210
218 <template> 211 <template>
219 212
220 <div id="topBar" class$="[[_computeBarClassName(justify)]]"> 213 <div id="topBar" class$="[[_computeBarClassName(justify)]]">
221 <content select=":not(.middle):not(.bottom)"></content> 214 <content select=":not(.middle):not(.bottom)"></content>
222 </div> 215 </div>
223 216
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 }); 317 });
325 return observer; 318 return observer;
326 }, 319 },
327 320
328 _updateAriaLabelledBy: function() { 321 _updateAriaLabelledBy: function() {
329 var labelledBy = []; 322 var labelledBy = [];
330 var contents = Polymer.dom(this.root).querySelectorAll('content'); 323 var contents = Polymer.dom(this.root).querySelectorAll('content');
331 for (var content, index = 0; content = contents[index]; index++) { 324 for (var content, index = 0; content = contents[index]; index++) {
332 var nodes = Polymer.dom(content).getDistributedNodes(); 325 var nodes = Polymer.dom(content).getDistributedNodes();
333 for (var node, jndex = 0; node = nodes[jndex]; jndex++) { 326 for (var node, jndex = 0; node = nodes[jndex]; jndex++) {
334 if (node.hasAttribute && node.hasAttribute('title')) { 327 if (node.classList && node.classList.contains('title')) {
335 if (node.id) { 328 if (node.id) {
336 labelledBy.push(node.id); 329 labelledBy.push(node.id);
337 } else { 330 } else {
338 var id = 'paper-toolbar-label-' + Math.floor(Math.random() * 100 00); 331 var id = 'paper-toolbar-label-' + Math.floor(Math.random() * 100 00);
339 node.id = id; 332 node.id = id;
340 labelledBy.push(id); 333 labelledBy.push(id);
341 } 334 }
342 } 335 }
343 } 336 }
344 } 337 }
(...skipping 21 matching lines...) Expand all
366 } 359 }
367 360
368 return classNames(classObj); 361 return classNames(classObj);
369 } 362 }
370 363
371 }); 364 });
372 365
373 }()); 366 }());
374 367
375 </script> 368 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698