mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
Support list-style-image in stylo. r=manishearth
MozReview-Commit-ID: HyGWZevQYEo
This commit is contained in:
parent
f491f61bb3
commit
e65bbdee01
1 changed files with 37 additions and 3 deletions
|
@ -19,6 +19,7 @@ use gecko_bindings::bindings::Gecko_Destroy_${style_struct.gecko_ffi_name};
|
||||||
% endfor
|
% endfor
|
||||||
use gecko_bindings::bindings::Gecko_CopyFontFamilyFrom;
|
use gecko_bindings::bindings::Gecko_CopyFontFamilyFrom;
|
||||||
use gecko_bindings::bindings::Gecko_CopyImageValueFrom;
|
use gecko_bindings::bindings::Gecko_CopyImageValueFrom;
|
||||||
|
use gecko_bindings::bindings::Gecko_CopyListStyleImageFrom;
|
||||||
use gecko_bindings::bindings::Gecko_CopyListStyleTypeFrom;
|
use gecko_bindings::bindings::Gecko_CopyListStyleTypeFrom;
|
||||||
use gecko_bindings::bindings::Gecko_CopyMozBindingFrom;
|
use gecko_bindings::bindings::Gecko_CopyMozBindingFrom;
|
||||||
use gecko_bindings::bindings::Gecko_CreateGradient;
|
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_AppendNamed;
|
||||||
use gecko_bindings::bindings::Gecko_FontFamilyList_Clear;
|
use gecko_bindings::bindings::Gecko_FontFamilyList_Clear;
|
||||||
use gecko_bindings::bindings::Gecko_SetGradientImageValue;
|
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_SetListStyleType;
|
||||||
use gecko_bindings::bindings::Gecko_SetMozBinding;
|
use gecko_bindings::bindings::Gecko_SetMozBinding;
|
||||||
use gecko_bindings::bindings::Gecko_SetNullImageValue;
|
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,
|
# These are part of shorthands so we must include them in stylo builds,
|
||||||
# but we haven't implemented the stylo glue for the longhand
|
# but we haven't implemented the stylo glue for the longhand
|
||||||
# so we generate a stub
|
# so we generate a stub
|
||||||
force_stub += ["list-style-image", # box
|
force_stub += ["flex-basis", # position
|
||||||
"flex-basis", # position
|
|
||||||
|
|
||||||
# transition
|
# transition
|
||||||
"transition-duration", "transition-timing-function",
|
"transition-duration", "transition-timing-function",
|
||||||
|
@ -1471,10 +1473,42 @@ fn static_assert() {
|
||||||
</%self:simple_image_array_property>
|
</%self:simple_image_array_property>
|
||||||
</%self:impl_trait>
|
</%self:impl_trait>
|
||||||
|
|
||||||
<%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__",
|
${impl_keyword_setter("list_style_type", "__LIST_STYLE_TYPE__",
|
||||||
data.longhands_by_name["list-style-type"].keyword)}
|
data.longhands_by_name["list-style-type"].keyword)}
|
||||||
|
|
||||||
pub fn copy_list_style_type_from(&mut self, other: &Self) {
|
pub fn copy_list_style_type_from(&mut self, other: &Self) {
|
||||||
unsafe {
|
unsafe {
|
||||||
Gecko_CopyListStyleTypeFrom(&mut self.gecko, &other.gecko);
|
Gecko_CopyListStyleTypeFrom(&mut self.gecko, &other.gecko);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue