mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Stop cascading servo-internal properties in geckolib builds.
This commit is contained in:
parent
e12ee065dc
commit
873bd82fff
1 changed files with 51 additions and 42 deletions
|
@ -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,16 +606,19 @@ pub mod longhands {
|
||||||
|
|
||||||
impl ComputedValueAsSpecified for SpecifiedValue {}
|
impl ComputedValueAsSpecified for SpecifiedValue {}
|
||||||
|
|
||||||
fn cascade_property_custom<C: ComputedValues>(
|
% if CONFIG["product"] == "servo":
|
||||||
_declaration: &PropertyDeclaration,
|
fn cascade_property_custom<C: ComputedValues>(
|
||||||
_inherited_style: &C,
|
_declaration: &PropertyDeclaration,
|
||||||
context: &mut computed::Context<C>,
|
_inherited_style: &C,
|
||||||
_seen: &mut PropertyBitField,
|
context: &mut computed::Context<C>,
|
||||||
_cacheable: &mut bool,
|
_seen: &mut PropertyBitField,
|
||||||
_error_reporter: &mut StdBox<ParseErrorReporter + Send>) {
|
_cacheable: &mut bool,
|
||||||
longhands::_servo_display_for_hypothetical_box::derive_from_display(context);
|
_error_reporter: &mut StdBox<ParseErrorReporter + Send>) {
|
||||||
longhands::_servo_text_decorations_in_effect::derive_from_display(context);
|
longhands::_servo_display_for_hypothetical_box::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,15 +2357,17 @@ pub mod longhands {
|
||||||
if !empty { Ok(result) } else { Err(()) }
|
if !empty { Ok(result) } else { Err(()) }
|
||||||
}
|
}
|
||||||
|
|
||||||
fn cascade_property_custom<C: ComputedValues>(
|
% if CONFIG["product"] == "servo":
|
||||||
_declaration: &PropertyDeclaration,
|
fn cascade_property_custom<C: ComputedValues>(
|
||||||
_inherited_style: &C,
|
_declaration: &PropertyDeclaration,
|
||||||
context: &mut computed::Context<C>,
|
_inherited_style: &C,
|
||||||
_seen: &mut PropertyBitField,
|
context: &mut computed::Context<C>,
|
||||||
_cacheable: &mut bool,
|
_seen: &mut PropertyBitField,
|
||||||
_error_reporter: &mut StdBox<ParseErrorReporter + Send>) {
|
_cacheable: &mut bool,
|
||||||
longhands::_servo_text_decorations_in_effect::derive_from_text_decoration(context);
|
_error_reporter: &mut StdBox<ParseErrorReporter + Send>) {
|
||||||
}
|
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);
|
||||||
box_.set__servo_display_for_hypothetical_box(if is_root_element {
|
% if CONFIG["product"] == "servo":
|
||||||
computed_display
|
box_.set__servo_display_for_hypothetical_box(if is_root_element {
|
||||||
} else {
|
computed_display
|
||||||
specified_display
|
} else {
|
||||||
});
|
specified_display
|
||||||
|
});
|
||||||
|
% endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue