Closed Bug 1625422 Opened 4 years ago Closed 4 years ago

Horizontal transform on SVG element with active layer produces vertical offset

Categories

(Core :: Graphics: Layers, defect, P3)

defect

Tracking

()

RESOLVED FIXED
mozilla78
Tracking Status
firefox-esr68 --- wontfix
firefox76 --- wontfix
firefox77 --- wontfix
firefox78 --- fixed

People

(Reporter: dongkingkong0, Assigned: longsonr)

References

(Regression)

Details

(Keywords: regression)

Attachments

(3 files)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:74.0) Gecko/20100101 Firefox/74.0

Steps to reproduce:

This problem occurs when animating the css transform property (happens through both transition and @keyframes) on svg elements that have the stroke-width property set to anything above 0.

Actual results:

The animation is offset by the stroke width and it "snaps" from the last frame to the resting position.
Note that this happens with all transform properties.

Expected results:

This is not the expected behavior, the offset looks odd. Also, this doesn't happen in other browsers (tested on Safari 13 and Chromium 71).

Here is some css that demonstrates the issue:

rect {
  stroke: #000;
  stroke-width: .5;
  fill: none;
  animation: demo 1s 1s forwards;
}

@keyframes demo {
  to {
    transform: translateX(4px);
  }
}

Bugbug thinks this bug should belong to this component, but please revert this change in case of error.

Component: Untriaged → CSS Transitions and Animations
Product: Firefox → Core

Thank you for the bug report. Do you have a test file demonstrating the problem? I tried to reproduce but could not (although I am on Windows).

It's likely this is a graphics issue related to making the layer no longer active. You might be able to work around it with will-change: transform.

Flags: needinfo?(dongkingkong0)

Here's a file that demonstrates the issue. I've tested this on both macOS Catalina and ubuntu 18.04, it happens on both systems. will-change: transform did not solve the problem for me.

Flags: needinfo?(dongkingkong0)

Thanks for the test case! I can reproduce this without the animation simply by toggling the specified style on the rect between 'none' and 'translateX(1px)' so it doesn't appear to be animation-related. Moving to SVG.

Status: UNCONFIRMED → NEW
Component: CSS Transitions and Animations → SVG
Ever confirmed: true
Priority: -- → P3
Version: 74 Branch → Trunk

It seems this is either triggered by animation or will-change: transform. Is an active layer the right term for that?

Moving to graphics for now.

Component: SVG → Graphics: Layers
Summary: CSS animated transform is offset on svg elements with stroke → Horizontal transform on SVG element with active layer produces vertical offset

Because this bug's Severity has not been changed from the default since it was filed, and it's Priority is P3 (Backlog,) indicating it has been triaged, the bug's Severity is being updated to S3 (normal.)

Severity: normal → S3

Caused by

https://hg.mozilla.org/mozilla-central/rev/5830f058ab4ef321e8f0ccf65a236ced21ee05fd

bug 1523343.

Doing a manual revert of that changeset fixes the bug for me.

Regressed by: 1523343
Has Regression Range: --- → yes

The patch in bug 1636119 fixes this.

Depends on: 1636119
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Assignee: nobody → longsonr
Target Milestone: --- → mozilla78
QA Whiteboard: [qa-78b-p2]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: