aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/node.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/dom/node.rs')
-rw-r--r--components/script/dom/node.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs
index 1e71966e4e7..0f2209c00ea 100644
--- a/components/script/dom/node.rs
+++ b/components/script/dom/node.rs
@@ -614,6 +614,12 @@ impl Node {
}
}
+ pub fn scroll_offset(&self) -> Point2D<f32> {
+ let document = self.owner_doc();
+ let window = document.window();
+ window.scroll_offset_query(self.to_trusted_node_address())
+ }
+
// https://dom.spec.whatwg.org/#dom-childnode-before
pub fn before(&self, nodes: Vec<NodeOrString>) -> ErrorResult {
// Step 1.
@@ -1852,6 +1858,11 @@ impl NodeMethods for Node {
}
}
+ // https://dom.spec.whatwg.org/#dom-node-rootnode
+ fn RootNode(&self) -> Root<Node> {
+ self.inclusive_ancestors().last().unwrap()
+ }
+
// https://dom.spec.whatwg.org/#dom-node-parentnode
fn GetParentNode(&self) -> Option<Root<Node>> {
self.parent_node.get()
@@ -2219,6 +2230,14 @@ impl NodeMethods for Node {
}
}
+ // https://dom.spec.whatwg.org/#dom-node-issamenode
+ fn IsSameNode(&self, otherNode: Option<&Node>) -> bool {
+ match otherNode {
+ Some(node) => self == node,
+ None => false,
+ }
+ }
+
// https://dom.spec.whatwg.org/#dom-node-comparedocumentposition
fn CompareDocumentPosition(&self, other: &Node) -> u16 {
if self == other {