Make DOMRefCell use style’s copy of RefCell

This commit is contained in:
Simon Sapin 2016-08-30 22:17:24 +02:00
parent edbd88cce5
commit ec723057b2
12 changed files with 31 additions and 24 deletions

View file

@ -56,7 +56,6 @@ plugins = {path = "../plugins"}
profile_traits = {path = "../profile_traits"}
rand = "0.3"
range = {path = "../range"}
ref_filter_map = "1.0"
ref_slice = "1.0"
regex = "0.1.43"
rustc-serialize = "0.3"

View file

@ -15,10 +15,10 @@ use dom::element::{AttributeMutation, Element};
use dom::virtualmethods::vtable_for;
use dom::window::Window;
use std::borrow::ToOwned;
use std::cell::Ref;
use std::mem;
use string_cache::{Atom, Namespace};
use style::attr::{AttrIdentifier, AttrValue};
use style::refcell::Ref;
// https://dom.spec.whatwg.org/#interface-attr
#[dom_struct]

View file

@ -6,7 +6,7 @@
use dom::bindings::trace::JSTraceable;
use js::jsapi::JSTracer;
use std::cell::{BorrowError, BorrowMutError, Ref, RefCell, RefMut};
use style::refcell::{BorrowError, BorrowMutError, Ref, RefCell, RefMut};
use style::thread_state;
use style::thread_state::SCRIPT;

View file

@ -19,7 +19,7 @@ use dom::element::Element;
use dom::node::{Node, NodeDamage};
use dom::processinginstruction::ProcessingInstruction;
use dom::text::Text;
use std::cell::Ref;
use style::refcell::Ref;
use util::opts;
// https://dom.spec.whatwg.org/#characterdata

View file

@ -14,12 +14,12 @@ use dom::element::Element;
use dom::node::{Node, NodeDamage, window_from_node};
use dom::window::Window;
use std::ascii::AsciiExt;
use std::cell::Ref;
use std::slice;
use string_cache::Atom;
use style::parser::ParserContextExtraData;
use style::properties::{PropertyDeclaration, Shorthand, Importance};
use style::properties::{is_supported_property, parse_one_declaration, parse_style_attribute};
use style::refcell::Ref;
use style::selector_impl::PseudoElement;
// http://dev.w3.org/csswg/cssom/#the-cssstyledeclaration-interface

View file

@ -110,7 +110,7 @@ use script_traits::{TouchEventType, TouchId};
use std::ascii::AsciiExt;
use std::borrow::ToOwned;
use std::boxed::FnBox;
use std::cell::{Cell, Ref, RefMut};
use std::cell::Cell;
use std::collections::HashMap;
use std::collections::hash_map::Entry::{Occupied, Vacant};
use std::default::Default;
@ -122,6 +122,7 @@ use std::sync::Arc;
use string_cache::{Atom, QualName};
use style::attr::AttrValue;
use style::context::ReflowGoal;
use style::refcell::{Ref, RefMut};
use style::selector_impl::ElementSnapshot;
use style::str::{split_html_space_chars, str_join};
use style::stylesheets::Stylesheet;

View file

@ -70,13 +70,12 @@ use html5ever::serialize::SerializeOpts;
use html5ever::serialize::TraversalScope;
use html5ever::serialize::TraversalScope::{ChildrenOnly, IncludeNode};
use html5ever::tree_builder::{LimitedQuirks, NoQuirks, Quirks};
use ref_filter_map::ref_filter_map;
use selectors::matching::{ElementFlags, matches};
use selectors::matching::{HAS_SLOW_SELECTOR, HAS_EDGE_CHILD_SELECTOR, HAS_SLOW_SELECTOR_LATER_SIBLINGS};
use selectors::parser::{AttrSelector, NamespaceConstraint, parse_author_origin_selector_list_from_str};
use std::ascii::AsciiExt;
use std::borrow::Cow;
use std::cell::{Cell, Ref};
use std::cell::Cell;
use std::convert::TryFrom;
use std::default::Default;
use std::fmt;
@ -90,6 +89,7 @@ use style::parser::ParserContextExtraData;
use style::properties::longhands::{self, background_image, border_spacing, font_family, overflow_x, font_size};
use style::properties::{DeclaredValue, Importance};
use style::properties::{PropertyDeclaration, PropertyDeclarationBlock, parse_style_attribute};
use style::refcell::Ref;
use style::selector_impl::{NonTSPseudoClass, ServoSelectorImpl};
use style::selector_matching::DeclarationBlock;
use style::sink::Push;
@ -871,7 +871,7 @@ impl Element {
pub fn get_inline_style_declaration(&self,
property: &Atom)
-> Option<Ref<(PropertyDeclaration, Importance)>> {
ref_filter_map(self.style_attribute.borrow(), |inline_declarations| {
Ref::filter_map(self.style_attribute.borrow(), |inline_declarations| {
inline_declarations.as_ref().and_then(|declarations| {
declarations.declarations
.iter()

View file

@ -69,7 +69,6 @@ extern crate phf;
extern crate profile_traits;
extern crate rand;
extern crate range;
extern crate ref_filter_map;
extern crate ref_slice;
extern crate regex;
extern crate rustc_serialize;