From e65bbdee0171dac3a86e6be5c2a28473fc4649e9 Mon Sep 17 00:00:00 2001 From: Cameron McCormack Date: Sun, 16 Oct 2016 11:03:58 +0800 Subject: [PATCH] Support list-style-image in stylo. r=manishearth MozReview-Commit-ID: HyGWZevQYEo --- components/style/properties/gecko.mako.rs | 40 +++++++++++++++++++++-- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/components/style/properties/gecko.mako.rs b/components/style/properties/gecko.mako.rs index 73676c23eb8..a0eb3051f17 100644 --- a/components/style/properties/gecko.mako.rs +++ b/components/style/properties/gecko.mako.rs @@ -19,6 +19,7 @@ use gecko_bindings::bindings::Gecko_Destroy_${style_struct.gecko_ffi_name}; % endfor use gecko_bindings::bindings::Gecko_CopyFontFamilyFrom; use gecko_bindings::bindings::Gecko_CopyImageValueFrom; +use gecko_bindings::bindings::Gecko_CopyListStyleImageFrom; use gecko_bindings::bindings::Gecko_CopyListStyleTypeFrom; use gecko_bindings::bindings::Gecko_CopyMozBindingFrom; use gecko_bindings::bindings::Gecko_CreateGradient; @@ -27,6 +28,8 @@ use gecko_bindings::bindings::Gecko_FontFamilyList_AppendGeneric; use gecko_bindings::bindings::Gecko_FontFamilyList_AppendNamed; use gecko_bindings::bindings::Gecko_FontFamilyList_Clear; use gecko_bindings::bindings::Gecko_SetGradientImageValue; +use gecko_bindings::bindings::Gecko_SetListStyleImage; +use gecko_bindings::bindings::Gecko_SetListStyleImageNone; use gecko_bindings::bindings::Gecko_SetListStyleType; use gecko_bindings::bindings::Gecko_SetMozBinding; use gecko_bindings::bindings::Gecko_SetNullImageValue; @@ -472,8 +475,7 @@ impl Debug for ${style_struct.gecko_struct_name} { # These are part of shorthands so we must include them in stylo builds, # but we haven't implemented the stylo glue for the longhand # so we generate a stub - force_stub += ["list-style-image", # box - "flex-basis", # position + force_stub += ["flex-basis", # position # transition "transition-duration", "transition-timing-function", @@ -1471,10 +1473,42 @@ fn static_assert() { -<%self:impl_trait style_struct_name="List" skip_longhands="list-style-type quotes" skip_additionals="*"> +<%self:impl_trait style_struct_name="List" + skip_longhands="list-style-image list-style-type quotes" + skip_additionals="*"> + + pub fn set_list_style_image(&mut self, image: longhands::list_style_image::computed_value::T) { + use values::computed::UrlOrNone; + match image { + UrlOrNone::None => { + unsafe { + Gecko_SetListStyleImageNone(&mut self.gecko); + } + } + UrlOrNone::Url(ref url, ref extra_data) => { + unsafe { + Gecko_SetListStyleImage(&mut self.gecko, + url.as_str().as_ptr(), + url.as_str().len() as u32, + extra_data.base.get(), + extra_data.referrer.get(), + extra_data.principal.get()); + } + // We don't need to record this struct as uncacheable, like when setting + // background-image to a url() value, since only properties in reset structs + // are re-used from the applicable declaration cache, and the List struct + // is an inherited struct. + } + } + } + + pub fn copy_list_style_image_from(&mut self, other: &Self) { + unsafe { Gecko_CopyListStyleImageFrom(&mut self.gecko, &other.gecko); } + } ${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);