style: Use cbindgen for text-decoration-line.

Differential Revision: https://phabricator.services.mozilla.com/D23412
This commit is contained in:
Emilio Cobos Álvarez 2019-03-18 17:58:16 +00:00
parent 4b07af2240
commit b0af565656
6 changed files with 110 additions and 158 deletions

View file

@ -3996,9 +3996,7 @@ fn static_assert() {
</%self:impl_trait>
<%self:impl_trait style_struct_name="Text"
skip_longhands="text-decoration-line text-overflow initial-letter">
${impl_simple_type_with_conversion("text_decoration_line")}
skip_longhands="text-overflow initial-letter">
fn clear_overflow_sides_if_string(&mut self) {
use crate::gecko_bindings::structs::nsStyleTextOverflowSide;
@ -4112,21 +4110,6 @@ fn static_assert() {
InitialLetter::Specified(self.gecko.mInitialLetterSize, Some(self.gecko.mInitialLetterSink))
}
}
#[inline]
pub fn has_underline(&self) -> bool {
(self.gecko.mTextDecorationLine & (structs::NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE as u8)) != 0
}
#[inline]
pub fn has_overline(&self) -> bool {
(self.gecko.mTextDecorationLine & (structs::NS_STYLE_TEXT_DECORATION_LINE_OVERLINE as u8)) != 0
}
#[inline]
pub fn has_line_through(&self) -> bool {
(self.gecko.mTextDecorationLine & (structs::NS_STYLE_TEXT_DECORATION_LINE_LINE_THROUGH as u8)) != 0
}
</%self:impl_trait>
// Set SVGPathData to StyleShapeSource.

View file

@ -5,16 +5,7 @@
<%namespace name="helpers" file="/helpers.mako.rs" />
<% from data import Method %>
<% data.new_style_struct(
"Text",
inherited=False,
gecko_name="TextReset",
additional_methods=[
Method("has_underline", "bool"),
Method("has_overline", "bool"),
Method("has_line_through", "bool"),
]
) %>
<% data.new_style_struct("Text", inherited=False, gecko_name="TextReset") %>
${helpers.predefined_type(
"text-overflow",

View file

@ -2638,24 +2638,6 @@ pub mod style_structs {
use crate::Zero;
!self.outline_width.is_zero()
}
% elif style_struct.name == "Text":
/// Whether the text decoration has an underline.
#[inline]
pub fn has_underline(&self) -> bool {
self.text_decoration_line.contains(longhands::text_decoration_line::SpecifiedValue::UNDERLINE)
}
/// Whether the text decoration has an overline.
#[inline]
pub fn has_overline(&self) -> bool {
self.text_decoration_line.contains(longhands::text_decoration_line::SpecifiedValue::OVERLINE)
}
/// Whether the text decoration has a line through.
#[inline]
pub fn has_line_through(&self) -> bool {
self.text_decoration_line.contains(longhands::text_decoration_line::SpecifiedValue::LINE_THROUGH)
}
% elif style_struct.name == "Box":
/// Sets the display property, but without touching original_display,
/// except when the adjustment comes from root or item display fixups.