diff options
author | rohan.prinja <rohan.prinja@samsung.com> | 2015-11-03 19:01:23 +0900 |
---|---|---|
committer | rohan.prinja <rohan.prinja@samsung.com> | 2015-11-03 19:01:23 +0900 |
commit | 6e774ea6eb6d719b98f924ab5bd0629d92fb27d0 (patch) | |
tree | fa48b89bb313a2e9514124b556bbcff5ed526a0f /components/script/dom/bindings | |
parent | 7032a5d1dee9bb2ba0bee45f1fda984dadfa0609 (diff) | |
parent | 4f51710ed387baa1ad0a6e4cdb0fc5eee44093d5 (diff) | |
download | servo-6e774ea6eb6d719b98f924ab5bd0629d92fb27d0.tar.gz servo-6e774ea6eb6d719b98f924ab5bd0629d92fb27d0.zip |
merge from master
Diffstat (limited to 'components/script/dom/bindings')
-rw-r--r-- | components/script/dom/bindings/codegen/CodegenRust.py | 4 | ||||
-rw-r--r-- | components/script/dom/bindings/global.rs | 4 | ||||
-rw-r--r-- | components/script/dom/bindings/js.rs | 8 | ||||
-rw-r--r-- | components/script/dom/bindings/num.rs | 3 | ||||
-rw-r--r-- | components/script/dom/bindings/trace.rs | 30 |
5 files changed, 11 insertions, 38 deletions
diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py index bd81592d43c..fe8e59d5f1e 100644 --- a/components/script/dom/bindings/codegen/CodegenRust.py +++ b/components/script/dom/bindings/codegen/CodegenRust.py @@ -2000,6 +2000,7 @@ def UnionTypes(descriptors, dictionaries, callbacks, config): 'dom::bindings::conversions::StringificationBehavior', 'dom::bindings::error::throw_not_in_union', 'dom::bindings::js::Root', + 'dom::bindings::str::USVString', 'dom::types::*', 'js::jsapi::JSContext', 'js::jsapi::{HandleValue, MutableHandleValue}', @@ -3492,6 +3493,9 @@ def getUnionTypeTemplateVars(type, descriptorProvider): elif type.isDOMString(): name = type.name typeName = "DOMString" + elif type.isUSVString(): + name = type.name + typeName = "USVString" elif type.isPrimitive(): name = type.name typeName = builtinNames[type.tag()] diff --git a/components/script/dom/bindings/global.rs b/components/script/dom/bindings/global.rs index 1f358048831..d89c1c21f32 100644 --- a/components/script/dom/bindings/global.rs +++ b/components/script/dom/bindings/global.rs @@ -230,8 +230,8 @@ impl GlobalField { /// Create a stack-bounded root for this reference. pub fn root(&self) -> GlobalRoot { match *self { - GlobalField::Window(ref window) => GlobalRoot::Window(window.root()), - GlobalField::Worker(ref worker) => GlobalRoot::Worker(worker.root()), + GlobalField::Window(ref window) => GlobalRoot::Window(Root::from_ref(window)), + GlobalField::Worker(ref worker) => GlobalRoot::Worker(Root::from_ref(worker)), } } } diff --git a/components/script/dom/bindings/js.rs b/components/script/dom/bindings/js.rs index 09f1392b762..55491d5d624 100644 --- a/components/script/dom/bindings/js.rs +++ b/components/script/dom/bindings/js.rs @@ -74,10 +74,6 @@ impl<T> JS<T> { } impl<T: Reflectable> JS<T> { - /// Root this JS-owned value to prevent its collection as garbage. - pub fn root(&self) -> Root<T> { - Root::new(self.ptr) - } /// Create a JS<T> from a Root<T> /// XXX Not a great API. Should be a call on Root<T> instead #[allow(unrooted_must_root)] @@ -292,7 +288,7 @@ impl<T: Reflectable> MutHeap<JS<T>> { pub fn get(&self) -> Root<T> { debug_assert!(task_state::get().is_script()); unsafe { - ptr::read(self.val.get()).root() + Root::from_ref(&*ptr::read(self.val.get())) } } } @@ -370,7 +366,7 @@ impl<T: Reflectable> MutNullableHeap<JS<T>> { pub fn get(&self) -> Option<Root<T>> { debug_assert!(task_state::get().is_script()); unsafe { - ptr::read(self.ptr.get()).map(|o| o.root()) + ptr::read(self.ptr.get()).map(|o| Root::from_ref(&*o)) } } diff --git a/components/script/dom/bindings/num.rs b/components/script/dom/bindings/num.rs index ed5d78cdb6c..720aeb28557 100644 --- a/components/script/dom/bindings/num.rs +++ b/components/script/dom/bindings/num.rs @@ -4,7 +4,6 @@ //! The `Finite<T>` struct. -use core::nonzero::Zeroable; use num::Float; use std::ops::Deref; @@ -12,8 +11,6 @@ use std::ops::Deref; #[derive(JSTraceable, Clone, Copy, Eq, PartialEq)] pub struct Finite<T: Float>(T); -unsafe impl<T: Float> Zeroable for Finite<T> {} - impl<T: Float> Finite<T> { /// Create a new `Finite<T: Float>` safely. pub fn new(value: T) -> Option<Finite<T>> { diff --git a/components/script/dom/bindings/trace.rs b/components/script/dom/bindings/trace.rs index 6ed7e45c45a..84869943239 100644 --- a/components/script/dom/bindings/trace.rs +++ b/components/script/dom/bindings/trace.rs @@ -63,10 +63,11 @@ use profile_traits::time::ProfilerChan as TimeProfilerChan; use script_task::ScriptChan; use script_traits::{TimerEventChan, TimerEventId, TimerSource, UntrustedNodeAddress}; use selectors::parser::PseudoElement; +use selectors::states::*; use serde::{Deserialize, Serialize}; use smallvec::SmallVec; use std::boxed::FnBox; -use std::cell::{Cell, RefCell, UnsafeCell}; +use std::cell::{Cell, UnsafeCell}; use std::collections::hash_state::HashState; use std::collections::{HashMap, HashSet}; use std::ffi::CString; @@ -139,12 +140,6 @@ pub fn trace_object(tracer: *mut JSTracer, description: &str, obj: &Heap<*mut JS } } -impl<T: JSTraceable> JSTraceable for RefCell<T> { - fn trace(&self, trc: *mut JSTracer) { - self.borrow().trace(trc) - } -} - impl<T: JSTraceable> JSTraceable for Rc<T> { fn trace(&self, trc: *mut JSTracer) { (**self).trace(trc) @@ -157,26 +152,6 @@ impl<T: JSTraceable> JSTraceable for Box<T> { } } -impl<T: JSTraceable> JSTraceable for *const T { - fn trace(&self, trc: *mut JSTracer) { - if !self.is_null() { - unsafe { - (**self).trace(trc) - } - } - } -} - -impl<T: JSTraceable> JSTraceable for *mut T { - fn trace(&self, trc: *mut JSTracer) { - if !self.is_null() { - unsafe { - (**self).trace(trc) - } - } - } -} - impl<T: JSTraceable + Copy> JSTraceable for Cell<T> { fn trace(&self, trc: *mut JSTracer) { self.get().trace(trc) @@ -309,6 +284,7 @@ no_jsmanaged_fields!(TimeProfilerChan); no_jsmanaged_fields!(MemProfilerChan); no_jsmanaged_fields!(PseudoElement); no_jsmanaged_fields!(Length); +no_jsmanaged_fields!(ElementState); impl JSTraceable for Box<ScriptChan + Send> { #[inline] |