Skip to content

Commit 04fa4ed

Browse files
OrKoNDevtools-frontend LUCI CQ
authored andcommitted
Move the expand option to UI.UIUtils.Renderer
Bug: 407751692 Change-Id: Iafc903ce041916dad214e33ce111ddb692c1b79d Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6897970 Reviewed-by: Philip Pfaffe <[email protected]> Commit-Queue: Alex Rudenko <[email protected]>
1 parent 999a114 commit 04fa4ed

File tree

5 files changed

+13
-7
lines changed

5 files changed

+13
-7
lines changed

front_end/models/extensions/ExtensionPanel.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -218,15 +218,11 @@ export class ExtensionSidebarPane extends UI.View.SimpleView {
218218
return;
219219
}
220220
objectPropertiesView.element.removeChildren();
221-
void UI.UIUtils.Renderer.render(object, {title, editable: false}).then(result => {
221+
void UI.UIUtils.Renderer.render(object, {title, editable: false, expand: true}).then(result => {
222222
if (!result) {
223223
callback();
224224
return;
225225
}
226-
const firstChild = result.tree?.firstChild();
227-
if (firstChild) {
228-
firstChild.expand();
229-
}
230226
objectPropertiesView.element.appendChild(result.node);
231227
callback();
232228
});

front_end/panels/console/ConsoleViewMessage.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -943,7 +943,7 @@ export class ConsoleViewMessage implements ConsoleViewportElement {
943943
result.appendChild(this.formatParameterAsObject(remoteObject, false));
944944
return;
945945
}
946-
const renderResult = await UI.UIUtils.Renderer.render((node as Object));
946+
const renderResult = await UI.UIUtils.Renderer.render(node);
947947
if (renderResult) {
948948
if (renderResult.tree) {
949949
this.selectableChildren.push(renderResult.tree);

front_end/panels/elements/ElementsTreeOutlineRenderer.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export class Renderer implements UI.UIUtils.Renderer {
5050
return rendererInstance;
5151
}
5252

53-
async render(object: Object): Promise<{
53+
async render(object: Object, options?: UI.UIUtils.Options): Promise<{
5454
node: Node,
5555
tree: UI.TreeOutline.TreeOutline|null,
5656
}|null> {
@@ -75,6 +75,9 @@ export class Renderer implements UI.UIUtils.Renderer {
7575
// @ts-expect-error used in console_test_runner
7676
treeOutline.element.treeElementForTest = treeOutline.firstChild();
7777
treeOutline.setShowSelectionOnKeyboardFocus(/* show: */ true, /* preventTabOrder: */ true);
78+
if (options?.expand) {
79+
treeOutline.firstChild()?.expand();
80+
}
7881
return {node: treeOutline.element, tree: treeOutline};
7982
}
8083
}

front_end/ui/legacy/UIUtils.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1812,6 +1812,10 @@ export function formatTimestamp(timestamp: number, full: boolean): string {
18121812
export interface Options {
18131813
title?: string|Element;
18141814
editable?: boolean;
1815+
/**
1816+
* Should the resulting object be expanded.
1817+
*/
1818+
expand?: boolean;
18151819
}
18161820

18171821
export interface HighlightChange {

front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1659,6 +1659,9 @@ export class Renderer implements UI.UIUtils.Renderer {
16591659
section.titleLessMode();
16601660
}
16611661
section.editable = Boolean(options.editable);
1662+
if (options.expand) {
1663+
section.firstChild()?.expand();
1664+
}
16621665
return {node: section.element, tree: section} as {
16631666
node: Node,
16641667
tree: UI.TreeOutline.TreeOutline | null,

0 commit comments

Comments
 (0)