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

Rule tree, v1 #13202

Merged
merged 4 commits into from Nov 5, 2016
Merged

Rule tree, v1 #13202

Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Simplify rule_tree::StyleSourceGuardHandle

  • Loading branch information
SimonSapin committed Nov 5, 2016
commit 2dd2c9cedde733f30042163c20e763b243567780
@@ -8,7 +8,6 @@ use arc_ptr_eq;
#[cfg(feature = "servo")]
use heapsize::HeapSizeOf;
use owning_handle::OwningHandle;
use owning_ref::{ArcRef, OwningRef};
use parking_lot::{RwLock, RwLockReadGuard};
use properties::{Importance, PropertyDeclarationBlock};
use std::io::{self, Write};
@@ -30,12 +29,9 @@ pub enum StyleSource {
Declarations(Arc<RwLock<PropertyDeclarationBlock>>),
}

// This is really nasty.
type StyleSourceGuardHandle<'a> =
OwningHandle<
OwningHandle<
OwningRef<Arc<RwLock<StyleRule>>, RwLock<StyleRule>>,
RwLockReadGuard<'a, StyleRule>>,
RwLockReadGuard<'a, StyleRule>,
RwLockReadGuard<'a, PropertyDeclarationBlock>>;

pub enum StyleSourceGuard<'a> {
@@ -80,13 +76,8 @@ impl StyleSource {
use self::StyleSource::*;
match *self {
Style(ref rule) => {
let arc_ref = ArcRef::new(rule.clone());
let rule_owning_ref =
OwningHandle::new(arc_ref, |r| unsafe { &*r }.read());
let block_owning_ref =
OwningHandle::new(rule_owning_ref, |r| unsafe { &*r }.block.read());

StyleSourceGuard::Style(block_owning_ref)
let owning_ref = OwningHandle::new(rule.read(), |r| unsafe { &*r }.block.read());
StyleSourceGuard::Style(owning_ref)
}
Declarations(ref block) => StyleSourceGuard::Declarations(block.read()),
}
@@ -325,7 +316,7 @@ impl StrongRuleNode {
last = Some(child);
}

let node = Box::new(RuleNode::new(root.clone(),
let node = Box::new(RuleNode::new(root,
self.clone(),
source.clone(),
importance));
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.