mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
style: Improve logging for attribute changes.
And general Element logging. We now print all the attributes for comparison. If this turns out to be too verbose we can change it to diff them or something. Differential Revision: https://phabricator.services.mozilla.com/D2471
This commit is contained in:
parent
2e3aacdf80
commit
c3289ad46e
4 changed files with 47 additions and 34 deletions
|
@ -43,6 +43,11 @@ pub trait ElementSnapshot: Sized {
|
|||
/// If this snapshot contains attribute information.
|
||||
fn has_attrs(&self) -> bool;
|
||||
|
||||
/// Gets the attribute information of the snapshot as a string.
|
||||
///
|
||||
/// Only for debugging purposes.
|
||||
fn debug_list_attributes(&self) -> String { String::new() }
|
||||
|
||||
/// The ID attribute per this snapshot. Should only be called if
|
||||
/// `has_attrs()` returns true.
|
||||
fn id_attr(&self) -> Option<&WeakAtom>;
|
||||
|
|
|
@ -208,20 +208,32 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
debug!("Collecting changes for: {:?}", element);
|
||||
debug!(" > state: {:?}", state_changes);
|
||||
debug!(
|
||||
" > id changed: {:?} -> +{:?} -{:?}",
|
||||
snapshot.id_changed(),
|
||||
id_added,
|
||||
id_removed
|
||||
);
|
||||
debug!(
|
||||
" > class changed: {:?} -> +{:?} -{:?}",
|
||||
snapshot.class_changed(),
|
||||
classes_added,
|
||||
classes_removed
|
||||
);
|
||||
if log_enabled!(::log::Level::Debug) {
|
||||
debug!("Collecting changes for: {:?}", element);
|
||||
if !state_changes.is_empty() {
|
||||
debug!(" > state: {:?}", state_changes);
|
||||
}
|
||||
if snapshot.id_changed() {
|
||||
debug!(
|
||||
" > id changed: +{:?} -{:?}",
|
||||
id_added,
|
||||
id_removed
|
||||
);
|
||||
}
|
||||
if snapshot.class_changed() {
|
||||
debug!(
|
||||
" > class changed: +{:?} -{:?}",
|
||||
classes_added,
|
||||
classes_removed
|
||||
);
|
||||
}
|
||||
if snapshot.other_attr_changed() {
|
||||
debug!(
|
||||
" > attributes changed, old: {}",
|
||||
snapshot.debug_list_attributes()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
let lookup_element = if element.implemented_pseudo_element().is_some() {
|
||||
element.pseudo_element_originating_element().unwrap()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue