mirror of
https://github.com/servo/servo.git
synced 2025-08-08 23:15:33 +01:00
Add some fmt::Debug implementations
This commit is contained in:
parent
477cae67df
commit
bc71e8b65b
7 changed files with 59 additions and 4 deletions
|
@ -201,7 +201,7 @@ pub trait PresentationalHintsSynthetizer {
|
|||
where V: Push<DeclarationBlock<Vec<PropertyDeclaration>>>;
|
||||
}
|
||||
|
||||
pub trait TElement : PartialEq + Sized + Copy + Clone + ElementExt + PresentationalHintsSynthetizer {
|
||||
pub trait TElement : PartialEq + Debug + Sized + Copy + Clone + ElementExt + PresentationalHintsSynthetizer {
|
||||
type ConcreteNode: TNode<ConcreteElement = Self, ConcreteDocument = Self::ConcreteDocument>;
|
||||
type ConcreteDocument: TDocument<ConcreteNode = Self::ConcreteNode, ConcreteElement = Self>;
|
||||
|
||||
|
|
|
@ -803,7 +803,7 @@ impl<T: ToCss> ToCss for DeclaredValue<T> {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(PartialEq, Clone, Debug)]
|
||||
#[derive(PartialEq, Clone)]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
pub enum PropertyDeclaration {
|
||||
% for property in data.longhands:
|
||||
|
@ -867,6 +867,24 @@ impl fmt::Display for PropertyDeclarationName {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Debug for PropertyDeclaration {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
try!(write!(f, "{}: ", self.name()));
|
||||
match *self {
|
||||
% for property in data.longhands:
|
||||
% if not property.derived_from:
|
||||
PropertyDeclaration::${property.camel_case}(ref value) => value.to_css(f),
|
||||
% endif
|
||||
% endfor
|
||||
PropertyDeclaration::Custom(_, ref value) => value.to_css(f),
|
||||
% if any(property.derived_from for property in data.longhands):
|
||||
_ => Err(fmt::Error),
|
||||
% endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ToCss for PropertyDeclaration {
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
match *self {
|
||||
|
|
|
@ -21,6 +21,7 @@ use selectors::parser::Selector;
|
|||
use sink::Push;
|
||||
use smallvec::VecLike;
|
||||
use std::collections::HashMap;
|
||||
use std::fmt;
|
||||
use std::hash::BuildHasherDefault;
|
||||
use std::sync::Arc;
|
||||
use string_cache::Atom;
|
||||
|
@ -275,6 +276,7 @@ impl Stylist {
|
|||
parent: &Arc<ComputedValues>)
|
||||
-> Option<Arc<ComputedValues>>
|
||||
where E: Element<Impl=TheSelectorImpl> +
|
||||
Debug +
|
||||
PresentationalHintsSynthetizer
|
||||
{
|
||||
debug_assert!(TheSelectorImpl::pseudo_element_cascade_type(pseudo).is_lazy());
|
||||
|
@ -343,6 +345,7 @@ impl Stylist {
|
|||
pseudo_element: Option<&PseudoElement>,
|
||||
applicable_declarations: &mut V) -> StyleRelations
|
||||
where E: Element<Impl=TheSelectorImpl> +
|
||||
fmt::Debug +
|
||||
PresentationalHintsSynthetizer,
|
||||
V: Push<DeclarationBlock> + VecLike<DeclarationBlock>
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue