Bug 1309848 - stylo: implement |quotes| property; r?emilio draft
authorManish Goregaokar <manishsmail@gmail.com>
Thu, 13 Oct 2016 18:00:14 +0530
changeset 424913 eb167a59605320199720f957f98084b58936af8d
parent 424912 f7901ac35a4255aaf0ca39b7847fa697c8031d82
child 533792 2ea942f75a78aa629106094ee976da564665f75d
push id32286
push userbmo:manishearth@gmail.com
push dateThu, 13 Oct 2016 19:02:26 +0000
reviewersemilio
bugs1309848
milestone52.0a1
Bug 1309848 - stylo: implement |quotes| property; r?emilio MozReview-Commit-ID: 5eAaJGXSkob
servo/components/style/properties/gecko.mako.rs
servo/components/style/properties/longhand/list.mako.rs
--- a/servo/components/style/properties/gecko.mako.rs
+++ b/servo/components/style/properties/gecko.mako.rs
@@ -1443,26 +1443,47 @@ fn static_assert() {
         match servo {
             T::scroll => structs::NS_STYLE_IMAGELAYER_ATTACHMENT_SCROLL as u8,
             T::fixed => structs::NS_STYLE_IMAGELAYER_ATTACHMENT_FIXED as u8,
             T::local => structs::NS_STYLE_IMAGELAYER_ATTACHMENT_LOCAL as u8,
         }
     </%self:simple_image_array_property>
 </%self:impl_trait>
 
-<%self:impl_trait style_struct_name="List" skip_longhands="list-style-type" skip_additionals="*">
+<%self:impl_trait style_struct_name="List" skip_longhands="list-style-type quotes" skip_additionals="*">
 
     ${impl_keyword_setter("list_style_type", "__LIST_STYLE_TYPE__",
                            data.longhands_by_name["list-style-type"].keyword)}
     pub fn copy_list_style_type_from(&mut self, other: &Self) {
         unsafe {
             Gecko_CopyListStyleTypeFrom(&mut self.gecko, &other.gecko);
         }
     }
 
+    pub fn set_quotes(&mut self, other: longhands::quotes::computed_value::T) {
+        use gecko_bindings::bindings::Gecko_NewStyleQuoteValues;
+        use gecko_bindings::sugar::refptr::UniqueRefPtr;
+        use nsstring::nsCString;
+
+        let mut refptr = unsafe {
+            UniqueRefPtr::from_addrefed(Gecko_NewStyleQuoteValues(other.0.len() as u32))
+        };
+
+        for (servo, gecko) in other.0.into_iter().zip(refptr.mQuotePairs.iter_mut()) {
+            gecko.first.assign_utf8(&nsCString::from(&*servo.0));
+            gecko.second.assign_utf8(&nsCString::from(&*servo.1));
+        }
+
+        unsafe { self.gecko.mQuotes.set_move(refptr.get()) }
+    }
+
+    pub fn copy_quotes_from(&mut self, other: &Self) {
+        unsafe { self.gecko.mQuotes.set(&other.gecko.mQuotes); }
+    }
+
 </%self:impl_trait>
 
 <%self:impl_trait style_struct_name="Effects"
                   skip_longhands="box-shadow">
     pub fn set_box_shadow(&mut self, v: longhands::box_shadow::computed_value::T) {
         use cssparser::Color;
 
         self.gecko.mBoxShadow.replace_with_new(v.0.len() as u32);
--- a/servo/components/style/properties/longhand/list.mako.rs
+++ b/servo/components/style/properties/longhand/list.mako.rs
@@ -99,17 +99,17 @@
         }
     }
     #[inline]
     pub fn get_initial_value() -> computed_value::T {
         computed_value::T(None)
     }
 </%helpers:longhand>
 
-<%helpers:longhand name="quotes" products="servo" animatable="False">
+<%helpers:longhand name="quotes" animatable="False">
     use std::borrow::Cow;
     use std::fmt;
     use values::NoViewportPercentage;
     use values::computed::ComputedValueAsSpecified;
 
     use cssparser::{ToCss, Token};
 
     pub use self::computed_value::T as SpecifiedValue;