Closed
Bug 1156456
Opened 10 years ago
Closed 10 years ago
z component of transform-origin incorrect when animated with off-main-thread animations with zoom or retina display
Categories
(Core :: CSS Parsing and Computation, defect)
Tracking
()
RESOLVED
FIXED
mozilla40
Tracking | Status | |
---|---|---|
firefox40 | --- | fixed |
People
(Reporter: kip, Assigned: dbaron)
References
()
Details
(Keywords: regression)
Attachments
(7 files)
22.16 KB,
image/png
|
Details | |
16.72 KB,
image/png
|
Details | |
3.27 KB,
text/html
|
Details | |
1.50 KB,
patch
|
Details | Diff | Splinter Review | |
6.42 KB,
patch
|
birtles
:
review+
|
Details | Diff | Splinter Review |
3.02 KB,
patch
|
birtles
:
review+
|
Details | Diff | Splinter Review |
6.27 KB,
patch
|
birtles
:
review+
|
Details | Diff | Splinter Review |
In the latest (2015-04-20) nightly, the CSS 3D Transform sample at attached URL does not render correctly. One face of the 3d spinning cube appears to be translated towards the center of the cube.
This appears to be a regression within the last few days. Previously, the example rendered the cube correctly.
Reporter | ||
Updated•10 years ago
|
Keywords: regressionwindow-wanted
Reporter | ||
Comment 1•10 years ago
|
||
Reporter | ||
Comment 2•10 years ago
|
||
Reporter | ||
Comment 3•10 years ago
|
||
The screenshot was taken while the browser window was on the built-in retina display of a 15" MacBook Pro (MacBookPro11,3). On the same machine, if the window is dragged to an external (non-retina) display, the problem still exists, but the offset is only a couple of pixels.
Comment 4•10 years ago
|
||
59:06.80 LOG: MainThread Bisector INFO Last good revision: ef53c6c25fb1
59:06.80 LOG: MainThread Bisector INFO First bad revision: eed5d2d610e2
59:06.80 LOG: MainThread Bisector INFO Pushlog:
https://hg.mozilla.org/integration/mozilla-inbound/pushloghtml?fromchange=ef53c6c25fb1&tochange=eed5d2d610e2
I found this window using a 15" Retina MacBook Pro, FWIW. Definitely caused by the fix to Bug 980770.
Blocks: enable-omt-animations
Component: Graphics: Layers → CSS Parsing and Computation
Keywords: regressionwindow-wanted → regression
Hardware: x86 → All
Comment 5•10 years ago
|
||
[Tracking Requested - why for this release]: Behavior regression.
tracking-firefox40:
--- → ?
Flags: needinfo?(dbaron)
Assignee | ||
Comment 6•10 years ago
|
||
Assignee | ||
Comment 7•10 years ago
|
||
I guess I see brokenness, but somewhat different symptoms: one face of the cube appears to get out of sync with the others, sometimes quite substantially, although most of the time only by a little bit.
Assignee | ||
Comment 8•10 years ago
|
||
Oh, wait, I see the original problem if I zoom in... which makes sense, since a retina display is like a zoom of 2x.
Assignee | ||
Updated•10 years ago
|
Summary: CSS 3D Transform regression, face of spinning cube example appears offset → Animated CSS 3D Transforms at wrong offset, with off-main-thread animations and zoom or retina display
Assignee | ||
Comment 9•10 years ago
|
||
This is the minimal fix.
However, I think it would be better to send these values across in device pixels, because it seems simpler.
Flags: needinfo?(dbaron)
Assignee | ||
Comment 10•10 years ago
|
||
Try run at:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=819d55662f00
I'm expected to have to add a small amount of fuzz to one or both of the tests (since locally I see 7 pixels off with max difference 16 on the non-zoom test, along one of the edges of the cube). I'll use the results of the try run to do so, but I think the rest is ready for review.
Assignee | ||
Comment 11•10 years ago
|
||
I confirmed that without the patch, the test marked as failing (the one
with zoom) in this patch (which will be unmarked in the next patch)
fails.
There is also a small amount of fuzz that will need to be annotated with
an additional patch on top of the patch stack.
Attachment #8595677 -
Flags: review?(bbirtles)
Assignee | ||
Updated•10 years ago
|
Assignee: nobody → dbaron
Status: NEW → ASSIGNED
Assignee | ||
Comment 12•10 years ago
|
||
I confirmed locally that this patch fixes the reftest (per reftest.list
change).
Attachment #8595678 -
Flags: review?(bbirtles)
Assignee | ||
Comment 13•10 years ago
|
||
Attachment #8595679 -
Flags: review?(bbirtles)
Assignee | ||
Updated•10 years ago
|
Summary: Animated CSS 3D Transforms at wrong offset, with off-main-thread animations and zoom or retina display → z component of transform-origin incorrect when animated with off-main-thread animations with zoom or retina display
Updated•10 years ago
|
Attachment #8595677 -
Flags: review?(bbirtles) → review+
Updated•10 years ago
|
Attachment #8595678 -
Flags: review?(bbirtles) → review+
Comment 14•10 years ago
|
||
Comment on attachment 8595679 [details] [diff] [review]
patch 3 - Send transform origin and perspective origin to layer in device pixels rather than CSS pixels
>diff --git a/gfx/layers/composite/AsyncCompositionManager.cpp b/gfx/layers/composite/AsyncCompositionManager.cpp
>--- a/gfx/layers/composite/AsyncCompositionManager.cpp
>+++ b/gfx/layers/composite/AsyncCompositionManager.cpp
>@@ -401,28 +401,19 @@ SampleValue(float aPortion, Animation& a
...
> TransformData& data = aAnimation.data().get_TransformData();
> nsPoint origin = data.origin();
>- // we expect all our transform data to arrive in css pixels, so here we must
>- // adjust to dev pixels.
>- double cssPerDev = double(nsDeviceContext::AppUnitsPerCSSPixel())
>- / double(data.appUnitsPerDevPixel());
>+ // we expect all our transform data to arrive in device pixels
I wonder if we still need this comment.
>diff --git a/layout/base/nsDisplayList.cpp b/layout/base/nsDisplayList.cpp
>--- a/layout/base/nsDisplayList.cpp
>+++ b/layout/base/nsDisplayList.cpp
>@@ -525,18 +525,19 @@ nsDisplayListBuilder::AddAnimationsAndTr
...
> AnimationData data;
> if (aProperty == eCSSProperty_transform) {
> nsRect bounds = nsDisplayTransform::GetFrameBoundsForTransform(aFrame);
>- // all data passed directly to the compositor should be in css pixels
>- float scale = nsDeviceContext::AppUnitsPerCSSPixel();
>+ // all data passed directly to the compositor should be in dev pixels
>+ int32_t d2a = aFrame->PresContext()->AppUnitsPerDevPixel();
Is d2a a convention? If not, something like devPixelsToAppUnits would be a little less cryptic to me, but it's up to you.
It's not entirely clear to me why passing device pixels is better (CSS pixels seems like a more appropriate value for an interface boundary) but I agree it simplifies this code.
Attachment #8595679 -
Flags: review?(bbirtles) → review+
Comment 15•10 years ago
|
||
(In reply to David Baron [:dbaron] ⏰UTC-7 from comment #11)
> Created attachment 8595677 [details] [diff] [review]
> patch 1 - Reftests comparing a 3-D transformed cube generated by main-thread
> paths and off-main-thread animations paths
>
> I confirmed that without the patch, the test marked as failing (the one
> with zoom) in this patch (which will be unmarked in the next patch)
> fails.
>
> There is also a small amount of fuzz that will need to be annotated with
> an additional patch on top of the patch stack.
Do we still need that fuzz?
Assignee | ||
Comment 16•10 years ago
|
||
(In reply to Brian Birtles (:birtles) from comment #15)
> Do we still need that fuzz?
Yes, for at least Linux 64 and Windows XP. (But not for Linux 32, Mac, Win8, or Android.) Still waiting on Win7.
Assignee | ||
Comment 17•10 years ago
|
||
That said, I think I've conclude that the fuzz is a bug, so I'm going to just try to debug and fix it.
(I was thinking it was because the layerization decisions were different, but they're not. I've found there's a rounding difference in the aTransform._42 parameter to BasicCompositor::DrawQuad that seems suspicious, and I'm looking to see where that difference comes from.)
Assignee | ||
Comment 18•10 years ago
|
||
In nsDisplayTransform::GetResultingTransformMatrixInternal, there's a small difference following the ReadTransforms call (looks like the result of converting doubles to floats and back) that ends up being turned into a larger difference by the result.ChangeBasis(offsetBetweenOrigins); at the end of the function.
Assignee | ||
Comment 19•10 years ago
|
||
So the reason for the subtle transform difference is that when we read the transform list via nsDisplayTransform::GetResultingTransformMatrix calling nsStyleTransformMatrix::ReadTransforms:
* in the non-OMTA case, we're reading the specified transform, which is rotateY(-120deg)
* in the OMTA case, we're reading the transform as converted to radians and passed around as a float
nsCSSValue::GetAngleValueInRadians produces different results in these cases since it converts the float to a double *before* doing the multiplication (so as to yield accurate results for round values in degrees).
I suspect the test could work around this by specifying the rotation as a round number in radians.
That doesn't, however, explain how this transform difference on the side that has OMT animations on it (the non-pseudo-element) causes differences at the edge of a *different* side.
Assignee | ||
Comment 20•10 years ago
|
||
(In reply to David Baron [:dbaron] ⏰UTC-7 from comment #19)
> That doesn't, however, explain how this transform difference on the side
> that has OMT animations on it (the non-pseudo-element) causes differences at
> the edge of a *different* side.
Er, actually, it does, since the non-OMTA layers are children of the OMTA layer.
Assignee | ||
Comment 21•10 years ago
|
||
Here's a new try run:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=ca9b01d97988
with:
* the 10px of extra spacing workaround removed from the test
* the angle on the div changed to be in radians, to work around comment 19
I filed bug 1157455 as a followup to fix the rounding problem.
Assignee | ||
Comment 22•10 years ago
|
||
... and I'll still need to mark the test fuzzy for Win7 reftest-no-accel (only!), which I'm just going to do and not worry about it.
Comment 23•10 years ago
|
||
Comment 24•10 years ago
|
||
Comment 25•10 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/dc6b401584e9
https://hg.mozilla.org/mozilla-central/rev/61bb4d672472
https://hg.mozilla.org/mozilla-central/rev/e08e45fd8922
https://hg.mozilla.org/mozilla-central/rev/1b7f3a1a9dd3
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
status-firefox40:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla40
Assignee | ||
Comment 26•10 years ago
|
||
I plan to land one more followup, which is to land an opacity equivalent of the transform reftest landed above. Try run for that reftest is here:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=6d70778c56ed
Comment 27•10 years ago
|
||
Comment 29•10 years ago
|
||
Since this is fixed, we're removing tracking for 40.
tracking-firefox40:
? → ---
You need to log in
before you can comment on or make changes to this bug.
Description
•