-
Notifications
You must be signed in to change notification settings - Fork 306
If the transform contains perspective component, the clip rect don't affect by this transform. #1693
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
☔ The latest upstream changes (presumably #1606) made this pull request unmergeable. Please resolve the merge conflicts. |
|
I'm a little unsure about this - shouldn't the LCCR take into account the transform with perspective and be conservative @kvark ? |
|
@glennw that is correct. LCCR should provide a conservative local rectangle bound even with transformations involved. Relevant code: NodeType::ReferenceFrame(ref info) => {
self.combined_local_viewport_rect =
info.transform.with_destination::<LayerPixel>()
.inverse_rect_footprint(&scrolled_parent_combined_clip);
self.reference_frame_relative_scroll_offset = LayerVector2D::zero();
(info.transform, state.parent_accumulated_scroll_offset) |
|
Can we try to find out why the code @kvark referenced above doesn't seem to get the conservative bounding rect in this case? |
a4d371c to
68bcb9a
Compare
|
@kvark Looks like this has been updated. @mephisto41 is it ready for review? |
|
☔ The latest upstream changes (presumably #1712) made this pull request unmergeable. Please resolve the merge conflicts. |
68bcb9a to
61997d2
Compare
|
@glennw , I think this is ready for review now. |
|
@mephisto41 Ideally I'd like to get @kvark to take a look at this. I thought that the inverse rect footprint calculation should handle perspective transforms. Unfortunately @kvark is traveling this week, apologies for the delay. Is this an urgent thing to get merged? (If so - we could possibly merge it and follow up when @kvark is back). We should also do a gecko try run and run the servo wpt tests on this - I can run those locally tomorrow if you're not sure how to do those? |
Yap, footprint calculation handle perspective transforms. But it ignores all perspective and 3d components (a.k.a third row and third column and m34 of matrix)
Not urgent, I can wait @kvark :)
Sure, thank you very much. 👍 |
|
@mephisto41 OK - the wrench and servo tests pass, but it looks like there are quite a lot of gecko failures that will need to be investigated: https://hg.mozilla.org/try/rev/3b88c7245af9af6976d639f5bddac6096ad3c55e |
|
Ah, I'll check the gecko failures first. |
|
After some experiments, I cannot find a very good way to solve this. In my test case, I have 2 stacking-contexts as follow.
scrolled_parent_combined_clip is TypedRect(1920×1080 at (0,0))
scrolled_parent_combined_clip is TypedRect(1920×1080 at (0,0)) The problem is when calculating the LCCR for second SC, we only consider its 2d components. In above example, we have perspective(300) in first SC and translateZ(-300) in second SC which means the final scale components should be (1, 1) so that the LCCR should be TypedRect(1920x1080 at(0,0)). I don't have a easy way to fix this. @glennw @kvark , Do you have any suggestion for this? Thanks. |
Actually, the second one is fine. It's the first one that should not have resulted in The code in question is here: fn inverse_project(&self, target: &TypedPoint2D<f32, Dst>) -> Option<TypedPoint2D<f32, Src>> {
let m: TypedTransform2D<f32, Src, Dst>;
m = TypedTransform2D::column_major(
self.m11 - target.x * self.m14,
self.m21 - target.x * self.m24,
self.m41 - target.x * self.m44,
self.m12 - target.y * self.m14,
self.m22 - target.y * self.m24,
self.m42 - target.y * self.m44,
);
m.inverse().map(|inv| TypedPoint2D::new(inv.m31, inv.m32))
}The proof was on a piece of paper somewhere, and now is a good time as ever to try deriving the formula again to find out what my original error was. |
61997d2 to
90aa4c2
Compare
|
Hi @glennw, as we discussed couple days ago. This version completely skip LCCR if transform has perspective component. How do you think about this version? I also push a try in gecko and it looks fine. https://treeherder.mozilla.org/#/jobs?repo=try&revision=b31b8f950142686f6107f7037c680fa5f30a1d3d&selectedJob=134828657 |
|
@mephisto41 Thanks for following this up! I think this looks fine - it's not the perfect solution, but it does add new test passes in the try run, and it does has a reftest to make sure we don't regress it with any follow up changes. @kvark Are you happy to have this merged? |
|
@glennw it's a good step for at least as long as |
|
thank you! |
|
📌 Commit 90aa4c2 has been approved by |
If the transform contains perspective component, the clip rect don't affect by this transform. When calculating the LCCR. If current transform or parent transform has perspective component, then we shouldn't transform the LCCR by this transform because we only consider 2d component for LCCR. Once the perspective component is presence, the LCCR would be wrong. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/webrender/1693) <!-- Reviewable:end -->
|
☀️ Test successful - status-appveyor, status-travis |
When calculating the LCCR. If current transform or parent transform has
perspective component, then we shouldn't transform the LCCR by this
transform because we only consider 2d component for LCCR. Once the
perspective component is presence, the LCCR would be wrong.
This change is