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

Unified Diff: third_party/WebKit/Source/devtools/front_end/ui/UIUtils.js

Issue 2891383002: Force non overlay scrollbar in Devtools/Performance for Aura Overlay Scrollbar (Closed)
Patch Set: Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
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}

Powered by Google App Engine
This is Rietveld 408576698