Commit ae67481a authored by Erik Luo's avatar Erik Luo Committed by Commit Bot

DevTools: expanded Objects hide overflow

All ObjectPropertiesSections call 'hideOverflow()', to avoid overflow
in the OPS's title (to adress crbugs 571759,571767).

However, hideOverflow does not hide overflow due to children, which
causes horizontal scrolling in Console.  This CL makes hide overflow
in properties for all OPS except JSONView.

Screenshot: https://imgur.com/a/x51xJNJ

Bug: none
Change-Id: Ie78f48cd873fd1d61b27c17e76683a4f7031aee8
Reviewed-on: https://chromium-review.googlesource.com/1162913Reviewed-by: default avatarAndrey Lushnikov <lushnikov@chromium.org>
Commit-Queue: Erik Luo <luoe@chromium.org>
Cr-Commit-Position: refs/heads/master@{#580726}
parent a9f67901
...@@ -35,12 +35,14 @@ ObjectUI.ObjectPropertiesSection = class extends UI.TreeOutlineInShadow { ...@@ -35,12 +35,14 @@ ObjectUI.ObjectPropertiesSection = class extends UI.TreeOutlineInShadow {
* @param {?string=} emptyPlaceholder * @param {?string=} emptyPlaceholder
* @param {boolean=} ignoreHasOwnProperty * @param {boolean=} ignoreHasOwnProperty
* @param {!Array.<!SDK.RemoteObjectProperty>=} extraProperties * @param {!Array.<!SDK.RemoteObjectProperty>=} extraProperties
* @param {boolean=} showOverflow
*/ */
constructor(object, title, linkifier, emptyPlaceholder, ignoreHasOwnProperty, extraProperties) { constructor(object, title, linkifier, emptyPlaceholder, ignoreHasOwnProperty, extraProperties, showOverflow) {
super(); super();
this._object = object; this._object = object;
this._editable = true; this._editable = true;
this.hideOverflow(); if (!showOverflow)
this.hideOverflow();
this.setFocusable(false); this.setFocusable(false);
this._objectTreeElement = new ObjectUI.ObjectPropertiesSection.RootElement( this._objectTreeElement = new ObjectUI.ObjectPropertiesSection.RootElement(
object, linkifier, emptyPlaceholder, ignoreHasOwnProperty, extraProperties); object, linkifier, emptyPlaceholder, ignoreHasOwnProperty, extraProperties);
...@@ -792,7 +794,7 @@ ObjectUI.ObjectPropertyTreeElement = class extends UI.TreeElement { ...@@ -792,7 +794,7 @@ ObjectUI.ObjectPropertyTreeElement = class extends UI.TreeElement {
this.expandedValueElement = this._createExpandedValueElement(this.property.value); this.expandedValueElement = this._createExpandedValueElement(this.property.value);
this.listItemElement.removeChildren(); this.listItemElement.removeChildren();
this._rowContainer = UI.html`<span>${this.nameElement}: ${this.valueElement}</span>`; this._rowContainer = UI.html`<span class='name-and-value'>${this.nameElement}: ${this.valueElement}</span>`;
this.listItemElement.appendChild(this._rowContainer); this.listItemElement.appendChild(this._rowContainer);
} }
...@@ -864,6 +866,7 @@ ObjectUI.ObjectPropertyTreeElement = class extends UI.TreeElement { ...@@ -864,6 +866,7 @@ ObjectUI.ObjectPropertyTreeElement = class extends UI.TreeElement {
const proxyElement = const proxyElement =
this._prompt.attachAndStartEditing(this._editableDiv, this._editingCommitted.bind(this, originalContent)); this._prompt.attachAndStartEditing(this._editableDiv, this._editingCommitted.bind(this, originalContent));
proxyElement.classList.add('property-prompt');
this.listItemElement.getComponentSelection().selectAllChildren(this._editableDiv); this.listItemElement.getComponentSelection().selectAllChildren(this._editableDiv);
proxyElement.addEventListener('keydown', this._promptKeyDown.bind(this, originalContent), false); proxyElement.addEventListener('keydown', this._promptKeyDown.bind(this, originalContent), false);
} }
......
...@@ -50,3 +50,17 @@ ...@@ -50,3 +50,17 @@
.object-properties-section .editable-div { .object-properties-section .editable-div {
overflow: hidden; overflow: hidden;
} }
.name-and-value {
overflow-x: hidden;
text-overflow: ellipsis;
}
.editing-sub-part .name-and-value {
overflow: visible;
display: inline-flex;
}
.property-prompt {
margin-left: 4px;
}
...@@ -166,7 +166,8 @@ SourceFrame.JSONView = class extends UI.VBox { ...@@ -166,7 +166,8 @@ SourceFrame.JSONView = class extends UI.VBox {
const obj = SDK.RemoteObject.fromLocalObject(this._parsedJSON.data); const obj = SDK.RemoteObject.fromLocalObject(this._parsedJSON.data);
const title = this._parsedJSON.prefix + obj.description + this._parsedJSON.suffix; const title = this._parsedJSON.prefix + obj.description + this._parsedJSON.suffix;
this._treeOutline = new ObjectUI.ObjectPropertiesSection(obj, title); this._treeOutline = new ObjectUI.ObjectPropertiesSection(
obj, title, undefined, undefined, undefined, undefined, true /* showOverflow */);
this._treeOutline.enableContextMenu(); this._treeOutline.enableContextMenu();
this._treeOutline.setEditable(false); this._treeOutline.setEditable(false);
this._treeOutline.expand(); this._treeOutline.expand();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment