mirror of
https://github.com/servo/servo.git
synced 2025-06-19 06:38:59 +01:00
style: Inline a bunch of stuff, fixup indentation of a couple things.
MozReview-Commit-ID: CgUNMeBDOCw Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
This commit is contained in:
parent
c414e90b20
commit
18ac41fe87
2 changed files with 20 additions and 4 deletions
|
@ -62,6 +62,7 @@ struct LocalMatchingContext<'a, 'b: 'a, Impl: SelectorImpl> {
|
|||
matches_hover_and_active_quirk: bool,
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn matches_selector_list<E>(
|
||||
selector_list: &SelectorList<E::Impl>,
|
||||
element: &E,
|
||||
|
@ -373,6 +374,7 @@ where
|
|||
}
|
||||
|
||||
/// Matches a complex selector.
|
||||
#[inline(always)]
|
||||
pub fn matches_complex_selector<E, F>(
|
||||
mut iter: SelectorIter<E::Impl>,
|
||||
element: &E,
|
||||
|
@ -385,8 +387,8 @@ where
|
|||
{
|
||||
// If this is the special pseudo-element mode, consume the ::pseudo-element
|
||||
// before proceeding, since the caller has already handled that part.
|
||||
if context.nesting_level == 0 &&
|
||||
context.matching_mode == MatchingMode::ForStatelessPseudoElement {
|
||||
if context.matching_mode == MatchingMode::ForStatelessPseudoElement &&
|
||||
context.nesting_level == 0 {
|
||||
// Consume the pseudo.
|
||||
match *iter.next().unwrap() {
|
||||
Component::PseudoElement(ref pseudo) => {
|
||||
|
|
|
@ -262,6 +262,7 @@ 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) }
|
||||
}
|
||||
|
@ -1767,10 +1768,12 @@ 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.
|
||||
|
@ -1783,6 +1786,7 @@ 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 {
|
||||
|
@ -1794,6 +1798,7 @@ 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 {
|
||||
|
@ -1805,6 +1810,7 @@ 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 {
|
||||
|
@ -1816,6 +1822,7 @@ 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 {
|
||||
|
@ -1907,12 +1914,14 @@ 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))
|
||||
|
@ -2079,6 +2088,7 @@ 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
|
||||
|
@ -2095,6 +2105,7 @@ 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;
|
||||
|
@ -2106,15 +2117,18 @@ 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