mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Auto merge of #17791 - bholley:less_verbose_cv, r=heycam
Bring back concise logging for ElementData This was removed recently in the ComputedValues patch, and makes traversal logging rather unusable. Reviewed in https://bugzilla.mozilla.org/show_bug.cgi?id=1382357 <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/17791) <!-- Reviewable:end -->
This commit is contained in:
commit
37d96f5ca9
1 changed files with 27 additions and 2 deletions
|
@ -13,6 +13,7 @@ use rule_tree::StrongRuleNode;
|
||||||
use selector_parser::{EAGER_PSEUDO_COUNT, PseudoElement, RestyleDamage};
|
use selector_parser::{EAGER_PSEUDO_COUNT, PseudoElement, RestyleDamage};
|
||||||
use servo_arc::Arc;
|
use servo_arc::Arc;
|
||||||
use shared_lock::StylesheetGuards;
|
use shared_lock::StylesheetGuards;
|
||||||
|
use std::fmt;
|
||||||
use std::ops::{Deref, DerefMut};
|
use std::ops::{Deref, DerefMut};
|
||||||
|
|
||||||
bitflags! {
|
bitflags! {
|
||||||
|
@ -118,7 +119,7 @@ impl RestyleData {
|
||||||
#[derive(Clone, Debug, Default)]
|
#[derive(Clone, Debug, Default)]
|
||||||
pub struct EagerPseudoStyles(Option<Arc<EagerPseudoArray>>);
|
pub struct EagerPseudoStyles(Option<Arc<EagerPseudoArray>>);
|
||||||
|
|
||||||
#[derive(Debug, Default)]
|
#[derive(Default)]
|
||||||
struct EagerPseudoArray(EagerPseudoArrayInner);
|
struct EagerPseudoArray(EagerPseudoArrayInner);
|
||||||
type EagerPseudoArrayInner = [Option<Arc<ComputedValues>>; EAGER_PSEUDO_COUNT];
|
type EagerPseudoArrayInner = [Option<Arc<ComputedValues>>; EAGER_PSEUDO_COUNT];
|
||||||
|
|
||||||
|
@ -147,6 +148,20 @@ impl Clone for EagerPseudoArray {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Override Debug to print which pseudos we have, and substitute the rule node
|
||||||
|
// for the much-more-verbose ComputedValues stringification.
|
||||||
|
impl fmt::Debug for EagerPseudoArray {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
|
write!(f, "EagerPseudoArray {{ ")?;
|
||||||
|
for i in 0..EAGER_PSEUDO_COUNT {
|
||||||
|
if let Some(ref values) = self[i] {
|
||||||
|
write!(f, "{:?}: {:?}, ", PseudoElement::from_eager_index(i), &values.rules)?;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
write!(f, "}}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl EagerPseudoStyles {
|
impl EagerPseudoStyles {
|
||||||
/// Returns whether there are any pseudo styles.
|
/// Returns whether there are any pseudo styles.
|
||||||
pub fn is_empty(&self) -> bool {
|
pub fn is_empty(&self) -> bool {
|
||||||
|
@ -179,7 +194,7 @@ impl EagerPseudoStyles {
|
||||||
|
|
||||||
/// The styles associated with a node, including the styles for any
|
/// The styles associated with a node, including the styles for any
|
||||||
/// pseudo-elements.
|
/// pseudo-elements.
|
||||||
#[derive(Clone, Debug, Default)]
|
#[derive(Clone, Default)]
|
||||||
pub struct ElementStyles {
|
pub struct ElementStyles {
|
||||||
/// The element's style.
|
/// The element's style.
|
||||||
pub primary: Option<Arc<ComputedValues>>,
|
pub primary: Option<Arc<ComputedValues>>,
|
||||||
|
@ -204,6 +219,16 @@ impl ElementStyles {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We manually implement Debug for ElementStyles so that we can avoid the
|
||||||
|
// verbose stringification of every property in the ComputedValues. We
|
||||||
|
// substitute the rule node instead.
|
||||||
|
impl fmt::Debug for ElementStyles {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
|
write!(f, "ElementStyles {{ primary: {:?}, pseudos: {:?} }}",
|
||||||
|
self.primary.as_ref().map(|x| &x.rules), self.pseudos)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Style system data associated with an Element.
|
/// Style system data associated with an Element.
|
||||||
///
|
///
|
||||||
/// In Gecko, this hangs directly off the Element. Servo, this is embedded
|
/// In Gecko, this hangs directly off the Element. Servo, this is embedded
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue