OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <!-- | 2 <!-- |
3 Copyright (c) 2014 The Chromium Authors. All rights reserved. | 3 Copyright (c) 2014 The Chromium Authors. All rights reserved. |
4 Use of this source code is governed by a BSD-style license that can be | 4 Use of this source code is governed by a BSD-style license that can be |
5 found in the LICENSE file. | 5 found in the LICENSE file. |
6 --> | 6 --> |
7 | 7 |
8 <link rel="import" href="/tracing/base/settings.html"> | 8 <link rel="import" href="/tracing/base/settings.html"> |
9 <link rel="import" href="/tracing/ui/base/ui.html"> | 9 <link rel="import" href="/tracing/ui/base/ui.html"> |
10 | 10 |
11 <style> | |
12 * /deep/ .labeled-checkbox { | |
13 display: flex; | |
14 white-space: nowrap; | |
15 } | |
16 </style> | |
17 | |
18 <script> | 11 <script> |
19 'use strict'; | 12 'use strict'; |
20 | 13 |
21 tr.exportTo('tr.ui.b', function() { | 14 tr.exportTo('tr.ui.b', function() { |
22 function createSpan(opt_dictionary) { | 15 function createSpan(opt_dictionary) { |
23 let ownerDocument = document; | 16 let ownerDocument = document; |
24 if (opt_dictionary && opt_dictionary.ownerDocument) { | 17 if (opt_dictionary && opt_dictionary.ownerDocument) { |
25 ownerDocument = opt_dictionary.ownerDocument; | 18 ownerDocument = opt_dictionary.ownerDocument; |
26 } | 19 } |
27 const spanEl = ownerDocument.createElement('span'); | 20 const spanEl = ownerDocument.createElement('span'); |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 } | 288 } |
296 if (opt_changeCb) { | 289 if (opt_changeCb) { |
297 opt_changeCb.call(); | 290 opt_changeCb.call(); |
298 } | 291 } |
299 } | 292 } |
300 | 293 |
301 buttonEl.addEventListener('change', onChange); | 294 buttonEl.addEventListener('change', onChange); |
302 | 295 |
303 const id = '#checkbox-' + nextCheckboxId++; | 296 const id = '#checkbox-' + nextCheckboxId++; |
304 | 297 |
305 const spanEl = createSpan({className: 'labeled-checkbox'}); | 298 const spanEl = createSpan(); |
| 299 spanEl.style.display = 'flex'; |
| 300 spanEl.style.whiteSpace = 'nowrap'; |
306 Polymer.dom(buttonEl).setAttribute('id', id); | 301 Polymer.dom(buttonEl).setAttribute('id', id); |
307 | 302 |
308 const labelEl = document.createElement('label'); | 303 const labelEl = document.createElement('label'); |
309 Polymer.dom(labelEl).textContent = label; | 304 Polymer.dom(labelEl).textContent = label; |
310 Polymer.dom(labelEl).setAttribute('for', id); | 305 Polymer.dom(labelEl).setAttribute('for', id); |
311 Polymer.dom(spanEl).appendChild(buttonEl); | 306 Polymer.dom(spanEl).appendChild(buttonEl); |
312 Polymer.dom(spanEl).appendChild(labelEl); | 307 Polymer.dom(spanEl).appendChild(labelEl); |
313 | 308 |
314 spanEl.__defineSetter__('checked', function(opt_bool) { | 309 spanEl.__defineSetter__('checked', function(opt_bool) { |
315 const changed = buttonEl.checked !== (!!opt_bool); | 310 const changed = buttonEl.checked !== (!!opt_bool); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 createSelector, | 381 createSelector, |
387 createOptionGroup, | 382 createOptionGroup, |
388 createCheckBox, | 383 createCheckBox, |
389 createButton, | 384 createButton, |
390 createTextInput, | 385 createTextInput, |
391 isElementAttachedToDocument, | 386 isElementAttachedToDocument, |
392 asHTMLOrTextNode, | 387 asHTMLOrTextNode, |
393 }; | 388 }; |
394 }); | 389 }); |
395 </script> | 390 </script> |
OLD | NEW |