Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style: Split style resolution and dynamic change computation. #17688

Merged
merged 11 commits into from Jul 12, 2017
Next

style: Derive Default for EagerPseudoStyles.

MozReview-Commit-ID: HkTtrV5CcF0
  • Loading branch information
emilio committed Jul 12, 2017
commit a2f8af920366499f8235630720dd8a627a1dc667
@@ -105,7 +105,7 @@ impl RestyleData {
/// not require duplicate allocations. We leverage the copy-on-write semantics of
/// Arc::make_mut(), which is free (i.e. does not require atomic RMU operations)
/// in servo_arc.
#[derive(Clone, Debug)]
#[derive(Clone, Debug, Default)]
pub struct EagerPseudoStyles(Option<Arc<EagerPseudoArray>>);

#[derive(Debug, Default)]
@@ -234,24 +234,14 @@ impl EagerPseudoStyles {

/// The styles associated with a node, including the styles for any
/// pseudo-elements.
#[derive(Clone, Debug)]
#[derive(Clone, Debug, Default)]
pub struct ElementStyles {
/// The element's style.
pub primary: Option<Arc<ComputedValues>>,
/// A list of the styles for the element's eagerly-cascaded pseudo-elements.
pub pseudos: EagerPseudoStyles,
}

impl Default for ElementStyles {
/// Construct an empty `ElementStyles`.
fn default() -> Self {
ElementStyles {
primary: None,
pseudos: EagerPseudoStyles(None),
}
}
}

impl ElementStyles {
/// Returns the primary style.
pub fn get_primary(&self) -> Option<&Arc<ComputedValues>> {
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.