Stop cascading servo-internal properties in geckolib builds.

This commit is contained in:
Bobby Holley 2016-04-13 16:42:27 -07:00
parent e12ee065dc
commit 873bd82fff

View file

@ -549,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
@ -606,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,
@ -616,6 +617,8 @@ 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")}
@ -641,7 +644,7 @@ pub mod longhands {
${single_keyword("clear", "none left right both", gecko_ffi_name="mBreakType")} ${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};
@ -744,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;
@ -2278,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;
@ -2353,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,
@ -2362,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",
@ -2370,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;
@ -6143,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()),
} }
} }
@ -6207,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,
} }
} }
@ -6427,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()
@ -7114,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
} }
} }