mirror of
https://github.com/servo/servo.git
synced 2025-08-13 01:15:34 +01:00
Share more strings between Debug implementations for property-based types.
This commit is contained in:
parent
ecd8abb178
commit
d41baf7f5f
2 changed files with 68 additions and 5 deletions
|
@ -446,7 +446,7 @@ bitflags! {
|
|||
}
|
||||
|
||||
/// An identifier for a given longhand property.
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||
#[derive(Clone, Copy, Eq, PartialEq)]
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
pub enum LonghandId {
|
||||
|
@ -456,6 +456,12 @@ pub enum LonghandId {
|
|||
% endfor
|
||||
}
|
||||
|
||||
impl fmt::Debug for LonghandId {
|
||||
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||
formatter.write_str(self.name())
|
||||
}
|
||||
}
|
||||
|
||||
impl LonghandId {
|
||||
/// Get the name of this longhand property.
|
||||
pub fn name(&self) -> &'static str {
|
||||
|
@ -3597,7 +3603,7 @@ pub fn modify_border_style_for_inline_sides(style: &mut Arc<ComputedValues>,
|
|||
}
|
||||
|
||||
/// An identifier for a given alias property.
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||
#[derive(Clone, Copy, Eq, PartialEq)]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
pub enum AliasId {
|
||||
% for i, property in enumerate(data.all_aliases()):
|
||||
|
@ -3606,6 +3612,17 @@ pub enum AliasId {
|
|||
% endfor
|
||||
}
|
||||
|
||||
impl fmt::Debug for AliasId {
|
||||
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||
let name = match *self {
|
||||
% for property in data.all_aliases():
|
||||
AliasId::${property.camel_case} => "${property.camel_case}",
|
||||
% endfor
|
||||
};
|
||||
formatter.write_str(name)
|
||||
}
|
||||
}
|
||||
|
||||
impl AliasId {
|
||||
/// Returns an nsCSSPropertyID.
|
||||
#[cfg(feature = "gecko")]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue