Skip to content

Commit

Permalink
Bug 1353798 - [devtools] Cleanup the timing bar calculations r=devtoo…
Browse files Browse the repository at this point in the history
…ls-reviewers,nchevobbe

Differential Revision: https://phabricator.services.mozilla.com/D196581
  • Loading branch information
bomsy committed Dec 19, 2023
1 parent 9920ba5 commit 71b1de7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,13 @@
display: flex;
flex: 1;
align-items: center;
padding-inline-end: 20px;
--total-timings-width-percentage: 90%;

}

.network-monitor .requests-list-timings-total {
width: calc(100% - var(--total-timings-width-percentage));
}

.network-monitor .requests-list-timings-offset {
Expand All @@ -400,6 +407,8 @@
border: none;
min-width: 1px;
transition: width 0.2s ease-out;
margin-inline-start: calc(var(--current-timing-offset, 0) * var(--total-timings-width-percentage));
width: calc(var(--current-timing-width, 0) * var(--total-timings-width-percentage));
}

.network-monitor .label-separator {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ const MDNLink = require("resource://devtools/client/shared/components/MdnLink.js

const { div, span } = dom;

const TIMINGS_END_PADDING = "80px";

/**
* Timings panel component
* Display timeline bars that shows the total wait time for various stages
Expand Down Expand Up @@ -97,23 +95,14 @@ class TimingsPanel extends Component {
),
div(
{ className: "requests-list-timings-container" },
span({
className: "requests-list-timings-offset",
style: {
width: `calc(${
offset > 0 ? offset : 0
} * (100% - ${TIMINGS_END_PADDING})`,
},
}),
span({
className: `requests-list-timings-box serviceworker-timings-color-${key.replace(
"ServiceWorker",
""
)}`,
style: {
width: `calc(${
value / totalTime
} * (100% - ${TIMINGS_END_PADDING}))`,
"--current-timing-offset": offset > 0 ? offset : 0,
"--current-timing-width": value / totalTime,
},
}),
span(
Expand Down Expand Up @@ -153,20 +142,11 @@ class TimingsPanel extends Component {
),
div(
{ className: "requests-list-timings-container" },
span({
className: "requests-list-timings-offset",
style: {
width: `calc(${
(totalTime - duration) / totalTime
} * (100% - ${TIMINGS_END_PADDING})`,
},
}),
span({
className: `requests-list-timings-box server-timings-color-${color}`,
style: {
width: `calc(${
duration / totalTime
} * (100% - ${TIMINGS_END_PADDING}))`,
"--current-timing-offset": (totalTime - duration) / totalTime,
"--current-timing-width": duration / totalTime,
},
}),
span(
Expand Down Expand Up @@ -230,16 +210,11 @@ class TimingsPanel extends Component {
),
div(
{ className: "requests-list-timings-container" },
span({
className: "requests-list-timings-offset",
style: {
width: `calc(${offsetScale} * (100% - ${TIMINGS_END_PADDING})`,
},
}),
span({
className: `requests-list-timings-box ${type}`,
style: {
width: `calc(${timelineScale} * (100% - ${TIMINGS_END_PADDING}))`,
"--current-timing-offset": offsetScale,
"--current-timing-width": timelineScale,
},
}),
span(
Expand Down

0 comments on commit 71b1de7

Please sign in to comment.