Revert "Make DOMRefCell use style’s copy of RefCell"

This reverts commit ec723057b2.
This commit is contained in:
Simon Sapin 2016-09-28 11:05:06 +02:00
parent c831369e3e
commit fbde392c3d
12 changed files with 10 additions and 35 deletions

View file

@ -51,8 +51,6 @@ fn is_unrooted_ty(cx: &LateContext, ty: &ty::TyS, in_new_function: bool) -> bool
false false
} else if match_def_path(cx, did.did, &["core", "cell", "Ref"]) } else if match_def_path(cx, did.did, &["core", "cell", "Ref"])
|| match_def_path(cx, did.did, &["core", "cell", "RefMut"]) || match_def_path(cx, did.did, &["core", "cell", "RefMut"])
|| match_def_path(cx, did.did, &["style", "refcell", "Ref"])
|| match_def_path(cx, did.did, &["style", "refcell", "RefMut"])
|| match_def_path(cx, did.did, &["core", "slice", "Iter"]) || match_def_path(cx, did.did, &["core", "slice", "Iter"])
|| match_def_path(cx, did.did, &["std", "collections", "hash", "map", "OccupiedEntry"]) || match_def_path(cx, did.did, &["std", "collections", "hash", "map", "OccupiedEntry"])
|| match_def_path(cx, did.did, &["std", "collections", "hash", "map", "VacantEntry"]) { || match_def_path(cx, did.did, &["std", "collections", "hash", "map", "VacantEntry"]) {

View file

@ -19,9 +19,9 @@ use js::jsapi::JS_ParseJSON;
use js::jsapi::Value as JSValue; use js::jsapi::Value as JSValue;
use js::jsval::UndefinedValue; use js::jsval::UndefinedValue;
use mime::{Mime, TopLevel, SubLevel}; use mime::{Mime, TopLevel, SubLevel};
use std::cell::Ref;
use std::rc::Rc; use std::rc::Rc;
use std::str; use std::str;
use style::refcell::Ref;
use url::form_urlencoded; use url::form_urlencoded;
pub enum BodyType { pub enum BodyType {

View file

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

View file

@ -4,7 +4,7 @@
//! A shareable mutable container for the DOM. //! A shareable mutable container for the DOM.
use style::refcell::{BorrowError, BorrowMutError, Ref, RefCell, RefMut}; use std::cell::{BorrowError, BorrowMutError, Ref, RefCell, RefMut};
use style::thread_state; use style::thread_state;
/// A mutable field in the DOM. /// A mutable field in the DOM.

View file

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

View file

@ -113,7 +113,7 @@ use script_traits::UntrustedNodeAddress;
use std::ascii::AsciiExt; use std::ascii::AsciiExt;
use std::borrow::ToOwned; use std::borrow::ToOwned;
use std::boxed::FnBox; use std::boxed::FnBox;
use std::cell::Cell; use std::cell::{Cell, Ref, RefMut};
use std::collections::HashMap; use std::collections::HashMap;
use std::collections::hash_map::Entry::{Occupied, Vacant}; use std::collections::hash_map::Entry::{Occupied, Vacant};
use std::default::Default; use std::default::Default;
@ -125,7 +125,6 @@ use std::time::{Duration, Instant};
use string_cache::{Atom, QualName}; use string_cache::{Atom, QualName};
use style::attr::AttrValue; use style::attr::AttrValue;
use style::context::ReflowGoal; use style::context::ReflowGoal;
use style::refcell::{Ref, RefMut};
use style::selector_impl::ElementSnapshot; use style::selector_impl::ElementSnapshot;
use style::str::{split_html_space_chars, str_join}; use style::str::{split_html_space_chars, str_join};
use style::stylesheets::Stylesheet; use style::stylesheets::Stylesheet;

View file

@ -14,9 +14,8 @@ use dom::bindings::reflector::{reflect_dom_object, Reflectable, Reflector};
use dom::dommatrix::DOMMatrix; use dom::dommatrix::DOMMatrix;
use dom::dompoint::DOMPoint; use dom::dompoint::DOMPoint;
use euclid::{Matrix4D, Point4D, Radians}; use euclid::{Matrix4D, Point4D, Radians};
use std::cell::Cell; use std::cell::{Cell, Ref};
use std::f64; use std::f64;
use style::refcell::Ref;
#[dom_struct] #[dom_struct]
pub struct DOMMatrixReadOnly { pub struct DOMMatrixReadOnly {

View file

@ -76,7 +76,7 @@ use selectors::matching::{HAS_EDGE_CHILD_SELECTOR, HAS_SLOW_SELECTOR, HAS_SLOW_S
use selectors::parser::{AttrSelector, NamespaceConstraint, parse_author_origin_selector_list_from_str}; use selectors::parser::{AttrSelector, NamespaceConstraint, parse_author_origin_selector_list_from_str};
use std::ascii::AsciiExt; use std::ascii::AsciiExt;
use std::borrow::Cow; use std::borrow::Cow;
use std::cell::Cell; use std::cell::{Cell, Ref};
use std::convert::TryFrom; use std::convert::TryFrom;
use std::default::Default; use std::default::Default;
use std::fmt; use std::fmt;
@ -90,7 +90,6 @@ use style::parser::ParserContextExtraData;
use style::properties::{DeclaredValue, Importance}; use style::properties::{DeclaredValue, Importance};
use style::properties::{PropertyDeclaration, PropertyDeclarationBlock, parse_style_attribute}; use style::properties::{PropertyDeclaration, PropertyDeclarationBlock, parse_style_attribute};
use style::properties::longhands::{self, background_image, border_spacing, font_family, font_size, overflow_x}; use style::properties::longhands::{self, background_image, border_spacing, font_family, font_size, overflow_x};
use style::refcell::Ref;
use style::selector_impl::{NonTSPseudoClass, ServoSelectorImpl}; use style::selector_impl::{NonTSPseudoClass, ServoSelectorImpl};
use style::selector_matching::ApplicableDeclarationBlock; use style::selector_matching::ApplicableDeclarationBlock;
use style::sink::Push; use style::sink::Push;

View file

@ -35,10 +35,9 @@ use net_traits::request::Referrer as NetTraitsRequestReferrer;
use net_traits::request::Request as NetTraitsRequest; use net_traits::request::Request as NetTraitsRequest;
use net_traits::request::RequestMode as NetTraitsRequestMode; use net_traits::request::RequestMode as NetTraitsRequestMode;
use net_traits::request::Type as NetTraitsRequestType; use net_traits::request::Type as NetTraitsRequestType;
use std::cell::Cell; use std::cell::{Cell, Ref};
use std::mem; use std::mem;
use std::rc::Rc; use std::rc::Rc;
use style::refcell::Ref;
use url::Url; use url::Url;
#[dom_struct] #[dom_struct]

View file

@ -22,10 +22,10 @@ use hyper::header::Headers as HyperHeaders;
use hyper::status::StatusCode; use hyper::status::StatusCode;
use hyper_serde::Serde; use hyper_serde::Serde;
use net_traits::response::{ResponseBody as NetTraitsResponseBody}; use net_traits::response::{ResponseBody as NetTraitsResponseBody};
use std::cell::Ref;
use std::mem; use std::mem;
use std::rc::Rc; use std::rc::Rc;
use std::str::FromStr; use std::str::FromStr;
use style::refcell::Ref;
use url::Position; use url::Position;
use url::Url; use url::Url;

View file

@ -17,6 +17,7 @@
#![feature(slice_patterns)] #![feature(slice_patterns)]
#![feature(stmt_expr_attributes)] #![feature(stmt_expr_attributes)]
#![feature(question_mark)] #![feature(question_mark)]
#![feature(try_borrow)]
#![feature(try_from)] #![feature(try_from)]
#![deny(unsafe_code)] #![deny(unsafe_code)]

View file

@ -15,7 +15,6 @@
#![allow(unsafe_code)] #![allow(unsafe_code)]
#[cfg(feature = "servo")] use heapsize::HeapSizeOf;
use std::cell::{UnsafeCell, Cell}; use std::cell::{UnsafeCell, Cell};
use std::cmp::Ordering; use std::cmp::Ordering;
use std::fmt::{self, Debug, Display}; use std::fmt::{self, Debug, Display};
@ -32,13 +31,6 @@ pub struct RefCell<T: ?Sized> {
value: UnsafeCell<T>, value: UnsafeCell<T>,
} }
#[cfg(feature = "servo")]
impl<T: HeapSizeOf> HeapSizeOf for RefCell<T> {
fn heap_size_of_children(&self) -> usize {
self.borrow().heap_size_of_children()
}
}
/// An enumeration of values returned from the `state` method on a `RefCell<T>`. /// An enumeration of values returned from the `state` method on a `RefCell<T>`.
#[derive(Copy, Clone, PartialEq, Eq, Debug)] #[derive(Copy, Clone, PartialEq, Eq, Debug)]
pub enum BorrowState { pub enum BorrowState {
@ -535,18 +527,6 @@ impl<'b, T: ?Sized> Ref<'b, T> {
borrow: orig.borrow, borrow: orig.borrow,
} }
} }
#[inline]
pub fn filter_map<U: ?Sized, F>(orig: Ref<'b, T>, f: F) -> Option<Ref<'b, U>>
where F: FnOnce(&T) -> Option<&U>
{
f(orig.value).map(move |new_value| {
Ref {
value: new_value,
borrow: orig.borrow,
}
})
}
} }
impl<'b, T: ?Sized> RefMut<'b, T> { impl<'b, T: ?Sized> RefMut<'b, T> {