Repository navigation
web: widening a table column widens the table (Qt parity) - #11858
Conversation
There was a problem hiding this comment.
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.
db70a30 to
451c823
Compare
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>
451c823 to
9e5dca1
Compare
|
|
|
Might be helpful to include a before and after screenshot |
|
@gadfort See PR body for before/after animation. |
|
@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 |
|
Claude says regarding Qt, the baseline: OpenROAD's Qt GUI sets the timing path tables and the hierarchy browser to Qt compresses in one place, the path detail tables. Their Pin column is One difference: this PR gives the panel's leftover space to the last column, where Qt's path tables leave it empty. |
maliberty
left a comment
There was a problem hiding this comment.
Correctness
timing-widget.js:641-648bug: 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 becauseautoSized=1anduserSizedis unset, the newmeasuredbranch inmakeResizableHeadersthrows awaysavedWidthsand 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 ontextColumnWidths, or pass the pin width in throughwidthsso it goes through the same path.ui-utils.jsfit()question: if the table is laid out while hidden,th.offsetWidthis 0, so a non-px width (the 30ch pin column) adds 0 tototal. Once the panel is shown, fixed layout widens the table paststyle.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 intextColumnWidthswould 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, sincemin-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.
textColumnWidthstest:w[1] > w[0]is weak. Asserting the exact0.6em*12px+24values 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.measureTextalso works with no layout and would be more accurate. Fine to keep as is if "close enough" is the goal. - nit:
table.fitColumns = fitis an expando on a DOM element. It works, but returningfitfrommakeResizableHeaderswould be cleaner. - (pre-existing)
hierarchy-browser.js:408andselection-browser.js:391pass 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.
|
agy |
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>
|
Review of 9e5dca1, item by item: Correctness
Testing
Other
|
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>
1c5b861
into
The-OpenROAD-Project:master
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.
asap7 gcd, final stage: the hierarchy table, loaded in the default narrow panel, then widened; the first column dragged 220 px wider.
box-sizing: border-box), so the columns add up to the table width and the last column is never squeezed to nothing.ColumnWidthsinui-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):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