Skip to content

Commit 84b5d95

Browse files
hashseedDevtools-frontend LUCI CQ
authored andcommitted
Fix heap snapshot rename UX
This change fixes three problems: - When the snapshot is renamed to empty string, there is no way to turn on edit mode anymore. To fix this, we cancel the edit if the new name is the empty string. - Because both the .title and the .title-container classes are set to overflow:hidden and text-overflow:ellipsis, we observe the issue in issue 383014858. To fix this, we only apply text-overflow:ellipsis when not editing. We also apply display:flex to auto-adjust the size of the .title span to avoid an overlap with the .subtitle span when editing - We add a small padding-left so that the .title span does not get slightly truncated from the left in some situations after an edit that changes the snapshot to a longer name is committed. Fixed: 383014858 Change-Id: I20967e209d86f59fcbcc29175366e8a62fec41bc Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6088098 Reviewed-by: Ergün Erdoğmuş <[email protected]> Auto-Submit: Yang Guo <[email protected]> Commit-Queue: Yang Guo <[email protected]>
1 parent 9020782 commit 84b5d95

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

front_end/panels/profiler/ProfileSidebarTreeElement.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,14 @@ export class ProfileSidebarTreeElement extends UI.TreeOutline.TreeElement {
9999
}
100100

101101
editingCommitted(_container: Element, newTitle: string): void {
102-
this.editing = null;
103-
this.profile.setTitle(newTitle);
102+
if (newTitle.trim().length === 0) {
103+
if (this.editing) {
104+
this.editing.cancel();
105+
}
106+
} else {
107+
this.editing = null;
108+
this.profile.setTitle(newTitle);
109+
}
104110
}
105111

106112
editingCancelled(): void {

front_end/panels/profiler/profilesSidebarTree.css

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,18 @@ li .titles {
184184

185185
li .titles > .title-container {
186186
z-index: 1;
187+
overflow: hidden;
188+
}
189+
190+
li .titles > .title-container:has(:not(.editing)) {
187191
text-overflow: ellipsis;
192+
}
193+
194+
li .titles > .title-container .title.editing {
195+
display: flex;
188196
overflow: hidden;
197+
margin-inline: 0;
198+
padding-inline: 0;
189199
}
190200

191201
li.small .titles {

0 commit comments

Comments
 (0)