mirror of
https://github.com/servo/servo.git
synced 2025-07-03 21:43:41 +01:00
Auto merge of #10556 - bholley:keyword_setters, r=SimonSapin
Automatically generate Gecko style struct setters for most keyword properties <!-- 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/10556) <!-- Reviewable:end -->
This commit is contained in:
commit
e21e5551ec
6 changed files with 278 additions and 147 deletions
|
@ -50,9 +50,11 @@ def to_camel_case(ident):
|
||||||
return re.sub("_([a-z])", lambda m: m.group(1).upper(), ident.strip("_").capitalize())
|
return re.sub("_([a-z])", lambda m: m.group(1).upper(), ident.strip("_").capitalize())
|
||||||
|
|
||||||
class Keyword(object):
|
class Keyword(object):
|
||||||
def __init__(self, name, values, extra_gecko_values=None, extra_servo_values=None):
|
def __init__(self, name, values, gecko_constant_prefix=None,
|
||||||
|
extra_gecko_values=None, extra_servo_values=None):
|
||||||
self.name = name
|
self.name = name
|
||||||
self.values = values
|
self.values = values
|
||||||
|
self.gecko_constant_prefix = gecko_constant_prefix or "NS_STYLE_" + self.name.upper().replace("-", "_")
|
||||||
self.extra_gecko_values = extra_gecko_values or []
|
self.extra_gecko_values = extra_gecko_values or []
|
||||||
self.extra_servo_values = extra_servo_values or []
|
self.extra_servo_values = extra_servo_values or []
|
||||||
def gecko_values(self):
|
def gecko_values(self):
|
||||||
|
@ -66,10 +68,13 @@ class Keyword(object):
|
||||||
return self.servo_values()
|
return self.servo_values()
|
||||||
else:
|
else:
|
||||||
raise Exception("Bad product: " + product)
|
raise Exception("Bad product: " + product)
|
||||||
|
def gecko_constant(self, value):
|
||||||
|
return self.gecko_constant_prefix + "_" + value.upper().replace("-", "_")
|
||||||
|
|
||||||
class Longhand(object):
|
class Longhand(object):
|
||||||
def __init__(self, name, derived_from=None, keyword=None,
|
def __init__(self, name, derived_from=None, keyword=None,
|
||||||
custom_cascade=False, experimental=False, internal=False):
|
custom_cascade=False, experimental=False, internal=False,
|
||||||
|
gecko_ffi_name=None):
|
||||||
self.name = name
|
self.name = name
|
||||||
self.keyword = keyword
|
self.keyword = keyword
|
||||||
self.ident = to_rust_ident(name)
|
self.ident = to_rust_ident(name)
|
||||||
|
@ -78,6 +83,7 @@ class Longhand(object):
|
||||||
self.experimental = ("layout.%s.enabled" % name) if experimental else None
|
self.experimental = ("layout.%s.enabled" % name) if experimental else None
|
||||||
self.custom_cascade = custom_cascade
|
self.custom_cascade = custom_cascade
|
||||||
self.internal = internal
|
self.internal = internal
|
||||||
|
self.gecko_ffi_name = gecko_ffi_name or "m" + self.camel_case
|
||||||
if derived_from is None:
|
if derived_from is None:
|
||||||
self.derived_from = None
|
self.derived_from = None
|
||||||
else:
|
else:
|
||||||
|
@ -174,7 +180,8 @@ pub mod longhands {
|
||||||
use values::specified;
|
use values::specified;
|
||||||
|
|
||||||
<%def name="raw_longhand(name, keyword=None, derived_from=None, products='gecko,servo',
|
<%def name="raw_longhand(name, keyword=None, derived_from=None, products='gecko,servo',
|
||||||
custom_cascade=False, experimental=False, internal=False)">
|
custom_cascade=False, experimental=False, internal=False,
|
||||||
|
gecko_ffi_name=None)">
|
||||||
<%
|
<%
|
||||||
if not CONFIG['product'] in products:
|
if not CONFIG['product'] in products:
|
||||||
return ""
|
return ""
|
||||||
|
@ -186,7 +193,8 @@ pub mod longhands {
|
||||||
keyword=keyword,
|
keyword=keyword,
|
||||||
custom_cascade=custom_cascade,
|
custom_cascade=custom_cascade,
|
||||||
experimental=experimental,
|
experimental=experimental,
|
||||||
internal=internal)
|
internal=internal,
|
||||||
|
gecko_ffi_name=gecko_ffi_name)
|
||||||
property.style_struct = THIS_STYLE_STRUCT
|
property.style_struct = THIS_STYLE_STRUCT
|
||||||
THIS_STYLE_STRUCT.longhands.append(property)
|
THIS_STYLE_STRUCT.longhands.append(property)
|
||||||
LONGHANDS.append(property)
|
LONGHANDS.append(property)
|
||||||
|
@ -315,10 +323,12 @@ pub mod longhands {
|
||||||
</%def>
|
</%def>
|
||||||
|
|
||||||
<%def name="longhand(name, derived_from=None, keyword=None, products='gecko,servo',
|
<%def name="longhand(name, derived_from=None, keyword=None, products='gecko,servo',
|
||||||
custom_cascade=False, experimental=False, internal=False)">
|
custom_cascade=False, experimental=False, internal=False,
|
||||||
|
gecko_ffi_name=None)">
|
||||||
<%self:raw_longhand name="${name}" derived_from="${derived_from}" keyword="${keyword}"
|
<%self:raw_longhand name="${name}" derived_from="${derived_from}" keyword="${keyword}"
|
||||||
products="${products}" custom_cascade="${custom_cascade}"
|
products="${products}" custom_cascade="${custom_cascade}"
|
||||||
experimental="${experimental}" internal="${internal}">
|
experimental="${experimental}" internal="${internal}"
|
||||||
|
gecko_ffi_name="${gecko_ffi_name}">
|
||||||
${caller.body()}
|
${caller.body()}
|
||||||
% if derived_from is None:
|
% if derived_from is None:
|
||||||
pub fn parse_specified(context: &ParserContext, input: &mut Parser)
|
pub fn parse_specified(context: &ParserContext, input: &mut Parser)
|
||||||
|
@ -331,12 +341,15 @@ pub mod longhands {
|
||||||
|
|
||||||
<%def name="single_keyword_computed(name, values, products='gecko,servo',
|
<%def name="single_keyword_computed(name, values, products='gecko,servo',
|
||||||
extra_gecko_values=None, extra_servo_values=None,
|
extra_gecko_values=None, extra_servo_values=None,
|
||||||
custom_cascade=False, experimental=False, internal=False)">
|
custom_cascade=False, experimental=False, internal=False,
|
||||||
|
gecko_constant_prefix=None, gecko_ffi_name=None)">
|
||||||
<%self:longhand name="${name}" keyword="${Keyword(name, values.split(),
|
<%self:longhand name="${name}" keyword="${Keyword(name, values.split(),
|
||||||
extra_gecko_values,
|
gecko_constant_prefix=gecko_constant_prefix,
|
||||||
extra_servo_values)}"
|
extra_gecko_values=extra_gecko_values,
|
||||||
|
extra_servo_values=extra_servo_values)}"
|
||||||
products="${products}" custom_cascade="${custom_cascade}"
|
products="${products}" custom_cascade="${custom_cascade}"
|
||||||
experimental="${experimental}" internal="${internal}">
|
experimental="${experimental}" internal="${internal}",
|
||||||
|
gecko_ffi_name="${gecko_ffi_name}">
|
||||||
pub use self::computed_value::T as SpecifiedValue;
|
pub use self::computed_value::T as SpecifiedValue;
|
||||||
${caller.body()}
|
${caller.body()}
|
||||||
pub mod computed_value {
|
pub mod computed_value {
|
||||||
|
@ -356,12 +369,16 @@ pub mod longhands {
|
||||||
</%self:longhand>
|
</%self:longhand>
|
||||||
</%def>
|
</%def>
|
||||||
|
|
||||||
<%def name="single_keyword(name, values, products='gecko,servo', experimental=False, internal=False)">
|
<%def name="single_keyword(name, values, products='gecko,servo',
|
||||||
|
experimental=False, internal=False,
|
||||||
|
gecko_constant_prefix=None, gecko_ffi_name=None)">
|
||||||
<%self:single_keyword_computed name="${name}"
|
<%self:single_keyword_computed name="${name}"
|
||||||
values="${values}"
|
values="${values}"
|
||||||
products="${products}"
|
products="${products}"
|
||||||
experimental="${experimental}"
|
experimental="${experimental}"
|
||||||
internal="${internal}">
|
internal="${internal}",
|
||||||
|
gecko_constant_prefix="${gecko_constant_prefix}"
|
||||||
|
gecko_ffi_name="${gecko_ffi_name}">
|
||||||
use values::computed::ComputedValueAsSpecified;
|
use values::computed::ComputedValueAsSpecified;
|
||||||
impl ComputedValueAsSpecified for SpecifiedValue {}
|
impl ComputedValueAsSpecified for SpecifiedValue {}
|
||||||
</%self:single_keyword_computed>
|
</%self:single_keyword_computed>
|
||||||
|
@ -532,7 +549,7 @@ pub mod longhands {
|
||||||
Method("transition_count", "usize")])}
|
Method("transition_count", "usize")])}
|
||||||
|
|
||||||
// TODO(SimonSapin): don't parse `inline-table`, since we don't support it
|
// TODO(SimonSapin): don't parse `inline-table`, since we don't support it
|
||||||
<%self:longhand name="display" custom_cascade="True">
|
<%self:longhand name="display" custom_cascade="${CONFIG['product'] == 'servo'}">
|
||||||
<%
|
<%
|
||||||
values = """inline block inline-block
|
values = """inline block inline-block
|
||||||
table inline-table table-row-group table-header-group table-footer-group
|
table inline-table table-row-group table-header-group table-footer-group
|
||||||
|
@ -589,6 +606,7 @@ pub mod longhands {
|
||||||
|
|
||||||
impl ComputedValueAsSpecified for SpecifiedValue {}
|
impl ComputedValueAsSpecified for SpecifiedValue {}
|
||||||
|
|
||||||
|
% if CONFIG["product"] == "servo":
|
||||||
fn cascade_property_custom<C: ComputedValues>(
|
fn cascade_property_custom<C: ComputedValues>(
|
||||||
_declaration: &PropertyDeclaration,
|
_declaration: &PropertyDeclaration,
|
||||||
_inherited_style: &C,
|
_inherited_style: &C,
|
||||||
|
@ -599,11 +617,13 @@ pub mod longhands {
|
||||||
longhands::_servo_display_for_hypothetical_box::derive_from_display(context);
|
longhands::_servo_display_for_hypothetical_box::derive_from_display(context);
|
||||||
longhands::_servo_text_decorations_in_effect::derive_from_display(context);
|
longhands::_servo_text_decorations_in_effect::derive_from_display(context);
|
||||||
}
|
}
|
||||||
|
% endif
|
||||||
|
|
||||||
</%self:longhand>
|
</%self:longhand>
|
||||||
|
|
||||||
${single_keyword("position", "static absolute relative fixed")}
|
${single_keyword("position", "static absolute relative fixed")}
|
||||||
|
|
||||||
<%self:single_keyword_computed name="float" values="none left right">
|
<%self:single_keyword_computed name="float" values="none left right" gecko_ffi_name="mFloats">
|
||||||
impl ToComputedValue for SpecifiedValue {
|
impl ToComputedValue for SpecifiedValue {
|
||||||
type ComputedValue = computed_value::T;
|
type ComputedValue = computed_value::T;
|
||||||
|
|
||||||
|
@ -622,9 +642,9 @@ pub mod longhands {
|
||||||
|
|
||||||
</%self:single_keyword_computed>
|
</%self:single_keyword_computed>
|
||||||
|
|
||||||
${single_keyword("clear", "none left right both")}
|
${single_keyword("clear", "none left right both", gecko_ffi_name="mBreakType")}
|
||||||
|
|
||||||
<%self:longhand name="-servo-display-for-hypothetical-box" derived_from="display">
|
<%self:longhand name="-servo-display-for-hypothetical-box" derived_from="display" products="servo">
|
||||||
pub use super::display::{SpecifiedValue, get_initial_value};
|
pub use super::display::{SpecifiedValue, get_initial_value};
|
||||||
pub use super::display::{parse};
|
pub use super::display::{parse};
|
||||||
|
|
||||||
|
@ -688,7 +708,7 @@ pub mod longhands {
|
||||||
}
|
}
|
||||||
</%self:longhand>
|
</%self:longhand>
|
||||||
|
|
||||||
${new_style_struct("InheritedBox", is_inherited=True,
|
${new_style_struct("InheritedBox", is_inherited=True, gecko_name="nsStyleVisibility",
|
||||||
additional_methods=[Method("clone_direction",
|
additional_methods=[Method("clone_direction",
|
||||||
"longhands::direction::computed_value::T"),
|
"longhands::direction::computed_value::T"),
|
||||||
Method("clone_writing_mode",
|
Method("clone_writing_mode",
|
||||||
|
@ -727,8 +747,9 @@ pub mod longhands {
|
||||||
"parse_non_negative")}
|
"parse_non_negative")}
|
||||||
|
|
||||||
${new_style_struct("InheritedText", is_inherited=True, gecko_name="nsStyleText",
|
${new_style_struct("InheritedText", is_inherited=True, gecko_name="nsStyleText",
|
||||||
additional_methods=[Method("clone__servo_text_decorations_in_effect",
|
additional_methods=([Method("clone__servo_text_decorations_in_effect",
|
||||||
"longhands::_servo_text_decorations_in_effect::computed_value::T")])}
|
"longhands::_servo_text_decorations_in_effect::computed_value::T")]
|
||||||
|
if CONFIG["product"] == "servo" else []))}
|
||||||
|
|
||||||
<%self:longhand name="line-height">
|
<%self:longhand name="line-height">
|
||||||
use cssparser::ToCss;
|
use cssparser::ToCss;
|
||||||
|
@ -919,7 +940,7 @@ pub mod longhands {
|
||||||
internal=True)}
|
internal=True)}
|
||||||
|
|
||||||
// FIXME(pcwalton, #2742): Implement scrolling for `scroll` and `auto`.
|
// FIXME(pcwalton, #2742): Implement scrolling for `scroll` and `auto`.
|
||||||
${single_keyword("overflow-x", "visible hidden scroll auto")}
|
${single_keyword("overflow-x", "visible hidden scroll auto", gecko_constant_prefix="NS_STYLE_OVERFLOW")}
|
||||||
|
|
||||||
// FIXME(pcwalton, #2742): Implement scrolling for `scroll` and `auto`.
|
// FIXME(pcwalton, #2742): Implement scrolling for `scroll` and `auto`.
|
||||||
<%self:longhand name="overflow-y">
|
<%self:longhand name="overflow-y">
|
||||||
|
@ -964,19 +985,25 @@ pub mod longhands {
|
||||||
${single_keyword("scroll-behavior", "auto smooth", products="gecko")}
|
${single_keyword("scroll-behavior", "auto smooth", products="gecko")}
|
||||||
|
|
||||||
// Non-standard: https://developer.mozilla.org/en-US/docs/Web/CSS/scroll-snap-type-x
|
// Non-standard: https://developer.mozilla.org/en-US/docs/Web/CSS/scroll-snap-type-x
|
||||||
${single_keyword("scroll-snap-type-x", "none mandatory proximity", products="gecko")}
|
${single_keyword("scroll-snap-type-x", "none mandatory proximity",
|
||||||
|
products="gecko", gecko_constant_prefix="NS_STYLE_SCROLL_SNAP_TYPE")}
|
||||||
|
|
||||||
// Non-standard: https://developer.mozilla.org/en-US/docs/Web/CSS/scroll-snap-type-y
|
// Non-standard: https://developer.mozilla.org/en-US/docs/Web/CSS/scroll-snap-type-y
|
||||||
${single_keyword("scroll-snap-type-y", "none mandatory proximity", products="gecko")}
|
${single_keyword("scroll-snap-type-y", "none mandatory proximity",
|
||||||
|
products="gecko", gecko_constant_prefix="NS_STYLE_SCROLL_SNAP_TYPE")}
|
||||||
|
|
||||||
|
// Compositing and Blending Level 1
|
||||||
|
// http://www.w3.org/TR/compositing-1/
|
||||||
|
${single_keyword("isolation", "auto isolate", products="gecko")}
|
||||||
|
|
||||||
${switch_to_style_struct("InheritedBox")}
|
${switch_to_style_struct("InheritedBox")}
|
||||||
|
|
||||||
// TODO: collapse. Well, do tables first.
|
// TODO: collapse. Well, do tables first.
|
||||||
${single_keyword("visibility", "visible hidden")}
|
${single_keyword("visibility", "visible hidden", gecko_ffi_name="mVisible")}
|
||||||
|
|
||||||
// CSS 2.1, Section 12 - Generated content, automatic numbering, and lists
|
// CSS 2.1, Section 12 - Generated content, automatic numbering, and lists
|
||||||
|
|
||||||
${new_style_struct("Counters", is_inherited=False)}
|
${new_style_struct("Counters", is_inherited=False, gecko_name="nsStyleContent")}
|
||||||
|
|
||||||
<%self:longhand name="content">
|
<%self:longhand name="content">
|
||||||
use cssparser::Token;
|
use cssparser::Token;
|
||||||
|
@ -1375,7 +1402,8 @@ pub mod longhands {
|
||||||
|
|
||||||
${single_keyword("page-break-after", "auto always avoid left right", products="gecko")}
|
${single_keyword("page-break-after", "auto always avoid left right", products="gecko")}
|
||||||
${single_keyword("page-break-before", "auto always avoid left right", products="gecko")}
|
${single_keyword("page-break-before", "auto always avoid left right", products="gecko")}
|
||||||
${single_keyword("page-break-inside", "auto avoid", products="gecko")}
|
${single_keyword("page-break-inside", "auto avoid",
|
||||||
|
products="gecko", gecko_ffi_name="mBreakInside", gecko_constant_prefix="NS_STYLE_PAGE_BREAK")}
|
||||||
|
|
||||||
// CSS 2.1, Section 14 - Colors and Backgrounds
|
// CSS 2.1, Section 14 - Colors and Backgrounds
|
||||||
|
|
||||||
|
@ -2236,13 +2264,14 @@ pub mod longhands {
|
||||||
|
|
||||||
// Also known as "word-wrap" (which is more popular because of IE), but this is the preferred
|
// Also known as "word-wrap" (which is more popular because of IE), but this is the preferred
|
||||||
// name per CSS-TEXT 6.2.
|
// name per CSS-TEXT 6.2.
|
||||||
${single_keyword("overflow-wrap", "normal break-word")}
|
${single_keyword("overflow-wrap", "normal break-word", gecko_ffi_name="mWordWrap",
|
||||||
|
gecko_constant_prefix="NS_STYLE_WORDWRAP")}
|
||||||
|
|
||||||
// TODO(pcwalton): Support `word-break: keep-all` once we have better CJK support.
|
// TODO(pcwalton): Support `word-break: keep-all` once we have better CJK support.
|
||||||
${single_keyword("word-break", "normal break-all")}
|
${single_keyword("word-break", "normal break-all", gecko_constant_prefix="NS_STYLE_WORDBREAK")}
|
||||||
|
|
||||||
// TODO(pcwalton): Support `text-justify: distribute`.
|
// TODO(pcwalton): Support `text-justify: distribute`.
|
||||||
${single_keyword("text-justify", "auto none inter-word")}
|
${single_keyword("text-justify", "auto none inter-word", products="servo")}
|
||||||
|
|
||||||
${new_style_struct("Text", is_inherited=False, gecko_name="nsStyleTextReset",
|
${new_style_struct("Text", is_inherited=False, gecko_name="nsStyleTextReset",
|
||||||
additional_methods=[Method("has_underline", "bool"),
|
additional_methods=[Method("has_underline", "bool"),
|
||||||
|
@ -2253,7 +2282,7 @@ pub mod longhands {
|
||||||
|
|
||||||
${single_keyword("unicode-bidi", "normal embed isolate bidi-override isolate-override plaintext")}
|
${single_keyword("unicode-bidi", "normal embed isolate bidi-override isolate-override plaintext")}
|
||||||
|
|
||||||
<%self:longhand name="text-decoration" custom_cascade="True">
|
<%self:longhand name="text-decoration" custom_cascade="${CONFIG['product'] == 'servo'}">
|
||||||
use cssparser::ToCss;
|
use cssparser::ToCss;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use values::computed::ComputedValueAsSpecified;
|
use values::computed::ComputedValueAsSpecified;
|
||||||
|
@ -2328,6 +2357,7 @@ pub mod longhands {
|
||||||
if !empty { Ok(result) } else { Err(()) }
|
if !empty { Ok(result) } else { Err(()) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
% if CONFIG["product"] == "servo":
|
||||||
fn cascade_property_custom<C: ComputedValues>(
|
fn cascade_property_custom<C: ComputedValues>(
|
||||||
_declaration: &PropertyDeclaration,
|
_declaration: &PropertyDeclaration,
|
||||||
_inherited_style: &C,
|
_inherited_style: &C,
|
||||||
|
@ -2337,6 +2367,7 @@ pub mod longhands {
|
||||||
_error_reporter: &mut StdBox<ParseErrorReporter + Send>) {
|
_error_reporter: &mut StdBox<ParseErrorReporter + Send>) {
|
||||||
longhands::_servo_text_decorations_in_effect::derive_from_text_decoration(context);
|
longhands::_servo_text_decorations_in_effect::derive_from_text_decoration(context);
|
||||||
}
|
}
|
||||||
|
% endif
|
||||||
</%self:longhand>
|
</%self:longhand>
|
||||||
|
|
||||||
${single_keyword("text-decoration-style", "-moz-none solid double dotted dashed wavy",
|
${single_keyword("text-decoration-style", "-moz-none solid double dotted dashed wavy",
|
||||||
|
@ -2345,7 +2376,7 @@ pub mod longhands {
|
||||||
${switch_to_style_struct("InheritedText")}
|
${switch_to_style_struct("InheritedText")}
|
||||||
|
|
||||||
<%self:longhand name="-servo-text-decorations-in-effect"
|
<%self:longhand name="-servo-text-decorations-in-effect"
|
||||||
derived_from="display text-decoration">
|
derived_from="display text-decoration" products="servo">
|
||||||
use cssparser::{RGBA, ToCss};
|
use cssparser::{RGBA, ToCss};
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
|
@ -2425,7 +2456,8 @@ pub mod longhands {
|
||||||
}
|
}
|
||||||
</%self:longhand>
|
</%self:longhand>
|
||||||
|
|
||||||
<%self:single_keyword_computed name="white-space" values="normal pre nowrap pre-wrap pre-line">
|
<%self:single_keyword_computed name="white-space" values="normal pre nowrap pre-wrap pre-line",
|
||||||
|
gecko_constant_prefix="NS_STYLE_WHITESPACE">
|
||||||
use values::computed::ComputedValueAsSpecified;
|
use values::computed::ComputedValueAsSpecified;
|
||||||
impl ComputedValueAsSpecified for SpecifiedValue {}
|
impl ComputedValueAsSpecified for SpecifiedValue {}
|
||||||
|
|
||||||
|
@ -2480,13 +2512,13 @@ pub mod longhands {
|
||||||
// CSS 2.1, Section 17 - Tables
|
// CSS 2.1, Section 17 - Tables
|
||||||
${new_style_struct("Table", is_inherited=False, gecko_name="nsStyleTable")}
|
${new_style_struct("Table", is_inherited=False, gecko_name="nsStyleTable")}
|
||||||
|
|
||||||
${single_keyword("table-layout", "auto fixed")}
|
${single_keyword("table-layout", "auto fixed", gecko_ffi_name="mLayoutStrategy")}
|
||||||
|
|
||||||
${new_style_struct("InheritedTable", is_inherited=True)}
|
${new_style_struct("InheritedTable", is_inherited=True, gecko_name="nsStyleTableBorder")}
|
||||||
|
|
||||||
${single_keyword("border-collapse", "separate collapse")}
|
${single_keyword("border-collapse", "separate collapse", gecko_constant_prefix="NS_STYLE_BORDER")}
|
||||||
|
|
||||||
${single_keyword("empty-cells", "show hide")}
|
${single_keyword("empty-cells", "show hide", gecko_constant_prefix="NS_STYLE_TABLE_EMPTY_CELLS")}
|
||||||
|
|
||||||
${single_keyword("caption-side", "top bottom")}
|
${single_keyword("caption-side", "top bottom")}
|
||||||
|
|
||||||
|
@ -2609,7 +2641,7 @@ pub mod longhands {
|
||||||
|
|
||||||
${single_keyword("box-sizing", "content-box border-box")}
|
${single_keyword("box-sizing", "content-box border-box")}
|
||||||
|
|
||||||
${new_style_struct("Pointing", is_inherited=True)}
|
${new_style_struct("Pointing", is_inherited=True, gecko_name="nsStyleUserInterface")}
|
||||||
|
|
||||||
<%self:longhand name="cursor">
|
<%self:longhand name="cursor">
|
||||||
pub use self::computed_value::T as SpecifiedValue;
|
pub use self::computed_value::T as SpecifiedValue;
|
||||||
|
@ -2853,7 +2885,7 @@ pub mod longhands {
|
||||||
</%self:longhand>
|
</%self:longhand>
|
||||||
|
|
||||||
// Box-shadow, etc.
|
// Box-shadow, etc.
|
||||||
${new_style_struct("Effects", is_inherited=False)}
|
${new_style_struct("Effects", is_inherited=False, gecko_name="nsStyleEffects")}
|
||||||
|
|
||||||
<%self:longhand name="opacity">
|
<%self:longhand name="opacity">
|
||||||
use cssparser::ToCss;
|
use cssparser::ToCss;
|
||||||
|
@ -4367,18 +4399,10 @@ pub mod longhands {
|
||||||
}
|
}
|
||||||
</%self:longhand>
|
</%self:longhand>
|
||||||
|
|
||||||
// Compositing and Blending Level 1
|
|
||||||
// http://www.w3.org/TR/compositing-1/
|
|
||||||
${single_keyword("isolation", "auto isolate", products="gecko")}
|
|
||||||
|
|
||||||
${single_keyword("mix-blend-mode",
|
${single_keyword("mix-blend-mode",
|
||||||
"""normal multiply screen overlay darken lighten color-dodge
|
"""normal multiply screen overlay darken lighten color-dodge
|
||||||
color-burn hard-light soft-light difference exclusion hue
|
color-burn hard-light soft-light difference exclusion hue
|
||||||
saturation color luminosity""")}
|
saturation color luminosity""", gecko_constant_prefix="NS_STYLE_BLEND")}
|
||||||
|
|
||||||
// CSS Masking Module Level 1
|
|
||||||
// https://www.w3.org/TR/css-masking-1/
|
|
||||||
${single_keyword("mask-type", "luminance alpha", products="gecko")}
|
|
||||||
|
|
||||||
// CSS Image Values and Replaced Content Module Level 3
|
// CSS Image Values and Replaced Content Module Level 3
|
||||||
// https://drafts.csswg.org/css-images-3/
|
// https://drafts.csswg.org/css-images-3/
|
||||||
|
@ -5001,20 +5025,17 @@ pub mod longhands {
|
||||||
|
|
||||||
// SVG 1.1 (Second Edition)
|
// SVG 1.1 (Second Edition)
|
||||||
// https://www.w3.org/TR/SVG/
|
// https://www.w3.org/TR/SVG/
|
||||||
${new_style_struct("SVG", is_inherited=True)}
|
${new_style_struct("SVGInherited", is_inherited=True, gecko_name="nsStyleSVG")}
|
||||||
|
|
||||||
// Section 10 - Text
|
// Section 10 - Text
|
||||||
${single_keyword("dominant-baseline",
|
|
||||||
"""auto use-script no-change reset-size ideographic alphabetic hanging
|
|
||||||
mathematical central middle text-after-edge text-before-edge""",
|
|
||||||
products="gecko")}
|
|
||||||
|
|
||||||
${single_keyword("text-anchor", "start middle end", products="gecko")}
|
${single_keyword("text-anchor", "start middle end", products="gecko")}
|
||||||
|
|
||||||
// Section 11 - Painting: Filling, Stroking and Marker Symbols
|
// Section 11 - Painting: Filling, Stroking and Marker Symbols
|
||||||
${single_keyword("color-interpolation", "auto sRGB linearRGB", products="gecko")}
|
${single_keyword("color-interpolation", "auto sRGB linearRGB", products="gecko")}
|
||||||
|
|
||||||
${single_keyword("color-interpolation-filters", "auto sRGB linearRGB", products="gecko")}
|
${single_keyword("color-interpolation-filters", "auto sRGB linearRGB",
|
||||||
|
products="gecko", gecko_constant_prefix="NS_STYLE_COLOR_INTERPOLATION")}
|
||||||
|
|
||||||
${single_keyword("fill-rule", "nonzero evenodd", products="gecko")}
|
${single_keyword("fill-rule", "nonzero evenodd", products="gecko")}
|
||||||
|
|
||||||
|
@ -5025,14 +5046,22 @@ pub mod longhands {
|
||||||
|
|
||||||
${single_keyword("stroke-linejoin", "miter round bevel", products="gecko")}
|
${single_keyword("stroke-linejoin", "miter round bevel", products="gecko")}
|
||||||
|
|
||||||
${switch_to_style_struct("Effects")}
|
// Section 14 - Clipping, Masking and Compositing
|
||||||
|
${single_keyword("clip-rule", "nonzero evenodd",
|
||||||
|
products="gecko", gecko_constant_prefix="NS_STYLE_FILL_RULE")}
|
||||||
|
|
||||||
|
${new_style_struct("SVG", is_inherited=False, gecko_name="nsStyleSVGReset")}
|
||||||
|
|
||||||
|
${single_keyword("dominant-baseline",
|
||||||
|
"""auto use-script no-change reset-size ideographic alphabetic hanging
|
||||||
|
mathematical central middle text-after-edge text-before-edge""",
|
||||||
|
products="gecko")}
|
||||||
|
|
||||||
${single_keyword("vector-effect", "none non-scaling-stroke", products="gecko")}
|
${single_keyword("vector-effect", "none non-scaling-stroke", products="gecko")}
|
||||||
|
|
||||||
${switch_to_style_struct("SVG")}
|
// CSS Masking Module Level 1
|
||||||
|
// https://www.w3.org/TR/css-masking-1/
|
||||||
// Section 14 - Clipping, Masking and Compositing
|
${single_keyword("mask-type", "luminance alpha", products="gecko")}
|
||||||
${single_keyword("clip-rule", "nonzero evenodd", products="gecko")}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -6120,29 +6149,30 @@ impl PropertyDeclaration {
|
||||||
pub fn name(&self) -> PropertyDeclarationName {
|
pub fn name(&self) -> PropertyDeclarationName {
|
||||||
match *self {
|
match *self {
|
||||||
% for property in LONGHANDS:
|
% for property in LONGHANDS:
|
||||||
|
PropertyDeclaration::${property.camel_case}(..) =>
|
||||||
% if property.derived_from is None:
|
% if property.derived_from is None:
|
||||||
PropertyDeclaration::${property.camel_case}(..) => {
|
PropertyDeclarationName::Longhand("${property.name}"),
|
||||||
PropertyDeclarationName::Longhand("${property.name}")
|
% else:
|
||||||
}
|
PropertyDeclarationName::Internal,
|
||||||
% endif
|
% endif
|
||||||
% endfor
|
% endfor
|
||||||
PropertyDeclaration::Custom(ref name, _) => {
|
PropertyDeclaration::Custom(ref name, _) => {
|
||||||
PropertyDeclarationName::Custom(name.clone())
|
PropertyDeclarationName::Custom(name.clone())
|
||||||
}
|
}
|
||||||
_ => PropertyDeclarationName::Internal,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn value(&self) -> String {
|
pub fn value(&self) -> String {
|
||||||
match *self {
|
match *self {
|
||||||
% for property in LONGHANDS:
|
% for property in LONGHANDS:
|
||||||
|
PropertyDeclaration::${property.camel_case}
|
||||||
% if property.derived_from is None:
|
% if property.derived_from is None:
|
||||||
PropertyDeclaration::${property.camel_case}(ref value) =>
|
(ref value) => value.to_css_string(),
|
||||||
value.to_css_string(),
|
% else:
|
||||||
|
(_) => panic!("unsupported property declaration: ${property.name}"),
|
||||||
% endif
|
% endif
|
||||||
% endfor
|
% endfor
|
||||||
PropertyDeclaration::Custom(_, ref value) => value.to_css_string(),
|
PropertyDeclaration::Custom(_, ref value) => value.to_css_string(),
|
||||||
ref decl => panic!("unsupported property declaration: {}", decl.name()),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6184,16 +6214,16 @@ impl PropertyDeclaration {
|
||||||
pub fn matches(&self, name: &str) -> bool {
|
pub fn matches(&self, name: &str) -> bool {
|
||||||
match *self {
|
match *self {
|
||||||
% for property in LONGHANDS:
|
% for property in LONGHANDS:
|
||||||
|
PropertyDeclaration::${property.camel_case}(..) =>
|
||||||
% if property.derived_from is None:
|
% if property.derived_from is None:
|
||||||
PropertyDeclaration::${property.camel_case}(..) => {
|
name.eq_ignore_ascii_case("${property.name}"),
|
||||||
name.eq_ignore_ascii_case("${property.name}")
|
% else:
|
||||||
}
|
false,
|
||||||
% endif
|
% endif
|
||||||
% endfor
|
% endfor
|
||||||
PropertyDeclaration::Custom(ref declaration_name, _) => {
|
PropertyDeclaration::Custom(ref declaration_name, _) => {
|
||||||
::custom_properties::parse_name(name) == Ok(&**declaration_name)
|
::custom_properties::parse_name(name) == Ok(&**declaration_name)
|
||||||
}
|
}
|
||||||
_ => false,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6404,7 +6434,7 @@ pub mod style_structs {
|
||||||
fn clone_text_orientation(&self) -> longhands::text_orientation::computed_value::T {
|
fn clone_text_orientation(&self) -> longhands::text_orientation::computed_value::T {
|
||||||
self.text_orientation.clone()
|
self.text_orientation.clone()
|
||||||
}
|
}
|
||||||
% elif style_struct.trait_name == "InheritedText":
|
% elif style_struct.trait_name == "InheritedText" and CONFIG["product"] == "servo":
|
||||||
fn clone__servo_text_decorations_in_effect(&self) ->
|
fn clone__servo_text_decorations_in_effect(&self) ->
|
||||||
longhands::_servo_text_decorations_in_effect::computed_value::T {
|
longhands::_servo_text_decorations_in_effect::computed_value::T {
|
||||||
self._servo_text_decorations_in_effect.clone()
|
self._servo_text_decorations_in_effect.clone()
|
||||||
|
@ -7091,11 +7121,13 @@ pub fn cascade<C: ComputedValues>(
|
||||||
if let Some(computed_display) = computed_display {
|
if let Some(computed_display) = computed_display {
|
||||||
let box_ = style.mutate_box();
|
let box_ = style.mutate_box();
|
||||||
box_.set_display(computed_display);
|
box_.set_display(computed_display);
|
||||||
|
% if CONFIG["product"] == "servo":
|
||||||
box_.set__servo_display_for_hypothetical_box(if is_root_element {
|
box_.set__servo_display_for_hypothetical_box(if is_root_element {
|
||||||
computed_display
|
computed_display
|
||||||
} else {
|
} else {
|
||||||
specified_display
|
specified_display
|
||||||
});
|
});
|
||||||
|
% endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,24 +1,10 @@
|
||||||
/* automatically generated by rust-bindgen */
|
/* automatically generated by rust-bindgen */
|
||||||
|
|
||||||
pub enum nsIAtom { }
|
|
||||||
pub enum nsINode { }
|
|
||||||
pub type RawGeckoNode = nsINode;
|
|
||||||
pub enum Element { }
|
|
||||||
pub type RawGeckoElement = Element;
|
|
||||||
pub enum nsIDocument { }
|
|
||||||
pub type RawGeckoDocument = nsIDocument;
|
|
||||||
pub enum ServoNodeData { }
|
|
||||||
pub enum ServoComputedValues { }
|
|
||||||
pub enum RawServoStyleSheet { }
|
|
||||||
pub enum RawServoStyleSet { }
|
|
||||||
|
|
||||||
// Temporary manual hack. This will be fixed soon in bindgen.
|
|
||||||
use gecko_style_structs::nsStyleFont;
|
use gecko_style_structs::nsStyleFont;
|
||||||
use gecko_style_structs::nsStyleColor;
|
use gecko_style_structs::nsStyleColor;
|
||||||
use gecko_style_structs::nsStyleList;
|
use gecko_style_structs::nsStyleList;
|
||||||
use gecko_style_structs::nsStyleText;
|
use gecko_style_structs::nsStyleText;
|
||||||
use gecko_style_structs::nsStyleVisibility;
|
use gecko_style_structs::nsStyleVisibility;
|
||||||
use gecko_style_structs::nsStyleQuotes;
|
|
||||||
use gecko_style_structs::nsStyleUserInterface;
|
use gecko_style_structs::nsStyleUserInterface;
|
||||||
use gecko_style_structs::nsStyleTableBorder;
|
use gecko_style_structs::nsStyleTableBorder;
|
||||||
use gecko_style_structs::nsStyleSVG;
|
use gecko_style_structs::nsStyleSVG;
|
||||||
|
@ -37,7 +23,20 @@ use gecko_style_structs::nsStyleOutline;
|
||||||
use gecko_style_structs::nsStyleXUL;
|
use gecko_style_structs::nsStyleXUL;
|
||||||
use gecko_style_structs::nsStyleSVGReset;
|
use gecko_style_structs::nsStyleSVGReset;
|
||||||
use gecko_style_structs::nsStyleColumn;
|
use gecko_style_structs::nsStyleColumn;
|
||||||
|
use gecko_style_structs::nsStyleEffects;
|
||||||
|
|
||||||
|
|
||||||
|
pub enum nsIAtom { }
|
||||||
|
pub enum nsINode { }
|
||||||
|
pub type RawGeckoNode = nsINode;
|
||||||
|
pub enum Element { }
|
||||||
|
pub type RawGeckoElement = Element;
|
||||||
|
pub enum nsIDocument { }
|
||||||
|
pub type RawGeckoDocument = nsIDocument;
|
||||||
|
pub enum ServoNodeData { }
|
||||||
|
pub enum ServoComputedValues { }
|
||||||
|
pub enum RawServoStyleSheet { }
|
||||||
|
pub enum RawServoStyleSet { }
|
||||||
extern "C" {
|
extern "C" {
|
||||||
pub fn Gecko_ChildrenCount(node: *mut RawGeckoNode) -> u32;
|
pub fn Gecko_ChildrenCount(node: *mut RawGeckoNode) -> u32;
|
||||||
pub fn Gecko_NodeIsElement(node: *mut RawGeckoNode) -> bool;
|
pub fn Gecko_NodeIsElement(node: *mut RawGeckoNode) -> bool;
|
||||||
|
@ -121,10 +120,6 @@ extern "C" {
|
||||||
other:
|
other:
|
||||||
*const nsStyleVisibility);
|
*const nsStyleVisibility);
|
||||||
pub fn Gecko_Destroy_nsStyleVisibility(ptr: *mut nsStyleVisibility);
|
pub fn Gecko_Destroy_nsStyleVisibility(ptr: *mut nsStyleVisibility);
|
||||||
pub fn Gecko_Construct_nsStyleQuotes(ptr: *mut nsStyleQuotes);
|
|
||||||
pub fn Gecko_CopyConstruct_nsStyleQuotes(ptr: *mut nsStyleQuotes,
|
|
||||||
other: *const nsStyleQuotes);
|
|
||||||
pub fn Gecko_Destroy_nsStyleQuotes(ptr: *mut nsStyleQuotes);
|
|
||||||
pub fn Gecko_Construct_nsStyleUserInterface(ptr:
|
pub fn Gecko_Construct_nsStyleUserInterface(ptr:
|
||||||
*mut nsStyleUserInterface);
|
*mut nsStyleUserInterface);
|
||||||
pub fn Gecko_CopyConstruct_nsStyleUserInterface(ptr:
|
pub fn Gecko_CopyConstruct_nsStyleUserInterface(ptr:
|
||||||
|
@ -205,4 +200,8 @@ extern "C" {
|
||||||
pub fn Gecko_CopyConstruct_nsStyleColumn(ptr: *mut nsStyleColumn,
|
pub fn Gecko_CopyConstruct_nsStyleColumn(ptr: *mut nsStyleColumn,
|
||||||
other: *const nsStyleColumn);
|
other: *const nsStyleColumn);
|
||||||
pub fn Gecko_Destroy_nsStyleColumn(ptr: *mut nsStyleColumn);
|
pub fn Gecko_Destroy_nsStyleColumn(ptr: *mut nsStyleColumn);
|
||||||
|
pub fn Gecko_Construct_nsStyleEffects(ptr: *mut nsStyleEffects);
|
||||||
|
pub fn Gecko_CopyConstruct_nsStyleEffects(ptr: *mut nsStyleEffects,
|
||||||
|
other: *const nsStyleEffects);
|
||||||
|
pub fn Gecko_Destroy_nsStyleEffects(ptr: *mut nsStyleEffects);
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,8 @@ try:
|
||||||
style_template.render(PRODUCT='gecko')
|
style_template.render(PRODUCT='gecko')
|
||||||
|
|
||||||
geckolib_template = Template(filename=os.environ['GECKOLIB_TEMPLATE'], input_encoding='utf8')
|
geckolib_template = Template(filename=os.environ['GECKOLIB_TEMPLATE'], input_encoding='utf8')
|
||||||
output = geckolib_template.render(STYLE_STRUCTS = style_template.module.STYLE_STRUCTS)
|
output = geckolib_template.render(STYLE_STRUCTS = style_template.module.STYLE_STRUCTS,
|
||||||
|
to_rust_ident = style_template.module.to_rust_ident)
|
||||||
print(output.encode('utf8'))
|
print(output.encode('utf8'))
|
||||||
except:
|
except:
|
||||||
sys.stderr.write(exceptions.text_error_template().render().encode('utf8'))
|
sys.stderr.write(exceptions.text_error_template().render().encode('utf8'))
|
||||||
|
|
|
@ -1314,7 +1314,6 @@ pub enum nsresult {
|
||||||
NS_ERROR_SIGNED_APP_MANIFEST_INVALID = -2140471295,
|
NS_ERROR_SIGNED_APP_MANIFEST_INVALID = -2140471295,
|
||||||
NS_ERROR_DOM_ANIM_MISSING_PROPS_ERR = -2140405759,
|
NS_ERROR_DOM_ANIM_MISSING_PROPS_ERR = -2140405759,
|
||||||
NS_ERROR_DOM_ANIM_NO_TARGET_ERR = -2140405758,
|
NS_ERROR_DOM_ANIM_NO_TARGET_ERR = -2140405758,
|
||||||
NS_ERROR_DOM_ANIM_TARGET_NOT_IN_DOC_ERR = -2140405757,
|
|
||||||
NS_ERROR_DOM_PUSH_INVALID_REGISTRATION_ERR = -2140340223,
|
NS_ERROR_DOM_PUSH_INVALID_REGISTRATION_ERR = -2140340223,
|
||||||
NS_ERROR_DOM_PUSH_DENIED_ERR = -2140340222,
|
NS_ERROR_DOM_PUSH_DENIED_ERR = -2140340222,
|
||||||
NS_ERROR_DOM_PUSH_ABORT_ERR = -2140340221,
|
NS_ERROR_DOM_PUSH_ABORT_ERR = -2140340221,
|
||||||
|
@ -1529,6 +1528,8 @@ fn bindgen_test_layout_nsAutoString() {
|
||||||
assert_eq!(::std::mem::size_of::<nsAutoString>() , 160usize);
|
assert_eq!(::std::mem::size_of::<nsAutoString>() , 160usize);
|
||||||
assert_eq!(::std::mem::align_of::<nsAutoString>() , 8usize);
|
assert_eq!(::std::mem::align_of::<nsAutoString>() , 8usize);
|
||||||
}
|
}
|
||||||
|
pub enum Dont_Instantiate_nsTArray_of { }
|
||||||
|
pub enum Instead_Use_nsTArray_of { }
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Copy, Clone, Debug)]
|
#[derive(Copy, Clone, Debug)]
|
||||||
pub struct nsTArrayElementTraits<> {
|
pub struct nsTArrayElementTraits<> {
|
||||||
|
@ -1887,6 +1888,7 @@ pub type nsCID = nsID;
|
||||||
* interface.
|
* interface.
|
||||||
*/
|
*/
|
||||||
pub type nsIID = nsID;
|
pub type nsIID = nsID;
|
||||||
|
pub enum COMTypeInfo { }
|
||||||
/**
|
/**
|
||||||
* Basic component object model interface. Objects which implement
|
* Basic component object model interface. Objects which implement
|
||||||
* this interface support runtime interface discovery (QueryInterface)
|
* this interface support runtime interface discovery (QueryInterface)
|
||||||
|
@ -1998,6 +2000,19 @@ pub struct RefPtr<T> {
|
||||||
}
|
}
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Copy, Clone, Debug)]
|
#[derive(Copy, Clone, Debug)]
|
||||||
|
pub struct RefPtr_Proxy<T, R, Args> {
|
||||||
|
pub mRawPtr: *mut T,
|
||||||
|
pub _phantom0: ::std::marker::PhantomData<R>,
|
||||||
|
pub _phantom1: ::std::marker::PhantomData<Args>,
|
||||||
|
}
|
||||||
|
#[repr(C)]
|
||||||
|
#[derive(Copy, Clone, Debug)]
|
||||||
|
pub struct RefPtr_ConstRemovingRefPtrTraits<T, U> {
|
||||||
|
pub _phantom0: ::std::marker::PhantomData<T>,
|
||||||
|
pub _phantom1: ::std::marker::PhantomData<U>,
|
||||||
|
}
|
||||||
|
#[repr(C)]
|
||||||
|
#[derive(Copy, Clone, Debug)]
|
||||||
pub struct RefPtrGetterAddRefs<T> {
|
pub struct RefPtrGetterAddRefs<T> {
|
||||||
pub mTargetSmartPtr: *mut RefPtr<T>,
|
pub mTargetSmartPtr: *mut RefPtr<T>,
|
||||||
pub _phantom0: ::std::marker::PhantomData<T>,
|
pub _phantom0: ::std::marker::PhantomData<T>,
|
||||||
|
@ -2145,6 +2160,13 @@ pub struct nsAutoPtr_Ptr<T> {
|
||||||
}
|
}
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Copy, Clone, Debug)]
|
#[derive(Copy, Clone, Debug)]
|
||||||
|
pub struct nsAutoPtr_Proxy<T, R, Args> {
|
||||||
|
pub mRawPtr: *mut T,
|
||||||
|
pub _phantom0: ::std::marker::PhantomData<R>,
|
||||||
|
pub _phantom1: ::std::marker::PhantomData<Args>,
|
||||||
|
}
|
||||||
|
#[repr(C)]
|
||||||
|
#[derive(Copy, Clone, Debug)]
|
||||||
pub struct nsAutoPtrGetterTransfers<T> {
|
pub struct nsAutoPtrGetterTransfers<T> {
|
||||||
pub mTargetSmartPtr: *mut nsAutoPtr<T>,
|
pub mTargetSmartPtr: *mut nsAutoPtr<T>,
|
||||||
pub _phantom0: ::std::marker::PhantomData<T>,
|
pub _phantom0: ::std::marker::PhantomData<T>,
|
||||||
|
@ -4176,7 +4198,6 @@ fn bindgen_test_layout_nsCSSShadowArray() {
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
pub struct nsStyleBorder {
|
pub struct nsStyleBorder {
|
||||||
pub mBorderColors: *mut *mut nsBorderColors,
|
pub mBorderColors: *mut *mut nsBorderColors,
|
||||||
pub mBoxShadow: RefPtr<nsCSSShadowArray>,
|
|
||||||
pub mBorderRadius: nsStyleCorners,
|
pub mBorderRadius: nsStyleCorners,
|
||||||
pub mBorderImageSource: nsStyleImage,
|
pub mBorderImageSource: nsStyleImage,
|
||||||
pub mBorderImageSlice: nsStyleSides,
|
pub mBorderImageSlice: nsStyleSides,
|
||||||
|
@ -4195,7 +4216,7 @@ pub struct nsStyleBorder {
|
||||||
}
|
}
|
||||||
#[test]
|
#[test]
|
||||||
fn bindgen_test_layout_nsStyleBorder() {
|
fn bindgen_test_layout_nsStyleBorder() {
|
||||||
assert_eq!(::std::mem::size_of::<nsStyleBorder>() , 312usize);
|
assert_eq!(::std::mem::size_of::<nsStyleBorder>() , 304usize);
|
||||||
assert_eq!(::std::mem::align_of::<nsStyleBorder>() , 8usize);
|
assert_eq!(::std::mem::align_of::<nsStyleBorder>() , 8usize);
|
||||||
}
|
}
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
|
@ -4214,17 +4235,34 @@ fn bindgen_test_layout_nsStyleOutline() {
|
||||||
assert_eq!(::std::mem::size_of::<nsStyleOutline>() , 112usize);
|
assert_eq!(::std::mem::size_of::<nsStyleOutline>() , 112usize);
|
||||||
assert_eq!(::std::mem::align_of::<nsStyleOutline>() , 8usize);
|
assert_eq!(::std::mem::align_of::<nsStyleOutline>() , 8usize);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* An object that allows sharing of arrays that store 'quotes' property
|
||||||
|
* values. This is particularly important for inheritance, where we want
|
||||||
|
* to share the same 'quotes' value with a parent style context.
|
||||||
|
*/
|
||||||
|
#[repr(C)]
|
||||||
|
pub struct nsStyleQuoteValues {
|
||||||
|
pub mRefCnt: nsAutoRefCnt,
|
||||||
|
pub _mOwningThread: nsAutoOwningThread,
|
||||||
|
pub mQuotePairs: u64,
|
||||||
|
}
|
||||||
|
#[test]
|
||||||
|
fn bindgen_test_layout_nsStyleQuoteValues() {
|
||||||
|
assert_eq!(::std::mem::size_of::<nsStyleQuoteValues>() , 24usize);
|
||||||
|
assert_eq!(::std::mem::align_of::<nsStyleQuoteValues>() , 8usize);
|
||||||
|
}
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
pub struct nsStyleList {
|
pub struct nsStyleList {
|
||||||
pub mListStylePosition: u8,
|
pub mListStylePosition: u8,
|
||||||
pub mListStyleType: nsString,
|
pub mListStyleType: nsString,
|
||||||
pub mCounterStyle: RefPtr<CounterStyle>,
|
pub mCounterStyle: RefPtr<CounterStyle>,
|
||||||
pub mListStyleImage: RefPtr<imgRequestProxy>,
|
pub mListStyleImage: RefPtr<imgRequestProxy>,
|
||||||
|
pub mQuotes: RefPtr<nsStyleQuoteValues>,
|
||||||
pub mImageRegion: nsRect,
|
pub mImageRegion: nsRect,
|
||||||
}
|
}
|
||||||
#[test]
|
#[test]
|
||||||
fn bindgen_test_layout_nsStyleList() {
|
fn bindgen_test_layout_nsStyleList() {
|
||||||
assert_eq!(::std::mem::size_of::<nsStyleList>() , 56usize);
|
assert_eq!(::std::mem::size_of::<nsStyleList>() , 64usize);
|
||||||
assert_eq!(::std::mem::align_of::<nsStyleList>() , 8usize);
|
assert_eq!(::std::mem::align_of::<nsStyleList>() , 8usize);
|
||||||
}
|
}
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
|
@ -4321,7 +4359,6 @@ fn bindgen_test_layout_nsStyleTextOverflow() {
|
||||||
}
|
}
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
pub struct nsStyleTextReset {
|
pub struct nsStyleTextReset {
|
||||||
pub mVerticalAlign: nsStyleCoord,
|
|
||||||
pub mTextOverflow: nsStyleTextOverflow,
|
pub mTextOverflow: nsStyleTextOverflow,
|
||||||
pub mTextDecorationLine: u8,
|
pub mTextDecorationLine: u8,
|
||||||
pub mUnicodeBidi: u8,
|
pub mUnicodeBidi: u8,
|
||||||
|
@ -4330,7 +4367,7 @@ pub struct nsStyleTextReset {
|
||||||
}
|
}
|
||||||
#[test]
|
#[test]
|
||||||
fn bindgen_test_layout_nsStyleTextReset() {
|
fn bindgen_test_layout_nsStyleTextReset() {
|
||||||
assert_eq!(::std::mem::size_of::<nsStyleTextReset>() , 80usize);
|
assert_eq!(::std::mem::size_of::<nsStyleTextReset>() , 64usize);
|
||||||
assert_eq!(::std::mem::align_of::<nsStyleTextReset>() , 8usize);
|
assert_eq!(::std::mem::align_of::<nsStyleTextReset>() , 8usize);
|
||||||
}
|
}
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
|
@ -4350,6 +4387,7 @@ pub struct nsStyleText {
|
||||||
pub mControlCharacterVisibility: u8,
|
pub mControlCharacterVisibility: u8,
|
||||||
pub mTextEmphasisPosition: u8,
|
pub mTextEmphasisPosition: u8,
|
||||||
pub mTextEmphasisStyle: u8,
|
pub mTextEmphasisStyle: u8,
|
||||||
|
pub mTextRendering: u8,
|
||||||
pub mTabSize: i32,
|
pub mTabSize: i32,
|
||||||
pub mTextEmphasisColor: nscolor,
|
pub mTextEmphasisColor: nscolor,
|
||||||
pub mWebkitTextFillColor: nscolor,
|
pub mWebkitTextFillColor: nscolor,
|
||||||
|
@ -4398,7 +4436,7 @@ pub struct nsStyleVisibility {
|
||||||
pub mImageOrientation: nsStyleImageOrientation,
|
pub mImageOrientation: nsStyleImageOrientation,
|
||||||
pub mDirection: u8,
|
pub mDirection: u8,
|
||||||
pub mVisible: u8,
|
pub mVisible: u8,
|
||||||
pub mPointerEvents: u8,
|
pub mImageRendering: u8,
|
||||||
pub mWritingMode: u8,
|
pub mWritingMode: u8,
|
||||||
pub mTextOrientation: u8,
|
pub mTextOrientation: u8,
|
||||||
pub mColorAdjust: u8,
|
pub mColorAdjust: u8,
|
||||||
|
@ -4531,8 +4569,6 @@ fn bindgen_test_layout_StyleAnimation() {
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
pub struct nsStyleDisplay {
|
pub struct nsStyleDisplay {
|
||||||
pub mBinding: RefPtr<URLValue>,
|
pub mBinding: RefPtr<URLValue>,
|
||||||
pub mClip: nsRect,
|
|
||||||
pub mOpacity: f32,
|
|
||||||
pub mDisplay: u8,
|
pub mDisplay: u8,
|
||||||
pub mOriginalDisplay: u8,
|
pub mOriginalDisplay: u8,
|
||||||
pub mContain: u8,
|
pub mContain: u8,
|
||||||
|
@ -4548,9 +4584,7 @@ pub struct nsStyleDisplay {
|
||||||
pub mOverflowY: u8,
|
pub mOverflowY: u8,
|
||||||
pub mOverflowClipBox: u8,
|
pub mOverflowClipBox: u8,
|
||||||
pub mResize: u8,
|
pub mResize: u8,
|
||||||
pub mClipFlags: u8,
|
|
||||||
pub mOrient: u8,
|
pub mOrient: u8,
|
||||||
pub mMixBlendMode: u8,
|
|
||||||
pub mIsolation: u8,
|
pub mIsolation: u8,
|
||||||
pub mTopLayer: u8,
|
pub mTopLayer: u8,
|
||||||
pub mWillChangeBitField: u8,
|
pub mWillChangeBitField: u8,
|
||||||
|
@ -4570,6 +4604,7 @@ pub struct nsStyleDisplay {
|
||||||
pub mTransformOrigin: [nsStyleCoord; 3usize],
|
pub mTransformOrigin: [nsStyleCoord; 3usize],
|
||||||
pub mChildPerspective: nsStyleCoord,
|
pub mChildPerspective: nsStyleCoord,
|
||||||
pub mPerspectiveOrigin: [nsStyleCoord; 2usize],
|
pub mPerspectiveOrigin: [nsStyleCoord; 2usize],
|
||||||
|
pub mVerticalAlign: nsStyleCoord,
|
||||||
pub mTransitions: [u64; 7usize],
|
pub mTransitions: [u64; 7usize],
|
||||||
pub mTransitionTimingFunctionCount: u32,
|
pub mTransitionTimingFunctionCount: u32,
|
||||||
pub mTransitionDurationCount: u32,
|
pub mTransitionDurationCount: u32,
|
||||||
|
@ -4587,7 +4622,7 @@ pub struct nsStyleDisplay {
|
||||||
}
|
}
|
||||||
#[test]
|
#[test]
|
||||||
fn bindgen_test_layout_nsStyleDisplay() {
|
fn bindgen_test_layout_nsStyleDisplay() {
|
||||||
assert_eq!(::std::mem::size_of::<nsStyleDisplay>() , 456usize);
|
assert_eq!(::std::mem::size_of::<nsStyleDisplay>() , 448usize);
|
||||||
assert_eq!(::std::mem::align_of::<nsStyleDisplay>() , 8usize);
|
assert_eq!(::std::mem::align_of::<nsStyleDisplay>() , 8usize);
|
||||||
}
|
}
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
|
@ -4669,16 +4704,6 @@ fn bindgen_test_layout_nsStyleCounterData() {
|
||||||
assert_eq!(::std::mem::align_of::<nsStyleCounterData>() , 8usize);
|
assert_eq!(::std::mem::align_of::<nsStyleCounterData>() , 8usize);
|
||||||
}
|
}
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
pub struct nsStyleQuotes {
|
|
||||||
pub mQuotesCount: u32,
|
|
||||||
pub mQuotes: *mut nsString,
|
|
||||||
}
|
|
||||||
#[test]
|
|
||||||
fn bindgen_test_layout_nsStyleQuotes() {
|
|
||||||
assert_eq!(::std::mem::size_of::<nsStyleQuotes>() , 16usize);
|
|
||||||
assert_eq!(::std::mem::align_of::<nsStyleQuotes>() , 8usize);
|
|
||||||
}
|
|
||||||
#[repr(C)]
|
|
||||||
pub struct nsStyleContent {
|
pub struct nsStyleContent {
|
||||||
pub mMarkerOffset: nsStyleCoord,
|
pub mMarkerOffset: nsStyleCoord,
|
||||||
pub mContents: *mut nsStyleContentData,
|
pub mContents: *mut nsStyleContentData,
|
||||||
|
@ -4723,13 +4748,14 @@ pub struct nsStyleUserInterface {
|
||||||
pub mUserInput: u8,
|
pub mUserInput: u8,
|
||||||
pub mUserModify: u8,
|
pub mUserModify: u8,
|
||||||
pub mUserFocus: u8,
|
pub mUserFocus: u8,
|
||||||
|
pub mPointerEvents: u8,
|
||||||
pub mCursor: u8,
|
pub mCursor: u8,
|
||||||
pub mCursorArrayLength: u32,
|
pub mCursorArrayLength: u32,
|
||||||
pub mCursorArray: *mut nsCursorImage,
|
pub mCursorArray: *mut nsCursorImage,
|
||||||
}
|
}
|
||||||
#[test]
|
#[test]
|
||||||
fn bindgen_test_layout_nsStyleUserInterface() {
|
fn bindgen_test_layout_nsStyleUserInterface() {
|
||||||
assert_eq!(::std::mem::size_of::<nsStyleUserInterface>() , 16usize);
|
assert_eq!(::std::mem::size_of::<nsStyleUserInterface>() , 24usize);
|
||||||
assert_eq!(::std::mem::align_of::<nsStyleUserInterface>() , 8usize);
|
assert_eq!(::std::mem::align_of::<nsStyleUserInterface>() , 8usize);
|
||||||
}
|
}
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
|
@ -4827,13 +4853,11 @@ pub struct nsStyleSVG {
|
||||||
pub mColorInterpolation: u8,
|
pub mColorInterpolation: u8,
|
||||||
pub mColorInterpolationFilters: u8,
|
pub mColorInterpolationFilters: u8,
|
||||||
pub mFillRule: u8,
|
pub mFillRule: u8,
|
||||||
pub mImageRendering: u8,
|
|
||||||
pub mPaintOrder: u8,
|
pub mPaintOrder: u8,
|
||||||
pub mShapeRendering: u8,
|
pub mShapeRendering: u8,
|
||||||
pub mStrokeLinecap: u8,
|
pub mStrokeLinecap: u8,
|
||||||
pub mStrokeLinejoin: u8,
|
pub mStrokeLinejoin: u8,
|
||||||
pub mTextAnchor: u8,
|
pub mTextAnchor: u8,
|
||||||
pub mTextRendering: u8,
|
|
||||||
pub _bitfield_1: u8,
|
pub _bitfield_1: u8,
|
||||||
pub _bitfield_2: u8,
|
pub _bitfield_2: u8,
|
||||||
}
|
}
|
||||||
|
@ -4933,7 +4957,6 @@ impl ::std::clone::Clone for nsTArray_CopyChooser {
|
||||||
pub struct nsStyleSVGReset {
|
pub struct nsStyleSVGReset {
|
||||||
pub mMask: nsStyleImageLayers,
|
pub mMask: nsStyleImageLayers,
|
||||||
pub mClipPath: nsStyleClipPath,
|
pub mClipPath: nsStyleClipPath,
|
||||||
pub mFilters: u64,
|
|
||||||
pub mStopColor: nscolor,
|
pub mStopColor: nscolor,
|
||||||
pub mFloodColor: nscolor,
|
pub mFloodColor: nscolor,
|
||||||
pub mLightingColor: nscolor,
|
pub mLightingColor: nscolor,
|
||||||
|
@ -4945,7 +4968,7 @@ pub struct nsStyleSVGReset {
|
||||||
}
|
}
|
||||||
#[test]
|
#[test]
|
||||||
fn bindgen_test_layout_nsStyleSVGReset() {
|
fn bindgen_test_layout_nsStyleSVGReset() {
|
||||||
assert_eq!(::std::mem::size_of::<nsStyleSVGReset>() , 224usize);
|
assert_eq!(::std::mem::size_of::<nsStyleSVGReset>() , 216usize);
|
||||||
assert_eq!(::std::mem::align_of::<nsStyleSVGReset>() , 8usize);
|
assert_eq!(::std::mem::align_of::<nsStyleSVGReset>() , 8usize);
|
||||||
}
|
}
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
|
@ -4957,3 +4980,17 @@ fn bindgen_test_layout_nsStyleVariables() {
|
||||||
assert_eq!(::std::mem::size_of::<nsStyleVariables>() , 56usize);
|
assert_eq!(::std::mem::size_of::<nsStyleVariables>() , 56usize);
|
||||||
assert_eq!(::std::mem::align_of::<nsStyleVariables>() , 8usize);
|
assert_eq!(::std::mem::align_of::<nsStyleVariables>() , 8usize);
|
||||||
}
|
}
|
||||||
|
#[repr(C)]
|
||||||
|
pub struct nsStyleEffects {
|
||||||
|
pub mFilters: u64,
|
||||||
|
pub mBoxShadow: RefPtr<nsCSSShadowArray>,
|
||||||
|
pub mClip: nsRect,
|
||||||
|
pub mOpacity: f32,
|
||||||
|
pub mClipFlags: u8,
|
||||||
|
pub mMixBlendMode: u8,
|
||||||
|
}
|
||||||
|
#[test]
|
||||||
|
fn bindgen_test_layout_nsStyleEffects() {
|
||||||
|
assert_eq!(::std::mem::size_of::<nsStyleEffects>() , 40usize);
|
||||||
|
assert_eq!(::std::mem::align_of::<nsStyleEffects>() , 8usize);
|
||||||
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@ use bindings::Gecko_CopyConstruct_${style_struct.gecko_ffi_name};
|
||||||
use bindings::Gecko_Destroy_${style_struct.gecko_ffi_name};
|
use bindings::Gecko_Destroy_${style_struct.gecko_ffi_name};
|
||||||
% endif
|
% endif
|
||||||
% endfor
|
% endfor
|
||||||
|
use gecko_style_structs;
|
||||||
use heapsize::HeapSizeOf;
|
use heapsize::HeapSizeOf;
|
||||||
use std::fmt::{self, Debug};
|
use std::fmt::{self, Debug};
|
||||||
use std::mem::zeroed;
|
use std::mem::zeroed;
|
||||||
|
@ -110,7 +111,6 @@ pub struct ${style_struct.gecko_struct_name};
|
||||||
impl ${style_struct.gecko_struct_name} {
|
impl ${style_struct.gecko_struct_name} {
|
||||||
#[allow(dead_code, unused_variables)]
|
#[allow(dead_code, unused_variables)]
|
||||||
fn initial() -> Arc<Self> {
|
fn initial() -> Arc<Self> {
|
||||||
% if style_struct.gecko_ffi_name:
|
|
||||||
// Some Gecko style structs have AutoTArray members, which have internal pointers and are
|
// Some Gecko style structs have AutoTArray members, which have internal pointers and are
|
||||||
// thus MOZ_NON_MEMMOVABLE. Since Rust is generally a very move-happy language, we need to
|
// thus MOZ_NON_MEMMOVABLE. Since Rust is generally a very move-happy language, we need to
|
||||||
// be very careful that nsStyle* structs are never moved after they are constructed.
|
// be very careful that nsStyle* structs are never moved after they are constructed.
|
||||||
|
@ -127,9 +127,6 @@ impl ${style_struct.gecko_struct_name} {
|
||||||
Gecko_Construct_${style_struct.gecko_ffi_name}(&mut Arc::make_mut(&mut result).gecko);
|
Gecko_Construct_${style_struct.gecko_ffi_name}(&mut Arc::make_mut(&mut result).gecko);
|
||||||
}
|
}
|
||||||
result
|
result
|
||||||
% else:
|
|
||||||
Arc::new(${style_struct.gecko_struct_name})
|
|
||||||
% endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
%if style_struct.gecko_ffi_name:
|
%if style_struct.gecko_ffi_name:
|
||||||
|
@ -165,6 +162,37 @@ impl Debug for ${style_struct.gecko_ffi_name} {
|
||||||
</%def>
|
</%def>
|
||||||
|
|
||||||
<%def name="raw_impl_trait(style_struct, skip_longhands=None, skip_additionals=None)">
|
<%def name="raw_impl_trait(style_struct, skip_longhands=None, skip_additionals=None)">
|
||||||
|
<%
|
||||||
|
longhands = [x for x in style_struct.longhands
|
||||||
|
if not (skip_longhands and x.name in skip_longhands)]
|
||||||
|
|
||||||
|
#
|
||||||
|
# Make a list of types we can't auto-generate.
|
||||||
|
#
|
||||||
|
force_stub = [];
|
||||||
|
# These are currently being shuffled to a different style struct on the gecko side.
|
||||||
|
force_stub += ["backface-visibility", "transform-box", "transform-style"]
|
||||||
|
# These live in nsStyleImageLayers in gecko. Need to figure out what to do about that.
|
||||||
|
force_stub += ["background-repeat", "background-attachment", "background-clip", "background-origin"];
|
||||||
|
# These live in an nsFont member in Gecko. Should be straightforward to do manually.
|
||||||
|
force_stub += ["font-kerning", "font-stretch", "font-style", "font-variant"]
|
||||||
|
# These have unusual representations in gecko.
|
||||||
|
force_stub += ["list-style-type", "text-overflow"]
|
||||||
|
# Enum class instead of NS_STYLE_...
|
||||||
|
force_stub += ["box-sizing"]
|
||||||
|
# Inconsistent constant naming in gecko
|
||||||
|
force_stub += ["unicode-bidi"]
|
||||||
|
# Need to figure out why servo has sideways-left computed value and gecko doesn't
|
||||||
|
force_stub += ["text-orientation"]
|
||||||
|
# Automatic mapping generates NS_STYLE_TEXT_DECORATION_STYLE__MOZ_NONE instead of
|
||||||
|
# NS_STYLE_TEXT_DECORATION_STYLE__NONE
|
||||||
|
force_stub += ["text-decoration-style"]
|
||||||
|
# These are booleans.
|
||||||
|
force_stub += ["page-break-after", "page-break-before"]
|
||||||
|
|
||||||
|
keyword_longhands = [x for x in longhands if x.keyword and not x.name in force_stub]
|
||||||
|
stub_longhands = [x for x in longhands if x not in keyword_longhands]
|
||||||
|
%>
|
||||||
impl ${style_struct.trait_name} for ${style_struct.gecko_struct_name} {
|
impl ${style_struct.trait_name} for ${style_struct.gecko_struct_name} {
|
||||||
/*
|
/*
|
||||||
* Manually-Implemented Methods.
|
* Manually-Implemented Methods.
|
||||||
|
@ -174,9 +202,26 @@ impl ${style_struct.trait_name} for ${style_struct.gecko_struct_name} {
|
||||||
/*
|
/*
|
||||||
* Auto-Generated Methods.
|
* Auto-Generated Methods.
|
||||||
*/
|
*/
|
||||||
<% longhands = [x for x in style_struct.longhands
|
% for longhand in keyword_longhands:
|
||||||
if not (skip_longhands and x.name in skip_longhands)] %>
|
fn set_${longhand.ident}(&mut self, v: longhands::${longhand.ident}::computed_value::T) {
|
||||||
% for longhand in longhands:
|
use gecko_style_structs as gss;
|
||||||
|
use style::properties::longhands::${longhand.ident}::computed_value::T as Keyword;
|
||||||
|
// FIXME(bholley): Align binary representations and ditch |match| for cast + static_asserts
|
||||||
|
self.gecko.${longhand.gecko_ffi_name} = match v {
|
||||||
|
% for value in longhand.keyword.values_for('gecko'):
|
||||||
|
Keyword::${to_rust_ident(value)} => gss::${longhand.keyword.gecko_constant(value)} as u8,
|
||||||
|
% endfor
|
||||||
|
};
|
||||||
|
}
|
||||||
|
fn copy_${longhand.ident}_from(&mut self, other: &Self) {
|
||||||
|
self.gecko.${longhand.gecko_ffi_name} = other.gecko.${longhand.gecko_ffi_name};
|
||||||
|
}
|
||||||
|
% endfor
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Stubs.
|
||||||
|
*/
|
||||||
|
% for longhand in stub_longhands:
|
||||||
fn set_${longhand.ident}(&mut self, _: longhands::${longhand.ident}::computed_value::T) {
|
fn set_${longhand.ident}(&mut self, _: longhands::${longhand.ident}::computed_value::T) {
|
||||||
unimplemented!()
|
unimplemented!()
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,18 +20,34 @@ export DYLD_LIBRARY_PATH="$(pwd)/llvm/build/Release+Asserts/lib"
|
||||||
export LD_LIBRARY_PATH="$(pwd)/llvm/build/Release+Asserts/lib"
|
export LD_LIBRARY_PATH="$(pwd)/llvm/build/Release+Asserts/lib"
|
||||||
export DIST_INCLUDE="$1/dist/include"
|
export DIST_INCLUDE="$1/dist/include"
|
||||||
|
|
||||||
|
# Prevent bindgen from generating opaque types for the gecko style structs.
|
||||||
|
export MAP_GECKO_STRUCTS=""
|
||||||
|
for STRUCT in nsStyleFont nsStyleColor nsStyleList nsStyleText \
|
||||||
|
nsStyleVisibility nsStyleUserInterface nsStyleTableBorder \
|
||||||
|
nsStyleSVG nsStyleVariables nsStyleBackground nsStylePosition \
|
||||||
|
nsStyleTextReset nsStyleDisplay nsStyleContent nsStyleUIReset \
|
||||||
|
nsStyleTable nsStyleMargin nsStylePadding nsStyleBorder \
|
||||||
|
nsStyleOutline nsStyleXUL nsStyleSVGReset nsStyleColumn nsStyleEffects
|
||||||
|
do
|
||||||
|
MAP_GECKO_STRUCTS=$MAP_GECKO_STRUCTS"-blacklist-type $STRUCT "
|
||||||
|
MAP_GECKO_STRUCTS=$MAP_GECKO_STRUCTS"-raw-line 'use gecko_style_structs::$STRUCT;'$'\n' "
|
||||||
|
done
|
||||||
|
|
||||||
# Check for the include directory.
|
# Check for the include directory.
|
||||||
if [ ! -d "$DIST_INCLUDE" ]; then
|
if [ ! -d "$DIST_INCLUDE" ]; then
|
||||||
echo "$DIST_INCLUDE: directory not found"
|
echo "$DIST_INCLUDE: directory not found"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# We need to use 'eval' here to make MAP_GECKO_STRUCTS evaluate properly as
|
||||||
|
# multiple arguments.
|
||||||
|
#
|
||||||
# Uncomment the following line to run rust-bindgen in a debugger on mac.
|
# Uncomment the following line to run rust-bindgen in a debugger on mac.
|
||||||
# The absolute path is required to allow launching lldb with an untrusted
|
# The absolute path is required to allow launching lldb with an untrusted
|
||||||
# library in DYLD_LIBRARY_PATH.
|
# library in DYLD_LIBRARY_PATH.
|
||||||
#
|
#
|
||||||
# /Applications/Xcode.app/Contents/Developer/usr/bin/lldb --
|
# /Applications/Xcode.app/Contents/Developer/usr/bin/lldb --
|
||||||
./rust-bindgen/target/debug/bindgen \
|
eval ./rust-bindgen/target/debug/bindgen \
|
||||||
-x c++ -std=gnu++0x \
|
-x c++ -std=gnu++0x \
|
||||||
"-I$DIST_INCLUDE" \
|
"-I$DIST_INCLUDE" \
|
||||||
-o ../bindings.rs \
|
-o ../bindings.rs \
|
||||||
|
@ -39,3 +55,4 @@ fi
|
||||||
"$DIST_INCLUDE/mozilla/ServoBindings.h" \
|
"$DIST_INCLUDE/mozilla/ServoBindings.h" \
|
||||||
-match "ServoBindings.h" \
|
-match "ServoBindings.h" \
|
||||||
-match "nsStyleStructList.h" \
|
-match "nsStyleStructList.h" \
|
||||||
|
$MAP_GECKO_STRUCTS
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue