Closed Bug 1270568 Opened 8 years ago Closed 2 years ago

Percentage-constrained SVG elements in Flexbox containers render at different sizes on repaint

Categories

(Core :: Layout, defect)

defect

Tracking

()

VERIFIED DUPLICATE of bug 1340715

People

(Reporter: nchase, Unassigned)

References

Details

Attachments

(1 file, 1 obsolete file)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.94 Safari/537.36

Steps to reproduce:

See example here: http://codepen.io/nchase/pen/pyqKGd

Here are the steps:

1. Create outermost <div>, set `display: flex;`
2. Create <div> inside
3. Create <div> inside, set `width: 75%` in CSS
4. Create <svg> inside, set `width: 100%` in CSS
5. Set an arbitrary property on the <svg> that will trigger a repaint (in the example above, I set a transparent 1px border on the svg)


Actual results:

If you repeatedly repaint, notice that the SVG gets smaller and smaller (by a factor of whatever the containing element's size is set to – 0.75 in this case) 


Expected results:

The SVG should stay the same size after a repaint
Attached file 1270568.html (obsolete) —
What do I need to do with the testcase?
Flags: needinfo?(nchase)
Hi Loic, if you force a minor repaint (e.g. by adding/removing border), notice that the SVG resizes by a factor equal to the percentage of the outer div whose dimensions are modified. Let me know if there's anything I can add or clarify, will have a computer in a few hours.
Component: Untriaged → Layout
Product: Firefox → Core
Posting an interactive version of the testcase, which you can try out by hovering the SVG (which temporarily changes the border-width).

[--> obsoleting the previous version, which wasn't directly testable due to having a "//" comment which disabled the CSS that was supposed to be toggleable. This new testcase is based on that one.]
Attachment #8749433 - Attachment is obsolete: true
Status: UNCONFIRMED → NEW
Ever confirmed: true
Version: 45 Branch → Trunk
[canceling needinfo, as my attached testcase demonstrates the bug.]

EXPECTED RESULTS: Hovering & un-hovering should restore the original rendering.
ACTUAL RESULTS: Hovering & un-hovering produces a progressively smaller SVG rendering.
Flags: needinfo?(nchase)
Flags: needinfo?(dholbert)
I have noticed that this bug still exists in Firefox 57 and is reproducible via the same procedure. Is there any appetite to fix this bug?
Severity: normal → S3

This is fixed in Nightly now, I think via bug 1340715.

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

Confirmed that this was essentially bug 1340715, though we also needed the fix for bug 1790167.

I confirmed that using testcase 1

  • Nightly 2022-08-31 is "bad" (SVG initially large, gets progressively smaller as you hover/un-hover)
  • On 09-01 early morning, bug 1340715's fix hits mozilla-central.
  • Nightly 2022-09-01 (first build w/ that fix) is a new kind of bad - the SVG renders as 0-size, which I think is bug 1790167.
  • Nightly 2022-09-11 has that same 0-size bad rendering.
  • Then bug 1790167's fix hits mozilla-central.
  • Nightly 2022-09-12 and newer render the SVG properly -- at a visible size with no persistent growing or shrinking on hover/unhover cycles.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: