aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2017-08-13 23:08:03 -0500
committerGitHub <noreply@github.com>2017-08-13 23:08:03 -0500
commitcd1251082511a44ef9ad020b7196336bca812a49 (patch)
tree746f2dfbe1b95c8a6440d3077d36e872b5e645ae
parent0eabba3c6fa232fd732eb2127f8fe285efd04288 (diff)
parent02277ce4a191c56359ebe2c033f59dec4423ad42 (diff)
downloadservo-cd1251082511a44ef9ad020b7196336bca812a49.tar.gz
servo-cd1251082511a44ef9ad020b7196336bca812a49.zip
Auto merge of #18068 - BorisChiou:stylo/animation/perspective, r=birtles
Fix the conversion from Perspective into ComputedMatrix. We convert a perspective function into a ComputedMatrix, but we apply the perspective length to a wrong matrix item. We should put it into m34, instead of m43. m43 is for translate parameter Z. --- - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix [Bug 1389023](https://bugzilla.mozilla.org/show_bug.cgi?id=1389023). - [X] These changes do not require tests because we have many transform tests in Gecko already. However, those tests may not be enough, so we should add more in Gecko later. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18068) <!-- Reviewable:end -->
-rw-r--r--components/style/properties/helpers/animated_properties.mako.rs12
1 files changed, 9 insertions, 3 deletions
diff --git a/components/style/properties/helpers/animated_properties.mako.rs b/components/style/properties/helpers/animated_properties.mako.rs
index 4b423751d6b..2f11d506f29 100644
--- a/components/style/properties/helpers/animated_properties.mako.rs
+++ b/components/style/properties/helpers/animated_properties.mako.rs
@@ -1474,11 +1474,17 @@ fn add_weighted_transform_lists(from_list: &[TransformOperation],
}
}
(&TransformOperation::Perspective(fd),
- &TransformOperation::Perspective(_td)) => {
+ &TransformOperation::Perspective(td)) => {
let mut fd_matrix = ComputedMatrix::identity();
let mut td_matrix = ComputedMatrix::identity();
- fd_matrix.m43 = -1. / fd.to_f32_px();
- td_matrix.m43 = -1. / _td.to_f32_px();
+ if fd.0 > 0 {
+ fd_matrix.m34 = -1. / fd.to_f32_px();
+ }
+
+ if td.0 > 0 {
+ td_matrix.m34 = -1. / td.to_f32_px();
+ }
+
let sum = fd_matrix.add_weighted(&td_matrix, self_portion, other_portion)
.unwrap();
result.push(TransformOperation::Matrix(sum));