Closed Bug 1909718 Opened 2 years ago Closed 2 years ago

Shaded/filled areas of a graph are not drawn with D2d-Canvas (Was: Problem rendering amcharts5 line graph (HTML canvas issue?) )

Categories

(Core :: Graphics: Canvas2D, defect)

Firefox 128
defect

Tracking

()

RESOLVED FIXED
131 Branch
Tracking Status
firefox-esr115 --- wontfix
firefox-esr128 --- wontfix
firefox128 --- wontfix
firefox129 --- wontfix
firefox130 --- wontfix
firefox131 --- fixed

People

(Reporter: julian, Assigned: lsalzman)

References

(Regression)

Details

(Keywords: regression)

Attachments

(4 files, 1 obsolete file)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:128.0) Gecko/20100101 Firefox/128.0
Firefox for Android

Steps to reproduce:

This issue exists on desktop and mobile versions.

Visit this codepen: https://codepen.io/jegelstaff/pen/poXERvo

It is code to display a line graph, using amcharts 5 which uses the HTML canvas element.

Actual results:

Part of the graph does not display. On desktop, the display changes depending on the zoom level in the browser and the resolution of the monitor, but no matter what only part of the graph is shown.

This may be a Firefox issue and not an amcharts 5 issue, since the graph displays perfectly in Chrome and Edge (presumably all Chromium browsers). If it is a Firefox issue, presumably it is a problem in drawing on the canvas?

The graph fails differently on Firefox for Android than Firefox for desktop. The graph works on Chrome on Android. So this is a problem on desktop and mobile versions.

Expected results:

The full graph should have displayed (try Chrome to see it normally)

I have opened a related issue with Amcharts: https://github.com/amcharts/amcharts5/issues/1633

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

Component: Untriaged → DOM: Core & HTML
Product: Firefox → Core

I can reproduce this with both d2d-canvas and gpu-canvas.
With D2d-canvas, prior to the regression the graph was drawn completely correct (including the shaded/filled parts).

Bisection:
https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=440856ffde519ea98b6c1fca7d461c20cc55a90c&tochange=ef0d179e0aeb0bb18be03786361046fb661ad64f

Suspect: bug 1804952

Status: UNCONFIRMED → NEW
Ever confirmed: true
Keywords: regression
Regressed by: 1804952
Component: DOM: Core & HTML → Graphics: Canvas2D

Set release status flags based on info from the regressing bug 1804952

:jrmuizel, since you are the author of the regressor, bug 1804952, could you take a look? Also, could you set the severity field?

For more information, please visit BugBot documentation.

I can reproduce this with accelerated canvas turned off which shouldn't be hitting the code from bug 1804952. Maybe it's something else?

Correction: with gpu-canvas/skia-canvas, hte graphs dont draw at all. Filed bug 1909796
Bisection range was found with d2d-canvas.

See Also: → 1909796
Summary: Problem rendering amcharts5 line graph (HTML canvas issue?) → Shaded/filled areas of a graph are not drawn with D2d-Canvas (Was: Problem rendering amcharts5 line graph (HTML canvas issue?) )
Attachment #9414905 - Attachment description: A recording of the problem → A canvas-rr recording of the problem
Flags: needinfo?(jmuizelaar)

Hello,

The creators of amcharts have identified the 'cause' of the issue, at least in as far as the top level JS code goes. A change to the JS 'fixes' the issue, but it is still true that in Firefox the original code does not render a graph properly but it does render properly in other browsers, so there would still seem to be an underlying issue in Firefox that deserves attention.

You can read the crux of the matter here: https://github.com/amcharts/amcharts5/issues/1633#issuecomment-2249530007

The problem is that the upper end of the specified range for the highlighted portion of the graph, is super high. That was done as a cheap way of ensuring all the data above a certain amount would be highlighted. The graph is generated dynamically in its real world location, and so the specific upper end will vary as the data varies. So having a huge upper end for the highlighted portion was a cheap way around having to deduce the real top end. (This was the line in the JS: endValue: value * 10000000)

However, the amcharts folks provided a change to the JS that avoids this issue by easily gathering the true max value in the graph. I have made another code pen that is the same as the first except for this change: https://codepen.io/jegelstaff/pen/xxoEaRy

The second codepen does render properly in Firefox, desktop and mobile. Yay!

It would seem that something about the rendering to the canvas gets tripped up by the hugh upper bound of the highlighted part of the graph. Presumably it is exceeding some threshold of some kind and Firefox just decides not to do anything at all. Perhaps it is possible to truncate extreme values to the limit of the possible workable values, and then everything will just work?

Thank you everyone for your attention on this issue, and thank you for Firefox!
--Julian

It looks like the problem is related to the large coordinates in the clip path:

    ["$2", "beginPath", []],
    ["$2", "moveTo", [-1697, -500]],
    ["$2", "lineTo", [-1697, 1000]],
    ["$2", "lineTo", [3394, 1000]],
    ["$2", "lineTo", [3394, -500]],
    ["$2", "lineTo", [-1697, -500]],
    ["$2", "moveTo", [0, -6091968027.988889]],
    ["$2", "lineTo", [1438, -6091968027.988889]],
    ["$2", "lineTo", [1438, 112.81423611111113]],
    ["$2", "lineTo", [0, 112.81423611111113]],
    ["$2", "lineTo", [0, -6091968027.988889]],
    ["$2", "clip", []],
Attachment #9414905 - Attachment is obsolete: true
Depends on: 1773091

Set release status flags based on info from the regressing bug 1804952

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

For more information, please visit BugBot documentation.

Flags: needinfo?(lsalzman)
Severity: -- → S3
Flags: needinfo?(lsalzman)
Assignee: nobody → lsalzman
Status: NEW → ASSIGNED
Pushed by lsalzman@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/8a003ad03d28 Guard against lossy PathSkia::AsRect conversions. r=aosmond
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 131 Branch

This is fixed for me on the latest Nightly (Win11x64 desktop with d2d/gpu canvas).

The patch landed in nightly and beta is affected.
:lsalzman, is this bug important enough to require an uplift?

  • If yes, please nominate the patch for beta approval.
  • If no, please set status-firefox130 to wontfix.

For more information, please visit BugBot documentation.

Flags: needinfo?(lsalzman)
Flags: needinfo?(lsalzman)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: