Skip to content

Commit

Permalink
Auto merge of #11018 - bholley:list_style_type, r=mbrubeck
Browse files Browse the repository at this point in the history
Geckolib: Implement list-style-type

Corresponding Gecko patch: https://bugzilla.mozilla.org/show_bug.cgi?id=1269933

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11018)
<!-- Reviewable:end -->
  • Loading branch information
bors-servo committed May 5, 2016
2 parents 52adcf3 + f1f36ef commit b29ae63
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 7 deletions.
14 changes: 9 additions & 5 deletions components/style/properties/longhand/list.mako.rs
Expand Up @@ -13,13 +13,17 @@ ${helpers.single_keyword("list-style-position", "outside inside")}
// decimal-leading-zero, armenian, upper-armenian, lower-armenian, georgian, lower-roman,
// upper-roman
//
// TODO(bholley): Missing quite a few gecko properties here as well.
//
// [1]: http://dev.w3.org/csswg/css-counter-styles/
${helpers.single_keyword("list-style-type", """
disc none circle square decimal arabic-indic bengali cambodian cjk-decimal devanagari
gujarati gurmukhi kannada khmer lao malayalam mongolian myanmar oriya persian telugu thai
tibetan lower-alpha upper-alpha cjk-earthly-branch cjk-heavenly-stem lower-greek hiragana
hiragana-iroha katakana katakana-iroha disclosure-open disclosure-closed
""")}
disc none circle square decimal lower-alpha upper-alpha disclosure-open disclosure-closed
""", extra_servo_values="""arabic-indic bengali cambodian cjk-decimal devanagari
gujarati gurmukhi kannada khmer lao malayalam mongolian
myanmar oriya persian telugu thai tibetan cjk-earthly-branch
cjk-heavenly-stem lower-greek hiragana hiragana-iroha katakana
katakana-iroha""",
gecko_constant_prefix="NS_STYLE_LIST_STYLE")}

<%helpers:longhand name="list-style-image">
use cssparser::{ToCss, Token};
Expand Down
3 changes: 3 additions & 0 deletions ports/geckolib/bindings.rs
Expand Up @@ -69,6 +69,9 @@ extern "C" {
pub fn Gecko_SetNodeData(node: *mut RawGeckoNode,
data: *mut ServoNodeData);
pub fn Servo_DropNodeData(data: *mut ServoNodeData);
pub fn Gecko_SetListStyleType(style_struct: *mut nsStyleList, type_: u32);
pub fn Gecko_CopyListStyleTypeFrom(dst: *mut nsStyleList,
src: *const nsStyleList);
pub fn Servo_StylesheetFromUTF8Bytes(bytes: *const u8, length: u32,
parsing_mode: SheetParsingMode)
-> *mut RawServoStyleSheet;
Expand Down
3 changes: 1 addition & 2 deletions ports/geckolib/gecko_style_structs.rs
Expand Up @@ -4716,15 +4716,14 @@ fn bindgen_test_layout_nsStyleQuoteValues() {
#[repr(C)]
pub struct nsStyleList {
pub mListStylePosition: u8,
pub mListStyleType: nsString,
pub mCounterStyle: RefPtr<CounterStyle>,
pub mListStyleImage: RefPtr<imgRequestProxy>,
pub mQuotes: RefPtr<nsStyleQuoteValues>,
pub mImageRegion: nsRect,
}
#[test]
fn bindgen_test_layout_nsStyleList() {
assert_eq!(::std::mem::size_of::<nsStyleList>() , 64usize);
assert_eq!(::std::mem::size_of::<nsStyleList>() , 48usize);
assert_eq!(::std::mem::align_of::<nsStyleList>() , 8usize);
}
#[repr(C)]
Expand Down
15 changes: 15 additions & 0 deletions ports/geckolib/properties.mako.rs
Expand Up @@ -16,6 +16,7 @@ use bindings::Gecko_Construct_${style_struct.gecko_ffi_name};
use bindings::Gecko_CopyConstruct_${style_struct.gecko_ffi_name};
use bindings::Gecko_Destroy_${style_struct.gecko_ffi_name};
% endfor
use bindings::{Gecko_CopyListStyleTypeFrom, Gecko_SetListStyleType};
use gecko_style_structs;
use glue::ArcHelpers;
use heapsize::HeapSizeOf;
Expand Down Expand Up @@ -153,6 +154,8 @@ def set_gecko_property(ffi_name, expr):
if is_border_style_masked(ffi_name):
return "self.gecko.%s &= !(gecko_style_structs::BORDER_STYLE_MASK as u8);" % ffi_name + \
"self.gecko.%s |= %s as u8;" % (ffi_name, expr)
elif ffi_name == "__LIST_STYLE_TYPE__":
return "unsafe { Gecko_SetListStyleType(&mut self.gecko, %s as u32); }" % expr
return "self.gecko.%s = %s;" % (ffi_name, expr)
%>

Expand Down Expand Up @@ -588,6 +591,18 @@ fn static_assert() {

</%self:impl_trait>

<%self:impl_trait style_struct_name="List" skip_longhands="list-style-type" skip_additionals="*">

<% impl_keyword_setter("list_style_type", "__LIST_STYLE_TYPE__",
data.longhands_by_name["list-style-type"].keyword) %>
fn copy_list_style_type_from(&mut self, other: &Self) {
unsafe {
Gecko_CopyListStyleTypeFrom(&mut self.gecko, &other.gecko);
}
}

</%self:impl_trait>

<%self:impl_trait style_struct_name="Text"
skip_longhands="text-decoration-color"
skip_additionals="*">
Expand Down

0 comments on commit b29ae63

Please sign in to comment.