Chromium Code Reviews| Index: third_party/WebKit/Source/devtools/front_end/ui/UIUtils.js |
| diff --git a/third_party/WebKit/Source/devtools/front_end/ui/UIUtils.js b/third_party/WebKit/Source/devtools/front_end/ui/UIUtils.js |
| index d952835790792d5407b3e3abc269ce4a9fd56e7b..0b9c84ba9825209c03a5e1469e7d58bd941b6ff9 100644 |
| --- a/third_party/WebKit/Source/devtools/front_end/ui/UIUtils.js |
| +++ b/third_party/WebKit/Source/devtools/front_end/ui/UIUtils.js |
| @@ -663,15 +663,37 @@ UI.asyncStackTraceLabel = function(description) { |
| }; |
| /** |
| + * @param {!Document} document |
| * @param {!Element} element |
| */ |
| -UI.installComponentRootStyles = function(element) { |
| +UI.installComponentRootStyles = function(document, element) { |
| UI.appendStyle(element, 'ui/inspectorCommon.css'); |
| UI.themeSupport.injectHighlightStyleSheets(element); |
| element.classList.add('platform-' + Host.platform()); |
| + |
| + 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
|
| + element.classList.add('overlay-scrollbar-enabled'); |
| }; |
| /** |
| + * Detect overlay scrollbar enable by checking clientWidth and offsetWidth of |
| + * overflow: scroll div. |
| + * @param {!Document} document |
| + * @return {boolean} |
| + */ |
| +function overlayScrollbarEnabled(document) { |
|
alph
2017/05/22 18:50:08
Please move the function inside the UI.installComp
|
| + let scrollDiv = document.createElement('div'); |
|
alph
2017/05/22 18:50:08
We do not use 'let' in DevTools yet.
|
| + scrollDiv.setAttribute('style', 'width: 100px; height: 100px; overflow: scroll;'); |
| + document.body.appendChild(scrollDiv); |
| + |
| + let scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth; |
| + |
|
alph
2017/05/22 18:50:09
please remove extra empty lines.
|
| + document.body.removeChild(scrollDiv); |
| + |
| + return scrollbarWidth === 0; |
| +} |
| + |
| +/** |
| * @param {!Element} element |
| * @param {string=} cssFile |
| * @return {!DocumentFragment} |