| 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 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 662 return Common.UIString('Async Call'); | 662 return Common.UIString('Async Call'); |
| 663 }; | 663 }; |
| 664 | 664 |
| 665 /** | 665 /** |
| 666 * @param {!Element} element | 666 * @param {!Element} element |
| 667 */ | 667 */ |
| 668 UI.installComponentRootStyles = function(element) { | 668 UI.installComponentRootStyles = function(element) { |
| 669 UI.appendStyle(element, 'ui/inspectorCommon.css'); | 669 UI.appendStyle(element, 'ui/inspectorCommon.css'); |
| 670 UI.themeSupport.injectHighlightStyleSheets(element); | 670 UI.themeSupport.injectHighlightStyleSheets(element); |
| 671 element.classList.add('platform-' + Host.platform()); | 671 element.classList.add('platform-' + Host.platform()); |
| 672 |
| 673 /** |
| 674 * Detect overlay scrollbar enable by checking clientWidth and offsetWidth of |
| 675 * overflow: scroll div. |
| 676 * @param {?Document=} document |
| 677 * @return {boolean} |
| 678 */ |
| 679 function overlayScrollbarEnabled(document) { |
| 680 var scrollDiv = document.createElement('div'); |
| 681 scrollDiv.setAttribute('style', 'width: 100px; height: 100px; overflow: scro
ll;'); |
| 682 document.body.appendChild(scrollDiv); |
| 683 var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth; |
| 684 document.body.removeChild(scrollDiv); |
| 685 return scrollbarWidth === 0; |
| 686 } |
| 687 |
| 688 if (!Host.isMac() && overlayScrollbarEnabled(element.ownerDocument)) |
| 689 element.classList.add('overlay-scrollbar-enabled'); |
| 672 }; | 690 }; |
| 673 | 691 |
| 674 /** | 692 /** |
| 675 * @param {!Element} element | 693 * @param {!Element} element |
| 676 * @param {string=} cssFile | 694 * @param {string=} cssFile |
| 677 * @return {!DocumentFragment} | 695 * @return {!DocumentFragment} |
| 678 */ | 696 */ |
| 679 UI.createShadowRootWithCoreStyles = function(element, cssFile) { | 697 UI.createShadowRootWithCoreStyles = function(element, cssFile) { |
| 680 var shadowRoot = element.createShadowRoot(); | 698 var shadowRoot = element.createShadowRoot(); |
| 681 UI.appendStyle(shadowRoot, 'ui/inspectorCommon.css'); | 699 UI.appendStyle(shadowRoot, 'ui/inspectorCommon.css'); |
| (...skipping 1339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2021 */ | 2039 */ |
| 2022 UI.createInlineButton = function(toolbarButton) { | 2040 UI.createInlineButton = function(toolbarButton) { |
| 2023 var element = createElement('span'); | 2041 var element = createElement('span'); |
| 2024 var shadowRoot = UI.createShadowRootWithCoreStyles(element, 'ui/inlineButton.c
ss'); | 2042 var shadowRoot = UI.createShadowRootWithCoreStyles(element, 'ui/inlineButton.c
ss'); |
| 2025 element.classList.add('inline-button'); | 2043 element.classList.add('inline-button'); |
| 2026 var toolbar = new UI.Toolbar(''); | 2044 var toolbar = new UI.Toolbar(''); |
| 2027 toolbar.appendToolbarItem(toolbarButton); | 2045 toolbar.appendToolbarItem(toolbarButton); |
| 2028 shadowRoot.appendChild(toolbar.element); | 2046 shadowRoot.appendChild(toolbar.element); |
| 2029 return element; | 2047 return element; |
| 2030 }; | 2048 }; |
| OLD | NEW |