Closed Bug 1561225 Opened 5 years ago Closed 4 years ago

Transform with decimal values in svg path animation occurs in a different area than the end path

Categories

(Core :: SVG, defect, P3)

69 Branch
defect

Tracking

()

RESOLVED FIXED
mozilla78
Tracking Status
firefox78 --- fixed

People

(Reporter: thewingthing, Assigned: hiro)

References

Details

Attachments

(3 files)

Attached image Jun-25-2019 18-15-58.gif (deleted) β€”

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

Steps to reproduce:

This bug is still occurring during animations (https://bugzilla.mozilla.org/show_bug.cgi?id=1561190). When the animation is done, the path then pops back into place.

This occurs with svg paths with decimal values.

Codepen: https://codepen.io/anon/pen/qzjvMg

<svg width="500" height="500" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2 2">
  <path class="square" d="M .1 .1 H .9 V .9 H .10 L .10 .10"/>

  <!-- Points -->
  <circle cx=".10" cy=".10" r=".02" fill="red"/>
  <circle cx=".90" cy=".90" r=".02" fill="red"/>
  <circle cx=".90" cy=".10" r=".02" fill="red"/>
  <circle cx=".10" cy=".90" r=".02" fill="red"/>

</svg>
.square {
  animation-name: ani;
  animation-fill-mode: forwards;
  transform: scale(0);
  animation-duration: 1s;
}

@keyframes ani {
  to {
    transform: scale(1);
  }
}

Actual results:

The animation happens in an incorrect area.

Expected results:

The animation happens in the right area.

Component: Untriaged → SVG
Product: Firefox → Core

Oops, that's the wrong codepen. New codepen: https://codepen.io/anon/pen/EBXqjr

Status: UNCONFIRMED → NEW
Ever confirmed: true

The culprit is https://searchfox.org/mozilla-central/rev/7e158713cf5a8514fa8161dd4a239737b05da64d/gfx/layers/composite/AsyncCompositionManager.cpp#606, setting true will round the origin, which is wrong for SVG element. Essentially it's the same cause as
Bug 1523343.

This search https://searchfox.org/mozilla-central/search?q=.origin()&case=true&regexp=false shows the data member origin() is only used in a few places. So the right approach might be to round the origin conditionally here: https://searchfox.org/mozilla-central/rev/7e158713cf5a8514fa8161dd4a239737b05da64d/layout/painting/nsDisplayList.cpp#785

Forgot to mention the above will only solve the non-WebRender case. The WebRender case is much worse, a decimal width will even affect color opacity... There must be some undesired rounding going on somewhere, but I'm not familiar with.

Priority: -- → P3
Depends on: 1564698

The patch in bug 1636119 fixes this.

I also confirmed the patch in bug 1636119 fixes this. And I wrote a reftest based on comment 0. I will post it here.

Depends on: 1636119

This reftest is based on a reduced test case provided by thewingthing.

Assignee: nobody → hikezoe.birchill
Status: NEW → ASSIGNED
Pushed by hikezoe.birchill@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/0c94dc7dfbff
Add a reftest a transform aniamtion which is runnin on the compositor on a path element. r=boris
Flags: needinfo?(hikezoe.birchill)

Oops, I should have run the test on Android. There seems to be still a bug... Will check it on Android emulator.

Succeeded locally on Android Emulator. :/ Oh, on WebRender...

And check ShouldSnapToGrid when we create a stacking context for the
transform display item.

I was totally missing a comment [1] in CreateAimationData.

[1] https://searchfox.org/mozilla-central/rev/3ce874dc2703831af3e5ef3a1d216ffd08057fa5/gfx/layers/AnimationInfo.cpp#683-685

Attachment #9148275 - Attachment description: Bug 1561225 - Add a reftest a transform aniamtion which is runnin on the compositor on a path element. r?boris → Bug 1561225 - Add a reftest a transform aniamtion which is running on the compositor on a path element. r?boris
Pushed by hikezoe.birchill@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/b85c17816d3b
Revert the WebRender part for bug 1636119. r=longsonr
https://hg.mozilla.org/integration/autoland/rev/ab2a9658abc1
Add a reftest a transform aniamtion which is running on the compositor on a path element. r=boris
Flags: needinfo?(hikezoe.birchill)
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla78
Regressions: 1638842
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: