--- a/devtools/client/netmonitor/src/components/RequestListContent.js
+++ b/devtools/client/netmonitor/src/components/RequestListContent.js
@@ -51,17 +51,16 @@ class RequestListContent extends Compone
onWaterfallMouseDown: PropTypes.func.isRequired,
scale: PropTypes.number,
selectedRequestId: PropTypes.string,
};
}
constructor(props) {
super(props);
- this.setScalingStyles = this.setScalingStyles.bind(this);
this.isScrolledToBottom = this.isScrolledToBottom.bind(this);
this.onHover = this.onHover.bind(this);
this.onScroll = this.onScroll.bind(this);
this.onKeyDown = this.onKeyDown.bind(this);
this.onContextMenu = this.onContextMenu.bind(this);
this.onFocusedNodeChange = this.onFocusedNodeChange.bind(this);
}
@@ -72,19 +71,16 @@ class RequestListContent extends Compone
getTabTarget: connector.getTabTarget,
getLongString: connector.getLongString,
openStatistics: (open) => dispatch(Actions.openStatistics(connector, open)),
});
this.tooltip = new HTMLTooltip(window.parent.document, { type: "arrow" });
}
componentDidMount() {
- // Set the CSS variables for waterfall scaling
- this.setScalingStyles();
-
// Install event handler for displaying a tooltip
this.tooltip.startTogglingOnHover(this.refs.contentEl, this.onHover, {
toggleDelay: REQUESTS_TOOLTIP_TOGGLE_DELAY,
interactive: true
});
// Install event handler to hide the tooltip on scroll
this.refs.contentEl.addEventListener("scroll", this.onScroll, true);
@@ -93,54 +89,31 @@ class RequestListContent extends Compone
componentWillUpdate(nextProps) {
// Check if the list is scrolled to bottom before the UI update.
// The scroll is ever needed only if new rows are added to the list.
const delta = nextProps.displayedRequests.size - this.props.displayedRequests.size;
this.shouldScrollBottom = delta > 0 && this.isScrolledToBottom();
}
componentDidUpdate(prevProps) {
- // Update the CSS variables for waterfall scaling after props change
- this.setScalingStyles(prevProps);
-
let node = this.refs.contentEl;
// Keep the list scrolled to bottom if a new row was added
if (this.shouldScrollBottom && node.scrollTop !== MAX_SCROLL_HEIGHT) {
// Using maximum scroll height rather than node.scrollHeight to avoid sync reflow.
node.scrollTop = MAX_SCROLL_HEIGHT;
}
}
componentWillUnmount() {
this.refs.contentEl.removeEventListener("scroll", this.onScroll, true);
// Uninstall the tooltip event handler
this.tooltip.stopTogglingOnHover();
}
- /**
- * Set the CSS variables for waterfall scaling. If React supported setting CSS
- * variables as part of the "style" property of a DOM element, we would use that.
- *
- * However, React doesn't support this, so we need to use a hack and update the
- * DOM element directly: https://github.com/facebook/react/issues/6411
- */
- setScalingStyles(prevProps) {
- const { scale } = this.props;
- if (prevProps && prevProps.scale === scale) {
- return;
- }
-
- const { style } = this.refs.contentEl;
- style.removeProperty("--timings-scale");
- style.removeProperty("--timings-rev-scale");
- style.setProperty("--timings-scale", scale);
- style.setProperty("--timings-rev-scale", 1 / scale);
- }
-
isScrolledToBottom() {
const { contentEl } = this.refs;
const lastChildEl = contentEl.lastElementChild;
if (!lastChildEl) {
return false;
}
@@ -245,27 +218,29 @@ class RequestListContent extends Compone
columns,
displayedRequests,
firstRequestStartedMillis,
onCauseBadgeMouseDown,
onItemMouseDown,
onSecurityIconMouseDown,
onThumbnailMouseDown,
onWaterfallMouseDown,
+ scale,
selectedRequestId,
} = this.props;
return (
div({ className: "requests-list-wrapper"},
div({ className: "requests-list-table"},
div({
ref: "contentEl",
className: "requests-list-contents",
tabIndex: 0,
onKeyDown: this.onKeyDown,
+ style: {"--timings-scale": scale, "--timings-rev-scale": 1 / scale}
},
RequestListHeader(),
displayedRequests.map((item, index) => RequestListItem({
firstRequestStartedMillis,
fromCache: item.status === "304" || item.fromCache,
columns,
item,
index,