From 60d46afa72865636c9c7852afea9a3a4d4df91ef Mon Sep 17 00:00:00 2001 From: Johannes Bechberger Date: Mon, 24 Oct 2022 17:41:12 +0200 Subject: [PATCH 01/14] Implement table resize --- src/actions/profile-view.js | 12 + src/components/app/ZipFileViewer.js | 2 + src/components/calltree/CallTree.css | 15 - src/components/calltree/CallTree.js | 59 +- src/components/marker-table/index.js | 39 +- src/components/shared/TreeView.css | 26 +- src/components/shared/TreeView.js | 315 +- src/reducers/profile-view.js | 46 + src/selectors/profile.js | 12 + .../__snapshots__/MarkerTable.test.js.snap | 216 ++ .../ProfileCallTreeView.test.js.snap | 2713 ++++++++++++++++- src/types/actions.js | 6 + src/types/state.js | 7 + 13 files changed, 3392 insertions(+), 76 deletions(-) diff --git a/src/actions/profile-view.js b/src/actions/profile-view.js index 643c6e6dec..73d3018bcf 100644 --- a/src/actions/profile-view.js +++ b/src/actions/profile-view.js @@ -73,6 +73,7 @@ import type { Tid, GlobalTrack, KeyboardModifiers, + TableViewOptions, } from 'firefox-profiler/types'; import { funcHasDirectRecursiveCall, @@ -1924,6 +1925,17 @@ export function changeMouseTimePosition( }; } +export function changeTableViewOptions( + tab: TabSlug, + tableViewOptions: TableViewOptions +): Action { + return { + type: 'CHANGE_TABLE_VIEW_OPTIONS', + tab, + tableViewOptions, + }; +} + export function openSourceView(file: string, currentTab: TabSlug): Action { return { type: 'OPEN_SOURCE_VIEW', diff --git a/src/components/app/ZipFileViewer.js b/src/components/app/ZipFileViewer.js index 228b4ed457..550eeb34e4 100644 --- a/src/components/app/ZipFileViewer.js +++ b/src/components/app/ZipFileViewer.js @@ -24,6 +24,7 @@ import { import { getPathInZipFileFromUrl } from 'firefox-profiler/selectors/url-state'; import { TreeView } from 'firefox-profiler/components/shared/TreeView'; import { ProfileViewer } from './ProfileViewer'; +import { defaultTableViewOptions } from 'firefox-profiler/reducers/profile-view'; import type { ConnectedProps } from 'firefox-profiler/utils/connect'; import type { ZipFileState } from 'firefox-profiler/types'; @@ -269,6 +270,7 @@ class ZipFileViewerImpl extends React.PureComponent { rowHeight={30} indentWidth={15} onEnterKey={this._onEnterKey} + viewOptions={defaultTableViewOptions} /> diff --git a/src/components/calltree/CallTree.css b/src/components/calltree/CallTree.css index 7134a4daa8..3f5702c346 100644 --- a/src/components/calltree/CallTree.css +++ b/src/components/calltree/CallTree.css @@ -7,20 +7,6 @@ text-align: right; } -.treeViewFixedColumn.total { - width: 70px; -} - -/* The header for the total column spans both totalPercent and total columns */ -.treeViewHeaderColumn.total { - width: 120px; -} - -.treeViewFixedColumn.totalPercent { - width: 50px; - border-right: none; -} - /* The header for the totalPercent column is not visible */ .treeViewHeaderColumn.totalPercent { display: none; @@ -32,7 +18,6 @@ .treeViewFixedColumn.icon { display: flex; - width: 19px; flex-flow: column nowrap; align-items: center; } diff --git a/src/components/calltree/CallTree.js b/src/components/calltree/CallTree.js index 464efc9bf1..c737b03bb4 100644 --- a/src/components/calltree/CallTree.js +++ b/src/components/calltree/CallTree.js @@ -21,6 +21,7 @@ import { getFocusCallTreeGeneration, getPreviewSelection, getCategories, + getCurrentTableViewOptions, } from 'firefox-profiler/selectors/profile'; import { selectedThreadSelectors } from 'firefox-profiler/selectors/per-thread'; import { @@ -30,6 +31,7 @@ import { addTransformToStack, handleCallNodeTransformShortcut, openSourceView, + changeTableViewOptions, } from 'firefox-profiler/actions/profile-view'; import { assertExhaustiveCheck } from 'firefox-profiler/utils/flow'; @@ -42,6 +44,7 @@ import type { IndexIntoCallNodeTable, CallNodeDisplayData, WeightType, + TableViewOptions, } from 'firefox-profiler/types'; import type { CallTree as CallTreeType } from 'firefox-profiler/profile-logic/call-tree'; @@ -66,6 +69,7 @@ type StateProps = {| +implementationFilter: ImplementationFilter, +callNodeMaxDepth: number, +weightType: WeightType, + +tableViewOptions: TableViewOptions, |}; type DispatchProps = {| @@ -75,6 +79,7 @@ type DispatchProps = {| +addTransformToStack: typeof addTransformToStack, +handleCallNodeTransformShortcut: typeof handleCallNodeTransformShortcut, +openSourceView: typeof openSourceView, + +onTableViewOptionsChange: (TableViewOptions) => any, |}; type Props = ConnectedProps<{||}, StateProps, DispatchProps>; @@ -100,40 +105,81 @@ class CallTreeImpl extends PureComponent { switch (weightType) { case 'tracing-ms': return [ - { propName: 'totalPercent', titleL10nId: '' }, + { + propName: 'totalPercent', + titleL10nId: '', + initialWidth: 50, + hideDividerAfter: true, + }, { propName: 'total', titleL10nId: 'CallTree--tracing-ms-total', + minWidth: 30, + initialWidth: 70, + resizable: true, + headerWidthAdjustment: 50, }, { propName: 'self', titleL10nId: 'CallTree--tracing-ms-self', + minWidth: 30, + initialWidth: 70, + resizable: true, }, { propName: 'icon', titleL10nId: '', component: Icon }, ]; case 'samples': return [ - { propName: 'totalPercent', titleL10nId: '' }, + { + propName: 'totalPercent', + titleL10nId: '', + initialWidth: 50, + hideDividerAfter: true, + }, { propName: 'total', titleL10nId: 'CallTree--samples-total', + minWidth: 30, + initialWidth: 70, + resizable: true, + headerWidthAdjustment: 50, }, { propName: 'self', titleL10nId: 'CallTree--samples-self', + minWidth: 30, + initialWidth: 70, + resizable: true, + }, + { + propName: 'icon', + titleL10nId: '', + component: Icon, + initialWidth: 10, }, - { propName: 'icon', titleL10nId: '', component: Icon }, ]; case 'bytes': return [ - { propName: 'totalPercent', titleL10nId: '' }, + { + propName: 'totalPercent', + titleL10nId: '', + initialWidth: 50, + hideDividerAfter: true, + }, { propName: 'total', titleL10nId: 'CallTree--bytes-total', + minWidth: 30, + initialWidth: 140, + resizable: true, + headerWidthAdjustment: 50, }, { propName: 'self', titleL10nId: 'CallTree--bytes-self', + minWidth: 30, + initialWidth: 90, + resizable: true, }, { propName: 'icon', titleL10nId: '', component: Icon }, ]; @@ -326,6 +372,8 @@ class CallTreeImpl extends PureComponent { onKeyDown={this._onKeyDown} onEnterKey={this._onEnterOrDoubleClick} onDoubleClick={this._onEnterOrDoubleClick} + viewOptions={this.props.tableViewOptions} + onViewOptionsChange={this.props.onTableViewOptionsChange} /> ); } @@ -355,6 +403,7 @@ export const CallTree = explicitConnect<{||}, StateProps, DispatchProps>({ callNodeMaxDepth: selectedThreadSelectors.getFilteredCallNodeMaxDepth(state), weightType: selectedThreadSelectors.getWeightTypeForCallTree(state), + tableViewOptions: getCurrentTableViewOptions(state), }), mapDispatchToProps: { changeSelectedCallNode, @@ -363,6 +412,8 @@ export const CallTree = explicitConnect<{||}, StateProps, DispatchProps>({ addTransformToStack, handleCallNodeTransformShortcut, openSourceView, + onTableViewOptionsChange: (options: TableViewOptions) => + changeTableViewOptions('calltree', options), }, component: CallTreeImpl, }); diff --git a/src/components/marker-table/index.js b/src/components/marker-table/index.js index 1f85812064..b222efeafb 100644 --- a/src/components/marker-table/index.js +++ b/src/components/marker-table/index.js @@ -14,12 +14,14 @@ import { getZeroAt, getScrollToSelectionGeneration, getMarkerSchemaByName, + getCurrentTableViewOptions, } from '../../selectors/profile'; import { selectedThreadSelectors } from '../../selectors/per-thread'; import { getSelectedThreadsKey } from '../../selectors/url-state'; import { changeSelectedMarker, changeRightClickedMarker, + changeTableViewOptions, } from '../../actions/profile-view'; import { MarkerSettings } from '../shared/MarkerSettings'; import { formatSeconds, formatTimestamp } from '../../utils/format-numbers'; @@ -32,6 +34,7 @@ import type { MarkerIndex, Milliseconds, MarkerSchemaByName, + TableViewOptions, } from 'firefox-profiler/types'; import type { ConnectedProps } from '../../utils/connect'; @@ -149,20 +152,40 @@ type StateProps = {| +scrollToSelectionGeneration: number, +markerSchemaByName: MarkerSchemaByName, +getMarkerLabel: (MarkerIndex) => string, + +tableViewOptions: TableViewOptions, |}; type DispatchProps = {| +changeSelectedMarker: typeof changeSelectedMarker, +changeRightClickedMarker: typeof changeRightClickedMarker, + +onTableViewOptionsChange: (TableViewOptions) => any, |}; type Props = ConnectedProps<{||}, StateProps, DispatchProps>; class MarkerTableImpl extends PureComponent { _fixedColumns = [ - { propName: 'start', titleL10nId: 'MarkerTable--start' }, - { propName: 'duration', titleL10nId: 'MarkerTable--duration' }, - { propName: 'type', titleL10nId: 'MarkerTable--type' }, + { + propName: 'start', + titleL10nId: 'MarkerTable--start', + minWidth: 30, + initialWidth: 90, + resizable: true, + }, + { + propName: 'duration', + titleL10nId: 'MarkerTable--duration', + minWidth: 30, + initialWidth: 80, + resizable: true, + }, + { + propName: 'type', + titleL10nId: 'MarkerTable--type', + minWidth: 30, + initialWidth: 150, + resizable: true, + }, ]; _mainColumn = { propName: 'name', titleL10nId: 'MarkerTable--description' }; _expandedNodeIds: Array = []; @@ -247,6 +270,8 @@ class MarkerTableImpl extends PureComponent { contextMenuId="MarkerContextMenu" rowHeight={16} indentWidth={10} + viewOptions={this.props.tableViewOptions} + onViewOptionsChange={this.props.onTableViewOptionsChange} /> )} @@ -266,7 +291,13 @@ export const MarkerTable = explicitConnect<{||}, StateProps, DispatchProps>({ zeroAt: getZeroAt(state), markerSchemaByName: getMarkerSchemaByName(state), getMarkerLabel: selectedThreadSelectors.getMarkerTableLabelGetter(state), + tableViewOptions: getCurrentTableViewOptions(state), }), - mapDispatchToProps: { changeSelectedMarker, changeRightClickedMarker }, + mapDispatchToProps: { + changeSelectedMarker, + changeRightClickedMarker, + onTableViewOptionsChange: (tableViewOptions) => + changeTableViewOptions('marker-table', tableViewOptions), + }, component: MarkerTableImpl, }); diff --git a/src/components/shared/TreeView.css b/src/components/shared/TreeView.css index dda999b6ad..75413faa23 100644 --- a/src/components/shared/TreeView.css +++ b/src/components/shared/TreeView.css @@ -77,29 +77,37 @@ .treeViewHeaderColumn { position: relative; - box-sizing: border-box; - padding: 0 5px; line-height: 15px; white-space: nowrap; } .treeViewFixedColumn { overflow: hidden; - padding: 0 5px; text-overflow: ellipsis; } +.treeViewColumnDivider { + width: 20px; + text-align: center; + display: inline-block; + flex: none; + margin-left: -5px; + margin-right: -5px; +} +.treeViewColumnDivider[resize=true]:hover { + cursor: col-resize; +} + +.treeViewColumnDivider span { + border-right: 1px solid var(--grey-30); + box-sizing: border-box; +} + .treeViewHeaderColumn.treeViewFixedColumn { /* The fixed columns in the row don't shrink because they're positioning using * position: sticky, therefore we prevent shrinking for the columns in the * header too. */ flex: none; - border-right: 1px solid #e2e2e2; -} - -.treeViewRowColumn.treeViewFixedColumn { - box-sizing: border-box; - border-right: 1px solid var(--grey-30); } .treeBadge { diff --git a/src/components/shared/TreeView.js b/src/components/shared/TreeView.js index fa0c0a03ce..dc3a5d5950 100644 --- a/src/components/shared/TreeView.js +++ b/src/components/shared/TreeView.js @@ -16,7 +16,7 @@ import { VirtualList } from './VirtualList'; import { ContextMenuTrigger } from './ContextMenuTrigger'; -import type { CssPixels } from 'firefox-profiler/types'; +import type { CssPixels, TableViewOptions } from 'firefox-profiler/types'; import './TreeView.css'; @@ -51,42 +51,109 @@ export type Column = {| +component?: React.ComponentType<{| displayData: DisplayData, |}>, + /** defaults to initialWidth */ + +minWidth?: CssPixels, + /** has only to be present in resizable columns */ + +initialWidth?: CssPixels, + /** found width + adjustment = width of header column */ + +headerWidthAdjustment?: CssPixels, + // false by default + +resizable?: boolean, + +hideDividerAfter?: boolean, |}; type TreeViewHeaderProps = {| +fixedColumns: Column[], +mainColumn: Column, + +viewOptions: TableViewOptions, + // called when the users moves the divider right of the column, + // passes the column index and the start x coordinate + +onColumnWidthChangeStart: (number, CssPixels) => void, + +onColumnWidthReset: (number) => void, |}; -const TreeViewHeader = ({ - fixedColumns, - mainColumn, -}: TreeViewHeaderProps) => { - if (fixedColumns.length === 0 && !mainColumn.titleL10nId) { - // If there is nothing to display in the header, do not render it. - return null; - } - return ( -
- {fixedColumns.map((col) => ( +class TreeViewHeader extends React.PureComponent< + TreeViewHeaderProps +> { + _onDividerMouseDown = (event: SyntheticMouseEvent<>) => { + this.props.onColumnWidthChangeStart( + // $FlowExpectError - we know that the target has this field + Number(event.target.attributes.columnIndex.value), + event.clientX + ); + event.stopPropagation(); + }; + + _onDividerDoubleClick = (event: SyntheticMouseEvent<>) => { + this.props.onColumnWidthReset( + // $FlowExpectError - we know that the target has this field + Number(event.target.attributes.columnIndex.value) + ); + event.stopPropagation(); + }; + + render() { + const { fixedColumns, mainColumn, viewOptions } = this.props; + const columnWidths = viewOptions.fixedColumnWidths; + if (fixedColumns.length === 0 && !mainColumn.titleL10nId) { + // If there is nothing to display in the header, do not render it. + return null; + } + return ( +
+ {fixedColumns.map((col, i) => { + const style = + columnWidths || col.initialWidth + ? { + width: + (columnWidths ? columnWidths[i] : col.initialWidth) + + (col.headerWidthAdjustment || 0), + } + : {}; + return ( + <> + + + + {col.hideDividerAfter !== true ? ( + + + + ) : null} + + ); + })} - ))} - - - -
- ); -}; +
+ ); + } +} function reactStringWithHighlightedSubstrings( string: string, @@ -130,6 +197,11 @@ type TreeViewRowFixedColumnsProps = {| +onClick: (NodeIndex, SyntheticMouseEvent<>) => mixed, +highlightRegExp: RegExp | null, +rowHeightStyle: { height: CssPixels, lineHeight: string }, + +viewOptions: TableViewOptions, + // called when the users moves the divider right of the column, + // passes the column index and the start x coordinate + +onColumnWidthChangeStart: (number, CssPixels) => void, + +onColumnWidthReset: (number) => void, |}; class TreeViewRowFixedColumns extends React.PureComponent< @@ -140,16 +212,35 @@ class TreeViewRowFixedColumns extends React.PureComponent< onClick(nodeId, event); }; + _onDividerMouseDown = (event: SyntheticMouseEvent<>) => { + this.props.onColumnWidthChangeStart( + // $FlowExpectError - we know that the target has this field + Number(event.target.attributes.columnIndex.value), + event.clientX + ); + event.stopPropagation(); + }; + + _onDividerDoubleClick = (event: SyntheticMouseEvent<>) => { + this.props.onColumnWidthReset( + // $FlowExpectError - we know that the target has this field + Number(event.target.attributes.columnIndex.value) + ); + event.stopPropagation(); + }; + render() { const { displayData, columns, + viewOptions, index, isSelected, isRightClicked, highlightRegExp, rowHeightStyle, } = this.props; + const columnWidths = viewOptions.fixedColumnWidths; return (
extends React.PureComponent< style={rowHeightStyle} onMouseDown={this._onClick} > - {columns.map((col) => { + {columns.map((col, i) => { const RenderComponent = col.component; const text = displayData[col.propName] || ''; - + const style = + columnWidths || col.initialWidth + ? { + width: columnWidths ? columnWidths[i] : col.initialWidth, + } + : {}; return ( - - {RenderComponent ? ( - - ) : ( - reactStringWithHighlightedSubstrings( - text, - highlightRegExp, - 'treeViewHighlighting' - ) - )} - + <> + + {RenderComponent ? ( + + ) : ( + reactStringWithHighlightedSubstrings( + text, + highlightRegExp, + 'treeViewHighlighting' + ) + )} + + {col.hideDividerAfter !== true ? ( + + + + ) : null} + ); })}
@@ -393,13 +509,25 @@ type TreeViewProps = {| +rowHeight: CssPixels, +indentWidth: CssPixels, +onKeyDown?: (SyntheticKeyboardEvent<>) => void, + +viewOptions: TableViewOptions, + +onViewOptionsChange?: (TableViewOptions) => void, +|}; + +type TreeViewState = {| + +fixedColumnWidths?: Array, |}; export class TreeView extends React.PureComponent< - TreeViewProps + TreeViewProps, + TreeViewState > { _list: VirtualList | null = null; _takeListRef = (list: VirtualList | null) => (this._list = list); + _currentMovedColumnState: { columnIndex: number, lastX: CssPixels } | null = + null; + state = { + fixedColumnWidths: undefined, + }; // The tuple `specialItems` always contains 2 elements: the first element is // the selected node id (if any), and the second element is the right clicked @@ -421,6 +549,97 @@ export class TreeView extends React.PureComponent< { limit: 1 } ); + _getCurrentFixedColumnWidths = (): Array => { + const widths = + this.state.fixedColumnWidths || + this.props.viewOptions.fixedColumnWidths || + this.props.fixedColumns.map((c) => c.initialWidth); + if (widths === undefined) { + throw new Error('The fixed column widths should be defined.'); + } + // $FlowExpectError - Flow doesn't understand that we checked that widths is defined. + return widths; + }; + + _getCurrentViewOptions = (): TableViewOptions => { + const widths = this._getCurrentFixedColumnWidths(); + return { + ...this.props.viewOptions, + fixedColumnWidths: widths, + }; + }; + + _onColumnWidthChangeStart = (columnIndex: number, startX: CssPixels) => { + this._currentMovedColumnState = { columnIndex, lastX: startX }; + window.addEventListener('mousemove', this._onColumnWidthChangeMouseMove); + window.addEventListener('mouseup', this._onColumnWidthChangeMouseUp); + }; + + _onColumnWidthChangeMouseMove = (event: MouseEvent) => { + const columnState = this._currentMovedColumnState; + if (columnState !== null) { + const { columnIndex, lastX } = columnState; + const column = this.props.fixedColumns[columnIndex]; + const fixedColumnWidths = this._getCurrentFixedColumnWidths(); + columnState.lastX = event.clientX; + const diff = event.clientX - lastX; + if (column.minWidth === undefined) { + console.warn( + "Minimal width is undefined for the column '" + JSON.stringify(column) + ); + } + const newWidth = Math.max( + fixedColumnWidths[columnIndex] + diff, + column.minWidth || 0 + ); + this.setState((prevState) => { + const newFixedColumnWidths = ( + prevState.fixedColumnWidths || fixedColumnWidths + ).slice(); + newFixedColumnWidths[columnIndex] = newWidth; + return { + fixedColumnWidths: newFixedColumnWidths, + }; + }); + event.stopPropagation(); + } + }; + + _onColumnWidthChangeMouseUp = (event: MouseEvent) => { + window.removeEventListener('mousemove', this._onColumnWidthChangeMouseMove); + window.removeEventListener('mouseup', this._onColumnWidthChangeMouseUp); + this._currentMovedColumnState = null; + this._propagateColumnWidthChange(this._getCurrentFixedColumnWidths()); + event.stopPropagation(); + }; + + _onColumnWidthReset = (columnIndex: number) => { + const column = this.props.fixedColumns[columnIndex]; + const fixedColumnWidths = + this.state.fixedColumnWidths || this.props.viewOptions.fixedColumnWidths; + if (fixedColumnWidths) { + if (column.initialWidth === undefined) { + console.warn( + "Can't reset the width of a column without an initial width." + ); + } else { + fixedColumnWidths[columnIndex] = column.initialWidth; + } + this._propagateColumnWidthChange(fixedColumnWidths); + } + }; + + // triggers a re-render + _propagateColumnWidthChange = (fixedColumnWidths: Array) => { + const { onViewOptionsChange, viewOptions } = this.props; + if (onViewOptionsChange) { + onViewOptionsChange({ + ...viewOptions, + fixedColumnWidths, + }); + } + }; + _computeAllVisibleRowsMemoized = memoize( (tree: Tree, expandedNodes: Set) => { function _addVisibleRowsFromNode(tree, expandedNodes, arr, nodeId) { @@ -482,6 +701,7 @@ export class TreeView extends React.PureComponent< extends React.PureComponent< onClick={this._onRowClicked} highlightRegExp={highlightRegExp || null} rowHeightStyle={rowHeightStyle} + onColumnWidthChangeStart={this._onColumnWidthChangeStart} + onColumnWidthReset={this._onColumnWidthReset} /> ); } @@ -749,7 +971,13 @@ export class TreeView extends React.PureComponent< } = this.props; return (
- + extends React.PureComponent< // at 3000 wide. containerWidth={Math.max(3000, maxNodeDepth * 10 + 2000)} ref={this._takeListRef} + key={JSON.stringify(this._getCurrentViewOptions())} /> {contextMenu} diff --git a/src/reducers/profile-view.js b/src/reducers/profile-view.js index 6474fcd0f1..311fc0af64 100644 --- a/src/reducers/profile-view.js +++ b/src/reducers/profile-view.js @@ -24,17 +24,20 @@ import type { SymbolicationStatus, ThreadViewOptions, ThreadViewOptionsPerThreads, + TableViewOptionsPerTab, RightClickedCallNode, MarkerReference, ActiveTabTimeline, CallNodePath, ThreadsKey, Milliseconds, + TableViewOptions, } from 'firefox-profiler/types'; import { applyFuncSubstitutionToCallPath, applyFuncSubstitutionToPathSetAndIncludeNewAncestors, } from '../profile-logic/symbolication'; +import type { TabSlug } from '../app-logic/tabs-handling'; import { objectMap } from '../utils/flow'; @@ -405,6 +408,48 @@ const viewOptionsPerThread: Reducer = ( } }; +export const defaultTableViewOptions: TableViewOptions = { + fixedColumnWidths: null, +}; + +function _getTableViewOptions(state: TableViewOptionsPerTab, tab: TabSlug) { + const options = state[tab]; + if (options) { + return options; + } + return defaultThreadViewOptions; +} + +function _updateTableViewOptions( + state: TableViewOptionsPerTab, + tab: TabSlug, + updates: $Shape +): TableViewOptionsPerTab { + const newState = { ...state }; + newState[tab] = { + ..._getTableViewOptions(state, tab), + ...updates, + }; + return newState; +} + +const tableViewOptionsPerTab: Reducer = ( + state = ({}: TableViewOptionsPerTab), + action +): TableViewOptionsPerTab => { + console.log(action); + switch (action.type) { + case 'CHANGE_TABLE_VIEW_OPTIONS': + return _updateTableViewOptions( + state, + action.tab, + action.tableViewOptions + ); + default: + return state; + } +}; + const waitingForLibs: Reducer> = ( state = new Set(), action @@ -721,6 +766,7 @@ const profileViewReducer: Reducer = wrapReducerInResetter( rightClickedMarker, hoveredMarker, mouseTimePosition, + perTable: tableViewOptionsPerTab, }), profile, full: combineReducers({ diff --git a/src/selectors/profile.js b/src/selectors/profile.js index 5b819ca7ab..8401e3a9df 100644 --- a/src/selectors/profile.js +++ b/src/selectors/profile.js @@ -21,6 +21,8 @@ import { } from '../profile-logic/marker-data'; import { markerSchemaFrontEndOnly } from '../profile-logic/marker-schema'; import { getDefaultCategories } from 'firefox-profiler/profile-logic/data-structures'; +import { defaultTableViewOptions } from '../reducers/profile-view'; +import type { TabSlug } from '../app-logic/tabs-handling'; import type { Profile, @@ -75,6 +77,7 @@ import type { SampleUnits, IndexIntoSamplesTable, ExtraProfileInfoSection, + TableViewOptions, } from 'firefox-profiler/types'; export const getProfileView: Selector = (state) => @@ -93,6 +96,9 @@ export const getOriginsProfileView: Selector = (state) => export const getProfileViewOptions: Selector< $PropertyType > = (state) => getProfileView(state).viewOptions; +export const getCurrentTableViewOptions: Selector = (state) => + getProfileViewOptions(state).perTable[UrlState.getSelectedTab(state)] || + defaultTableViewOptions; export const getProfileRootRange: Selector = (state) => getProfileViewOptions(state).rootRange; export const getSymbolicationStatus: Selector = (state) => @@ -122,6 +128,12 @@ export const getCommittedRange: Selector = createSelector( export const getMouseTimePosition: Selector = (state) => getProfileViewOptions(state).mouseTimePosition; +export const getTableViewOptionSelectors: (TabSlug) => Selector = + (tab) => (state) => { + const options = getProfileViewOptions(state).perTable[tab]; + return options || defaultTableViewOptions; + }; + export const getPreviewSelection: Selector = (state) => getProfileViewOptions(state).previewSelection; diff --git a/src/test/components/__snapshots__/MarkerTable.test.js.snap b/src/test/components/__snapshots__/MarkerTable.test.js.snap index a46aaa6901..601754d870 100644 --- a/src/test/components/__snapshots__/MarkerTable.test.js.snap +++ b/src/test/components/__snapshots__/MarkerTable.test.js.snap @@ -88,19 +88,46 @@ exports[`MarkerTable renders some basic markers and updates when needed 1`] = ` > Start + + + Duration + + + Type + + + @@ -136,22 +163,49 @@ exports[`MarkerTable renders some basic markers and updates when needed 1`] = ` > 0.000s + + + 0s + + + UserTiming + + +
0.002s + + + + + + Paint + + +
0.108s + + + unknown + + + IPC + + +
0.153s + + + 584.00ns + + + Text + + +
0.153s + + + 584.00ns + + + Text + + +
0.158s + + + + + + Log + + +
0.162s + + + 1ms + + + FileIO + + +
diff --git a/src/test/components/__snapshots__/ProfileCallTreeView.test.js.snap b/src/test/components/__snapshots__/ProfileCallTreeView.test.js.snap index 53f3829e06..c97f4c50a5 100644 --- a/src/test/components/__snapshots__/ProfileCallTreeView.test.js.snap +++ b/src/test/components/__snapshots__/ProfileCallTreeView.test.js.snap @@ -150,9 +150,11 @@ exports[`ProfileCallTreeView with JS Allocations matches the snapshot for JS all > Total Size (bytes) + + + Self (bytes) + + + + + + @@ -207,22 +235,41 @@ allocated or deallocated in the program." > 100% 15 + + + + + + + + +
100% 15 + + + + + + + + +
80% 12 + + + + + + + + +
80% 12 + + + 5 + + + + + +
47% 7 + + + + + + + + +
47% 7 + + + 7 + + + + + +
20% 3 + + + + + + + + +
@@ -821,9 +1038,11 @@ exports[`ProfileCallTreeView with balanced native allocations matches the snapsh > Total Size (bytes) + + + Self (bytes) + + + + + + @@ -878,22 +1123,41 @@ allocated or deallocated in the program." > -100% -15 + + + + + + + + +
-100% -15 + + + + + + + + +
-80% -12 + + + + + + + + +
-80% -12 + + + -5 + + + + + +
-47% -7 + + + + + + + + +
-47% -7 + + + -7 + + + + + +
-20% -3 + + + + + + + + +
@@ -1492,9 +1926,11 @@ exports[`ProfileCallTreeView with balanced native allocations matches the snapsh > Total Size (bytes) + + + Self (bytes) + + + + + + @@ -1549,22 +2011,41 @@ allocated or deallocated in the program." > 100% 41 + + + + + + + + +
100% 41 + + + + + + + + +
73% 30 + + + + + + + + +
73% 30 + + + 13 + + + + + +
41% 17 + + + + + + + + +
41% 17 + + + 17 + + + + + +
27% 11 + + + + + + + + +
@@ -2151,9 +2802,11 @@ exports[`ProfileCallTreeView with unbalanced native allocations matches the snap > Total Size (bytes) + + + Self (bytes) + + + + + + @@ -2208,22 +2887,41 @@ allocated or deallocated in the program." > 100% 15 + + + + + + + + +
100% 15 + + + + + + + + +
80% 12 + + + + + + + + +
80% 12 + + + 5 + + + + + +
47% 7 + + + + + + + + +
47% 7 + + + 7 + + + + + +
20% 3 + + + + + + + + +
@@ -2810,9 +3678,11 @@ exports[`ProfileCallTreeView with unbalanced native allocations matches the snap > Total Size (bytes) + + + Self (bytes) + + + + + + @@ -2867,22 +3763,41 @@ allocated or deallocated in the program." > -100% -41 + + + + + + + + +
-100% -41 + + + + + + + + +
-59% -24 + + + + + + + + +
-41% -17 + + + + + + + + +
-41% -17 + + + -17 + + + + + +
@@ -3765,9 +4796,11 @@ exports[`calltree/ProfileCallTreeView renders an inverted call tree 1`] = ` > Total (samples) + + + Self + + + + + + @@ -3821,30 +4880,58 @@ for understanding where time was actually spent in a program." > 67% 2 + + + 2 + + +
+ + +
67% 2 + + + + + +
+ + +
67% 2 + + + + + +
+ + +
33% 1 + + + + + +
+ + +
33% 1 + + + + + +
+ + +
33% 1 + + + + + +
+ + +
33% 1 + + + 1 + + +
+ + +
@@ -4391,9 +5646,11 @@ exports[`calltree/ProfileCallTreeView renders an unfiltered call tree 1`] = ` > Total (samples) + + + Self + + + + + + @@ -4447,30 +5730,58 @@ for understanding where time was actually spent in a program." > 100% 3 + + + + + +
+ + +
100% 3 + + + + + +
+ + +
67% 2 + + + + + +
+ + +
33% 1 + + + + + +
-
+ + + +
33% 1 + + + 1 + + +
+ + +
33% 1 + + + + + +
+ + +
33% 1 + + + + + +
+ + +
@@ -5017,9 +6496,11 @@ exports[`calltree/ProfileCallTreeView renders an unfiltered call tree with filen > Total (samples) + + + Self + + + + + + @@ -5073,30 +6580,58 @@ for understanding where time was actually spent in a program." > 100% 1 + + + + + +
+ + +
100% 1 + + + + + +
+ + +
100% 1 + + + + + +
+ + +
100% 1 + + + 1 + + +
+ + +
@@ -5466,9 +7085,11 @@ exports[`calltree/ProfileCallTreeView renders call tree with some search strings > Total (samples) + + + Self + + + + + + @@ -5522,30 +7169,58 @@ for understanding where time was actually spent in a program." > 100% 3 + + + + + +
+ + +
100% 3 + + + + + +
+ + +
67% 2 + + + + + +
+ + +
33% 1 + + + + + +
+ + +
33% 1 + + + 1 + + +
+ + +
33% 1 + + + + + +
+ + +
33% 1 + + + + + +
+ + +
@@ -6092,9 +7935,11 @@ exports[`calltree/ProfileCallTreeView renders call tree with some search strings > Total (samples) + + + Self + + + + + + @@ -6148,30 +8019,58 @@ for understanding where time was actually spent in a program." > 100% 2 + + + + + +
+ + +
100% 2 + + + + + +
+ + +
100% 2 + + + + + +
+ + +
50% 1 + + + + + +
+ + +
50% 1 + + + 1 + + +
+ + +
50% 1 + + + + + +
+ + +
@@ -6659,9 +8698,11 @@ exports[`calltree/ProfileCallTreeView renders call tree with some search strings > Total (samples) + + + Self + + + + + + @@ -6715,30 +8782,58 @@ for understanding where time was actually spent in a program." > 100% 2 + + + + + +
+ + +
100% 2 + + + + + +
+ + +
100% 2 + + + + + +
+ + +
50% 1 + + + + + +
+ + +
50% 1 + + + 1 + + +
+ + +
50% 1 + + + + + +
+ + +
@@ -7226,9 +9461,11 @@ exports[`calltree/ProfileCallTreeView renders call tree with some search strings > Total (samples) + + + Self + + + + + + @@ -7282,30 +9545,58 @@ for understanding where time was actually spent in a program." > 100% 1 + + + + + +
+ + +
100% 1 + + + + + +
+ + +
100% 1 + + + + + +
+ + +
100% 1 + + + + + +
+ + +
@@ -7676,9 +10051,11 @@ exports[`calltree/ProfileCallTreeView renders call tree with some search strings > Total (samples) + + + Self + + + + + + @@ -7732,30 +10135,58 @@ for understanding where time was actually spent in a program." > 100% 1 + + + + + +
+ + +
100% 1 + + + + + +
+ + +
100% 1 + + + + + +
+ + +
100% 1 + + + + + +
+ + +
@@ -8126,9 +10641,11 @@ exports[`calltree/ProfileCallTreeView renders call tree with some search strings > Total (samples) + + + Self + + + + + + @@ -8182,30 +10725,58 @@ for understanding where time was actually spent in a program." > 100% 2 + + + + + +
+ + +
100% 2 + + + + + +
+ + +
100% 2 + + + + + +
+ + +
50% 1 + + + + + +
+ + +
50% 1 + + + 1 + + +
+ + +
50% 1 + + + + + +
+ + +
diff --git a/src/types/actions.js b/src/types/actions.js index fbdc6ca10a..599d5b3b72 100644 --- a/src/types/actions.js +++ b/src/types/actions.js @@ -37,6 +37,7 @@ import type { State, UploadedProfileInformation, SourceLoadingError, + TableViewOptions, } from './state'; import type { CssPixels, StartEndRange, Milliseconds } from './units'; import type { BrowserConnectionStatus } from '../app-logic/browser-connection'; @@ -503,6 +504,11 @@ type UrlStateAction = +type: 'CHANGE_MOUSE_TIME_POSITION', +mouseTimePosition: Milliseconds | null, |} + | {| + +type: 'CHANGE_TABLE_VIEW_OPTIONS', + +tab: TabSlug, + +tableViewOptions: TableViewOptions, + |} | {| +type: 'TOGGLE_RESOURCES_PANEL', +selectedThreadIndexes: Set, diff --git a/src/types/state.js b/src/types/state.js index 9cd8fb2a23..0801e3c175 100644 --- a/src/types/state.js +++ b/src/types/state.js @@ -57,6 +57,12 @@ export type ThreadViewOptions = {| export type ThreadViewOptionsPerThreads = { [ThreadsKey]: ThreadViewOptions }; +export type TableViewOptions = {| + +fixedColumnWidths: Array | null, +|}; + +export type TableViewOptionsPerTab = { [TabSlug]: TableViewOptions }; + export type RightClickedCallNode = {| +threadsKey: ThreadsKey, +callNodePath: CallNodePath, @@ -108,6 +114,7 @@ export type ProfileViewState = { rightClickedMarker: MarkerReference | null, hoveredMarker: MarkerReference | null, mouseTimePosition: Milliseconds | null, + perTable: TableViewOptionsPerTab, |}, +profile: Profile | null, +full: FullProfileViewState, From 14c927f0ca175f00cbba15dc7baea4657091c5c5 Mon Sep 17 00:00:00 2001 From: Johannes Bechberger Date: Tue, 20 Dec 2022 15:17:30 +0100 Subject: [PATCH 02/14] Update src/types/state.js Co-authored-by: Julien Wajsberg --- src/types/state.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/types/state.js b/src/types/state.js index 0801e3c175..6c423b4984 100644 --- a/src/types/state.js +++ b/src/types/state.js @@ -114,7 +114,7 @@ export type ProfileViewState = { rightClickedMarker: MarkerReference | null, hoveredMarker: MarkerReference | null, mouseTimePosition: Milliseconds | null, - perTable: TableViewOptionsPerTab, + perTab: TableViewOptionsPerTab, |}, +profile: Profile | null, +full: FullProfileViewState, From d75cae8c292758d72e3cde9357554944bdba6aca Mon Sep 17 00:00:00 2001 From: Johannes Bechberger Date: Tue, 20 Dec 2022 15:19:45 +0100 Subject: [PATCH 03/14] Update src/reducers/profile-view.js Co-authored-by: Julien Wajsberg --- src/reducers/profile-view.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/reducers/profile-view.js b/src/reducers/profile-view.js index 311fc0af64..65e96a784e 100644 --- a/src/reducers/profile-view.js +++ b/src/reducers/profile-view.js @@ -427,7 +427,7 @@ function _updateTableViewOptions( ): TableViewOptionsPerTab { const newState = { ...state }; newState[tab] = { - ..._getTableViewOptions(state, tab), + ...(state[tab] ?? defaultTableViewOptions), ...updates, }; return newState; From 3fe0bb502baf3f7862067a3ef41da606b22e17d0 Mon Sep 17 00:00:00 2001 From: Johannes Bechberger Date: Wed, 21 Dec 2022 11:45:16 +0100 Subject: [PATCH 04/14] Fix suggestions --- src/components/calltree/CallTree.js | 6 +- src/components/shared/TreeView.css | 15 +- src/components/shared/TreeView.js | 155 +- src/reducers/profile-view.js | 11 +- src/selectors/profile.js | 4 +- src/test/components/SourceView.test.js | 1 + .../__snapshots__/MarkerTable.test.js.snap | 195 +- .../ProfileCallTreeView.test.js.snap | 2513 +++++------------ 8 files changed, 881 insertions(+), 2019 deletions(-) diff --git a/src/components/calltree/CallTree.js b/src/components/calltree/CallTree.js index c737b03bb4..5042ff6a59 100644 --- a/src/components/calltree/CallTree.js +++ b/src/components/calltree/CallTree.js @@ -346,6 +346,8 @@ class CallTreeImpl extends PureComponent { disableOverscan, callNodeMaxDepth, weightType, + tableViewOptions, + onTableViewOptionsChange, } = this.props; if (tree.getRoots().length === 0) { return ; @@ -372,8 +374,8 @@ class CallTreeImpl extends PureComponent { onKeyDown={this._onKeyDown} onEnterKey={this._onEnterOrDoubleClick} onDoubleClick={this._onEnterOrDoubleClick} - viewOptions={this.props.tableViewOptions} - onViewOptionsChange={this.props.onTableViewOptionsChange} + viewOptions={tableViewOptions} + onViewOptionsChange={onTableViewOptionsChange} /> ); } diff --git a/src/components/shared/TreeView.css b/src/components/shared/TreeView.css index 75413faa23..efac4bd6b9 100644 --- a/src/components/shared/TreeView.css +++ b/src/components/shared/TreeView.css @@ -87,20 +87,23 @@ } .treeViewColumnDivider { - width: 20px; - text-align: center; display: inline-block; + width: 20px; flex: none; - margin-left: -5px; margin-right: -5px; + margin-left: -5px; + text-align: center; } -.treeViewColumnDivider[resize=true]:hover { + +.treeViewColumnDivider[data-resize='true']:hover { cursor: col-resize; } -.treeViewColumnDivider span { +.treeViewColumnDivider::before { + border-top: 2px solid var(--grey-30); border-right: 1px solid var(--grey-30); - box-sizing: border-box; + border-bottom: 2px solid var(--grey-30); + content: ''; } .treeViewHeaderColumn.treeViewFixedColumn { diff --git a/src/components/shared/TreeView.js b/src/components/shared/TreeView.js index dc3a5d5950..9305469744 100644 --- a/src/components/shared/TreeView.js +++ b/src/components/shared/TreeView.js @@ -59,6 +59,7 @@ export type Column = {| +headerWidthAdjustment?: CssPixels, // false by default +resizable?: boolean, + // is the divider after the column hidden? false by default +hideDividerAfter?: boolean, |}; @@ -75,21 +76,17 @@ type TreeViewHeaderProps = {| class TreeViewHeader extends React.PureComponent< TreeViewHeaderProps > { - _onDividerMouseDown = (event: SyntheticMouseEvent<>) => { + _onDividerMouseDown = (event: SyntheticMouseEvent) => { this.props.onColumnWidthChangeStart( - // $FlowExpectError - we know that the target has this field - Number(event.target.attributes.columnIndex.value), + Number(event.currentTarget.dataset.columnIndex), event.clientX ); - event.stopPropagation(); }; - _onDividerDoubleClick = (event: SyntheticMouseEvent<>) => { + _onDividerDoubleClick = (event: SyntheticMouseEvent) => { this.props.onColumnWidthReset( - // $FlowExpectError - we know that the target has this field - Number(event.target.attributes.columnIndex.value) + Number(event.currentTarget.dataset.columnIndex) ); - event.stopPropagation(); }; render() { @@ -111,12 +108,8 @@ class TreeViewHeader extends React.PureComponent< } : {}; return ( - <> - + + extends React.PureComponent< onDoubleClick={ col.resizable ? this._onDividerDoubleClick : undefined } - columnIndex={i} - column={col.propName} - resize={String(col.resizable || false)} - > - - + data-column-index={i} + // required for the CSS selector, to trigger the cursor change on hover + data-resize={String(col.resizable || false)} + > ) : null} - + ); })} = {| +highlightRegExp: RegExp | null, +rowHeightStyle: { height: CssPixels, lineHeight: string }, +viewOptions: TableViewOptions, - // called when the users moves the divider right of the column, - // passes the column index and the start x coordinate - +onColumnWidthChangeStart: (number, CssPixels) => void, - +onColumnWidthReset: (number) => void, |}; class TreeViewRowFixedColumns extends React.PureComponent< @@ -212,23 +199,6 @@ class TreeViewRowFixedColumns extends React.PureComponent< onClick(nodeId, event); }; - _onDividerMouseDown = (event: SyntheticMouseEvent<>) => { - this.props.onColumnWidthChangeStart( - // $FlowExpectError - we know that the target has this field - Number(event.target.attributes.columnIndex.value), - event.clientX - ); - event.stopPropagation(); - }; - - _onDividerDoubleClick = (event: SyntheticMouseEvent<>) => { - this.props.onColumnWidthReset( - // $FlowExpectError - we know that the target has this field - Number(event.target.attributes.columnIndex.value) - ); - event.stopPropagation(); - }; - render() { const { displayData, @@ -262,12 +232,12 @@ class TreeViewRowFixedColumns extends React.PureComponent< } : {}; return ( - <> + {RenderComponent ? ( @@ -280,23 +250,9 @@ class TreeViewRowFixedColumns extends React.PureComponent< )} {col.hideDividerAfter !== true ? ( - - - + ) : null} - + ); })}
@@ -514,7 +470,7 @@ type TreeViewProps = {| |}; type TreeViewState = {| - +fixedColumnWidths?: Array, + +fixedColumnWidths: Array | null, |}; export class TreeView extends React.PureComponent< @@ -523,11 +479,15 @@ export class TreeView extends React.PureComponent< > { _list: VirtualList | null = null; _takeListRef = (list: VirtualList | null) => (this._list = list); - _currentMovedColumnState: { columnIndex: number, lastX: CssPixels } | null = - null; + _currentMovedColumnState: {| + columnIndex: number, + lastX: CssPixels, + initialWidth: CssPixels, + |} | null = null; state = { - fixedColumnWidths: undefined, + fixedColumnWidths: null, }; + _stateCounter: number = 0; // The tuple `specialItems` always contains 2 elements: the first element is // the selected node id (if any), and the second element is the right clicked @@ -557,7 +517,7 @@ export class TreeView extends React.PureComponent< if (widths === undefined) { throw new Error('The fixed column widths should be defined.'); } - // $FlowExpectError - Flow doesn't understand that we checked that widths is defined. + // $FlowExpectError - Flow doesn't understand that we're checking for undefined above. return widths; }; @@ -569,30 +529,41 @@ export class TreeView extends React.PureComponent< }; }; + _getTreeTabChildren = () => { + const treeTab = document.getElementById('calltree-tab'); + if (treeTab) { + return treeTab.childNodes; + } + return []; + }; + _onColumnWidthChangeStart = (columnIndex: number, startX: CssPixels) => { - this._currentMovedColumnState = { columnIndex, lastX: startX }; + this._currentMovedColumnState = { + columnIndex, + lastX: startX, + initialWidth: this._getCurrentFixedColumnWidths()[columnIndex], + }; window.addEventListener('mousemove', this._onColumnWidthChangeMouseMove); window.addEventListener('mouseup', this._onColumnWidthChangeMouseUp); + for (const elem of this._getTreeTabChildren()) { + // $FlowExpectError - we know that these are HTML nodes + elem.style.setProperty('cursor', 'col-resize'); + } }; _onColumnWidthChangeMouseMove = (event: MouseEvent) => { const columnState = this._currentMovedColumnState; if (columnState !== null) { - const { columnIndex, lastX } = columnState; + const { columnIndex, lastX, initialWidth } = columnState; const column = this.props.fixedColumns[columnIndex]; const fixedColumnWidths = this._getCurrentFixedColumnWidths(); - columnState.lastX = event.clientX; const diff = event.clientX - lastX; - if (column.minWidth === undefined) { - console.warn( - "Minimal width is undefined for the column '" + JSON.stringify(column) - ); + if (diff === 0) { + return; } - const newWidth = Math.max( - fixedColumnWidths[columnIndex] + diff, - column.minWidth || 0 - ); + const newWidth = Math.max(initialWidth + diff, column.minWidth || 10); this.setState((prevState) => { + this._stateCounter++; const newFixedColumnWidths = ( prevState.fixedColumnWidths || fixedColumnWidths ).slice(); @@ -601,16 +572,26 @@ export class TreeView extends React.PureComponent< fixedColumnWidths: newFixedColumnWidths, }; }); - event.stopPropagation(); } }; - _onColumnWidthChangeMouseUp = (event: MouseEvent) => { + _cleanUpMouseHandlersAndResetCursor = () => { window.removeEventListener('mousemove', this._onColumnWidthChangeMouseMove); window.removeEventListener('mouseup', this._onColumnWidthChangeMouseUp); + for (const elem of this._getTreeTabChildren()) { + // $FlowExpectError - we know that these are HTML nodes + elem.style.removeProperty('cursor'); + } + }; + + _onColumnWidthChangeMouseUp = () => { + this._cleanUpMouseHandlersAndResetCursor(); this._currentMovedColumnState = null; this._propagateColumnWidthChange(this._getCurrentFixedColumnWidths()); - event.stopPropagation(); + }; + + componentWillUnmount = () => { + this._cleanUpMouseHandlersAndResetCursor(); }; _onColumnWidthReset = (columnIndex: number) => { @@ -618,13 +599,7 @@ export class TreeView extends React.PureComponent< const fixedColumnWidths = this.state.fixedColumnWidths || this.props.viewOptions.fixedColumnWidths; if (fixedColumnWidths) { - if (column.initialWidth === undefined) { - console.warn( - "Can't reset the width of a column without an initial width." - ); - } else { - fixedColumnWidths[columnIndex] = column.initialWidth; - } + fixedColumnWidths[columnIndex] = column.initialWidth || 10; this._propagateColumnWidthChange(fixedColumnWidths); } }; @@ -709,8 +684,6 @@ export class TreeView extends React.PureComponent< onClick={this._onRowClicked} highlightRegExp={highlightRegExp || null} rowHeightStyle={rowHeightStyle} - onColumnWidthChangeStart={this._onColumnWidthChangeStart} - onColumnWidthReset={this._onColumnWidthReset} /> ); } @@ -999,13 +972,15 @@ export class TreeView extends React.PureComponent< focusable={true} onKeyDown={this._onKeyDown} specialItems={this._getSpecialItems()} - disableOverscan={!!disableOverscan} + disableOverscan={ + !!disableOverscan || this._currentMovedColumnState === null + } onCopy={this._onCopy} // If there is a deep call node depth, expand the width, or else keep it // at 3000 wide. containerWidth={Math.max(3000, maxNodeDepth * 10 + 2000)} ref={this._takeListRef} - key={JSON.stringify(this._getCurrentViewOptions())} + forceRender={this._stateCounter} /> {contextMenu} diff --git a/src/reducers/profile-view.js b/src/reducers/profile-view.js index 65e96a784e..ee85da8795 100644 --- a/src/reducers/profile-view.js +++ b/src/reducers/profile-view.js @@ -412,14 +412,6 @@ export const defaultTableViewOptions: TableViewOptions = { fixedColumnWidths: null, }; -function _getTableViewOptions(state: TableViewOptionsPerTab, tab: TabSlug) { - const options = state[tab]; - if (options) { - return options; - } - return defaultThreadViewOptions; -} - function _updateTableViewOptions( state: TableViewOptionsPerTab, tab: TabSlug, @@ -437,7 +429,6 @@ const tableViewOptionsPerTab: Reducer = ( state = ({}: TableViewOptionsPerTab), action ): TableViewOptionsPerTab => { - console.log(action); switch (action.type) { case 'CHANGE_TABLE_VIEW_OPTIONS': return _updateTableViewOptions( @@ -766,7 +757,7 @@ const profileViewReducer: Reducer = wrapReducerInResetter( rightClickedMarker, hoveredMarker, mouseTimePosition, - perTable: tableViewOptionsPerTab, + perTab: tableViewOptionsPerTab, }), profile, full: combineReducers({ diff --git a/src/selectors/profile.js b/src/selectors/profile.js index 8401e3a9df..1d6614acd9 100644 --- a/src/selectors/profile.js +++ b/src/selectors/profile.js @@ -97,7 +97,7 @@ export const getProfileViewOptions: Selector< $PropertyType > = (state) => getProfileView(state).viewOptions; export const getCurrentTableViewOptions: Selector = (state) => - getProfileViewOptions(state).perTable[UrlState.getSelectedTab(state)] || + getProfileViewOptions(state).perTab[UrlState.getSelectedTab(state)] || defaultTableViewOptions; export const getProfileRootRange: Selector = (state) => getProfileViewOptions(state).rootRange; @@ -130,7 +130,7 @@ export const getMouseTimePosition: Selector = (state) => export const getTableViewOptionSelectors: (TabSlug) => Selector = (tab) => (state) => { - const options = getProfileViewOptions(state).perTable[tab]; + const options = getProfileViewOptions(state).perTab[tab]; return options || defaultTableViewOptions; }; diff --git a/src/test/components/SourceView.test.js b/src/test/components/SourceView.test.js index 407649b1d2..cc9c337bc1 100644 --- a/src/test/components/SourceView.test.js +++ b/src/test/components/SourceView.test.js @@ -101,6 +101,7 @@ describe('SourceView', () => { const { sourceView } = setup(); const frameElement = screen.getByRole('treeitem', { name: /^A/ }); + fireFullClick(frameElement); fireFullClick(frameElement, { detail: 2 }); expect(sourceView()).toBeInTheDocument(); diff --git a/src/test/components/__snapshots__/MarkerTable.test.js.snap b/src/test/components/__snapshots__/MarkerTable.test.js.snap index 601754d870..7ab96c3f9c 100644 --- a/src/test/components/__snapshots__/MarkerTable.test.js.snap +++ b/src/test/components/__snapshots__/MarkerTable.test.js.snap @@ -94,12 +94,9 @@ exports[`MarkerTable renders some basic markers and updates when needed 1`] = `
- - + data-column-index="0" + data-resize="true" + /> - - + data-column-index="1" + data-resize="true" + /> - - + data-column-index="2" + data-resize="true" + /> @@ -163,6 +154,7 @@ exports[`MarkerTable renders some basic markers and updates when needed 1`] = ` > @@ -170,14 +162,10 @@ exports[`MarkerTable renders some basic markers and updates when needed 1`] = ` - - + /> @@ -185,14 +173,10 @@ exports[`MarkerTable renders some basic markers and updates when needed 1`] = ` - - + /> @@ -200,12 +184,7 @@ exports[`MarkerTable renders some basic markers and updates when needed 1`] = ` - - + />
@@ -220,27 +200,19 @@ exports[`MarkerTable renders some basic markers and updates when needed 1`] = ` - - + /> - - + /> @@ -248,12 +220,7 @@ exports[`MarkerTable renders some basic markers and updates when needed 1`] = ` - - + />
@@ -268,14 +236,10 @@ exports[`MarkerTable renders some basic markers and updates when needed 1`] = ` - - + /> @@ -283,14 +247,10 @@ exports[`MarkerTable renders some basic markers and updates when needed 1`] = ` - - + /> @@ -298,12 +258,7 @@ exports[`MarkerTable renders some basic markers and updates when needed 1`] = ` - - + />
@@ -318,14 +274,10 @@ exports[`MarkerTable renders some basic markers and updates when needed 1`] = ` - - + /> @@ -333,14 +285,10 @@ exports[`MarkerTable renders some basic markers and updates when needed 1`] = ` - - + /> @@ -348,12 +296,7 @@ exports[`MarkerTable renders some basic markers and updates when needed 1`] = ` - - + />
@@ -368,14 +312,10 @@ exports[`MarkerTable renders some basic markers and updates when needed 1`] = ` - - + /> @@ -383,14 +323,10 @@ exports[`MarkerTable renders some basic markers and updates when needed 1`] = ` - - + /> @@ -398,12 +334,7 @@ exports[`MarkerTable renders some basic markers and updates when needed 1`] = ` - - + />
@@ -418,27 +350,19 @@ exports[`MarkerTable renders some basic markers and updates when needed 1`] = ` - - + /> - - + /> @@ -446,12 +370,7 @@ exports[`MarkerTable renders some basic markers and updates when needed 1`] = ` - - + />
@@ -466,14 +386,10 @@ exports[`MarkerTable renders some basic markers and updates when needed 1`] = ` - - + /> @@ -481,14 +397,10 @@ exports[`MarkerTable renders some basic markers and updates when needed 1`] = ` - - + /> @@ -496,12 +408,7 @@ exports[`MarkerTable renders some basic markers and updates when needed 1`] = ` - - + />
diff --git a/src/test/components/__snapshots__/ProfileCallTreeView.test.js.snap b/src/test/components/__snapshots__/ProfileCallTreeView.test.js.snap index c97f4c50a5..21a80502ca 100644 --- a/src/test/components/__snapshots__/ProfileCallTreeView.test.js.snap +++ b/src/test/components/__snapshots__/ProfileCallTreeView.test.js.snap @@ -164,12 +164,9 @@ bytes of the callers from this function."
- - + data-column-index="1" + data-resize="true" + /> - - + data-column-index="2" + data-resize="true" + /> - - + data-column-index="3" + data-resize="false" + /> @@ -235,6 +226,7 @@ allocated or deallocated in the program." > @@ -242,6 +234,7 @@ allocated or deallocated in the program." @@ -249,14 +242,10 @@ allocated or deallocated in the program." - - + /> @@ -264,14 +253,11 @@ allocated or deallocated in the program." - - + />
- - + />
@@ -300,6 +282,7 @@ allocated or deallocated in the program." @@ -307,14 +290,10 @@ allocated or deallocated in the program." - - + /> @@ -322,14 +301,11 @@ allocated or deallocated in the program." - - + />
- - + />
@@ -358,6 +330,7 @@ allocated or deallocated in the program." @@ -365,14 +338,10 @@ allocated or deallocated in the program." - - + /> @@ -380,14 +349,11 @@ allocated or deallocated in the program." - - + />
- - + />
@@ -416,6 +378,7 @@ allocated or deallocated in the program." @@ -423,14 +386,10 @@ allocated or deallocated in the program." - - + /> @@ -438,14 +397,11 @@ allocated or deallocated in the program." - - + />
- - + />
@@ -474,6 +426,7 @@ allocated or deallocated in the program." @@ -481,14 +434,10 @@ allocated or deallocated in the program." - - + /> @@ -496,14 +445,11 @@ allocated or deallocated in the program." - - + />
- - + />
@@ -532,6 +474,7 @@ allocated or deallocated in the program." @@ -539,14 +482,10 @@ allocated or deallocated in the program." - - + /> @@ -554,14 +493,11 @@ allocated or deallocated in the program." - - + />
- - + />
@@ -590,6 +522,7 @@ allocated or deallocated in the program." @@ -597,14 +530,10 @@ allocated or deallocated in the program." - - + /> @@ -612,14 +541,11 @@ allocated or deallocated in the program." - - + />
- - + />
@@ -1052,12 +973,9 @@ bytes of the callers from this function."
- - + data-column-index="1" + data-resize="true" + /> - - + data-column-index="2" + data-resize="true" + /> - - + data-column-index="3" + data-resize="false" + /> @@ -1123,6 +1035,7 @@ allocated or deallocated in the program." > @@ -1130,6 +1043,7 @@ allocated or deallocated in the program." @@ -1137,14 +1051,10 @@ allocated or deallocated in the program." - - + /> @@ -1152,14 +1062,11 @@ allocated or deallocated in the program." - - + />
- - + />
@@ -1188,6 +1091,7 @@ allocated or deallocated in the program." @@ -1195,14 +1099,10 @@ allocated or deallocated in the program." - - + /> @@ -1210,14 +1110,11 @@ allocated or deallocated in the program." - - + />
- - + />
@@ -1246,6 +1139,7 @@ allocated or deallocated in the program." @@ -1253,14 +1147,10 @@ allocated or deallocated in the program." - - + /> @@ -1268,14 +1158,11 @@ allocated or deallocated in the program." - - + />
- - + />
@@ -1304,6 +1187,7 @@ allocated or deallocated in the program." @@ -1311,14 +1195,10 @@ allocated or deallocated in the program." - - + /> @@ -1326,14 +1206,11 @@ allocated or deallocated in the program." - - + />
- - + />
@@ -1362,6 +1235,7 @@ allocated or deallocated in the program." @@ -1369,14 +1243,10 @@ allocated or deallocated in the program." - - + /> @@ -1384,14 +1254,11 @@ allocated or deallocated in the program." - - + />
- - + />
@@ -1420,6 +1283,7 @@ allocated or deallocated in the program." @@ -1427,14 +1291,10 @@ allocated or deallocated in the program." - - + /> @@ -1442,14 +1302,11 @@ allocated or deallocated in the program." - - + />
- - + />
@@ -1478,6 +1331,7 @@ allocated or deallocated in the program." @@ -1485,14 +1339,10 @@ allocated or deallocated in the program." - - + /> @@ -1500,14 +1350,11 @@ allocated or deallocated in the program." - - + />
- - + />
@@ -1940,12 +1782,9 @@ bytes of the callers from this function."
- - + data-column-index="1" + data-resize="true" + /> - - + data-column-index="2" + data-resize="true" + /> - - + data-column-index="3" + data-resize="false" + /> @@ -2011,6 +1844,7 @@ allocated or deallocated in the program." > @@ -2018,6 +1852,7 @@ allocated or deallocated in the program." @@ -2025,14 +1860,10 @@ allocated or deallocated in the program." - - + /> @@ -2040,14 +1871,11 @@ allocated or deallocated in the program." - - + />
- - + />
@@ -2076,6 +1900,7 @@ allocated or deallocated in the program." @@ -2083,14 +1908,10 @@ allocated or deallocated in the program." - - + /> @@ -2098,14 +1919,11 @@ allocated or deallocated in the program." - - + />
- - + />
@@ -2134,6 +1948,7 @@ allocated or deallocated in the program." @@ -2141,14 +1956,10 @@ allocated or deallocated in the program." - - + /> @@ -2156,14 +1967,11 @@ allocated or deallocated in the program." - - + />
- - + />
@@ -2192,6 +1996,7 @@ allocated or deallocated in the program." @@ -2199,14 +2004,10 @@ allocated or deallocated in the program." - - + /> @@ -2214,14 +2015,11 @@ allocated or deallocated in the program." - - + />
- - + />
@@ -2250,6 +2044,7 @@ allocated or deallocated in the program." @@ -2257,14 +2052,10 @@ allocated or deallocated in the program." - - + /> @@ -2272,14 +2063,11 @@ allocated or deallocated in the program." - - + />
- - + />
@@ -2308,6 +2092,7 @@ allocated or deallocated in the program." @@ -2315,14 +2100,10 @@ allocated or deallocated in the program." - - + /> @@ -2330,14 +2111,11 @@ allocated or deallocated in the program." - - + />
- - + />
@@ -2366,6 +2140,7 @@ allocated or deallocated in the program." @@ -2373,14 +2148,10 @@ allocated or deallocated in the program." - - + /> @@ -2388,14 +2159,11 @@ allocated or deallocated in the program." - - + />
- - + />
@@ -2816,12 +2579,9 @@ bytes of the callers from this function."
- - + data-column-index="1" + data-resize="true" + /> - - + data-column-index="2" + data-resize="true" + /> - - + data-column-index="3" + data-resize="false" + /> @@ -2887,6 +2641,7 @@ allocated or deallocated in the program." > @@ -2894,6 +2649,7 @@ allocated or deallocated in the program." @@ -2901,14 +2657,10 @@ allocated or deallocated in the program." - - + /> @@ -2916,14 +2668,11 @@ allocated or deallocated in the program." - - + />
- - + />
@@ -2952,6 +2697,7 @@ allocated or deallocated in the program." @@ -2959,14 +2705,10 @@ allocated or deallocated in the program." - - + /> @@ -2974,14 +2716,11 @@ allocated or deallocated in the program." - - + />
- - + />
@@ -3010,6 +2745,7 @@ allocated or deallocated in the program." @@ -3017,14 +2753,10 @@ allocated or deallocated in the program." - - + /> @@ -3032,14 +2764,11 @@ allocated or deallocated in the program." - - + />
- - + />
@@ -3068,6 +2793,7 @@ allocated or deallocated in the program." @@ -3075,14 +2801,10 @@ allocated or deallocated in the program." - - + /> @@ -3090,14 +2812,11 @@ allocated or deallocated in the program." - - + />
- - + />
@@ -3126,6 +2841,7 @@ allocated or deallocated in the program." @@ -3133,14 +2849,10 @@ allocated or deallocated in the program." - - + /> @@ -3148,14 +2860,11 @@ allocated or deallocated in the program." - - + />
- - + />
@@ -3184,6 +2889,7 @@ allocated or deallocated in the program." @@ -3191,14 +2897,10 @@ allocated or deallocated in the program." - - + /> @@ -3206,14 +2908,11 @@ allocated or deallocated in the program." - - + />
- - + />
@@ -3242,6 +2937,7 @@ allocated or deallocated in the program." @@ -3249,14 +2945,10 @@ allocated or deallocated in the program." - - + /> @@ -3264,14 +2956,11 @@ allocated or deallocated in the program." - - + />
- - + />
@@ -3692,12 +3376,9 @@ bytes of the callers from this function."
- - + data-column-index="1" + data-resize="true" + /> - - + data-column-index="2" + data-resize="true" + /> - - + data-column-index="3" + data-resize="false" + /> @@ -3763,6 +3438,7 @@ allocated or deallocated in the program." > @@ -3770,6 +3446,7 @@ allocated or deallocated in the program." @@ -3777,14 +3454,10 @@ allocated or deallocated in the program." - - + /> @@ -3792,14 +3465,11 @@ allocated or deallocated in the program." - - + />
- - + />
@@ -3828,6 +3494,7 @@ allocated or deallocated in the program." @@ -3835,14 +3502,10 @@ allocated or deallocated in the program." - - + /> @@ -3850,14 +3513,11 @@ allocated or deallocated in the program." - - + />
- - + />
@@ -3886,6 +3542,7 @@ allocated or deallocated in the program." @@ -3893,14 +3550,10 @@ allocated or deallocated in the program." - - + /> @@ -3908,14 +3561,11 @@ allocated or deallocated in the program." - - + />
- - + />
@@ -3944,6 +3590,7 @@ allocated or deallocated in the program." @@ -3951,14 +3598,10 @@ allocated or deallocated in the program." - - + /> @@ -3966,14 +3609,11 @@ allocated or deallocated in the program." - - + />
- - + />
@@ -4002,6 +3638,7 @@ allocated or deallocated in the program." @@ -4009,14 +3646,10 @@ allocated or deallocated in the program." - - + /> @@ -4024,14 +3657,11 @@ allocated or deallocated in the program." - - + />
- - + />
@@ -4810,12 +4435,9 @@ function."
- - + data-column-index="1" + data-resize="true" + /> - - + data-column-index="2" + data-resize="true" + /> - - + data-column-index="3" + data-resize="false" + /> @@ -4880,6 +4496,7 @@ for understanding where time was actually spent in a program." > @@ -4887,6 +4504,7 @@ for understanding where time was actually spent in a program." @@ -4894,14 +4512,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -4909,14 +4523,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -4926,12 +4536,7 @@ for understanding where time was actually spent in a program." - - + />
@@ -4946,6 +4552,7 @@ for understanding where time was actually spent in a program." @@ -4953,14 +4560,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -4968,14 +4571,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -4985,12 +4584,7 @@ for understanding where time was actually spent in a program." - - + />
@@ -5005,21 +4600,18 @@ for understanding where time was actually spent in a program." 2 - - + class="treeViewColumnDivider" + /> @@ -5027,14 +4619,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -5044,12 +4632,7 @@ for understanding where time was actually spent in a program." - - + />
@@ -5064,6 +4648,7 @@ for understanding where time was actually spent in a program." @@ -5071,14 +4656,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -5086,14 +4667,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -5103,12 +4680,7 @@ for understanding where time was actually spent in a program." - - + />
@@ -5123,6 +4696,7 @@ for understanding where time was actually spent in a program." @@ -5130,14 +4704,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -5145,14 +4715,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -5162,12 +4728,7 @@ for understanding where time was actually spent in a program." - - + />
@@ -5182,6 +4744,7 @@ for understanding where time was actually spent in a program." @@ -5189,14 +4752,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -5204,14 +4763,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -5221,12 +4776,7 @@ for understanding where time was actually spent in a program." - - + />
@@ -5241,6 +4792,7 @@ for understanding where time was actually spent in a program." @@ -5248,14 +4800,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -5263,14 +4811,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -5280,12 +4824,7 @@ for understanding where time was actually spent in a program." - - + />
@@ -5660,12 +5199,9 @@ function."
- - + data-column-index="1" + data-resize="true" + /> - - + data-column-index="2" + data-resize="true" + /> - - + data-column-index="3" + data-resize="false" + /> @@ -5730,6 +5260,7 @@ for understanding where time was actually spent in a program." > @@ -5737,6 +5268,7 @@ for understanding where time was actually spent in a program." @@ -5744,14 +5276,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -5759,14 +5287,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -5776,12 +5300,7 @@ for understanding where time was actually spent in a program." - - + />
@@ -5796,6 +5316,7 @@ for understanding where time was actually spent in a program." @@ -5803,14 +5324,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -5818,14 +5335,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -5835,12 +5348,7 @@ for understanding where time was actually spent in a program." - - + />
@@ -5855,6 +5364,7 @@ for understanding where time was actually spent in a program." @@ -5862,14 +5372,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -5877,14 +5383,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -5894,12 +5396,7 @@ for understanding where time was actually spent in a program." - - + />
@@ -5914,6 +5412,7 @@ for understanding where time was actually spent in a program." @@ -5921,14 +5420,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -5936,14 +5431,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -5953,12 +5444,7 @@ for understanding where time was actually spent in a program." - - + />
@@ -5973,6 +5460,7 @@ for understanding where time was actually spent in a program." @@ -5980,14 +5468,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -5995,14 +5479,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -6012,12 +5492,7 @@ for understanding where time was actually spent in a program." - - + />
@@ -6032,6 +5508,7 @@ for understanding where time was actually spent in a program." @@ -6039,14 +5516,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -6054,14 +5527,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -6071,12 +5540,7 @@ for understanding where time was actually spent in a program." - - + />
@@ -6091,6 +5556,7 @@ for understanding where time was actually spent in a program." @@ -6098,14 +5564,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -6113,14 +5575,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -6130,12 +5588,7 @@ for understanding where time was actually spent in a program." - - + />
@@ -6510,12 +5963,9 @@ function."
- - + data-column-index="1" + data-resize="true" + /> - - + data-column-index="2" + data-resize="true" + /> - - + data-column-index="3" + data-resize="false" + /> @@ -6580,6 +6024,7 @@ for understanding where time was actually spent in a program." > @@ -6587,6 +6032,7 @@ for understanding where time was actually spent in a program." @@ -6594,14 +6040,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -6609,14 +6051,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -6626,12 +6064,7 @@ for understanding where time was actually spent in a program." - - + />
@@ -6646,6 +6080,7 @@ for understanding where time was actually spent in a program." @@ -6653,14 +6088,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -6668,14 +6099,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -6685,12 +6112,7 @@ for understanding where time was actually spent in a program." - - + />
@@ -6705,6 +6128,7 @@ for understanding where time was actually spent in a program." @@ -6712,14 +6136,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -6727,14 +6147,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -6744,12 +6160,7 @@ for understanding where time was actually spent in a program." - - + />
@@ -6764,6 +6176,7 @@ for understanding where time was actually spent in a program." @@ -6771,14 +6184,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -6786,14 +6195,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -6803,12 +6208,7 @@ for understanding where time was actually spent in a program." - - + />
@@ -7099,12 +6499,9 @@ function."
- - + data-column-index="1" + data-resize="true" + /> - - + data-column-index="2" + data-resize="true" + /> - - + data-column-index="3" + data-resize="false" + /> @@ -7169,6 +6560,7 @@ for understanding where time was actually spent in a program." > @@ -7176,6 +6568,7 @@ for understanding where time was actually spent in a program." @@ -7183,14 +6576,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -7198,14 +6587,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -7215,12 +6600,7 @@ for understanding where time was actually spent in a program." - - + />
@@ -7235,6 +6616,7 @@ for understanding where time was actually spent in a program." @@ -7242,14 +6624,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -7257,14 +6635,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -7274,12 +6648,7 @@ for understanding where time was actually spent in a program." - - + />
@@ -7294,6 +6664,7 @@ for understanding where time was actually spent in a program." @@ -7301,14 +6672,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -7316,14 +6683,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -7333,12 +6696,7 @@ for understanding where time was actually spent in a program." - - + />
@@ -7353,6 +6712,7 @@ for understanding where time was actually spent in a program." @@ -7360,14 +6720,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -7375,14 +6731,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -7392,12 +6744,7 @@ for understanding where time was actually spent in a program." - - + />
@@ -7412,6 +6760,7 @@ for understanding where time was actually spent in a program." @@ -7419,14 +6768,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -7434,14 +6779,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -7451,12 +6792,7 @@ for understanding where time was actually spent in a program." - - + />
@@ -7471,6 +6808,7 @@ for understanding where time was actually spent in a program." @@ -7478,14 +6816,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -7493,14 +6827,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -7510,12 +6840,7 @@ for understanding where time was actually spent in a program." - - + />
@@ -7530,6 +6856,7 @@ for understanding where time was actually spent in a program." @@ -7537,14 +6864,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -7552,14 +6875,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -7569,12 +6888,7 @@ for understanding where time was actually spent in a program." - - + />
@@ -7949,12 +7263,9 @@ function."
- - + data-column-index="1" + data-resize="true" + /> - - + data-column-index="2" + data-resize="true" + /> - - + data-column-index="3" + data-resize="false" + /> @@ -8019,6 +7324,7 @@ for understanding where time was actually spent in a program." > @@ -8026,6 +7332,7 @@ for understanding where time was actually spent in a program." @@ -8033,14 +7340,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -8048,14 +7351,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -8065,12 +7364,7 @@ for understanding where time was actually spent in a program." - - + />
@@ -8085,6 +7380,7 @@ for understanding where time was actually spent in a program." @@ -8092,14 +7388,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -8107,14 +7399,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -8124,12 +7412,7 @@ for understanding where time was actually spent in a program." - - + />
@@ -8144,6 +7428,7 @@ for understanding where time was actually spent in a program." @@ -8151,14 +7436,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -8166,14 +7447,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -8183,12 +7460,7 @@ for understanding where time was actually spent in a program." - - + />
@@ -8203,6 +7476,7 @@ for understanding where time was actually spent in a program." @@ -8210,14 +7484,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -8225,14 +7495,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -8242,12 +7508,7 @@ for understanding where time was actually spent in a program." - - + />
@@ -8262,6 +7524,7 @@ for understanding where time was actually spent in a program." @@ -8269,14 +7532,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -8284,14 +7543,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -8301,12 +7556,7 @@ for understanding where time was actually spent in a program." - - + />
@@ -8321,6 +7572,7 @@ for understanding where time was actually spent in a program." @@ -8328,14 +7580,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -8343,14 +7591,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -8360,12 +7604,7 @@ for understanding where time was actually spent in a program." - - + />
@@ -8712,12 +7951,9 @@ function."
- - + data-column-index="1" + data-resize="true" + /> - - + data-column-index="2" + data-resize="true" + /> - - + data-column-index="3" + data-resize="false" + /> @@ -8782,6 +8012,7 @@ for understanding where time was actually spent in a program." > @@ -8789,6 +8020,7 @@ for understanding where time was actually spent in a program." @@ -8796,14 +8028,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -8811,14 +8039,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -8828,12 +8052,7 @@ for understanding where time was actually spent in a program." - - + />
@@ -8848,6 +8068,7 @@ for understanding where time was actually spent in a program." @@ -8855,14 +8076,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -8870,14 +8087,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -8887,12 +8100,7 @@ for understanding where time was actually spent in a program." - - + />
@@ -8907,6 +8116,7 @@ for understanding where time was actually spent in a program." @@ -8914,14 +8124,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -8929,14 +8135,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -8946,12 +8148,7 @@ for understanding where time was actually spent in a program." - - + />
@@ -8966,6 +8164,7 @@ for understanding where time was actually spent in a program." @@ -8973,14 +8172,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -8988,14 +8183,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -9005,12 +8196,7 @@ for understanding where time was actually spent in a program." - - + />
@@ -9025,6 +8212,7 @@ for understanding where time was actually spent in a program." @@ -9032,14 +8220,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -9047,14 +8231,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -9064,12 +8244,7 @@ for understanding where time was actually spent in a program." - - + />
@@ -9084,6 +8260,7 @@ for understanding where time was actually spent in a program." @@ -9091,14 +8268,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -9106,14 +8279,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -9123,12 +8292,7 @@ for understanding where time was actually spent in a program." - - + />
@@ -9475,12 +8639,9 @@ function."
- - + data-column-index="1" + data-resize="true" + /> - - + data-column-index="2" + data-resize="true" + /> - - + data-column-index="3" + data-resize="false" + /> @@ -9545,6 +8700,7 @@ for understanding where time was actually spent in a program." > @@ -9552,6 +8708,7 @@ for understanding where time was actually spent in a program." @@ -9559,14 +8716,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -9574,14 +8727,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -9591,12 +8740,7 @@ for understanding where time was actually spent in a program." - - + />
@@ -9611,6 +8756,7 @@ for understanding where time was actually spent in a program." @@ -9618,14 +8764,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -9633,14 +8775,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -9650,12 +8788,7 @@ for understanding where time was actually spent in a program." - - + />
@@ -9670,6 +8804,7 @@ for understanding where time was actually spent in a program." @@ -9677,14 +8812,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -9692,14 +8823,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -9709,12 +8836,7 @@ for understanding where time was actually spent in a program." - - + />
@@ -9729,6 +8852,7 @@ for understanding where time was actually spent in a program." @@ -9736,14 +8860,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -9751,14 +8871,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -9768,12 +8884,7 @@ for understanding where time was actually spent in a program." - - + />
@@ -10065,12 +9176,9 @@ function."
- - + data-column-index="1" + data-resize="true" + /> - - + data-column-index="2" + data-resize="true" + /> - - + data-column-index="3" + data-resize="false" + /> @@ -10135,6 +9237,7 @@ for understanding where time was actually spent in a program." > @@ -10142,6 +9245,7 @@ for understanding where time was actually spent in a program." @@ -10149,14 +9253,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -10164,14 +9264,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -10181,12 +9277,7 @@ for understanding where time was actually spent in a program." - - + />
@@ -10201,6 +9293,7 @@ for understanding where time was actually spent in a program." @@ -10208,14 +9301,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -10223,14 +9312,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -10240,12 +9325,7 @@ for understanding where time was actually spent in a program." - - + />
@@ -10260,6 +9341,7 @@ for understanding where time was actually spent in a program." @@ -10267,14 +9349,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -10282,14 +9360,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -10299,12 +9373,7 @@ for understanding where time was actually spent in a program." - - + />
@@ -10319,6 +9389,7 @@ for understanding where time was actually spent in a program." @@ -10326,14 +9397,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -10341,14 +9408,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -10358,12 +9421,7 @@ for understanding where time was actually spent in a program." - - + />
@@ -10655,12 +9713,9 @@ function."
- - + data-column-index="1" + data-resize="true" + /> - - + data-column-index="2" + data-resize="true" + /> - - + data-column-index="3" + data-resize="false" + /> @@ -10725,6 +9774,7 @@ for understanding where time was actually spent in a program." > @@ -10732,6 +9782,7 @@ for understanding where time was actually spent in a program." @@ -10739,14 +9790,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -10754,14 +9801,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -10771,12 +9814,7 @@ for understanding where time was actually spent in a program." - - + />
@@ -10791,6 +9830,7 @@ for understanding where time was actually spent in a program." @@ -10798,14 +9838,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -10813,14 +9849,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -10830,12 +9862,7 @@ for understanding where time was actually spent in a program." - - + />
@@ -10850,6 +9878,7 @@ for understanding where time was actually spent in a program." @@ -10857,14 +9886,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -10872,14 +9897,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -10889,12 +9910,7 @@ for understanding where time was actually spent in a program." - - + />
@@ -10909,6 +9926,7 @@ for understanding where time was actually spent in a program." @@ -10916,14 +9934,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -10931,14 +9945,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -10948,12 +9958,7 @@ for understanding where time was actually spent in a program." - - + />
@@ -10968,6 +9974,7 @@ for understanding where time was actually spent in a program." @@ -10975,14 +9982,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -10990,14 +9993,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -11007,12 +10006,7 @@ for understanding where time was actually spent in a program." - - + />
@@ -11027,6 +10022,7 @@ for understanding where time was actually spent in a program." @@ -11034,14 +10030,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -11049,14 +10041,10 @@ for understanding where time was actually spent in a program." - - + /> @@ -11066,12 +10054,7 @@ for understanding where time was actually spent in a program." - - + />
From 565b55e8c0006a19bf6fa245e7c8fe1712bdcd3e Mon Sep 17 00:00:00 2001 From: Julien Wajsberg Date: Thu, 22 Dec 2022 17:07:56 +0100 Subject: [PATCH 05/14] Make initialWidth mandatory for the fixed columns, as well as remove resize-relevant properties for the other columns --- src/components/calltree/CallTree.js | 21 +++++++++++++++++---- src/components/shared/TreeView.js | 15 +++++++++------ 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/src/components/calltree/CallTree.js b/src/components/calltree/CallTree.js index 5042ff6a59..c23189f6b1 100644 --- a/src/components/calltree/CallTree.js +++ b/src/components/calltree/CallTree.js @@ -48,7 +48,10 @@ import type { } from 'firefox-profiler/types'; import type { CallTree as CallTreeType } from 'firefox-profiler/profile-logic/call-tree'; -import type { Column } from 'firefox-profiler/components/shared/TreeView'; +import type { + Column, + MaybeResizableColumn, +} from 'firefox-profiler/components/shared/TreeView'; import type { ConnectedProps } from 'firefox-profiler/utils/connect'; import './CallTree.css'; @@ -101,7 +104,7 @@ class CallTreeImpl extends PureComponent { * appropriate labels for the call tree based on this weight. */ _weightTypeToColumns = memoize( - (weightType: WeightType): Column[] => { + (weightType: WeightType): MaybeResizableColumn[] => { switch (weightType) { case 'tracing-ms': return [ @@ -126,7 +129,12 @@ class CallTreeImpl extends PureComponent { initialWidth: 70, resizable: true, }, - { propName: 'icon', titleL10nId: '', component: Icon }, + { + propName: 'icon', + titleL10nId: '', + component: Icon, + initialWidth: 10, + }, ]; case 'samples': return [ @@ -181,7 +189,12 @@ class CallTreeImpl extends PureComponent { initialWidth: 90, resizable: true, }, - { propName: 'icon', titleL10nId: '', component: Icon }, + { + propName: 'icon', + titleL10nId: '', + component: Icon, + initialWidth: 10, + }, ]; default: throw assertExhaustiveCheck(weightType, 'Unhandled WeightType.'); diff --git a/src/components/shared/TreeView.js b/src/components/shared/TreeView.js index 9305469744..baf9040408 100644 --- a/src/components/shared/TreeView.js +++ b/src/components/shared/TreeView.js @@ -51,10 +51,14 @@ export type Column = {| +component?: React.ComponentType<{| displayData: DisplayData, |}>, +|}; + +export type MaybeResizableColumn = {| + ...Column, /** defaults to initialWidth */ +minWidth?: CssPixels, - /** has only to be present in resizable columns */ - +initialWidth?: CssPixels, + /** This is the initial width, this can be changed in resizable columns */ + +initialWidth: CssPixels, /** found width + adjustment = width of header column */ +headerWidthAdjustment?: CssPixels, // false by default @@ -64,7 +68,7 @@ export type Column = {| |}; type TreeViewHeaderProps = {| - +fixedColumns: Column[], + +fixedColumns: MaybeResizableColumn[], +mainColumn: Column, +viewOptions: TableViewOptions, // called when the users moves the divider right of the column, @@ -181,7 +185,7 @@ function reactStringWithHighlightedSubstrings( type TreeViewRowFixedColumnsProps = {| +displayData: DisplayData, +nodeId: NodeIndex, - +columns: Column[], + +columns: MaybeResizableColumn[], +index: number, +isSelected: boolean, +isRightClicked: boolean, @@ -445,7 +449,7 @@ interface Tree { } type TreeViewProps = {| - +fixedColumns: Column[], + +fixedColumns: MaybeResizableColumn[], +mainColumn: Column, +tree: Tree, +expandedNodeIds: Array, @@ -517,7 +521,6 @@ export class TreeView extends React.PureComponent< if (widths === undefined) { throw new Error('The fixed column widths should be defined.'); } - // $FlowExpectError - Flow doesn't understand that we're checking for undefined above. return widths; }; From f8c079a34c648829621e694b1e254eb7f9045dd3 Mon Sep 17 00:00:00 2001 From: Julien Wajsberg Date: Thu, 22 Dec 2022 17:15:15 +0100 Subject: [PATCH 06/14] Use a class instead of a data attribute to trigger the resize mouse cursor --- src/components/shared/TreeView.css | 2 +- src/components/shared/TreeView.js | 6 +- .../__snapshots__/MarkerTable.test.js.snap | 9 +- .../ProfileCallTreeView.test.js.snap | 164 +++++++----------- 4 files changed, 68 insertions(+), 113 deletions(-) diff --git a/src/components/shared/TreeView.css b/src/components/shared/TreeView.css index efac4bd6b9..9f07fc974a 100644 --- a/src/components/shared/TreeView.css +++ b/src/components/shared/TreeView.css @@ -95,7 +95,7 @@ text-align: center; } -.treeViewColumnDivider[data-resize='true']:hover { +.treeViewColumnDivider.isResizable { cursor: col-resize; } diff --git a/src/components/shared/TreeView.js b/src/components/shared/TreeView.js index baf9040408..1589334b11 100644 --- a/src/components/shared/TreeView.js +++ b/src/components/shared/TreeView.js @@ -122,7 +122,9 @@ class TreeViewHeader extends React.PureComponent< {col.hideDividerAfter !== true ? ( extends React.PureComponent< col.resizable ? this._onDividerDoubleClick : undefined } data-column-index={i} - // required for the CSS selector, to trigger the cursor change on hover - data-resize={String(col.resizable || false)} > ) : null} diff --git a/src/test/components/__snapshots__/MarkerTable.test.js.snap b/src/test/components/__snapshots__/MarkerTable.test.js.snap index 7ab96c3f9c..35b18201a1 100644 --- a/src/test/components/__snapshots__/MarkerTable.test.js.snap +++ b/src/test/components/__snapshots__/MarkerTable.test.js.snap @@ -93,9 +93,8 @@ exports[`MarkerTable renders some basic markers and updates when needed 1`] = ` Start
Date: Thu, 22 Dec 2022 17:40:40 +0100 Subject: [PATCH 07/14] Use a more generic way to keep the cursor while resizing the column --- src/components/shared/TreeView.css | 3 ++- src/components/shared/TreeView.js | 29 +++++++++-------------------- 2 files changed, 11 insertions(+), 21 deletions(-) diff --git a/src/components/shared/TreeView.css b/src/components/shared/TreeView.css index 9f07fc974a..c4c2af181c 100644 --- a/src/components/shared/TreeView.css +++ b/src/components/shared/TreeView.css @@ -95,7 +95,8 @@ text-align: center; } -.treeViewColumnDivider.isResizable { +.treeViewColumnDivider.isResizable, +.treeView.isResizingColumns { cursor: col-resize; } diff --git a/src/components/shared/TreeView.js b/src/components/shared/TreeView.js index 1589334b11..dbd54b2df7 100644 --- a/src/components/shared/TreeView.js +++ b/src/components/shared/TreeView.js @@ -475,6 +475,7 @@ type TreeViewProps = {| type TreeViewState = {| +fixedColumnWidths: Array | null, + +isResizingColumns: boolean, |}; export class TreeView extends React.PureComponent< @@ -490,6 +491,7 @@ export class TreeView extends React.PureComponent< |} | null = null; state = { fixedColumnWidths: null, + isResizingColumns: false, }; _stateCounter: number = 0; @@ -532,26 +534,15 @@ export class TreeView extends React.PureComponent< }; }; - _getTreeTabChildren = () => { - const treeTab = document.getElementById('calltree-tab'); - if (treeTab) { - return treeTab.childNodes; - } - return []; - }; - _onColumnWidthChangeStart = (columnIndex: number, startX: CssPixels) => { this._currentMovedColumnState = { columnIndex, lastX: startX, initialWidth: this._getCurrentFixedColumnWidths()[columnIndex], }; + this.setState({ isResizingColumns: true }); window.addEventListener('mousemove', this._onColumnWidthChangeMouseMove); window.addEventListener('mouseup', this._onColumnWidthChangeMouseUp); - for (const elem of this._getTreeTabChildren()) { - // $FlowExpectError - we know that these are HTML nodes - elem.style.setProperty('cursor', 'col-resize'); - } }; _onColumnWidthChangeMouseMove = (event: MouseEvent) => { @@ -578,23 +569,20 @@ export class TreeView extends React.PureComponent< } }; - _cleanUpMouseHandlersAndResetCursor = () => { + _cleanUpMouseHandlers = () => { window.removeEventListener('mousemove', this._onColumnWidthChangeMouseMove); window.removeEventListener('mouseup', this._onColumnWidthChangeMouseUp); - for (const elem of this._getTreeTabChildren()) { - // $FlowExpectError - we know that these are HTML nodes - elem.style.removeProperty('cursor'); - } }; _onColumnWidthChangeMouseUp = () => { - this._cleanUpMouseHandlersAndResetCursor(); + this.setState({ isResizingColumns: false }); + this._cleanUpMouseHandlers(); this._currentMovedColumnState = null; this._propagateColumnWidthChange(this._getCurrentFixedColumnWidths()); }; componentWillUnmount = () => { - this._cleanUpMouseHandlersAndResetCursor(); + this._cleanUpMouseHandlers(); }; _onColumnWidthReset = (columnIndex: number) => { @@ -945,8 +933,9 @@ export class TreeView extends React.PureComponent< rowHeight, selectedNodeId, } = this.props; + const { isResizingColumns } = this.state; return ( -
+
Date: Thu, 22 Dec 2022 18:22:59 +0100 Subject: [PATCH 08/14] Improve the divider's CSS so that it has the right height --- src/components/shared/TreeView.css | 7 +- src/components/shared/TreeView.js | 1 - .../__snapshots__/MarkerTable.test.js.snap | 21 -- .../ProfileCallTreeView.test.js.snap | 336 ------------------ 4 files changed, 3 insertions(+), 362 deletions(-) diff --git a/src/components/shared/TreeView.css b/src/components/shared/TreeView.css index c4c2af181c..9c8d56d8f6 100644 --- a/src/components/shared/TreeView.css +++ b/src/components/shared/TreeView.css @@ -87,12 +87,13 @@ } .treeViewColumnDivider { - display: inline-block; + display: flex; width: 20px; flex: none; + align-items: stretch; + justify-content: center; margin-right: -5px; margin-left: -5px; - text-align: center; } .treeViewColumnDivider.isResizable, @@ -101,9 +102,7 @@ } .treeViewColumnDivider::before { - border-top: 2px solid var(--grey-30); border-right: 1px solid var(--grey-30); - border-bottom: 2px solid var(--grey-30); content: ''; } diff --git a/src/components/shared/TreeView.js b/src/components/shared/TreeView.js index dbd54b2df7..17fb2fa5f7 100644 --- a/src/components/shared/TreeView.js +++ b/src/components/shared/TreeView.js @@ -241,7 +241,6 @@ class TreeViewRowFixedColumns extends React.PureComponent< className={`treeViewRowColumn treeViewFixedColumn ${col.propName}`} title={text} style={style} - data-divider={col.hideDividerAfter !== true} > {RenderComponent ? ( diff --git a/src/test/components/__snapshots__/MarkerTable.test.js.snap b/src/test/components/__snapshots__/MarkerTable.test.js.snap index 35b18201a1..cb1fe477d0 100644 --- a/src/test/components/__snapshots__/MarkerTable.test.js.snap +++ b/src/test/components/__snapshots__/MarkerTable.test.js.snap @@ -151,7 +151,6 @@ exports[`MarkerTable renders some basic markers and updates when needed 1`] = ` > @@ -162,7 +161,6 @@ exports[`MarkerTable renders some basic markers and updates when needed 1`] = ` /> @@ -173,7 +171,6 @@ exports[`MarkerTable renders some basic markers and updates when needed 1`] = ` /> @@ -189,7 +186,6 @@ exports[`MarkerTable renders some basic markers and updates when needed 1`] = ` > @@ -200,7 +196,6 @@ exports[`MarkerTable renders some basic markers and updates when needed 1`] = ` /> @@ -209,7 +204,6 @@ exports[`MarkerTable renders some basic markers and updates when needed 1`] = ` /> @@ -225,7 +219,6 @@ exports[`MarkerTable renders some basic markers and updates when needed 1`] = ` > @@ -236,7 +229,6 @@ exports[`MarkerTable renders some basic markers and updates when needed 1`] = ` /> @@ -247,7 +239,6 @@ exports[`MarkerTable renders some basic markers and updates when needed 1`] = ` /> @@ -263,7 +254,6 @@ exports[`MarkerTable renders some basic markers and updates when needed 1`] = ` > @@ -274,7 +264,6 @@ exports[`MarkerTable renders some basic markers and updates when needed 1`] = ` /> @@ -285,7 +274,6 @@ exports[`MarkerTable renders some basic markers and updates when needed 1`] = ` /> @@ -301,7 +289,6 @@ exports[`MarkerTable renders some basic markers and updates when needed 1`] = ` > @@ -312,7 +299,6 @@ exports[`MarkerTable renders some basic markers and updates when needed 1`] = ` /> @@ -323,7 +309,6 @@ exports[`MarkerTable renders some basic markers and updates when needed 1`] = ` /> @@ -339,7 +324,6 @@ exports[`MarkerTable renders some basic markers and updates when needed 1`] = ` > @@ -350,7 +334,6 @@ exports[`MarkerTable renders some basic markers and updates when needed 1`] = ` /> @@ -359,7 +342,6 @@ exports[`MarkerTable renders some basic markers and updates when needed 1`] = ` /> @@ -375,7 +357,6 @@ exports[`MarkerTable renders some basic markers and updates when needed 1`] = ` > @@ -386,7 +367,6 @@ exports[`MarkerTable renders some basic markers and updates when needed 1`] = ` /> @@ -397,7 +377,6 @@ exports[`MarkerTable renders some basic markers and updates when needed 1`] = ` /> diff --git a/src/test/components/__snapshots__/ProfileCallTreeView.test.js.snap b/src/test/components/__snapshots__/ProfileCallTreeView.test.js.snap index 94f9f34c5b..25b2329a40 100644 --- a/src/test/components/__snapshots__/ProfileCallTreeView.test.js.snap +++ b/src/test/components/__snapshots__/ProfileCallTreeView.test.js.snap @@ -223,7 +223,6 @@ allocated or deallocated in the program." > @@ -231,7 +230,6 @@ allocated or deallocated in the program." @@ -242,7 +240,6 @@ allocated or deallocated in the program." /> @@ -253,7 +250,6 @@ allocated or deallocated in the program." /> @@ -271,7 +267,6 @@ allocated or deallocated in the program." > @@ -279,7 +274,6 @@ allocated or deallocated in the program." @@ -290,7 +284,6 @@ allocated or deallocated in the program." /> @@ -301,7 +294,6 @@ allocated or deallocated in the program." /> @@ -319,7 +311,6 @@ allocated or deallocated in the program." > @@ -327,7 +318,6 @@ allocated or deallocated in the program." @@ -338,7 +328,6 @@ allocated or deallocated in the program." /> @@ -349,7 +338,6 @@ allocated or deallocated in the program." /> @@ -367,7 +355,6 @@ allocated or deallocated in the program." > @@ -375,7 +362,6 @@ allocated or deallocated in the program." @@ -386,7 +372,6 @@ allocated or deallocated in the program." /> @@ -397,7 +382,6 @@ allocated or deallocated in the program." /> @@ -415,7 +399,6 @@ allocated or deallocated in the program." > @@ -423,7 +406,6 @@ allocated or deallocated in the program." @@ -434,7 +416,6 @@ allocated or deallocated in the program." /> @@ -445,7 +426,6 @@ allocated or deallocated in the program." /> @@ -463,7 +443,6 @@ allocated or deallocated in the program." > @@ -471,7 +450,6 @@ allocated or deallocated in the program." @@ -482,7 +460,6 @@ allocated or deallocated in the program." /> @@ -493,7 +470,6 @@ allocated or deallocated in the program." /> @@ -511,7 +487,6 @@ allocated or deallocated in the program." > @@ -519,7 +494,6 @@ allocated or deallocated in the program." @@ -530,7 +504,6 @@ allocated or deallocated in the program." /> @@ -541,7 +514,6 @@ allocated or deallocated in the program." /> @@ -1029,7 +1001,6 @@ allocated or deallocated in the program." > @@ -1037,7 +1008,6 @@ allocated or deallocated in the program." @@ -1048,7 +1018,6 @@ allocated or deallocated in the program." /> @@ -1059,7 +1028,6 @@ allocated or deallocated in the program." /> @@ -1077,7 +1045,6 @@ allocated or deallocated in the program." > @@ -1085,7 +1052,6 @@ allocated or deallocated in the program." @@ -1096,7 +1062,6 @@ allocated or deallocated in the program." /> @@ -1107,7 +1072,6 @@ allocated or deallocated in the program." /> @@ -1125,7 +1089,6 @@ allocated or deallocated in the program." > @@ -1133,7 +1096,6 @@ allocated or deallocated in the program." @@ -1144,7 +1106,6 @@ allocated or deallocated in the program." /> @@ -1155,7 +1116,6 @@ allocated or deallocated in the program." /> @@ -1173,7 +1133,6 @@ allocated or deallocated in the program." > @@ -1181,7 +1140,6 @@ allocated or deallocated in the program." @@ -1192,7 +1150,6 @@ allocated or deallocated in the program." /> @@ -1203,7 +1160,6 @@ allocated or deallocated in the program." /> @@ -1221,7 +1177,6 @@ allocated or deallocated in the program." > @@ -1229,7 +1184,6 @@ allocated or deallocated in the program." @@ -1240,7 +1194,6 @@ allocated or deallocated in the program." /> @@ -1251,7 +1204,6 @@ allocated or deallocated in the program." /> @@ -1269,7 +1221,6 @@ allocated or deallocated in the program." > @@ -1277,7 +1228,6 @@ allocated or deallocated in the program." @@ -1288,7 +1238,6 @@ allocated or deallocated in the program." /> @@ -1299,7 +1248,6 @@ allocated or deallocated in the program." /> @@ -1317,7 +1265,6 @@ allocated or deallocated in the program." > @@ -1325,7 +1272,6 @@ allocated or deallocated in the program." @@ -1336,7 +1282,6 @@ allocated or deallocated in the program." /> @@ -1347,7 +1292,6 @@ allocated or deallocated in the program." /> @@ -1835,7 +1779,6 @@ allocated or deallocated in the program." > @@ -1843,7 +1786,6 @@ allocated or deallocated in the program." @@ -1854,7 +1796,6 @@ allocated or deallocated in the program." /> @@ -1865,7 +1806,6 @@ allocated or deallocated in the program." /> @@ -1883,7 +1823,6 @@ allocated or deallocated in the program." > @@ -1891,7 +1830,6 @@ allocated or deallocated in the program." @@ -1902,7 +1840,6 @@ allocated or deallocated in the program." /> @@ -1913,7 +1850,6 @@ allocated or deallocated in the program." /> @@ -1931,7 +1867,6 @@ allocated or deallocated in the program." > @@ -1939,7 +1874,6 @@ allocated or deallocated in the program." @@ -1950,7 +1884,6 @@ allocated or deallocated in the program." /> @@ -1961,7 +1894,6 @@ allocated or deallocated in the program." /> @@ -1979,7 +1911,6 @@ allocated or deallocated in the program." > @@ -1987,7 +1918,6 @@ allocated or deallocated in the program." @@ -1998,7 +1928,6 @@ allocated or deallocated in the program." /> @@ -2009,7 +1938,6 @@ allocated or deallocated in the program." /> @@ -2027,7 +1955,6 @@ allocated or deallocated in the program." > @@ -2035,7 +1962,6 @@ allocated or deallocated in the program." @@ -2046,7 +1972,6 @@ allocated or deallocated in the program." /> @@ -2057,7 +1982,6 @@ allocated or deallocated in the program." /> @@ -2075,7 +1999,6 @@ allocated or deallocated in the program." > @@ -2083,7 +2006,6 @@ allocated or deallocated in the program." @@ -2094,7 +2016,6 @@ allocated or deallocated in the program." /> @@ -2105,7 +2026,6 @@ allocated or deallocated in the program." /> @@ -2123,7 +2043,6 @@ allocated or deallocated in the program." > @@ -2131,7 +2050,6 @@ allocated or deallocated in the program." @@ -2142,7 +2060,6 @@ allocated or deallocated in the program." /> @@ -2153,7 +2070,6 @@ allocated or deallocated in the program." /> @@ -2629,7 +2545,6 @@ allocated or deallocated in the program." > @@ -2637,7 +2552,6 @@ allocated or deallocated in the program." @@ -2648,7 +2562,6 @@ allocated or deallocated in the program." /> @@ -2659,7 +2572,6 @@ allocated or deallocated in the program." /> @@ -2677,7 +2589,6 @@ allocated or deallocated in the program." > @@ -2685,7 +2596,6 @@ allocated or deallocated in the program." @@ -2696,7 +2606,6 @@ allocated or deallocated in the program." /> @@ -2707,7 +2616,6 @@ allocated or deallocated in the program." /> @@ -2725,7 +2633,6 @@ allocated or deallocated in the program." > @@ -2733,7 +2640,6 @@ allocated or deallocated in the program." @@ -2744,7 +2650,6 @@ allocated or deallocated in the program." /> @@ -2755,7 +2660,6 @@ allocated or deallocated in the program." /> @@ -2773,7 +2677,6 @@ allocated or deallocated in the program." > @@ -2781,7 +2684,6 @@ allocated or deallocated in the program." @@ -2792,7 +2694,6 @@ allocated or deallocated in the program." /> @@ -2803,7 +2704,6 @@ allocated or deallocated in the program." /> @@ -2821,7 +2721,6 @@ allocated or deallocated in the program." > @@ -2829,7 +2728,6 @@ allocated or deallocated in the program." @@ -2840,7 +2738,6 @@ allocated or deallocated in the program." /> @@ -2851,7 +2748,6 @@ allocated or deallocated in the program." /> @@ -2869,7 +2765,6 @@ allocated or deallocated in the program." > @@ -2877,7 +2772,6 @@ allocated or deallocated in the program." @@ -2888,7 +2782,6 @@ allocated or deallocated in the program." /> @@ -2899,7 +2792,6 @@ allocated or deallocated in the program." /> @@ -2917,7 +2809,6 @@ allocated or deallocated in the program." > @@ -2925,7 +2816,6 @@ allocated or deallocated in the program." @@ -2936,7 +2826,6 @@ allocated or deallocated in the program." /> @@ -2947,7 +2836,6 @@ allocated or deallocated in the program." /> @@ -3423,7 +3311,6 @@ allocated or deallocated in the program." > @@ -3431,7 +3318,6 @@ allocated or deallocated in the program." @@ -3442,7 +3328,6 @@ allocated or deallocated in the program." /> @@ -3453,7 +3338,6 @@ allocated or deallocated in the program." /> @@ -3471,7 +3355,6 @@ allocated or deallocated in the program." > @@ -3479,7 +3362,6 @@ allocated or deallocated in the program." @@ -3490,7 +3372,6 @@ allocated or deallocated in the program." /> @@ -3501,7 +3382,6 @@ allocated or deallocated in the program." /> @@ -3519,7 +3399,6 @@ allocated or deallocated in the program." > @@ -3527,7 +3406,6 @@ allocated or deallocated in the program." @@ -3538,7 +3416,6 @@ allocated or deallocated in the program." /> @@ -3549,7 +3426,6 @@ allocated or deallocated in the program." /> @@ -3567,7 +3443,6 @@ allocated or deallocated in the program." > @@ -3575,7 +3450,6 @@ allocated or deallocated in the program." @@ -3586,7 +3460,6 @@ allocated or deallocated in the program." /> @@ -3597,7 +3470,6 @@ allocated or deallocated in the program." /> @@ -3615,7 +3487,6 @@ allocated or deallocated in the program." > @@ -3623,7 +3494,6 @@ allocated or deallocated in the program." @@ -3634,7 +3504,6 @@ allocated or deallocated in the program." /> @@ -3645,7 +3514,6 @@ allocated or deallocated in the program." /> @@ -4478,7 +4346,6 @@ for understanding where time was actually spent in a program." > @@ -4486,7 +4353,6 @@ for understanding where time was actually spent in a program." @@ -4497,7 +4363,6 @@ for understanding where time was actually spent in a program." /> @@ -4508,7 +4373,6 @@ for understanding where time was actually spent in a program." /> @@ -4526,7 +4390,6 @@ for understanding where time was actually spent in a program." > @@ -4534,7 +4397,6 @@ for understanding where time was actually spent in a program." @@ -4545,7 +4407,6 @@ for understanding where time was actually spent in a program." /> @@ -4556,7 +4417,6 @@ for understanding where time was actually spent in a program." /> @@ -4574,7 +4434,6 @@ for understanding where time was actually spent in a program." > @@ -4582,7 +4441,6 @@ for understanding where time was actually spent in a program." @@ -4593,7 +4451,6 @@ for understanding where time was actually spent in a program." /> @@ -4604,7 +4461,6 @@ for understanding where time was actually spent in a program." /> @@ -4622,7 +4478,6 @@ for understanding where time was actually spent in a program." > @@ -4630,7 +4485,6 @@ for understanding where time was actually spent in a program." @@ -4641,7 +4495,6 @@ for understanding where time was actually spent in a program." /> @@ -4652,7 +4505,6 @@ for understanding where time was actually spent in a program." /> @@ -4670,7 +4522,6 @@ for understanding where time was actually spent in a program." > @@ -4678,7 +4529,6 @@ for understanding where time was actually spent in a program." @@ -4689,7 +4539,6 @@ for understanding where time was actually spent in a program." /> @@ -4700,7 +4549,6 @@ for understanding where time was actually spent in a program." /> @@ -4718,7 +4566,6 @@ for understanding where time was actually spent in a program." > @@ -4726,7 +4573,6 @@ for understanding where time was actually spent in a program." @@ -4737,7 +4583,6 @@ for understanding where time was actually spent in a program." /> @@ -4748,7 +4593,6 @@ for understanding where time was actually spent in a program." /> @@ -4766,7 +4610,6 @@ for understanding where time was actually spent in a program." > @@ -4774,7 +4617,6 @@ for understanding where time was actually spent in a program." @@ -4785,7 +4627,6 @@ for understanding where time was actually spent in a program." /> @@ -4796,7 +4637,6 @@ for understanding where time was actually spent in a program." /> @@ -5239,7 +5079,6 @@ for understanding where time was actually spent in a program." > @@ -5247,7 +5086,6 @@ for understanding where time was actually spent in a program." @@ -5258,7 +5096,6 @@ for understanding where time was actually spent in a program." /> @@ -5269,7 +5106,6 @@ for understanding where time was actually spent in a program." /> @@ -5287,7 +5123,6 @@ for understanding where time was actually spent in a program." > @@ -5295,7 +5130,6 @@ for understanding where time was actually spent in a program." @@ -5306,7 +5140,6 @@ for understanding where time was actually spent in a program." /> @@ -5317,7 +5150,6 @@ for understanding where time was actually spent in a program." /> @@ -5335,7 +5167,6 @@ for understanding where time was actually spent in a program." > @@ -5343,7 +5174,6 @@ for understanding where time was actually spent in a program." @@ -5354,7 +5184,6 @@ for understanding where time was actually spent in a program." /> @@ -5365,7 +5194,6 @@ for understanding where time was actually spent in a program." /> @@ -5383,7 +5211,6 @@ for understanding where time was actually spent in a program." > @@ -5391,7 +5218,6 @@ for understanding where time was actually spent in a program." @@ -5402,7 +5228,6 @@ for understanding where time was actually spent in a program." /> @@ -5413,7 +5238,6 @@ for understanding where time was actually spent in a program." /> @@ -5431,7 +5255,6 @@ for understanding where time was actually spent in a program." > @@ -5439,7 +5262,6 @@ for understanding where time was actually spent in a program." @@ -5450,7 +5272,6 @@ for understanding where time was actually spent in a program." /> @@ -5461,7 +5282,6 @@ for understanding where time was actually spent in a program." /> @@ -5479,7 +5299,6 @@ for understanding where time was actually spent in a program." > @@ -5487,7 +5306,6 @@ for understanding where time was actually spent in a program." @@ -5498,7 +5316,6 @@ for understanding where time was actually spent in a program." /> @@ -5509,7 +5326,6 @@ for understanding where time was actually spent in a program." /> @@ -5527,7 +5343,6 @@ for understanding where time was actually spent in a program." > @@ -5535,7 +5350,6 @@ for understanding where time was actually spent in a program." @@ -5546,7 +5360,6 @@ for understanding where time was actually spent in a program." /> @@ -5557,7 +5370,6 @@ for understanding where time was actually spent in a program." /> @@ -6000,7 +5812,6 @@ for understanding where time was actually spent in a program." > @@ -6008,7 +5819,6 @@ for understanding where time was actually spent in a program." @@ -6019,7 +5829,6 @@ for understanding where time was actually spent in a program." /> @@ -6030,7 +5839,6 @@ for understanding where time was actually spent in a program." /> @@ -6048,7 +5856,6 @@ for understanding where time was actually spent in a program." > @@ -6056,7 +5863,6 @@ for understanding where time was actually spent in a program." @@ -6067,7 +5873,6 @@ for understanding where time was actually spent in a program." /> @@ -6078,7 +5883,6 @@ for understanding where time was actually spent in a program." /> @@ -6096,7 +5900,6 @@ for understanding where time was actually spent in a program." > @@ -6104,7 +5907,6 @@ for understanding where time was actually spent in a program." @@ -6115,7 +5917,6 @@ for understanding where time was actually spent in a program." /> @@ -6126,7 +5927,6 @@ for understanding where time was actually spent in a program." /> @@ -6144,7 +5944,6 @@ for understanding where time was actually spent in a program." > @@ -6152,7 +5951,6 @@ for understanding where time was actually spent in a program." @@ -6163,7 +5961,6 @@ for understanding where time was actually spent in a program." /> @@ -6174,7 +5971,6 @@ for understanding where time was actually spent in a program." /> @@ -6533,7 +6329,6 @@ for understanding where time was actually spent in a program." > @@ -6541,7 +6336,6 @@ for understanding where time was actually spent in a program." @@ -6552,7 +6346,6 @@ for understanding where time was actually spent in a program." /> @@ -6563,7 +6356,6 @@ for understanding where time was actually spent in a program." /> @@ -6581,7 +6373,6 @@ for understanding where time was actually spent in a program." > @@ -6589,7 +6380,6 @@ for understanding where time was actually spent in a program." @@ -6600,7 +6390,6 @@ for understanding where time was actually spent in a program." /> @@ -6611,7 +6400,6 @@ for understanding where time was actually spent in a program." /> @@ -6629,7 +6417,6 @@ for understanding where time was actually spent in a program." > @@ -6637,7 +6424,6 @@ for understanding where time was actually spent in a program." @@ -6648,7 +6434,6 @@ for understanding where time was actually spent in a program." /> @@ -6659,7 +6444,6 @@ for understanding where time was actually spent in a program." /> @@ -6677,7 +6461,6 @@ for understanding where time was actually spent in a program." > @@ -6685,7 +6468,6 @@ for understanding where time was actually spent in a program." @@ -6696,7 +6478,6 @@ for understanding where time was actually spent in a program." /> @@ -6707,7 +6488,6 @@ for understanding where time was actually spent in a program." /> @@ -6725,7 +6505,6 @@ for understanding where time was actually spent in a program." > @@ -6733,7 +6512,6 @@ for understanding where time was actually spent in a program." @@ -6744,7 +6522,6 @@ for understanding where time was actually spent in a program." /> @@ -6755,7 +6532,6 @@ for understanding where time was actually spent in a program." /> @@ -6773,7 +6549,6 @@ for understanding where time was actually spent in a program." > @@ -6781,7 +6556,6 @@ for understanding where time was actually spent in a program." @@ -6792,7 +6566,6 @@ for understanding where time was actually spent in a program." /> @@ -6803,7 +6576,6 @@ for understanding where time was actually spent in a program." /> @@ -6821,7 +6593,6 @@ for understanding where time was actually spent in a program." > @@ -6829,7 +6600,6 @@ for understanding where time was actually spent in a program." @@ -6840,7 +6610,6 @@ for understanding where time was actually spent in a program." /> @@ -6851,7 +6620,6 @@ for understanding where time was actually spent in a program." /> @@ -7294,7 +7062,6 @@ for understanding where time was actually spent in a program." > @@ -7302,7 +7069,6 @@ for understanding where time was actually spent in a program." @@ -7313,7 +7079,6 @@ for understanding where time was actually spent in a program." /> @@ -7324,7 +7089,6 @@ for understanding where time was actually spent in a program." /> @@ -7342,7 +7106,6 @@ for understanding where time was actually spent in a program." > @@ -7350,7 +7113,6 @@ for understanding where time was actually spent in a program." @@ -7361,7 +7123,6 @@ for understanding where time was actually spent in a program." /> @@ -7372,7 +7133,6 @@ for understanding where time was actually spent in a program." /> @@ -7390,7 +7150,6 @@ for understanding where time was actually spent in a program." > @@ -7398,7 +7157,6 @@ for understanding where time was actually spent in a program." @@ -7409,7 +7167,6 @@ for understanding where time was actually spent in a program." /> @@ -7420,7 +7177,6 @@ for understanding where time was actually spent in a program." /> @@ -7438,7 +7194,6 @@ for understanding where time was actually spent in a program." > @@ -7446,7 +7201,6 @@ for understanding where time was actually spent in a program." @@ -7457,7 +7211,6 @@ for understanding where time was actually spent in a program." /> @@ -7468,7 +7221,6 @@ for understanding where time was actually spent in a program." /> @@ -7486,7 +7238,6 @@ for understanding where time was actually spent in a program." > @@ -7494,7 +7245,6 @@ for understanding where time was actually spent in a program." @@ -7505,7 +7255,6 @@ for understanding where time was actually spent in a program." /> @@ -7516,7 +7265,6 @@ for understanding where time was actually spent in a program." /> @@ -7534,7 +7282,6 @@ for understanding where time was actually spent in a program." > @@ -7542,7 +7289,6 @@ for understanding where time was actually spent in a program." @@ -7553,7 +7299,6 @@ for understanding where time was actually spent in a program." /> @@ -7564,7 +7309,6 @@ for understanding where time was actually spent in a program." /> @@ -7979,7 +7723,6 @@ for understanding where time was actually spent in a program." > @@ -7987,7 +7730,6 @@ for understanding where time was actually spent in a program." @@ -7998,7 +7740,6 @@ for understanding where time was actually spent in a program." /> @@ -8009,7 +7750,6 @@ for understanding where time was actually spent in a program." /> @@ -8027,7 +7767,6 @@ for understanding where time was actually spent in a program." > @@ -8035,7 +7774,6 @@ for understanding where time was actually spent in a program." @@ -8046,7 +7784,6 @@ for understanding where time was actually spent in a program." /> @@ -8057,7 +7794,6 @@ for understanding where time was actually spent in a program." /> @@ -8075,7 +7811,6 @@ for understanding where time was actually spent in a program." > @@ -8083,7 +7818,6 @@ for understanding where time was actually spent in a program." @@ -8094,7 +7828,6 @@ for understanding where time was actually spent in a program." /> @@ -8105,7 +7838,6 @@ for understanding where time was actually spent in a program." /> @@ -8123,7 +7855,6 @@ for understanding where time was actually spent in a program." > @@ -8131,7 +7862,6 @@ for understanding where time was actually spent in a program." @@ -8142,7 +7872,6 @@ for understanding where time was actually spent in a program." /> @@ -8153,7 +7882,6 @@ for understanding where time was actually spent in a program." /> @@ -8171,7 +7899,6 @@ for understanding where time was actually spent in a program." > @@ -8179,7 +7906,6 @@ for understanding where time was actually spent in a program." @@ -8190,7 +7916,6 @@ for understanding where time was actually spent in a program." /> @@ -8201,7 +7926,6 @@ for understanding where time was actually spent in a program." /> @@ -8219,7 +7943,6 @@ for understanding where time was actually spent in a program." > @@ -8227,7 +7950,6 @@ for understanding where time was actually spent in a program." @@ -8238,7 +7960,6 @@ for understanding where time was actually spent in a program." /> @@ -8249,7 +7970,6 @@ for understanding where time was actually spent in a program." /> @@ -8664,7 +8384,6 @@ for understanding where time was actually spent in a program." > @@ -8672,7 +8391,6 @@ for understanding where time was actually spent in a program." @@ -8683,7 +8401,6 @@ for understanding where time was actually spent in a program." /> @@ -8694,7 +8411,6 @@ for understanding where time was actually spent in a program." /> @@ -8712,7 +8428,6 @@ for understanding where time was actually spent in a program." > @@ -8720,7 +8435,6 @@ for understanding where time was actually spent in a program." @@ -8731,7 +8445,6 @@ for understanding where time was actually spent in a program." /> @@ -8742,7 +8455,6 @@ for understanding where time was actually spent in a program." /> @@ -8760,7 +8472,6 @@ for understanding where time was actually spent in a program." > @@ -8768,7 +8479,6 @@ for understanding where time was actually spent in a program." @@ -8779,7 +8489,6 @@ for understanding where time was actually spent in a program." /> @@ -8790,7 +8499,6 @@ for understanding where time was actually spent in a program." /> @@ -8808,7 +8516,6 @@ for understanding where time was actually spent in a program." > @@ -8816,7 +8523,6 @@ for understanding where time was actually spent in a program." @@ -8827,7 +8533,6 @@ for understanding where time was actually spent in a program." /> @@ -8838,7 +8543,6 @@ for understanding where time was actually spent in a program." /> @@ -9198,7 +8902,6 @@ for understanding where time was actually spent in a program." > @@ -9206,7 +8909,6 @@ for understanding where time was actually spent in a program." @@ -9217,7 +8919,6 @@ for understanding where time was actually spent in a program." /> @@ -9228,7 +8929,6 @@ for understanding where time was actually spent in a program." /> @@ -9246,7 +8946,6 @@ for understanding where time was actually spent in a program." > @@ -9254,7 +8953,6 @@ for understanding where time was actually spent in a program." @@ -9265,7 +8963,6 @@ for understanding where time was actually spent in a program." /> @@ -9276,7 +8973,6 @@ for understanding where time was actually spent in a program." /> @@ -9294,7 +8990,6 @@ for understanding where time was actually spent in a program." > @@ -9302,7 +8997,6 @@ for understanding where time was actually spent in a program." @@ -9313,7 +9007,6 @@ for understanding where time was actually spent in a program." /> @@ -9324,7 +9017,6 @@ for understanding where time was actually spent in a program." /> @@ -9342,7 +9034,6 @@ for understanding where time was actually spent in a program." > @@ -9350,7 +9041,6 @@ for understanding where time was actually spent in a program." @@ -9361,7 +9051,6 @@ for understanding where time was actually spent in a program." /> @@ -9372,7 +9061,6 @@ for understanding where time was actually spent in a program." /> @@ -9732,7 +9420,6 @@ for understanding where time was actually spent in a program." > @@ -9740,7 +9427,6 @@ for understanding where time was actually spent in a program." @@ -9751,7 +9437,6 @@ for understanding where time was actually spent in a program." /> @@ -9762,7 +9447,6 @@ for understanding where time was actually spent in a program." /> @@ -9780,7 +9464,6 @@ for understanding where time was actually spent in a program." > @@ -9788,7 +9471,6 @@ for understanding where time was actually spent in a program." @@ -9799,7 +9481,6 @@ for understanding where time was actually spent in a program." /> @@ -9810,7 +9491,6 @@ for understanding where time was actually spent in a program." /> @@ -9828,7 +9508,6 @@ for understanding where time was actually spent in a program." > @@ -9836,7 +9515,6 @@ for understanding where time was actually spent in a program." @@ -9847,7 +9525,6 @@ for understanding where time was actually spent in a program." /> @@ -9858,7 +9535,6 @@ for understanding where time was actually spent in a program." /> @@ -9876,7 +9552,6 @@ for understanding where time was actually spent in a program." > @@ -9884,7 +9559,6 @@ for understanding where time was actually spent in a program." @@ -9895,7 +9569,6 @@ for understanding where time was actually spent in a program." /> @@ -9906,7 +9579,6 @@ for understanding where time was actually spent in a program." /> @@ -9924,7 +9596,6 @@ for understanding where time was actually spent in a program." > @@ -9932,7 +9603,6 @@ for understanding where time was actually spent in a program." @@ -9943,7 +9613,6 @@ for understanding where time was actually spent in a program." /> @@ -9954,7 +9623,6 @@ for understanding where time was actually spent in a program." /> @@ -9972,7 +9640,6 @@ for understanding where time was actually spent in a program." > @@ -9980,7 +9647,6 @@ for understanding where time was actually spent in a program." @@ -9991,7 +9657,6 @@ for understanding where time was actually spent in a program." /> @@ -10002,7 +9667,6 @@ for understanding where time was actually spent in a program." /> From 185a6506c630c09300e7bdc942e68adcd0b5e2fa Mon Sep 17 00:00:00 2001 From: Julien Wajsberg Date: Thu, 22 Dec 2022 18:24:00 +0100 Subject: [PATCH 09/14] Remove extraneous if block --- src/components/shared/TreeView.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/components/shared/TreeView.js b/src/components/shared/TreeView.js index 17fb2fa5f7..b372806f84 100644 --- a/src/components/shared/TreeView.js +++ b/src/components/shared/TreeView.js @@ -551,9 +551,6 @@ export class TreeView extends React.PureComponent< const column = this.props.fixedColumns[columnIndex]; const fixedColumnWidths = this._getCurrentFixedColumnWidths(); const diff = event.clientX - lastX; - if (diff === 0) { - return; - } const newWidth = Math.max(initialWidth + diff, column.minWidth || 10); this.setState((prevState) => { this._stateCounter++; From 0a1fc2c4abd0bbcbaf4d166a00ec28f85723b563 Mon Sep 17 00:00:00 2001 From: Julien Wajsberg Date: Thu, 22 Dec 2022 18:33:58 +0100 Subject: [PATCH 10/14] Fix the doubleclick gesture to reset the column width --- src/components/shared/TreeView.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/components/shared/TreeView.js b/src/components/shared/TreeView.js index b372806f84..115291fbbe 100644 --- a/src/components/shared/TreeView.js +++ b/src/components/shared/TreeView.js @@ -583,12 +583,12 @@ export class TreeView extends React.PureComponent< _onColumnWidthReset = (columnIndex: number) => { const column = this.props.fixedColumns[columnIndex]; - const fixedColumnWidths = - this.state.fixedColumnWidths || this.props.viewOptions.fixedColumnWidths; - if (fixedColumnWidths) { - fixedColumnWidths[columnIndex] = column.initialWidth || 10; - this._propagateColumnWidthChange(fixedColumnWidths); - } + const fixedColumnWidths = this._getCurrentFixedColumnWidths(); + const newFixedColumnWidths = fixedColumnWidths.slice(); + newFixedColumnWidths[columnIndex] = column.initialWidth || 10; + this._stateCounter++; + this.setState({ fixedColumnWidths: newFixedColumnWidths }); + this._propagateColumnWidthChange(newFixedColumnWidths); }; // triggers a re-render @@ -960,9 +960,7 @@ export class TreeView extends React.PureComponent< focusable={true} onKeyDown={this._onKeyDown} specialItems={this._getSpecialItems()} - disableOverscan={ - !!disableOverscan || this._currentMovedColumnState === null - } + disableOverscan={!!disableOverscan || isResizingColumns} onCopy={this._onCopy} // If there is a deep call node depth, expand the width, or else keep it // at 3000 wide. From 36f6a02a5e266dc71d53598cbbaec0e1d4e84e2b Mon Sep 17 00:00:00 2001 From: Julien Wajsberg Date: Thu, 22 Dec 2022 18:37:15 +0100 Subject: [PATCH 11/14] Use a double border for the dividers that are manipulable --- src/components/shared/TreeView.css | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/components/shared/TreeView.css b/src/components/shared/TreeView.css index 9c8d56d8f6..684def6524 100644 --- a/src/components/shared/TreeView.css +++ b/src/components/shared/TreeView.css @@ -106,6 +106,11 @@ content: ''; } +.treeViewColumnDivider.isResizable::before { + width: 1px; + border-left: 1px solid var(--grey-30); +} + .treeViewHeaderColumn.treeViewFixedColumn { /* The fixed columns in the row don't shrink because they're positioning using * position: sticky, therefore we prevent shrinking for the columns in the From 0a0df25deaa4dd38f412d498bec51081d47b85ab Mon Sep 17 00:00:00 2001 From: Julien Wajsberg Date: Thu, 22 Dec 2022 18:55:00 +0100 Subject: [PATCH 12/14] Rename some variables, simplify a few functions, move functions around and add comments --- src/components/shared/TreeView.js | 82 +++++++++++++++---------------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/src/components/shared/TreeView.js b/src/components/shared/TreeView.js index 115291fbbe..1426c62e69 100644 --- a/src/components/shared/TreeView.js +++ b/src/components/shared/TreeView.js @@ -44,6 +44,9 @@ function PermissiveLocalized(props: React.ElementConfig) { // See https://github.com/facebook/flow/issues/4099 type RegExpResult = null | ({ index: number, input: string } & string[]); type NodeIndex = number; +type TableViewOptionsWithDefault = {| + fixedColumnWidths: Array, +|}; export type Column = {| +propName: string, @@ -70,7 +73,7 @@ export type MaybeResizableColumn = {| type TreeViewHeaderProps = {| +fixedColumns: MaybeResizableColumn[], +mainColumn: Column, - +viewOptions: TableViewOptions, + +viewOptions: TableViewOptionsWithDefault, // called when the users moves the divider right of the column, // passes the column index and the start x coordinate +onColumnWidthChangeStart: (number, CssPixels) => void, @@ -103,19 +106,12 @@ class TreeViewHeader extends React.PureComponent< return (
{fixedColumns.map((col, i) => { - const style = - columnWidths || col.initialWidth - ? { - width: - (columnWidths ? columnWidths[i] : col.initialWidth) + - (col.headerWidthAdjustment || 0), - } - : {}; + const width = columnWidths[i] + (col.headerWidthAdjustment || 0); return ( @@ -192,7 +188,7 @@ type TreeViewRowFixedColumnsProps = {| +onClick: (NodeIndex, SyntheticMouseEvent<>) => mixed, +highlightRegExp: RegExp | null, +rowHeightStyle: { height: CssPixels, lineHeight: string }, - +viewOptions: TableViewOptions, + +viewOptions: TableViewOptionsWithDefault, |}; class TreeViewRowFixedColumns extends React.PureComponent< @@ -229,18 +225,12 @@ class TreeViewRowFixedColumns extends React.PureComponent< {columns.map((col, i) => { const RenderComponent = col.component; const text = displayData[col.propName] || ''; - const style = - columnWidths || col.initialWidth - ? { - width: columnWidths ? columnWidths[i] : col.initialWidth, - } - : {}; return ( {RenderComponent ? ( @@ -483,16 +473,25 @@ export class TreeView extends React.PureComponent< > { _list: VirtualList | null = null; _takeListRef = (list: VirtualList | null) => (this._list = list); + + // This contains the information about the current column resizing happening currently. _currentMovedColumnState: {| columnIndex: number, - lastX: CssPixels, + startX: CssPixels, initialWidth: CssPixels, |} | null = null; + state = { + // This contains the current widths, while or after the user resizes them. fixedColumnWidths: null, + + // This is true when the user is currently resizing a column. isResizingColumns: false, }; - _stateCounter: number = 0; + + // This is incremented when a column changed its size. We use this to force a + // rerender of the VirtualList component. + _columnSizeChangedCounter: number = 0; // The tuple `specialItems` always contains 2 elements: the first element is // the selected node id (if any), and the second element is the right clicked @@ -514,29 +513,30 @@ export class TreeView extends React.PureComponent< { limit: 1 } ); + // This returns the column widths from several possible sources, in this order: + // * the current state (this means the user changed them recently, or is + // currently changing them) + // * the view options (this comes from the redux state, this means the user + // changed them in the past) + // * or finally the initial values from the fixedColumns information. _getCurrentFixedColumnWidths = (): Array => { - const widths = + return ( this.state.fixedColumnWidths || this.props.viewOptions.fixedColumnWidths || - this.props.fixedColumns.map((c) => c.initialWidth); - if (widths === undefined) { - throw new Error('The fixed column widths should be defined.'); - } - return widths; + this.props.fixedColumns.map((c) => c.initialWidth) + ); }; - _getCurrentViewOptions = (): TableViewOptions => { - const widths = this._getCurrentFixedColumnWidths(); + _getCurrentViewOptions = (): TableViewOptionsWithDefault => { return { - ...this.props.viewOptions, - fixedColumnWidths: widths, + fixedColumnWidths: this._getCurrentFixedColumnWidths(), }; }; _onColumnWidthChangeStart = (columnIndex: number, startX: CssPixels) => { this._currentMovedColumnState = { columnIndex, - lastX: startX, + startX, initialWidth: this._getCurrentFixedColumnWidths()[columnIndex], }; this.setState({ isResizingColumns: true }); @@ -544,16 +544,21 @@ export class TreeView extends React.PureComponent< window.addEventListener('mouseup', this._onColumnWidthChangeMouseUp); }; + _cleanUpMouseHandlers = () => { + window.removeEventListener('mousemove', this._onColumnWidthChangeMouseMove); + window.removeEventListener('mouseup', this._onColumnWidthChangeMouseUp); + }; + _onColumnWidthChangeMouseMove = (event: MouseEvent) => { const columnState = this._currentMovedColumnState; if (columnState !== null) { - const { columnIndex, lastX, initialWidth } = columnState; + const { columnIndex, startX, initialWidth } = columnState; const column = this.props.fixedColumns[columnIndex]; const fixedColumnWidths = this._getCurrentFixedColumnWidths(); - const diff = event.clientX - lastX; + const diff = event.clientX - startX; const newWidth = Math.max(initialWidth + diff, column.minWidth || 10); this.setState((prevState) => { - this._stateCounter++; + this._columnSizeChangedCounter++; const newFixedColumnWidths = ( prevState.fixedColumnWidths || fixedColumnWidths ).slice(); @@ -565,11 +570,6 @@ export class TreeView extends React.PureComponent< } }; - _cleanUpMouseHandlers = () => { - window.removeEventListener('mousemove', this._onColumnWidthChangeMouseMove); - window.removeEventListener('mouseup', this._onColumnWidthChangeMouseUp); - }; - _onColumnWidthChangeMouseUp = () => { this.setState({ isResizingColumns: false }); this._cleanUpMouseHandlers(); @@ -586,7 +586,7 @@ export class TreeView extends React.PureComponent< const fixedColumnWidths = this._getCurrentFixedColumnWidths(); const newFixedColumnWidths = fixedColumnWidths.slice(); newFixedColumnWidths[columnIndex] = column.initialWidth || 10; - this._stateCounter++; + this._columnSizeChangedCounter++; this.setState({ fixedColumnWidths: newFixedColumnWidths }); this._propagateColumnWidthChange(newFixedColumnWidths); }; @@ -966,7 +966,7 @@ export class TreeView extends React.PureComponent< // at 3000 wide. containerWidth={Math.max(3000, maxNodeDepth * 10 + 2000)} ref={this._takeListRef} - forceRender={this._stateCounter} + forceRender={this._columnSizeChangedCounter} /> {contextMenu} From e9fb4cf35349546bcc4cea940e8a040ec6790d7d Mon Sep 17 00:00:00 2001 From: Julien Wajsberg Date: Thu, 22 Dec 2022 19:51:10 +0100 Subject: [PATCH 13/14] Memoize the initial widths so that we don't get a new array at each render --- src/components/shared/TreeView.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/shared/TreeView.js b/src/components/shared/TreeView.js index 1426c62e69..72a3fbd2f0 100644 --- a/src/components/shared/TreeView.js +++ b/src/components/shared/TreeView.js @@ -513,6 +513,11 @@ export class TreeView extends React.PureComponent< { limit: 1 } ); + _computeInitialColumnWidthsMemoized = memoize( + (fixedColumns: Array>): CssPixels[] => + fixedColumns.map((c) => c.initialWidth) + ); + // This returns the column widths from several possible sources, in this order: // * the current state (this means the user changed them recently, or is // currently changing them) @@ -523,7 +528,7 @@ export class TreeView extends React.PureComponent< return ( this.state.fixedColumnWidths || this.props.viewOptions.fixedColumnWidths || - this.props.fixedColumns.map((c) => c.initialWidth) + this._computeInitialColumnWidthsMemoized(this.props.fixedColumns) ); }; From e938fd487791be0a3150cc0d02d56dce48bf7dcb Mon Sep 17 00:00:00 2001 From: Julien Wajsberg Date: Thu, 22 Dec 2022 19:35:54 +0100 Subject: [PATCH 14/14] Add a test --- src/test/components/MarkerTable.test.js | 59 ++++++++++++++++++++++++- 1 file changed, 58 insertions(+), 1 deletion(-) diff --git a/src/test/components/MarkerTable.test.js b/src/test/components/MarkerTable.test.js index ba67e6a2d7..2d70401c1c 100644 --- a/src/test/components/MarkerTable.test.js +++ b/src/test/components/MarkerTable.test.js @@ -9,7 +9,11 @@ import { stripIndent } from 'common-tags'; // This module is mocked. import copy from 'copy-to-clipboard'; -import { render, screen } from 'firefox-profiler/test/fixtures/testing-library'; +import { + render, + screen, + fireEvent, +} from 'firefox-profiler/test/fixtures/testing-library'; import { MarkerTable } from '../../components/marker-table'; import { MaybeMarkerContextMenu } from '../../components/shared/MarkerContextMenu'; import { @@ -19,6 +23,7 @@ import { hideLocalTrack, selectTrackWithModifiers, } from '../../actions/profile-view'; +import { changeSelectedTab } from 'firefox-profiler/actions/app'; import { ensureExists } from '../../utils/flow'; import { getEmptyThread } from 'firefox-profiler/profile-logic/data-structures'; @@ -420,6 +425,58 @@ describe('MarkerTable', function () { expect(screen.queryByText(/Select the/)).not.toBeInTheDocument(); }); }); + + describe('column resizing', () => { + it('can resize a column, then move it back to its initial size', () => { + const store = storeWithProfile(getMarkerTableProfile()); + store.dispatch(changeSelectedTab('marker-table')); + const { unmount } = render( + + + + ); + + let dividerForFirstColumn = ensureExists( + document.querySelector('.treeViewColumnDivider') + ); + let firstColumn = screen.getByText('Start'); + expect(firstColumn).toHaveStyle({ width: '90px' }); + fireEvent.mouseDown(dividerForFirstColumn, { clientX: 90 }); + + const body = ensureExists(document.body); + + // Move right + fireEvent.mouseMove(body, { clientX: 100 }); + expect(firstColumn).toHaveStyle({ width: '100px' }); + + // Move left + fireEvent.mouseMove(body, { clientX: 80 }); + expect(firstColumn).toHaveStyle({ width: '80px' }); + + // Release the mouse -> still the same style + fireEvent.mouseUp(body); + expect(firstColumn).toHaveStyle({ width: '80px' }); + + // Now we'll unmount and render again. + unmount(); + render( + + + + ); + + // Make sure the first column kept its width + firstColumn = screen.getByText('Start'); + expect(firstColumn).toHaveStyle({ width: '80px' }); + + // Now double click to reset the style. + dividerForFirstColumn = ensureExists( + document.querySelector('.treeViewColumnDivider') + ); + fireEvent.dblClick(dividerForFirstColumn, { detail: 2 }); + expect(firstColumn).toHaveStyle({ width: '90px' }); + }); + }); }); function getReflowMarker(