mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
Backed out changeset dbd300f4d75b for build bustage. r=backout on a CLOSED TREE
Backs out https://github.com/servo/servo/pull/19108
This commit is contained in:
parent
a0cd781bdc
commit
8f8fd517ed
8 changed files with 60 additions and 371 deletions
|
@ -110,26 +110,6 @@ impl<'ld> TDocument for GeckoDocument<'ld> {
|
|||
fn quirks_mode(&self) -> QuirksMode {
|
||||
self.0.mCompatMode.into()
|
||||
}
|
||||
|
||||
fn elements_with_id(&self, id: &Atom) -> Result<&[GeckoElement<'ld>], ()> {
|
||||
unsafe {
|
||||
let array = bindings::Gecko_GetElementsWithId(self.0, id.as_ptr());
|
||||
if array.is_null() {
|
||||
return Ok(&[]);
|
||||
}
|
||||
|
||||
let elements: &[*mut RawGeckoElement] = &**array;
|
||||
|
||||
// NOTE(emilio): We rely on the in-memory representation of
|
||||
// GeckoElement<'ld> and *mut RawGeckoElement being the same.
|
||||
#[allow(dead_code)]
|
||||
unsafe fn static_assert() {
|
||||
mem::transmute::<*mut RawGeckoElement, GeckoElement<'static>>(0xbadc0de as *mut _);
|
||||
}
|
||||
|
||||
Ok(mem::transmute(elements))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A simple wrapper over a non-null Gecko node (`nsINode`) pointer.
|
||||
|
@ -262,7 +242,6 @@ impl<'ln> TNode for GeckoNode<'ln> {
|
|||
type ConcreteDocument = GeckoDocument<'ln>;
|
||||
type ConcreteElement = GeckoElement<'ln>;
|
||||
|
||||
#[inline]
|
||||
fn parent_node(&self) -> Option<Self> {
|
||||
unsafe { self.0.mParent.as_ref().map(GeckoNode) }
|
||||
}
|
||||
|
@ -293,11 +272,6 @@ impl<'ln> TNode for GeckoNode<'ln> {
|
|||
GeckoDocument(unsafe { &*self.node_info().mDocument })
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn is_in_document(&self) -> bool {
|
||||
self.get_bool_flag(nsINode_BooleanFlag::IsInDocument)
|
||||
}
|
||||
|
||||
fn traversal_parent(&self) -> Option<GeckoElement<'ln>> {
|
||||
self.flattened_tree_parent().and_then(|n| n.as_element())
|
||||
}
|
||||
|
@ -1768,12 +1742,10 @@ impl<'le> Hash for GeckoElement<'le> {
|
|||
impl<'le> ::selectors::Element for GeckoElement<'le> {
|
||||
type Impl = SelectorImpl;
|
||||
|
||||
#[inline]
|
||||
fn opaque(&self) -> OpaqueElement {
|
||||
OpaqueElement::new(self.0)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn parent_element(&self) -> Option<Self> {
|
||||
// FIXME(emilio): This will need to jump across if the parent node is a
|
||||
// shadow root to get the shadow host.
|
||||
|
@ -1786,7 +1758,6 @@ impl<'le> ::selectors::Element for GeckoElement<'le> {
|
|||
self.closest_non_native_anonymous_ancestor()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn first_child_element(&self) -> Option<Self> {
|
||||
let mut child = self.as_node().first_child();
|
||||
while let Some(child_node) = child {
|
||||
|
@ -1798,7 +1769,6 @@ impl<'le> ::selectors::Element for GeckoElement<'le> {
|
|||
None
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn last_child_element(&self) -> Option<Self> {
|
||||
let mut child = self.as_node().last_child();
|
||||
while let Some(child_node) = child {
|
||||
|
@ -1810,7 +1780,6 @@ impl<'le> ::selectors::Element for GeckoElement<'le> {
|
|||
None
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn prev_sibling_element(&self) -> Option<Self> {
|
||||
let mut sibling = self.as_node().prev_sibling();
|
||||
while let Some(sibling_node) = sibling {
|
||||
|
@ -1822,7 +1791,6 @@ impl<'le> ::selectors::Element for GeckoElement<'le> {
|
|||
None
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn next_sibling_element(&self) -> Option<Self> {
|
||||
let mut sibling = self.as_node().next_sibling();
|
||||
while let Some(sibling_node) = sibling {
|
||||
|
@ -1914,14 +1882,12 @@ impl<'le> ::selectors::Element for GeckoElement<'le> {
|
|||
})
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn get_local_name(&self) -> &WeakAtom {
|
||||
unsafe {
|
||||
WeakAtom::new(self.as_node().node_info().mInner.mName)
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn get_namespace(&self) -> &WeakNamespace {
|
||||
unsafe {
|
||||
WeakNamespace::new(Gecko_Namespace(self.0))
|
||||
|
@ -2088,7 +2054,6 @@ impl<'le> ::selectors::Element for GeckoElement<'le> {
|
|||
self.get_state().intersects(NonTSPseudoClass::AnyLink.state_flag())
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn has_id(&self, id: &Atom, case_sensitivity: CaseSensitivity) -> bool {
|
||||
if !self.has_id() {
|
||||
return false
|
||||
|
@ -2105,7 +2070,6 @@ impl<'le> ::selectors::Element for GeckoElement<'le> {
|
|||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn has_class(&self, name: &Atom, case_sensitivity: CaseSensitivity) -> bool {
|
||||
if !self.may_have_class() {
|
||||
return false;
|
||||
|
@ -2117,18 +2081,15 @@ impl<'le> ::selectors::Element for GeckoElement<'le> {
|
|||
Gecko_ClassOrClassList)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn is_html_element_in_html_document(&self) -> bool {
|
||||
self.is_html_element() &&
|
||||
self.as_node().owner_doc().is_html_document()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn ignores_nth_child_selectors(&self) -> bool {
|
||||
self.is_root_of_anonymous_subtree()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn blocks_ancestor_combinators(&self) -> bool {
|
||||
if !self.is_root_of_anonymous_subtree() {
|
||||
return false
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue