aboutsummaryrefslogtreecommitdiffstats
path: root/ports
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2017-11-27 20:13:34 -0600
committerGitHub <noreply@github.com>2017-11-27 20:13:34 -0600
commit823da9e34aacca750942c0fb53a29d6ca16c394d (patch)
tree278151ee1cd8edc60622f1b320494fcaa02c3db9 /ports
parentc93f989e11b954e5cc104502684bd8e3f353d5f3 (diff)
parent3a38e815ecbbcb7ae5ba93d9763894c4907fb87a (diff)
downloadservo-823da9e34aacca750942c0fb53a29d6ca16c394d.tar.gz
servo-823da9e34aacca750942c0fb53a29d6ca16c394d.zip
Auto merge of #19388 - BorisChiou:stylo/dommatrix/parser, r=emilio,heycam
stylo: Implement Servo_ParseTransformIntoMatrix This is an inter-dependent patch of Bug 1408310. DOMMatrix needs to convert a specified transform list into a matrix, so we rewrite to_transform_3d_matrix by generics for both specified and computed transform lists. --- - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix [Bug 1408310](https://bugzilla.mozilla.org/show_bug.cgi?id=1408310). - [X] These changes do not require tests because we can count on the wpt tests for DOMMatrix on Gecko side. <!-- 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/19388) <!-- Reviewable:end -->
Diffstat (limited to 'ports')
-rw-r--r--ports/geckolib/glue.rs36
1 files changed, 36 insertions, 0 deletions
diff --git a/ports/geckolib/glue.rs b/ports/geckolib/glue.rs
index 9c02b3d7f14..894e66579bb 100644
--- a/ports/geckolib/glue.rs
+++ b/ports/geckolib/glue.rs
@@ -4651,6 +4651,42 @@ pub extern "C" fn Servo_ParseIntersectionObserverRootMargin(
}
#[no_mangle]
+pub extern "C" fn Servo_ParseTransformIntoMatrix(
+ value: *const nsAString,
+ contain_3d: *mut bool,
+ result: *mut RawGeckoGfxMatrix4x4
+) -> bool {
+ use style::properties::longhands::transform;
+
+ let string = unsafe { (*value).to_string() };
+ let mut input = ParserInput::new(&string);
+ let mut parser = Parser::new(&mut input);
+ let context = ParserContext::new(
+ Origin::Author,
+ unsafe { dummy_url_data() },
+ Some(CssRuleType::Style),
+ ParsingMode::DEFAULT,
+ QuirksMode::NoQuirks
+ );
+
+ let transform = match parser.parse_entirely(|t| transform::parse(&context, t)) {
+ Ok(t) => t,
+ Err(..) => return false,
+ };
+
+ let (m, is_3d) = match transform.to_transform_3d_matrix(None) {
+ Ok(result) => result,
+ Err(..) => return false,
+ };
+
+ let result = unsafe { result.as_mut() }.expect("not a valid matrix");
+ let contain_3d = unsafe { contain_3d.as_mut() }.expect("not a valid bool");
+ *result = m.to_row_major_array();
+ *contain_3d = is_3d;
+ true
+}
+
+#[no_mangle]
pub unsafe extern "C" fn Servo_SourceSizeList_Parse(
value: *const nsACString,
) -> *mut RawServoSourceSizeList {