Closed Bug 1785051 Opened 2 years ago Closed 2 years ago

<dialog> element containing SVG expands in size when setting textContent within

Categories

(Core :: SVG, defect)

Firefox 103
defect

Tracking

()

VERIFIED DUPLICATE of bug 1340715

People

(Reporter: aquarius, Assigned: emilio)

References

(Regression)

Details

Attachments

(3 files)

Attached file weirdbug.html (deleted) —

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:103.0) Gecko/20100101 Firefox/103.0

Steps to reproduce:

Visit https://jsbin.com/jaxixif/1/edit?html,output

or use the following code (also attached):

<!doctype html>
<html lang="en">
<head>
<style>
dialog svg { padding: 2px; }
</style>
</head>
<body>
<dialog>
<details>
<summary>Click this to see the bug</summary>
<svg version="1.1" xmlns="http://www.w3.org/2000/svg"
role="img" viewBox="0 0 100 10" id="graph">
</svg>
<div><b></b></div>
</details>
</div>

</body>
</html>
<script>
tickingCountdown = setInterval(() => {
// we set the textContent. We don't add to it.
document.querySelector("b").textContent = "watch the dialog grow!";
}, 1000);
document.querySelector("dialog").showModal();
</script>

and click the summary to open.

Actual results:

Every tick of the interval, the dialog grows by a small amount.

This doesn't happen if the (empty) SVG is not present, and it doesn't happen in Chrome, so I think it's some sort of layout bug.

Expected results:

This expanding shouldn't happen!

Attached video weirdbug.mp4 (deleted) —

A video is attached demonstrating the "growing".

As a data point, putting the <svg> inside a <div> seems to fix this, although I have no idea why.

The Bugbug bot thinks this bug should belong to the 'Core::SVG' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → SVG
Product: Firefox → Core

The severity field is not set for this bug.
:dholbert, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(dholbert)
Attached file More reduced test-case. (deleted) —

It seems something about SVG intrinsic sizing is wrongly stateful.

https://searchfox.org/mozilla-central/rev/3840d8109501fbebdf22212165ea15a391280dcb/layout/svg/SVGOuterSVGFrame.cpp#180-199

Looks extremely suspicious (from bug 1162418).

Assignee: nobody → emilio
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Regressed by: 1162418

This is just bug 1340715, will try to fix this there.

Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Flags: needinfo?(dholbert)
Resolution: --- → DUPLICATE

Looks beautiful with that bug fixed :)

Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: