Skip to content

Commit

Permalink
Merge branch 'main' into dhat
Browse files Browse the repository at this point in the history
  • Loading branch information
julienw authored Aug 5, 2021
2 parents 12dec49 + 5707f11 commit 8406440
Show file tree
Hide file tree
Showing 22 changed files with 74 additions and 128 deletions.
1 change: 0 additions & 1 deletion src/components/shared/Backtrace.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
.backtrace {
max-width: var(--tooltip-detail-max-width);
padding: 0;
margin: 0;
}
Expand Down
1 change: 1 addition & 0 deletions src/components/timeline/TrackNetwork.js
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ class Network extends PureComponent<Props, State> {
{shouldShowTooltip && hoveredMarkerIndex !== null && hoveredMarker ? (
<Tooltip mouseX={mouseX} mouseY={mouseY}>
<TooltipMarker
className="tooltipNetwork"
markerIndex={hoveredMarkerIndex}
marker={hoveredMarker}
threadsKey={threadIndex}
Expand Down
12 changes: 9 additions & 3 deletions src/components/tooltip/CallNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,9 @@ export class TooltipCallNode extends React.PureComponent<Props> {
<div className="tooltipLabel" key="file">
Script URL:
</div>,
fileNameURL,
<div className="tooltipDetailsUrl" key="fileVal">
{fileNameURL}
</div>,
];
}

Expand Down Expand Up @@ -249,7 +251,9 @@ export class TooltipCallNode extends React.PureComponent<Props> {
<div className="tooltipLabel" key="iframe">
iframe URL:
</div>,
<div key="iframeVal">{page.url}</div>,
<div className="tooltipDetailsUrl" key="iframeVal">
{page.url}
</div>,
];

// Getting the embedder URL now.
Expand All @@ -271,7 +275,9 @@ export class TooltipCallNode extends React.PureComponent<Props> {
<div className="tooltipLabel" key="page">
Page URL:
</div>,
<div key="pageVal">{page.url}</div>,
<div className="tooltipDetailsUrl" key="pageVal">
{page.url}
</div>,
];
}
}
Expand Down
9 changes: 2 additions & 7 deletions src/components/tooltip/Marker.js
Original file line number Diff line number Diff line change
Expand Up @@ -391,14 +391,9 @@ class MarkerTooltipContents extends React.PureComponent<Props> {
* a short list of rendering strategies, in the order they appear.
*/
render() {
const { className, restrictHeightWidth } = this.props;
const { className } = this.props;
return (
<div
className={classNames('tooltipMarker', className)}
style={{
'--tooltip-detail-max-width': restrictHeightWidth ? '600px' : '100%',
}}
>
<div className={classNames('tooltipMarker', className)}>
<div className="tooltipHeader">
<div className="tooltipOneLine">
{this._maybeRenderMarkerDuration()}
Expand Down
4 changes: 0 additions & 4 deletions src/components/tooltip/NetworkMarker.css
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,3 @@
.tooltipNetworkMimeTypeSwatch {
background-color: var(--marker-color);
}

.tooltipNetworkUrl {
word-break: break-word;
}
8 changes: 4 additions & 4 deletions src/components/tooltip/NetworkMarker.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ function _getHumanReadableDataStatus(status: NetworkStatus): string {
return 'Response received';
case 'STATUS_REDIRECT':
return 'Redirecting request';
case 'STATUS_ABORT':
return 'Request was aborted';
case 'STATUS_CANCEL':
return 'Request was canceled';
default:
throw assertExhaustiveCheck(status);
}
Expand Down Expand Up @@ -381,14 +381,14 @@ export function getNetworkMarkerDetails(
{payload.cache}
</TooltipDetail>,
<TooltipDetail label="URL" key="Network-URL">
<span className="tooltipNetworkUrl">{payload.URI}</span>
<span className="tooltipDetailsUrl">{payload.URI}</span>
</TooltipDetail>
);

if (payload.RedirectURI) {
details.push(
<TooltipDetail label="Redirect URL" key="Network-Redirect URL">
<span className="tooltipNetworkUrl">{payload.RedirectURI}</span>
<span className="tooltipDetailsUrl">{payload.RedirectURI}</span>
</TooltipDetail>
);
}
Expand Down
22 changes: 5 additions & 17 deletions src/components/tooltip/Tooltip.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,7 @@
position: fixed;
display: inline-block;
overflow: hidden;

/**
* The VISUAL_MARGIN = 8 for the Tooltip is defined in src/components/tooltip/Tooltip.js.
* Both added together equals: 8px + 8px = 16px
*/
max-width: calc(100% - 16px);
box-sizing: border-box;
max-width: 600px;
padding: 8px;
border: 1px solid #ccc;
background-color: var(--grey-10);
Expand Down Expand Up @@ -69,7 +63,10 @@
display: grid;
padding-top: 5px;
grid-gap: 2px 5px;
grid-template-columns: min-content auto;

/* Make the right column "definitely" sized (ignore its intrinsic size) by setting a min-width of 0.
* This stops long contents from overflowing the tooltip. */
grid-template-columns: min-content minmax(0, 1fr);
}

.tooltipDetailSeparator {
Expand All @@ -79,22 +76,13 @@
}

.tooltipDetailsUrl {
/* URLs can be really long, and it's disruptive when widths change rapidly
* this components. Define an arbitrary max-width in px to restrict this change.
* Set the variable to 100% to allow the full-width, e.g. in the sidebar. */
max-width: var(--tooltip-detail-max-width);
word-break: break-all;
}

.tooltipDetailsDim {
color: var(--grey-50);
}

.tooltipDetailsDescription {
/* Stop long descriptions from making the tooltip disruptively long. */
max-width: var(--tooltip-detail-max-width);
}

.tooltipLabel {
color: var(--grey-50);
text-align: right;
Expand Down
4 changes: 0 additions & 4 deletions src/components/tooltip/Tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,6 @@ export class Tooltip extends React.PureComponent<Props> {
<div
className="tooltip"
data-testid="tooltip"
style={{
/* This is the default max width, but can be redefined in children */
'--tooltip-detail-max-width': '600px',
}}
ref={this._interiorElementRef}
>
{this.props.children}
Expand Down
2 changes: 1 addition & 1 deletion src/profile-logic/marker-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ export function deriveMarkersFromRawMarkerTable(
openNetworkMarkers.set(data.id, rawMarkerIndex);
} else {
// End status can be any status other than 'STATUS_START'. They are
// either 'STATUS_STOP', 'STATUS_REDIRECT' or 'STATUS_ABORT'.
// either 'STATUS_STOP', 'STATUS_REDIRECT' or 'STATUS_CANCEL'.
const endData = data;

const startIndex = openNetworkMarkers.get(data.id);
Expand Down
4 changes: 0 additions & 4 deletions src/test/components/Tooltip.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ describe('shared/Tooltip', () => {
expect(getTooltipStyle()).toEqual({
left: `${MOUSE_OFFSET}px`,
top: `${MOUSE_OFFSET}px`,
'--tooltip-detail-max-width': '600px',
});

const mouseX = 50;
Expand All @@ -53,7 +52,6 @@ describe('shared/Tooltip', () => {
expect(getTooltipStyle()).toEqual({
left: `${mouseX + MOUSE_OFFSET}px`,
top: `${mouseY + MOUSE_OFFSET}px`,
'--tooltip-detail-max-width': '600px',
});
});

Expand All @@ -72,7 +70,6 @@ describe('shared/Tooltip', () => {
expect(getTooltipStyle()).toEqual({
left: `${expectedLeft}px`,
top: `${expectedTop}px`,
'--tooltip-detail-max-width': '600px',
});
});

Expand All @@ -87,7 +84,6 @@ describe('shared/Tooltip', () => {
expect(getTooltipStyle()).toEqual({
left: `${expectedLeft}px`,
top: `${expectedTop}px`,
'--tooltip-detail-max-width': '600px',
});
});
});
Expand Down
2 changes: 1 addition & 1 deletion src/test/components/TooltipMarker.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,7 @@ describe('TooltipMarker', function() {
payload: {
contentType: null,
cache: 'Unresolved',
status: 'STATUS_ABORT',
status: 'STATUS_CANCEL',
},
})
);
Expand Down
16 changes: 12 additions & 4 deletions src/test/components/__snapshots__/FlameGraph.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ exports[`FlameGraph has a tooltip that matches the snapshot 1`] = `
<div
class="tooltip"
data-testid="tooltip"
style="--tooltip-detail-max-width: 600px; left: 14px; top: 306px;"
style="left: 14px; top: 306px;"
>
<div
class="tooltipCallNode"
Expand Down Expand Up @@ -152,7 +152,11 @@ exports[`FlameGraph has a tooltip that matches the snapshot 1`] = `
>
Script URL:
</div>
path/to/file:10:100
<div
class="tooltipDetailsUrl"
>
path/to/file:10:100
</div>
</div>
</div>
</div>
Expand Down Expand Up @@ -694,7 +698,7 @@ exports[`FlameGraph shows a tooltip with the resource information 1`] = `
<div
class="tooltip"
data-testid="tooltip"
style="--tooltip-detail-max-width: 600px; left: 80.66666666666666px; top: 226px;"
style="left: 80.66666666666666px; top: 226px;"
>
<div
class="tooltipCallNode"
Expand Down Expand Up @@ -825,7 +829,11 @@ exports[`FlameGraph shows a tooltip with the resource information 1`] = `
>
Script URL:
</div>
path/to/file:17:107
<div
class="tooltipDetailsUrl"
>
path/to/file:17:107
</div>
<div
class="tooltipLabel"
>
Expand Down
6 changes: 2 additions & 4 deletions src/test/components/__snapshots__/MarkerChart.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -256,11 +256,10 @@ exports[`MarkerChart renders the hoveredItem markers properly 2`] = `
<div
class="tooltip"
data-testid="tooltip"
style="--tooltip-detail-max-width: 600px; left: 189px; top: 150px;"
style="left: 189px; top: 150px;"
>
<div
class="tooltipMarker"
style="--tooltip-detail-max-width: 600px;"
>
<div
class="tooltipHeader"
Expand Down Expand Up @@ -1081,11 +1080,10 @@ exports[`MarkerChart with active tab renders the hovered marker properly 2`] = `
<div
class="tooltip"
data-testid="tooltip"
style="--tooltip-detail-max-width: 600px; left: 102px; top: 38px;"
style="left: 102px; top: 38px;"
>
<div
class="tooltipMarker"
style="--tooltip-detail-max-width: 600px;"
>
<div
class="tooltipHeader"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ exports[`MarkerSidebar matches the snapshots when displaying data about the curr
>
<div
class="tooltipMarker"
style="--tooltip-detail-max-width: 100%;"
>
<div
class="tooltipHeader"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ exports[`SampleTooltipContents renders the sample tooltip properly 1`] = `
<div
class="tooltip"
data-testid="tooltip"
style="--tooltip-detail-max-width: 600px; left: 11px; top: 10px;"
style="left: 11px; top: 10px;"
>
<div
class="tooltipDetails"
Expand Down Expand Up @@ -285,7 +285,7 @@ exports[`SampleTooltipContents renders the sample with "variable CPU cycles" CPU
<div
class="tooltip"
data-testid="tooltip"
style="--tooltip-detail-max-width: 600px; left: 11px; top: 10px;"
style="left: 11px; top: 10px;"
>
<div
class="tooltipDetails"
Expand Down Expand Up @@ -397,7 +397,7 @@ exports[`SampleTooltipContents renders the sample with ns CPU usage information
<div
class="tooltip"
data-testid="tooltip"
style="--tooltip-detail-max-width: 600px; left: 11px; top: 10px;"
style="left: 11px; top: 10px;"
>
<div
class="tooltipDetails"
Expand Down Expand Up @@ -509,7 +509,7 @@ exports[`SampleTooltipContents renders the sample with µs CPU usage information
<div
class="tooltip"
data-testid="tooltip"
style="--tooltip-detail-max-width: 600px; left: 11px; top: 10px;"
style="left: 11px; top: 10px;"
>
<div
class="tooltipDetails"
Expand Down
3 changes: 1 addition & 2 deletions src/test/components/__snapshots__/StackChart.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -865,11 +865,10 @@ exports[`MarkerChart shows a tooltip when hovering 1`] = `
<div
class="tooltip"
data-testid="tooltip"
style="--tooltip-detail-max-width: 600px; left: 200.36363636363637px; top: 54px;"
style="left: 200.36363636363637px; top: 54px;"
>
<div
class="tooltipMarker"
style="--tooltip-detail-max-width: 600px;"
>
<div
class="tooltipHeader"
Expand Down
2 changes: 1 addition & 1 deletion src/test/components/__snapshots__/Tooltip.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ exports[`shared/Tooltip is rendered appropriately 1`] = `
<div
class="tooltip"
data-testid="tooltip"
style="--tooltip-detail-max-width: 600px; left: 11px; top: 11px;"
style="left: 11px; top: 11px;"
>
<p>
Lorem ipsum
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,9 @@ exports[`TooltipCallNode with page information displays Page URL for iframe page
>
iframe URL:
</div>
<div>
<div
class="tooltipDetailsUrl"
>
https://iframe.example.com/
</div>
<div
Expand Down Expand Up @@ -192,7 +194,9 @@ exports[`TooltipCallNode with page information displays Page URL for non-iframe
>
Page URL:
</div>
<div>
<div
class="tooltipDetailsUrl"
>
https://developer.mozilla.org/en-US/
</div>
</div>
Expand Down
Loading

0 comments on commit 8406440

Please sign in to comment.