Skip to content

web: widening a table column widens the table (Qt parity) - #11858

Merged
maliberty merged 10 commits into
The-OpenROAD-Project:masterfrom
oharboe:web-table-columns
Nov 12, 2026
Merged

maliberty merged 10 commits into
The-OpenROAD-Project:masterfrom
oharboe:web-table-columns

Conversation

@oharboe

@oharboe oharboe commented Oct 20, 2026 •

Copy link
Copy Markdown
Collaborator

A Qt-parity nit. Widening a column of the timing, hierarchy or selection table squeezed every other column, because the table was held at the panel's width in a fixed layout. Reading a long start or end pin name meant squeezing everything else. Qt's header view widens the table and scrolls instead.

Before After
before after

asap7 gcd, final stage: the hierarchy table, loaded in the default narrow panel, then widened; the first column dragged 220 px wider.

  • Table width: the table is now as wide as its columns. A column's width includes its padding (box-sizing: border-box), so the columns add up to the table width and the last column is never squeezed to nothing.
  • Last column: it takes any space the panel has left over, and it resizes too.
  • Scrolling: the panel scrolls sideways past that.
  • Long names: a cell narrower than its text cuts it off with "…", as Qt does, the first column too, which used to wrap. Hovering a cut-off cell shows its full text as a tooltip.
  • Default widths: until a column is dragged, each column is as wide as its widest cell, at most 480 px, measured from the browser's layout (fonts, tree indent, checkboxes, and swatches included). A table filled while its panel is hidden (a slack-histogram click does that) has no layout; it falls back to an estimate from the text of the header and the first 200 rows. The detail table's pin column is measured the same way; it was a fixed 30ch on the first render only.
  • Stable widths: measured widths only grow until new data loads (a new timing report, hierarchy, or selection), so sorting, expanding a module, ticking a checkbox, or selecting another path does not move the columns.
  • Dragged widths: once a column is dragged, its table keeps every width across re-renders: a new path, a sort, expanding a module, a new selection, an empty selection. The selection browser's Selected and Highlighted tabs have different columns and keep their own widths. The hierarchy and selection tables used to lose them on every re-render. The widths are kept on the widget (ColumnWidths in ui-utils.js), not on the table element that each render replaces.

Measuring from the layout costs about 22 ms for a 1000-row table in Chrome (the selection browser's cap; the timing tables hold at most 100 paths), next to the 24 ms its fixed layout takes anyway. A sort of a 108-path timing table redraws in 10-16 ms.

Tests (table_columns_test, new):

  • a dragged column widens the table and leaves the others alone; widths include the padding;
  • the last column resizes and keeps its width when the table is emptied and rebuilt;
  • widths come from the text when there is no layout, to the pixel, including a cell's indent, checkbox, and swatch;
  • no dragged widths are kept until a column is dragged, and widths for other columns are measured again but kept;
  • a measured column does not narrow on a re-render until it is reset;
  • a cut-off cell shows its full text as a tooltip.

timing_widget_test, hierarchy_browser_test, selection_browser_test: the detail table's pin column keeps its width from one path to the next, does not narrow for a shorter path, and is measured afresh for a new report; a dragged column keeps its width across a re-render in the timing, hierarchy, and selection tables, across a selection-browser tab switch, and while the selection table is empty.

Checked in Chrome on ihp-sg13g2 i2c-gpio-expander: timing path and detail tables across Update, sorting, and path changes; hierarchy expand and collapse; selection browser tab switches and filtering.

One of four small Qt-parity nits in the web viewer (#11857, #11858, #11859, #11860), each independent of the others. All four have been in use in a downstream integration since The-OpenROAD-Project/bazel-orfs#1343.

🤖 Generated with Claude Code

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request improves table column resizing and layout behavior across the timing, hierarchy, and selection tables. It introduces a text-based column width measurement strategy (textColumnWidths) to prevent cramped columns when tables are rendered empty or hidden, and updates makeResizableHeaders to dynamically fit columns and support resizing the last column. The feedback highlights potential layout calculation bugs in ui-utils.js when parsing non-pixel CSS units (such as '30ch' or 'rem') for column widths and font sizes, suggesting explicit checks for pixel units before parsing.

Comment thread src/web/src/ui-utils.js Resolved
Comment thread src/web/src/ui-utils.js Resolved
@oharboe
oharboe force-pushed the web-table-columns branch 2 times, most recently from db70a30 to 451c823 Compare October 20, 2026 10:59
Qt parity: dragging a column of the timing, hierarchy or selection
table wider took the width from every other column, because the table
was held at the panel's width in a fixed layout; a long start or end
pin name could only be read by squeezing the rest. Qt's header view
widens the table and scrolls.

The table is now as wide as its columns; the last one takes whatever
the panel has left over and resizes too, and the panel scrolls sideways
past that. A cell narrower than its text elides it, as Qt does.

Until a column is dragged, the columns are sized from their text, the
longest of the header and the first 200 rows, at most 480 px, and sized
again on each render: measured from the layout instead, a table filled
while its panel is hidden (a slack-histogram click fills the timing
table, then shows it) measured every column at 0 px.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
@oharboe
oharboe marked this pull request as ready for review November 2, 2026 06:42
@oharboe
oharboe requested a review from a team as a code owner November 2, 2026 06:42
@oharboe
oharboe requested a review from gadfort November 2, 2026 06:42
@oharboe

oharboe commented Nov 3, 2026

Copy link
Copy Markdown
Collaborator Author

pr-merge fails on //src/grt/test:congestion_acceptance_is_recorded-tcl_test, which this PR does not touch (it changes only src/web/). The test passes locally on master 4155ac3 merged with this PR, as does //src/web/test/.... Other open PRs on the same CI revision fail different unrelated tests (#12090 stt, #12051 gpl/flow, #12009 web), so this looks like CI flakiness; a re-run should clear it.

@gadfort

gadfort commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Might be helpful to include a before and after screenshot

@oharboe

oharboe commented Nov 3, 2026

Copy link
Copy Markdown
Collaborator Author

@gadfort See PR body for before/after animation.

@gadfort

gadfort commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

@oharboe the before seems to compress until the data doesn't fit and then move it off screen, that seems like a better behavior then moving it off screen immediately.

@oharboe

oharboe commented Nov 3, 2026

Copy link
Copy Markdown
Collaborator Author

@oharboe the before seems to compress until the data doesn't fit and then move it off screen, that seems like a better behavior then moving it off screen immediately.

I have to adjust O(n^2) columns the way it is today when endpoint names are very long and I have to read the entire name

@oharboe

oharboe commented Nov 3, 2026

Copy link
Copy Markdown
Collaborator Author

Claude says regarding Qt, the baseline:

OpenROAD's Qt GUI sets the timing path tables and the hierarchy browser to QHeaderView::Interactive, with cascadingSectionResizes and stretchLastSection false (timingWidget.cpp:183, browserWidget.cpp:159-165). Widening one column there leaves the others alone, and the view scrolls sideways. This PR does the same.

Qt compresses in one place, the path detail tables. Their Pin column is Stretch (timingWidget.cpp:600-605), so it alone gives up width; the other columns keep theirs.

One difference: this PR gives the panel's leftover space to the last column, where Qt's path tables leave it empty.

@maliberty maliberty left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correctness

  • timing-widget.js:641-648 bug: the detail table's 30ch pin column only holds on the first render. After that, savedWidths[0] is '30ch', which is truthy, so the 30ch block is skipped. And because autoSized=1 and userSized is unset, the new measured branch in makeResizableHeaders throws away savedWidths and measures from the text again. Picking a second path therefore turns the pin column from 30ch into a text-measured column of up to 480px. Either drop the 30ch special case and rely on textColumnWidths, or pass the pin width in through widths so it goes through the same path.
  • ui-utils.js fit() question: if the table is laid out while hidden, th.offsetWidth is 0, so a non-px width (the 30ch pin column) adds 0 to total. Once the panel is shown, fixed layout widens the table past style.width, and the last column (auto width) is left with no spare space, so it can collapse. Can the detail table be filled while its panel is hidden (histogram click → auto-select)? If so, converting ch to px with the font size you already read in textColumnWidths would avoid it.
  • last-column grip nit: when the panel is wider than the table, the last column draws wider than lastMin. Dragging its grip inward then changes nothing visible, since min-width:100% wins. That matches Qt's stretch-last behavior, so this is mostly a UX question about whether the grip should be shown there.

Testing

  • Missing: the transition from an auto-sized render to a re-render with saved widths, which is the path behind the 30ch issue above. Add a TimingWidget test that renders the detail table twice and checks the pin column width.
  • textColumnWidths test: w[1] > w[0] is weak. Asserting the exact 0.6em*12px+24 values would catch formula drift.

Other

  • suggestion: the 0.6em-per-char estimate assumes monospace, but header text is not monospace and includes the sort arrows. canvas.measureText also works with no layout and would be more accurate. Fine to keep as is if "close enough" is the goal.
  • nit: table.fitColumns = fit is an expando on a DOM element. It works, but returning fit from makeResizableHeaders would be cleaner.
  • (pre-existing) hierarchy-browser.js:408 and selection-browser.js:391 pass no widths, so a dragged width is lost on every re-render (e.g. expand/collapse). The new "until a column is dragged" comment promises more than these callers deliver. Consider saving widths there the way timing-widget does.
  • style.css: .timing-table td:first-child { white-space: normal; word-break: break-all } still wraps the first column, so the new ellipsis rule doesn't apply to it. Make sure that's intended.

The direction is good and the change is well scoped. Main ask: fix the detail-table pin column changing width after the first render, and add a test for it.

@maliberty

Copy link
Copy Markdown
Member

agy
== Priority 1 (correctness) ==
- src/web/src/timing-widget.js:642-648 bug: _renderDetailTable()
overrides pinTh.style.width = '30ch' on first render
(!savedWidths[0]), which causes two issues: (1) if rendered while the
panel is hidden (offsetWidth === 0), fitColumns() evaluates '30ch'
as 0px and omits the Pin column from table.style.width; (2) on the
next render before any user drag, savedWidths[0] is '30ch' (truthy,
so if (!savedWidths[0]) is skipped) while makeResizableHeaders sees
measured === true and replaces it with textColumnWidths(), causing
the Pin column width to jump on the second path selection. Since
textColumnWidths() now sizes columns from content, can the '30ch'
override be removed?
- src/web/src/style.css:2558-2561 bug: .timing-table tbody td
(specificity 0,1,2) adds white-space: nowrap; overflow: hidden; text-overflow: ellipsis;, but .timing-table td:first-child at lines
2641-2645 has higher specificity (0,2,1) and still sets white-space: normal; word-break: break-all;, so the first column of .timing-table
(Pin in the detail table, Clock in the path table) wraps across lines
instead of eliding with ….
- src/web/src/ui-utils.js:646-652 bug: HierarchyBrowser._render()
(src/web/src/hierarchy-browser.js:408) calls
makeResizableHeaders(this._table) without savedWidths on every tree
expand/collapse or visibility checkbox toggle; because !widths is true,
any user-dragged column widths (and lastMinWidth) are reset to
textColumnWidths() on expand/collapse. (Similarly,
SelectionBrowser._renderTable() in
src/web/src/selection-browser.js:281,391 recreates <table> on sort.)

oharboe and others added 5 commits November 6, 2026 22:13
The pin column was set to 30ch after makeResizableHeaders had measured
it, and only on the first render: the next render saw '30ch' as a saved
width, and the table, auto-sized and never dragged, measured from its
text again.  Picking a second path turned the pin column from 30ch into
up to 480 px.  The pin column is now measured from its text on every
render, as every other column is, so no width in other units is left
and fit() no longer reads one from the layout (0 while the panel is
hidden).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
The detail table's 30ch pin column was its only caller.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
The hierarchy and selection tables passed no widths to
makeResizableHeaders, so a dragged width was lost on every re-render:
expanding or collapsing a module, a sort, a new selection.  The
timing tables passed their header widths back on every render, dragged
or measured, and makeResizableHeaders told the two apart with flags.

savedColumnWidths() now gives the widths to pass back, undefined until
a column was dragged; all four tables use it.  The widths are kept on
the table, last column included, so a table emptied in between (the
detail table with no path selected) and a table replaced outright (the
selection browser builds a new one per render) keep them.  Widths for
a different set of columns (the selection browser's other tab) are
measured again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
The first column of the timing and hierarchy tables wrapped a long
name, from 3c3acad, when the pin column was a fixed 30ch.  It is
now measured from its text and can be dragged wider, so it elides
with an ellipsis like every other column, as Qt does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
At a pinned font size, so a change to the 0.6 em estimate or the
24 px of padding and grip shows.  The 12 px fallback is for a missing
getComputedStyle; jsdom has one and reports 16 px.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
@oharboe

oharboe commented Nov 6, 2026

Copy link
Copy Markdown
Collaborator Author

Review of 9e5dca1, item by item:

Correctness

  • Detail-table pin column after the first render: confirmed, it went from 30ch to the measured width on the second path. 72c335e drops the 30ch special case; the pin column is measured from its text on every render, like the other columns.
  • fit() on a hidden table: the 30ch column was the only width not in px. With it gone, fit() sums px widths only and no longer reads offsetWidth (72c335e).
  • Last-column grip: kept, as Qt's stretch-last section keeps its handle.

Testing

  • timing_widget_test: the detail table is rendered for two paths, and the pin column must be 216 px both times (it fails on 9e5dca1 with 30ch). A second case drags the pin column to 300 px and picks the next path.
  • textColumnWidths asserts the exact widths at a pinned 10 px font: [54, 66, 480] (8a154a7). jsdom reports 16 px, not the 12 px fallback, so the fallback comment now says it is for a missing getComputedStyle.

Other

  • canvas.measureText: kept the 0.6 em estimate. jsdom has no canvas, so the measured path would be a second path no test runs. The estimate is only the starting width; a dragged width is exact.
  • fitColumns expando: removed (c6207d3). No caller is left after 72c335e, so makeResizableHeaders returns nothing rather than an unused fit.
  • Hierarchy and selection tables losing dragged widths: fixed in 0fd978f. savedColumnWidths(table) returns the widths to pass back, undefined until a column is dragged, and all four tables use it. The widths are kept on the table, last column included, so a table emptied in between (the detail table with no path selected) or replaced (the selection browser builds a new one each render) keeps them. This also replaces the autoSized/userSized flags. New tests in hierarchy_browser_test and selection_browser_test fail on 9e5dca1.
  • .timing-table td:first-child wrap: removed (0622271). It came with 3c3acad for the fixed 30ch pin column; the first column now elides like the others.

bazel test //src/web/...: 59 tests pass.

@oharboe
oharboe requested review from jorge-ferreira-pii and removed request for gadfort November 12, 2026 06:12
src/web/src/timing-widget.js: master imports withBusyCursor and adds
detailRows (Expand clock) where this branch imports savedColumnWidths;
the import takes all of them and detailRows is kept.

src/web/test/js/test-timing-widget.js: master's Expand clock tests and
this branch's detail table column tests were added at the same spot;
both are kept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Signed-off-by: Matt Liberty <mliberty@precisioninno.com>

# Conflicts:
#	src/web/test/js/test-timing-widget.js
Each table keeps a ColumnWidths state on its widget rather than on the
table element, so dragged widths survive an empty selection and each
selection-browser tab keeps its own.  Measured widths only grow until new
data loads, so sorting, expanding a tree node, or selecting another path
no longer moves the columns.

Columns are measured from the browser's layout when the table has one
(fonts, tree indent, checkboxes, and swatches included), falling back to
the text estimate for a hidden panel; the estimate now counts a cell's
indent and inline widgets.  An elided cell shows its full text as a
tooltip.  A drag on the last column starts from its shown width.

Signed-off-by: Matt Liberty <mliberty@precisioninno.com>
Header widths are measured and dragged as border-box widths but were
applied as content-box, so every column grew by its padding and the
fixed table width squeezed the last column to nothing.  Headers now use
box-sizing: border-box.

Signed-off-by: Matt Liberty <mliberty@precisioninno.com>
@github-actions github-actions Bot added size/L and removed size/M labels Nov 12, 2026
@maliberty
maliberty enabled auto-merge November 12, 2026 18:22
@maliberty
maliberty merged commit 1c5b861 into The-OpenROAD-Project:master Nov 12, 2026
19 of 21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants