Support {flood,lighting,stop,text-decoration}-color in geckolib.

This commit is contained in:
Cameron McCormack 2016-05-02 14:41:25 +10:00
parent 174680f98c
commit 330c47f78e
4 changed files with 54 additions and 0 deletions

View file

@ -20,6 +20,7 @@
<%call expr="longhand(name, predefined_type=type, **kwargs)">
#[allow(unused_imports)]
use app_units::Au;
use cssparser::{Color as CSSParserColor, RGBA};
pub type SpecifiedValue = specified::${type};
pub mod computed_value {
pub use values::computed::${type} as T;

View file

@ -15,12 +15,27 @@ ${helpers.single_keyword("vector-effect", "none non-scaling-stroke", products="g
// Section 13 - Gradients and Patterns
${helpers.predefined_type(
"stop-color", "CSSColor",
"CSSParserColor::RGBA(RGBA { red: 0.0, green: 0.0, blue: 0.0, alpha: 1.0 })",
products="gecko")}
${helpers.predefined_type("stop-opacity", "Opacity", "1.0", products="gecko")}
// Section 15 - Filter Effects
${helpers.predefined_type(
"flood-color", "CSSColor",
"CSSParserColor::RGBA(RGBA { red: 0.0, green: 0.0, blue: 0.0, alpha: 1.0 })",
products="gecko")}
${helpers.predefined_type("flood-opacity", "Opacity", "1.0", products="gecko")}
${helpers.predefined_type(
"lighting-color", "CSSColor",
"CSSParserColor::RGBA(RGBA { red: 1.0, green: 1.0, blue: 1.0, alpha: 1.0 })",
products="gecko")}
// CSS Masking Module Level 1
// https://www.w3.org/TR/css-masking-1/
${helpers.single_keyword("mask-type", "luminance alpha", products="gecko")}

View file

@ -107,3 +107,8 @@ ${helpers.single_keyword("unicode-bidi", "normal embed isolate bidi-override iso
${helpers.single_keyword("text-decoration-style",
"-moz-none solid double dotted dashed wavy",
products="gecko")}
${helpers.predefined_type(
"text-decoration-color", "CSSColor",
"CSSParserColor::RGBA(RGBA { red: 0.0, green: 0.0, blue: 0.0, alpha: 1.0 })",
products="gecko")}

View file

@ -546,6 +546,39 @@ fn static_assert() {
</%self:impl_trait>
<%self:impl_trait style_struct_name="Text"
skip_longhands="text-decoration-color"
skip_additionals="*">
<% impl_color("text_decoration_color", "mTextDecorationColor",
color_flags_ffi_name="mTextDecorationStyle") %>
fn has_underline(&self) -> bool {
use gecko_style_structs as gss;
(self.gecko.mTextDecorationStyle & (gss::NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE as u8)) != 0
}
fn has_overline(&self) -> bool {
use gecko_style_structs as gss;
(self.gecko.mTextDecorationStyle & (gss::NS_STYLE_TEXT_DECORATION_LINE_OVERLINE as u8)) != 0
}
fn has_line_through(&self) -> bool {
use gecko_style_structs as gss;
(self.gecko.mTextDecorationStyle & (gss::NS_STYLE_TEXT_DECORATION_LINE_LINE_THROUGH as u8)) != 0
}
</%self:impl_trait>
<%self:impl_trait style_struct_name="SVG"
skip_longhands="flood-color lighting-color stop-color"
skip_additionals="*">
<% impl_color("flood_color", "mFloodColor") %>
<% impl_color("lighting_color", "mLightingColor") %>
<% impl_color("stop_color", "mStopColor") %>
</%self:impl_trait>
<%def name="define_ffi_struct_accessor(style_struct)">
#[no_mangle]
#[allow(non_snake_case, unused_variables)]