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

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

Issue 2623053002: [Devtools] Fix left margin for selection element (Closed)
Patch Set: dgozman comments Created 3 years, 11 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
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/accessibility/AXTreePane.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/devtools/front_end/ui/treeoutline.js
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/treeoutline.js b/third_party/WebKit/Source/devtools/front_end/ui/treeoutline.js
index 99e46546a0beff60193852d0a43a369db5af30a7..b32588bfc35d12c21b9acd67704fa02f180d61d7 100644
--- a/third_party/WebKit/Source/devtools/front_end/ui/treeoutline.js
+++ b/third_party/WebKit/Source/devtools/front_end/ui/treeoutline.js
@@ -51,6 +51,10 @@ UI.TreeOutline = class extends Common.Object {
this.element = this.contentElement;
+ // Adjust to allow computing margin-left for the selection element.
+ // Check the padding-left for the li element for correct value.
+ this._paddingSize = 0;
+
/**
* @param {boolean} isFocused
* @this {UI.TreeOutline}
@@ -209,6 +213,13 @@ UI.TreeOutline = class extends Common.Object {
}
/**
+ * @param {number} paddingSize
+ */
+ setPaddingSize(paddingSize) {
+ this._paddingSize = paddingSize;
+ }
+
+ /**
* @param {!Event} event
*/
_treeKeyDown(event) {
@@ -752,11 +763,27 @@ UI.TreeElement = class {
}
}
+ /**
+ * @return {number}
+ */
+ computeLeftMargin() {
+ var treeElement = this.parent;
+ var depth = 0;
+ while (treeElement !== null) {
+ depth++;
+ treeElement = treeElement.parent;
+ }
+
+ return -(this.treeOutline._paddingSize * (depth - 1) + 4);
+ }
+
_ensureSelection() {
if (!this.treeOutline || !this.treeOutline._renderSelection)
return;
if (!this._selectionElement)
this._selectionElement = createElementWithClass('div', 'selection fill');
+ if (this.treeOutline._paddingSize)
+ this._selectionElement.style.setProperty('margin-left', this.computeLeftMargin() + 'px');
this._listItemNode.insertBefore(this._selectionElement, this.listItemElement.firstChild);
}
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/accessibility/AXTreePane.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698