mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
style: Minor debugging improvements.
These were useful when implementing forwarding, and forgot to send them earlier. Differential Revision: https://phabricator.services.mozilla.com/D53767
This commit is contained in:
parent
a7c50b57a1
commit
d7167cec58
2 changed files with 10 additions and 3 deletions
|
@ -331,7 +331,7 @@ where
|
|||
}
|
||||
|
||||
/// The ShadowRoot trait.
|
||||
pub trait TShadowRoot: Sized + Copy + Clone + PartialEq {
|
||||
pub trait TShadowRoot: Sized + Copy + Clone + Debug + PartialEq {
|
||||
/// The concrete node type.
|
||||
type ConcreteNode: TNode<ConcreteShadowRoot = Self>;
|
||||
|
||||
|
|
|
@ -144,6 +144,13 @@ impl<'ld> TDocument for GeckoDocument<'ld> {
|
|||
#[derive(Clone, Copy)]
|
||||
pub struct GeckoShadowRoot<'lr>(pub &'lr structs::ShadowRoot);
|
||||
|
||||
impl<'ln> fmt::Debug for GeckoShadowRoot<'ln> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
// TODO(emilio): Maybe print the host or something?
|
||||
write!(f, "<shadow-root> ({:#x})", self.as_node().opaque().0)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'lr> PartialEq for GeckoShadowRoot<'lr> {
|
||||
#[inline]
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
|
@ -232,8 +239,8 @@ impl<'ln> fmt::Debug for GeckoNode<'ln> {
|
|||
return write!(f, "<document> ({:#x})", self.opaque().0);
|
||||
}
|
||||
|
||||
if self.is_shadow_root() {
|
||||
return write!(f, "<shadow-root> ({:#x})", self.opaque().0);
|
||||
if let Some(sr) = self.as_shadow_root() {
|
||||
return sr.fmt(f);
|
||||
}
|
||||
|
||||
write!(f, "<non-text node> ({:#x})", self.opaque().0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue