From fdb29e15a4d14354484ed69f708bf06862bfaa88 Mon Sep 17 00:00:00 2001 From: Xidorn Quan Date: Tue, 16 May 2017 09:47:16 +1000 Subject: [PATCH] Add binding for setting pair value of nsCSSValue. --- components/style/gecko/rules.rs | 11 +++++------ components/style/gecko_bindings/sugar/ns_css_value.rs | 7 +++++++ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/components/style/gecko/rules.rs b/components/style/gecko/rules.rs index 4bb3ed85041..1bf58b449c4 100644 --- a/components/style/gecko/rules.rs +++ b/components/style/gecko/rules.rs @@ -180,14 +180,14 @@ impl ToNsCssValue for counter_style::System { let mut b = nsCSSValue::null(); a.set_enum(structs::NS_STYLE_COUNTER_SYSTEM_FIXED as i32); b.set_integer(first_symbol_value.unwrap_or(1)); - //nscssvalue.set_pair(a, b); // FIXME: add bindings for nsCSSValue::SetPairValue + nscssvalue.set_pair(&a, &b); } Extends(ref other) => { let mut a = nsCSSValue::null(); let mut b = nsCSSValue::null(); a.set_enum(structs::NS_STYLE_COUNTER_SYSTEM_EXTENDS as i32); b.set_string_from_atom(&other.0); - //nscssvalue.set_pair(a, b); // FIXME: add bindings for nsCSSValue::SetPairValue + nscssvalue.set_pair(&a, &b); } } } @@ -200,7 +200,7 @@ impl ToNsCssValue for counter_style::Negative { let mut b = nsCSSValue::null(); a.set_from(&self.0); b.set_from(second); - //nscssvalue.set_pair(a, b); // FIXME: add bindings for nsCSSValue::SetPairValue + nscssvalue.set_pair(&a, &b); } else { nscssvalue.set_from(&self.0) } @@ -240,13 +240,12 @@ impl ToNsCssValue for counter_style::Ranges { } impl ToNsCssValue for counter_style::Pad { - fn convert(&self, _nscssvalue: &mut nsCSSValue) { + fn convert(&self, nscssvalue: &mut nsCSSValue) { let mut min_length = nsCSSValue::null(); let mut pad_with = nsCSSValue::null(); min_length.set_integer(self.0 as i32); pad_with.set_from(&self.1); - // FIXME: add bindings for nsCSSValue::SetPairValue - //nscssvalue.set_pair(min_length, pad_with); + nscssvalue.set_pair(&min_length, &pad_with); } } diff --git a/components/style/gecko_bindings/sugar/ns_css_value.rs b/components/style/gecko_bindings/sugar/ns_css_value.rs index 3cc6ae1df00..ec18ec2c6a9 100644 --- a/components/style/gecko_bindings/sugar/ns_css_value.rs +++ b/components/style/gecko_bindings/sugar/ns_css_value.rs @@ -213,6 +213,13 @@ impl nsCSSValue { *self.mValue.mFloat.as_mut() = value; } } + + /// Set to a pair value + /// + /// This is only supported on the main thread. + pub fn set_pair(&mut self, x: &nsCSSValue, y: &nsCSSValue) { + unsafe { bindings::Gecko_CSSValue_SetPair(self, x, y) } + } } impl Drop for nsCSSValue {