mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
style: Remove -servo-display-for-hypothetical-box from longhand
This commit is contained in:
parent
e81193c5c9
commit
0291a75b3c
5 changed files with 64 additions and 56 deletions
|
@ -1863,6 +1863,11 @@ pub mod style_structs {
|
|||
/// The font hash, used for font caching.
|
||||
pub hash: u64,
|
||||
% endif
|
||||
% if style_struct.name == "Box":
|
||||
/// The display value specified by the CSS stylesheets (without any style adjustments),
|
||||
/// which is needed for hypothetical layout boxes.
|
||||
pub original_display: longhands::display::computed_value::T,
|
||||
% endif
|
||||
}
|
||||
% if style_struct.name == "Font":
|
||||
|
||||
|
@ -1893,6 +1898,17 @@ pub mod style_structs {
|
|||
self.${longhand.ident} = longhands::${longhand.ident}::computed_value
|
||||
::T(v.into_iter().collect());
|
||||
}
|
||||
% elif longhand.ident == "display":
|
||||
/// Set `display`.
|
||||
///
|
||||
/// We need to keep track of the original display for hypothetical boxes,
|
||||
/// so we need to special-case this.
|
||||
#[allow(non_snake_case)]
|
||||
#[inline]
|
||||
pub fn set_display(&mut self, v: longhands::display::computed_value::T) {
|
||||
self.display = v;
|
||||
self.original_display = v;
|
||||
}
|
||||
% else:
|
||||
/// Set ${longhand.name}.
|
||||
#[allow(non_snake_case)]
|
||||
|
@ -1901,13 +1917,25 @@ pub mod style_structs {
|
|||
self.${longhand.ident} = v;
|
||||
}
|
||||
% endif
|
||||
/// Set ${longhand.name} from other struct.
|
||||
#[allow(non_snake_case)]
|
||||
#[inline]
|
||||
pub fn copy_${longhand.ident}_from(&mut self, other: &Self) {
|
||||
self.${longhand.ident} = other.${longhand.ident}.clone();
|
||||
}
|
||||
|
||||
% if longhand.ident == "display":
|
||||
/// Set `display` from other struct.
|
||||
///
|
||||
/// Same as `set_display` above.
|
||||
/// Thus, we need to special-case this.
|
||||
#[allow(non_snake_case)]
|
||||
#[inline]
|
||||
pub fn copy_display_from(&mut self, other: &Self) {
|
||||
self.display = other.display.clone();
|
||||
self.original_display = other.display.clone();
|
||||
}
|
||||
% else:
|
||||
/// Set ${longhand.name} from other struct.
|
||||
#[allow(non_snake_case)]
|
||||
#[inline]
|
||||
pub fn copy_${longhand.ident}_from(&mut self, other: &Self) {
|
||||
self.${longhand.ident} = other.${longhand.ident}.clone();
|
||||
}
|
||||
% endif
|
||||
/// Reset ${longhand.name} from the initial struct.
|
||||
#[allow(non_snake_case)]
|
||||
#[inline]
|
||||
|
@ -2002,15 +2030,16 @@ pub mod style_structs {
|
|||
self.text_decoration_line.contains(longhands::text_decoration_line::SpecifiedValue::LINE_THROUGH)
|
||||
}
|
||||
% elif style_struct.name == "Box":
|
||||
/// Sets the display property, but without touching
|
||||
/// __servo_display_for_hypothetical_box, except when the
|
||||
/// adjustment comes from root or item display fixups.
|
||||
pub fn set_adjusted_display(&mut self,
|
||||
dpy: longhands::display::computed_value::T,
|
||||
is_item_or_root: bool) {
|
||||
self.set_display(dpy);
|
||||
/// Sets the display property, but without touching original_display,
|
||||
/// except when the adjustment comes from root or item display fixups.
|
||||
pub fn set_adjusted_display(
|
||||
&mut self,
|
||||
dpy: longhands::display::computed_value::T,
|
||||
is_item_or_root: bool
|
||||
) {
|
||||
self.display = dpy;
|
||||
if is_item_or_root {
|
||||
self.set__servo_display_for_hypothetical_box(dpy);
|
||||
self.original_display = dpy;
|
||||
}
|
||||
}
|
||||
% endif
|
||||
|
@ -3048,6 +3077,9 @@ mod lazy_static_module {
|
|||
% if style_struct.name == "Font":
|
||||
hash: 0,
|
||||
% endif
|
||||
% if style_struct.name == "Box":
|
||||
original_display: longhands::display::get_initial_value(),
|
||||
% endif
|
||||
}),
|
||||
% endfor
|
||||
custom_properties: None,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue