Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit efc08c5

Browse files
gh-135953: Prevent overflow in the profiler flamegraph hover boxes (#138880)
1 parent 1c984ba commit efc08c5

File tree

2 files changed

+33
-7
lines changed

2 files changed

+33
-7
lines changed

‎Lib/profiling/sampling/flamegraph.css

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,3 +403,27 @@ body {
403403
margin: 0;
404404
padding: 12px 0;
405405
}
406+
407+
/* Tooltip overflow fixes */
408+
.python-tooltip {
409+
max-width: 500px !important;
410+
word-wrap: break-word !important;
411+
overflow-wrap: break-word !important;
412+
box-sizing: border-box !important;
413+
}
414+
415+
/* Responsive tooltip adjustments */
416+
@media (max-width: 768px) {
417+
.python-tooltip {
418+
max-width: calc(100vw - 40px) !important;
419+
max-height: calc(100vh - 80px) !important;
420+
overflow-y: auto !important;
421+
}
422+
}
423+
424+
@media (max-width: 480px) {
425+
.python-tooltip {
426+
max-width: calc(100vw - 20px) !important;
427+
font-size: 12px !important;
428+
}
429+
}

‎Lib/profiling/sampling/flamegraph.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ function createPythonTooltip(data) {
4242
.style("font-weight", "400")
4343
.style("line-height", "1.5")
4444
.style("max-width", "500px")
45+
.style("word-wrap", "break-word")
46+
.style("overflow-wrap", "break-word")
4547
.style("font-family", "'Source Sans Pro', sans-serif")
4648
.style("opacity", 0);
4749
}
@@ -61,7 +63,7 @@ function createPythonTooltip(data) {
6163
`<div style="font-family: 'SF Mono', 'Monaco', 'Consolas', ` +
6264
`monospace; font-size: 12px; color: ${
6365
line.startsWith("→") ? "#3776ab" : "#5a6c7d"
64-
}; white-space: pre; line-height: 1.4; padding: 2px 0;">${line
66+
}; white-space: pre-wrap; word-break: break-all; overflow-wrap: break-word; line-height: 1.4; padding: 2px 0;">${line
6567
.replace(/&/g, "&amp;")
6668
.replace(/</g, "&lt;")
6769
.replace(/>/g, "&gt;")}</div>`,
@@ -77,7 +79,7 @@ function createPythonTooltip(data) {
7779
</div>
7880
<div style="background: #f8f9fa; border: 1px solid #e9ecef;
7981
border-radius: 6px; padding: 12px; max-height: 150px;
80-
overflow-y: auto;">
82+
overflow-y: auto; overflow-x: hidden;">
8183
${sourceLines}
8284
</div>
8385
</div>`;
@@ -92,7 +94,7 @@ function createPythonTooltip(data) {
9294
</div>
9395
<div style="background: #f8f9fa; border: 1px solid #e9ecef;
9496
border-radius: 6px; padding: 12px; max-height: 150px;
95-
overflow-y: auto; font-family: monospace; font-size: 11px;">
97+
overflow-y: auto; overflow-x: hidden; font-family: monospace; font-size: 11px; word-break: break-all; overflow-wrap: break-word;">
9698
${JSON.stringify(source, null, 2)}
9799
</div>
98100
</div>`;
@@ -101,13 +103,13 @@ function createPythonTooltip(data) {
101103
const tooltipHTML = `
102104
<div>
103105
<div style="color: #3776ab; font-weight: 600; font-size: 16px;
104-
margin-bottom: 8px; line-height: 1.3;">
105-
${d.data.funcname||d.data.name}
106+
margin-bottom: 8px; line-height: 1.3; word-break: break-word; overflow-wrap: break-word;">
107+
${funcname}
106108
</div>
107109
<div style="color: #5a6c7d; font-size: 13px; margin-bottom: 12px;
108110
font-family: monospace; background: #f8f9fa;
109-
padding: 4px 8px; border-radius: 4px;">
110-
${d.data.filename||""}${d.data.lineno ? ":" + d.data.lineno : ""}
111+
padding: 4px 8px; border-radius: 4px; word-break: break-all; overflow-wrap: break-word;">
112+
${filename}${d.data.lineno ? ":" + d.data.lineno : ""}
111113
</div>
112114
<div style="display: grid; grid-template-columns: auto 1fr;
113115
gap: 8px 16px; font-size: 14px;">

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /