Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. | 3 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. |
| 4 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com). | 4 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com). |
| 5 * Copyright (C) 2009 Joseph Pecoraro | 5 * Copyright (C) 2009 Joseph Pecoraro |
| 6 * | 6 * |
| 7 * Redistribution and use in source and binary forms, with or without | 7 * Redistribution and use in source and binary forms, with or without |
| 8 * modification, are permitted provided that the following conditions | 8 * modification, are permitted provided that the following conditions |
| 9 * are met: | 9 * are met: |
| 10 * | 10 * |
| (...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 656 if (description === 'Promise.resolve') | 656 if (description === 'Promise.resolve') |
| 657 description = Common.UIString('Promise resolved'); | 657 description = Common.UIString('Promise resolved'); |
| 658 else if (description === 'Promise.reject') | 658 else if (description === 'Promise.reject') |
| 659 description = Common.UIString('Promise rejected'); | 659 description = Common.UIString('Promise rejected'); |
| 660 return description + ' ' + Common.UIString('(async)'); | 660 return description + ' ' + Common.UIString('(async)'); |
| 661 } | 661 } |
| 662 return Common.UIString('Async Call'); | 662 return Common.UIString('Async Call'); |
| 663 }; | 663 }; |
| 664 | 664 |
| 665 /** | 665 /** |
| 666 * @param {!Document} document | |
| 666 * @param {!Element} element | 667 * @param {!Element} element |
| 667 */ | 668 */ |
| 668 UI.installComponentRootStyles = function(element) { | 669 UI.installComponentRootStyles = function(document, element) { |
| 669 UI.appendStyle(element, 'ui/inspectorCommon.css'); | 670 UI.appendStyle(element, 'ui/inspectorCommon.css'); |
| 670 UI.themeSupport.injectHighlightStyleSheets(element); | 671 UI.themeSupport.injectHighlightStyleSheets(element); |
| 671 element.classList.add('platform-' + Host.platform()); | 672 element.classList.add('platform-' + Host.platform()); |
| 673 | |
| 674 if (!Host.isMac() && overlayScrollbarEnabled(document)) | |
|
alph
2017/05/22 18:50:08
Can we do it for Mac as well, because on it is pos
chaopeng
2017/05/23 17:26:40
No, for aura-overlay-scrollbar, we must restart ch
| |
| 675 element.classList.add('overlay-scrollbar-enabled'); | |
| 672 }; | 676 }; |
| 673 | 677 |
| 674 /** | 678 /** |
| 679 * Detect overlay scrollbar enable by checking clientWidth and offsetWidth of | |
| 680 * overflow: scroll div. | |
| 681 * @param {!Document} document | |
| 682 * @return {boolean} | |
| 683 */ | |
| 684 function overlayScrollbarEnabled(document) { | |
|
alph
2017/05/22 18:50:08
Please move the function inside the UI.installComp
| |
| 685 let scrollDiv = document.createElement('div'); | |
|
alph
2017/05/22 18:50:08
We do not use 'let' in DevTools yet.
| |
| 686 scrollDiv.setAttribute('style', 'width: 100px; height: 100px; overflow: scroll ;'); | |
| 687 document.body.appendChild(scrollDiv); | |
| 688 | |
| 689 let scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth; | |
| 690 | |
|
alph
2017/05/22 18:50:09
please remove extra empty lines.
| |
| 691 document.body.removeChild(scrollDiv); | |
| 692 | |
| 693 return scrollbarWidth === 0; | |
| 694 } | |
| 695 | |
| 696 /** | |
| 675 * @param {!Element} element | 697 * @param {!Element} element |
| 676 * @param {string=} cssFile | 698 * @param {string=} cssFile |
| 677 * @return {!DocumentFragment} | 699 * @return {!DocumentFragment} |
| 678 */ | 700 */ |
| 679 UI.createShadowRootWithCoreStyles = function(element, cssFile) { | 701 UI.createShadowRootWithCoreStyles = function(element, cssFile) { |
| 680 var shadowRoot = element.createShadowRoot(); | 702 var shadowRoot = element.createShadowRoot(); |
| 681 UI.appendStyle(shadowRoot, 'ui/inspectorCommon.css'); | 703 UI.appendStyle(shadowRoot, 'ui/inspectorCommon.css'); |
| 682 UI.themeSupport.injectHighlightStyleSheets(shadowRoot); | 704 UI.themeSupport.injectHighlightStyleSheets(shadowRoot); |
| 683 if (cssFile) | 705 if (cssFile) |
| 684 UI.appendStyle(shadowRoot, cssFile); | 706 UI.appendStyle(shadowRoot, cssFile); |
| (...skipping 1336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2021 */ | 2043 */ |
| 2022 UI.createInlineButton = function(toolbarButton) { | 2044 UI.createInlineButton = function(toolbarButton) { |
| 2023 var element = createElement('span'); | 2045 var element = createElement('span'); |
| 2024 var shadowRoot = UI.createShadowRootWithCoreStyles(element, 'ui/inlineButton.c ss'); | 2046 var shadowRoot = UI.createShadowRootWithCoreStyles(element, 'ui/inlineButton.c ss'); |
| 2025 element.classList.add('inline-button'); | 2047 element.classList.add('inline-button'); |
| 2026 var toolbar = new UI.Toolbar(''); | 2048 var toolbar = new UI.Toolbar(''); |
| 2027 toolbar.appendToolbarItem(toolbarButton); | 2049 toolbar.appendToolbarItem(toolbarButton); |
| 2028 shadowRoot.appendChild(toolbar.element); | 2050 shadowRoot.appendChild(toolbar.element); |
| 2029 return element; | 2051 return element; |
| 2030 }; | 2052 }; |
| OLD | NEW |