aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManish Goregaokar <manishearth@gmail.com>2017-05-23 18:15:47 -0700
committerManish Goregaokar <manishsmail@gmail.com>2017-05-27 10:47:44 -0700
commitde269b6b36a9ee21505c330dafcdffd5313c1163 (patch)
tree1b64f3f4aeae6684ce081d0a301b69bead787016
parent9ed5a7a05ef28906a2d3b8ee96fba1551b713bbb (diff)
downloadservo-de269b6b36a9ee21505c330dafcdffd5313c1163.tar.gz
servo-de269b6b36a9ee21505c330dafcdffd5313c1163.zip
stylo: Support -moz-context-properties
-rw-r--r--components/style/gecko/generated/bindings.rs8
-rw-r--r--components/style/properties/gecko.mako.rs30
-rw-r--r--components/style/properties/longhand/inherited_svg.mako.rs25
3 files changed, 62 insertions, 1 deletions
diff --git a/components/style/gecko/generated/bindings.rs b/components/style/gecko/generated/bindings.rs
index 7f3aa9921e1..edd90a36ab5 100644
--- a/components/style/gecko/generated/bindings.rs
+++ b/components/style/gecko/generated/bindings.rs
@@ -1123,6 +1123,14 @@ extern "C" {
src: *const nsStyleSVG);
}
extern "C" {
+ pub fn Gecko_nsStyleSVG_SetContextPropertiesLength(svg: *mut nsStyleSVG,
+ len: u32);
+}
+extern "C" {
+ pub fn Gecko_nsStyleSVG_CopyContextProperties(dst: *mut nsStyleSVG,
+ src: *const nsStyleSVG);
+}
+extern "C" {
pub fn Gecko_NewURLValue(uri: ServoBundledURI) -> *mut URLValue;
}
extern "C" {
diff --git a/components/style/properties/gecko.mako.rs b/components/style/properties/gecko.mako.rs
index 4b1c2cef4fe..a611c1c7f09 100644
--- a/components/style/properties/gecko.mako.rs
+++ b/components/style/properties/gecko.mako.rs
@@ -4028,7 +4028,7 @@ clip-path
</%self:impl_trait>
<%self:impl_trait style_struct_name="InheritedSVG"
- skip_longhands="paint-order stroke-dasharray stroke-dashoffset stroke-width"
+ skip_longhands="paint-order stroke-dasharray stroke-dashoffset stroke-width -moz-context-properties"
skip_additionals="*">
pub fn set_paint_order(&mut self, v: longhands::paint_order::computed_value::T) {
use self::longhands::paint_order;
@@ -4136,6 +4136,34 @@ clip-path
_ => unreachable!(),
}
}
+
+ #[allow(non_snake_case)]
+ pub fn set__moz_context_properties<I>(&mut self, v: I)
+ where I: IntoIterator<Item = longhands::_moz_context_properties::computed_value::single_value::T>,
+ I::IntoIter: ExactSizeIterator
+ {
+ let v = v.into_iter();
+ unsafe {
+ bindings::Gecko_nsStyleSVG_SetContextPropertiesLength(&mut self.gecko, v.len() as u32);
+ }
+
+ self.gecko.mContextPropsBits = 0;
+ for (mut gecko, servo) in self.gecko.mContextProps.iter_mut().zip(v) {
+ if servo.0 == atom!("fill") {
+ self.gecko.mContextPropsBits |= structs::NS_STYLE_CONTEXT_PROPERTY_FILL as u8;
+ } else if servo.0 == atom!("stroke") {
+ self.gecko.mContextPropsBits |= structs::NS_STYLE_CONTEXT_PROPERTY_STROKE as u8;
+ }
+ unsafe { gecko.set_raw_from_addrefed::<structs::nsIAtom>(servo.0.into_addrefed()) }
+ }
+ }
+
+ #[allow(non_snake_case)]
+ pub fn copy__moz_context_properties_from(&mut self, other: &Self) {
+ unsafe {
+ bindings::Gecko_nsStyleSVG_CopyContextProperties(&mut self.gecko, &other.gecko);
+ }
+ }
</%self:impl_trait>
<%self:impl_trait style_struct_name="Color"
diff --git a/components/style/properties/longhand/inherited_svg.mako.rs b/components/style/properties/longhand/inherited_svg.mako.rs
index bbc006a4e58..f02cccafaa4 100644
--- a/components/style/properties/longhand/inherited_svg.mako.rs
+++ b/components/style/properties/longhand/inherited_svg.mako.rs
@@ -268,3 +268,28 @@ ${helpers.predefined_type("marker-end", "UrlOrNone", "Either::Second(None_)",
impl ComputedValueAsSpecified for SpecifiedValue { }
</%helpers:longhand>
+<%helpers:vector_longhand name="-moz-context-properties"
+ animation_value_type="none"
+ products="gecko"
+ spec="Nonstandard (Internal-only)"
+ internal="True"
+ allow_empty="True">
+ use values::CustomIdent;
+ use values::computed::ComputedValueAsSpecified;
+
+ no_viewport_percentage!(SpecifiedValue);
+
+ impl ComputedValueAsSpecified for SpecifiedValue { }
+
+ pub type SpecifiedValue = CustomIdent;
+
+ pub mod computed_value {
+ pub type T = super::SpecifiedValue;
+ }
+
+
+ pub fn parse(_context: &ParserContext, input: &mut Parser) -> Result<SpecifiedValue, ()> {
+ let i = input.expect_ident()?;
+ CustomIdent::from_ident(i, &["all", "none", "auto"])
+ }
+</%helpers:vector_longhand>