aboutsummaryrefslogtreecommitdiffstats
path: root/components/script
diff options
context:
space:
mode:
authorrohan.prinja <rohan.prinja@samsung.com>2015-10-29 21:48:39 +0900
committerrohan.prinja <rohan.prinja@samsung.com>2015-10-29 21:48:39 +0900
commit4a4f041948f38818d9616125c1639e1431327d09 (patch)
tree8a2960a3a9761fddd78cdd2d14ad427bda44e264 /components/script
parent430578355b75a3d58bec48b865cccbcf7eb8c990 (diff)
downloadservo-4a4f041948f38818d9616125c1639e1431327d09.tar.gz
servo-4a4f041948f38818d9616125c1639e1431327d09.zip
remove get_rooted() and replace all references to it with references to get()
Diffstat (limited to 'components/script')
-rw-r--r--components/script/dom/attr.rs2
-rw-r--r--components/script/dom/bindings/js.rs6
-rw-r--r--components/script/dom/document.rs16
-rw-r--r--components/script/dom/event.rs4
-rw-r--r--components/script/dom/filereader.rs2
-rw-r--r--components/script/dom/mouseevent.rs2
-rw-r--r--components/script/dom/node.rs20
-rw-r--r--components/script/dom/storageevent.rs2
-rw-r--r--components/script/dom/uievent.rs2
-rw-r--r--components/script/dom/webglrenderingcontext.rs4
-rw-r--r--components/script/dom/xmlhttprequest.rs2
11 files changed, 28 insertions, 34 deletions
diff --git a/components/script/dom/attr.rs b/components/script/dom/attr.rs
index 84dc04086f8..50e028a03b3 100644
--- a/components/script/dom/attr.rs
+++ b/components/script/dom/attr.rs
@@ -319,7 +319,7 @@ impl Attr {
}
pub fn owner(&self) -> Option<Root<Element>> {
- self.owner.get_rooted()
+ self.owner.get()
}
pub fn summarize(&self) -> AttrInfo {
diff --git a/components/script/dom/bindings/js.rs b/components/script/dom/bindings/js.rs
index f591bb8b996..a6af7680a96 100644
--- a/components/script/dom/bindings/js.rs
+++ b/components/script/dom/bindings/js.rs
@@ -373,12 +373,6 @@ impl<T: Reflectable> MutNullableHeap<JS<T>> {
}
}
- /// Get a rooted value out of this object
- pub fn get_rooted(&self) -> Option<Root<T>> {
- debug_assert!(task_state::get().is_script());
- self.get()
- }
-
/// Set this `MutNullableHeap` to the given value.
pub fn set(&self, val: Option<&T>) {
debug_assert!(task_state::get().is_script());
diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs
index 9564f8ccca8..2ad0a12262f 100644
--- a/components/script/dom/document.rs
+++ b/components/script/dom/document.rs
@@ -310,7 +310,7 @@ impl Document {
/// Returns the first `base` element in the DOM that has an `href` attribute.
pub fn base_element(&self) -> Option<Root<HTMLBaseElement>> {
- self.base_element.get_rooted()
+ self.base_element.get()
}
/// Refresh the cached first base element in the DOM.
@@ -508,7 +508,7 @@ impl Document {
/// Return the element that currently has focus.
// https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#events-focusevent-doc-focus
pub fn get_focused_element(&self) -> Option<Root<Element>> {
- self.focused.get_rooted()
+ self.focused.get()
}
/// Initiate a new round of checking for elements requesting focus. The last element to call
@@ -529,13 +529,13 @@ impl Document {
pub fn commit_focus_transaction(&self, focus_type: FocusType) {
//TODO: dispatch blur, focus, focusout, and focusin events
- if let Some(ref elem) = self.focused.get_rooted() {
+ if let Some(ref elem) = self.focused.get() {
elem.set_focus_state(false);
}
self.focused.set(self.possibly_focused.get().r());
- if let Some(ref elem) = self.focused.get_rooted() {
+ if let Some(ref elem) = self.focused.get() {
elem.set_focus_state(true);
// Update the focus state for all elements in the focus chain.
@@ -1045,7 +1045,7 @@ impl Document {
// A finished resource load can potentially unblock parsing. In that case, resume the
// parser so its loop can find out.
- if let Some(parser) = self.current_parser.get_rooted() {
+ if let Some(parser) = self.current_parser.get() {
if parser.is_suspended() {
parser.resume();
}
@@ -1063,7 +1063,7 @@ impl Document {
/// execute it.
/// https://html.spec.whatwg.org/multipage/#ready-to-be-parser-executed
fn maybe_execute_parser_blocking_script(&self) -> ParserBlockedByScript {
- let script = match self.pending_parsing_blocking_script.get_rooted() {
+ let script = match self.pending_parsing_blocking_script.get() {
None => return ParserBlockedByScript::Unblocked,
Some(script) => script,
};
@@ -1156,7 +1156,7 @@ impl Document {
}
pub fn get_current_parser(&self) -> Option<Root<ServoHTMLParser>> {
- self.current_parser.get_rooted()
+ self.current_parser.get()
}
/// Find an iframe element in the document.
@@ -1735,7 +1735,7 @@ impl DocumentMethods for Document {
// https://html.spec.whatwg.org/multipage/#dom-document-currentscript
fn GetCurrentScript(&self) -> Option<Root<HTMLScriptElement>> {
- self.current_script.get_rooted()
+ self.current_script.get()
}
// https://html.spec.whatwg.org/multipage/#dom-document-body
diff --git a/components/script/dom/event.rs b/components/script/dom/event.rs
index 10118923f56..6b63b3a58ee 100644
--- a/components/script/dom/event.rs
+++ b/components/script/dom/event.rs
@@ -168,12 +168,12 @@ impl EventMethods for Event {
// https://dom.spec.whatwg.org/#dom-event-target
fn GetTarget(&self) -> Option<Root<EventTarget>> {
- self.target.get_rooted()
+ self.target.get()
}
// https://dom.spec.whatwg.org/#dom-event-currenttarget
fn GetCurrentTarget(&self) -> Option<Root<EventTarget>> {
- self.current_target.get_rooted()
+ self.current_target.get()
}
// https://dom.spec.whatwg.org/#dom-event-defaultprevented
diff --git a/components/script/dom/filereader.rs b/components/script/dom/filereader.rs
index 4e17f6dd62e..dce7ef438dc 100644
--- a/components/script/dom/filereader.rs
+++ b/components/script/dom/filereader.rs
@@ -302,7 +302,7 @@ impl FileReaderMethods for FileReader {
// https://w3c.github.io/FileAPI/#dfn-error
fn GetError(&self) -> Option<Root<DOMException>> {
- self.error.get_rooted()
+ self.error.get()
}
// https://w3c.github.io/FileAPI/#dfn-result
diff --git a/components/script/dom/mouseevent.rs b/components/script/dom/mouseevent.rs
index a81d54f0b9b..e34be058cd1 100644
--- a/components/script/dom/mouseevent.rs
+++ b/components/script/dom/mouseevent.rs
@@ -156,7 +156,7 @@ impl MouseEventMethods for MouseEvent {
// https://w3c.github.io/uievents/#widl-MouseEvent-relatedTarget
fn GetRelatedTarget(&self) -> Option<Root<EventTarget>> {
- self.related_target.get_rooted()
+ self.related_target.get()
}
// See discussion at:
diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs
index 8aa54aafd2a..18c40157514 100644
--- a/components/script/dom/node.rs
+++ b/components/script/dom/node.rs
@@ -248,11 +248,11 @@ impl Node {
assert!(new_child.next_sibling.get().is_none());
match before {
Some(ref before) => {
- assert!(before.parent_node.get_rooted().r() == Some(self));
+ assert!(before.parent_node.get().r() == Some(self));
let prev_sibling = before.GetPreviousSibling();
match prev_sibling {
None => {
- assert!(Some(*before) == self.first_child.get_rooted().r());
+ assert!(Some(*before) == self.first_child.get().r());
self.first_child.set(Some(new_child));
},
Some(ref prev_sibling) => {
@@ -293,7 +293,7 @@ impl Node {
///
/// Fails unless `child` is a child of this node.
fn remove_child(&self, child: &Node) {
- assert!(child.parent_node.get_rooted().r() == Some(self));
+ assert!(child.parent_node.get().r() == Some(self));
let prev_sibling = child.GetPreviousSibling();
match prev_sibling {
None => {
@@ -670,7 +670,7 @@ impl Node {
let doc = self.owner_doc();
let node = try!(doc.r().node_from_nodes_and_strings(nodes));
// Step 2.
- let first_child = self.first_child.get_rooted();
+ let first_child = self.first_child.get();
Node::pre_insert(node.r(), self, first_child.r()).map(|_| ())
}
@@ -1818,7 +1818,7 @@ impl NodeMethods for Node {
// https://dom.spec.whatwg.org/#dom-node-parentnode
fn GetParentNode(&self) -> Option<Root<Node>> {
- self.parent_node.get_rooted()
+ self.parent_node.get()
}
// https://dom.spec.whatwg.org/#dom-node-parentelement
@@ -1842,22 +1842,22 @@ impl NodeMethods for Node {
// https://dom.spec.whatwg.org/#dom-node-firstchild
fn GetFirstChild(&self) -> Option<Root<Node>> {
- self.first_child.get_rooted()
+ self.first_child.get()
}
// https://dom.spec.whatwg.org/#dom-node-lastchild
fn GetLastChild(&self) -> Option<Root<Node>> {
- self.last_child.get_rooted()
+ self.last_child.get()
}
// https://dom.spec.whatwg.org/#dom-node-previoussibling
fn GetPreviousSibling(&self) -> Option<Root<Node>> {
- self.prev_sibling.get_rooted()
+ self.prev_sibling.get()
}
// https://dom.spec.whatwg.org/#dom-node-nextsibling
fn GetNextSibling(&self) -> Option<Root<Node>> {
- self.next_sibling.get_rooted()
+ self.next_sibling.get()
}
// https://dom.spec.whatwg.org/#dom-node-nodevalue
@@ -2360,7 +2360,7 @@ impl VirtualMethods for Node {
self.children_count.set(added.len() as u32);
},
}
- if let Some(list) = self.child_list.get_rooted() {
+ if let Some(list) = self.child_list.get() {
list.as_children_list().children_changed(mutation);
}
}
diff --git a/components/script/dom/storageevent.rs b/components/script/dom/storageevent.rs
index f64dd0b2af8..8d1e9139254 100644
--- a/components/script/dom/storageevent.rs
+++ b/components/script/dom/storageevent.rs
@@ -106,6 +106,6 @@ impl StorageEventMethods for StorageEvent {
// https://html.spec.whatwg.org/multipage/#dom-storageevent-storagearea
fn GetStorageArea(&self) -> Option<Root<Storage>> {
- self.storageArea.get_rooted()
+ self.storageArea.get()
}
}
diff --git a/components/script/dom/uievent.rs b/components/script/dom/uievent.rs
index 343d9f31620..5f6e8609795 100644
--- a/components/script/dom/uievent.rs
+++ b/components/script/dom/uievent.rs
@@ -71,7 +71,7 @@ impl UIEvent {
impl UIEventMethods for UIEvent {
// https://w3c.github.io/uievents/#widl-UIEvent-view
fn GetView(&self) -> Option<Root<Window>> {
- self.view.get_rooted()
+ self.view.get()
}
// https://w3c.github.io/uievents/#widl-UIEvent-detail
diff --git a/components/script/dom/webglrenderingcontext.rs b/components/script/dom/webglrenderingcontext.rs
index 749885571eb..aa92967cb1e 100644
--- a/components/script/dom/webglrenderingcontext.rs
+++ b/components/script/dom/webglrenderingcontext.rs
@@ -145,8 +145,8 @@ impl WebGLRenderingContext {
pub fn bound_texture_for(&self, target: u32) -> Option<Root<WebGLTexture>> {
match target {
- constants::TEXTURE_2D => self.bound_texture_2d.get_rooted(),
- constants::TEXTURE_CUBE_MAP => self.bound_texture_cube_map.get_rooted(),
+ constants::TEXTURE_2D => self.bound_texture_2d.get(),
+ constants::TEXTURE_CUBE_MAP => self.bound_texture_cube_map.get(),
_ => unreachable!(),
}
diff --git a/components/script/dom/xmlhttprequest.rs b/components/script/dom/xmlhttprequest.rs
index 067ba1019ed..a68d9478270 100644
--- a/components/script/dom/xmlhttprequest.rs
+++ b/components/script/dom/xmlhttprequest.rs
@@ -721,7 +721,7 @@ impl XMLHttpRequestMethods for XMLHttpRequest {
// https://xhr.spec.whatwg.org/#the-responsexml-attribute
fn GetResponseXML(&self) -> Option<Root<Document>> {
- self.response_xml.get_rooted()
+ self.response_xml.get()
}
}