mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
Auto merge of #10516 - Ms2ger:cleanup, r=nox
Various cleanup. <!-- Reviewable:start --> This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10516) <!-- Reviewable:end -->
This commit is contained in:
commit
5adf36231e
3 changed files with 20 additions and 29 deletions
|
@ -606,6 +606,12 @@ impl<T: Reflectable> PartialEq for Root<T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T: Reflectable> Clone for Root<T> {
|
||||
fn clone(&self) -> Root<T> {
|
||||
Root::from_ref(&*self)
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Reflectable> Drop for Root<T> {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
|
|
|
@ -1166,34 +1166,20 @@ impl Iterator for PrecedingNodeIterator {
|
|||
Some(current) => current,
|
||||
};
|
||||
|
||||
if self.root == current {
|
||||
self.current = None;
|
||||
return None
|
||||
}
|
||||
|
||||
let node = current;
|
||||
if let Some(previous_sibling) = node.GetPreviousSibling() {
|
||||
self.current = if self.root == current {
|
||||
None
|
||||
} else if let Some(previous_sibling) = current.GetPreviousSibling() {
|
||||
if self.root == previous_sibling {
|
||||
self.current = None;
|
||||
return None
|
||||
None
|
||||
} else if let Some(last_child) = previous_sibling.descending_last_children().last() {
|
||||
Some(last_child)
|
||||
} else {
|
||||
Some(previous_sibling)
|
||||
}
|
||||
|
||||
if let Some(last_child) = previous_sibling.descending_last_children().last() {
|
||||
self.current = Some(last_child);
|
||||
return previous_sibling.descending_last_children().last()
|
||||
}
|
||||
|
||||
self.current = Some(previous_sibling);
|
||||
return node.GetPreviousSibling()
|
||||
} else {
|
||||
current.GetParentNode()
|
||||
};
|
||||
|
||||
if let Some(parent_node) = node.GetParentNode() {
|
||||
self.current = Some(parent_node);
|
||||
return node.GetParentNode()
|
||||
}
|
||||
|
||||
self.current = None;
|
||||
None
|
||||
self.current.clone()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
use document_loader::DocumentLoader;
|
||||
use dom::bindings::codegen::Bindings::DocumentBinding::DocumentMethods;
|
||||
use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods;
|
||||
use dom::bindings::codegen::Bindings::XMLDocumentBinding::{self, XMLDocumentMethods};
|
||||
use dom::bindings::global::GlobalRef;
|
||||
use dom::bindings::inheritance::Castable;
|
||||
|
@ -77,16 +76,16 @@ impl XMLDocument {
|
|||
impl XMLDocumentMethods for XMLDocument {
|
||||
// https://html.spec.whatwg.org/multipage/#dom-document-location
|
||||
fn GetLocation(&self) -> Option<Root<Location>> {
|
||||
self.document.GetLocation()
|
||||
self.upcast::<Document>().GetLocation()
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-tree-accessors:supported-property-names
|
||||
fn SupportedPropertyNames(&self) -> Vec<DOMString> {
|
||||
self.document.SupportedPropertyNames()
|
||||
self.upcast::<Document>().SupportedPropertyNames()
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-tree-accessors:dom-document-nameditem-filter
|
||||
fn NamedGetter(&self, _cx: *mut JSContext, name: DOMString, found: &mut bool) -> *mut JSObject {
|
||||
self.document.NamedGetter(_cx, name, found)
|
||||
self.upcast::<Document>().NamedGetter(_cx, name, found)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue