implement |quotes| property

MozReview-Commit-ID: 5eAaJGXSkob
This commit is contained in:
Manish Goregaokar 2016-10-13 18:00:14 +05:30
parent 17a46418dc
commit bb736f41d3
2 changed files with 23 additions and 2 deletions

View file

@ -1448,7 +1448,7 @@ fn static_assert() {
</%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)}
@ -1458,6 +1458,27 @@ fn static_assert() {
}
}
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"

View file

@ -104,7 +104,7 @@ ${helpers.single_keyword("list-style-type", """
}
</%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;