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,
|
matches_hover_and_active_quirk: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline(always)]
|
||||||
pub fn matches_selector_list<E>(
|
pub fn matches_selector_list<E>(
|
||||||
selector_list: &SelectorList<E::Impl>,
|
selector_list: &SelectorList<E::Impl>,
|
||||||
element: &E,
|
element: &E,
|
||||||
|
@ -373,6 +374,7 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Matches a complex selector.
|
/// Matches a complex selector.
|
||||||
|
#[inline(always)]
|
||||||
pub fn matches_complex_selector<E, F>(
|
pub fn matches_complex_selector<E, F>(
|
||||||
mut iter: SelectorIter<E::Impl>,
|
mut iter: SelectorIter<E::Impl>,
|
||||||
element: &E,
|
element: &E,
|
||||||
|
@ -385,8 +387,8 @@ where
|
||||||
{
|
{
|
||||||
// If this is the special pseudo-element mode, consume the ::pseudo-element
|
// If this is the special pseudo-element mode, consume the ::pseudo-element
|
||||||
// before proceeding, since the caller has already handled that part.
|
// before proceeding, since the caller has already handled that part.
|
||||||
if context.nesting_level == 0 &&
|
if context.matching_mode == MatchingMode::ForStatelessPseudoElement &&
|
||||||
context.matching_mode == MatchingMode::ForStatelessPseudoElement {
|
context.nesting_level == 0 {
|
||||||
// Consume the pseudo.
|
// Consume the pseudo.
|
||||||
match *iter.next().unwrap() {
|
match *iter.next().unwrap() {
|
||||||
Component::PseudoElement(ref pseudo) => {
|
Component::PseudoElement(ref pseudo) => {
|
||||||
|
@ -571,12 +573,12 @@ where
|
||||||
// Only ancestor combinators are allowed while looking for
|
// Only ancestor combinators are allowed while looking for
|
||||||
// relevant links, so switch to not looking.
|
// relevant links, so switch to not looking.
|
||||||
*relevant_link = RelevantLinkStatus::NotLooking;
|
*relevant_link = RelevantLinkStatus::NotLooking;
|
||||||
SelectorMatchingResult::NotMatchedAndRestartFromClosestDescendant
|
SelectorMatchingResult::NotMatchedAndRestartFromClosestDescendant
|
||||||
}
|
}
|
||||||
Combinator::Child |
|
Combinator::Child |
|
||||||
Combinator::Descendant |
|
Combinator::Descendant |
|
||||||
Combinator::PseudoElement => {
|
Combinator::PseudoElement => {
|
||||||
SelectorMatchingResult::NotMatchedGlobally
|
SelectorMatchingResult::NotMatchedGlobally
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -262,6 +262,7 @@ impl<'ln> TNode for GeckoNode<'ln> {
|
||||||
type ConcreteDocument = GeckoDocument<'ln>;
|
type ConcreteDocument = GeckoDocument<'ln>;
|
||||||
type ConcreteElement = GeckoElement<'ln>;
|
type ConcreteElement = GeckoElement<'ln>;
|
||||||
|
|
||||||
|
#[inline]
|
||||||
fn parent_node(&self) -> Option<Self> {
|
fn parent_node(&self) -> Option<Self> {
|
||||||
unsafe { self.0.mParent.as_ref().map(GeckoNode) }
|
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> {
|
impl<'le> ::selectors::Element for GeckoElement<'le> {
|
||||||
type Impl = SelectorImpl;
|
type Impl = SelectorImpl;
|
||||||
|
|
||||||
|
#[inline]
|
||||||
fn opaque(&self) -> OpaqueElement {
|
fn opaque(&self) -> OpaqueElement {
|
||||||
OpaqueElement::new(self.0)
|
OpaqueElement::new(self.0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
fn parent_element(&self) -> Option<Self> {
|
fn parent_element(&self) -> Option<Self> {
|
||||||
// FIXME(emilio): This will need to jump across if the parent node is a
|
// FIXME(emilio): This will need to jump across if the parent node is a
|
||||||
// shadow root to get the shadow host.
|
// shadow root to get the shadow host.
|
||||||
|
@ -1783,6 +1786,7 @@ impl<'le> ::selectors::Element for GeckoElement<'le> {
|
||||||
self.closest_non_native_anonymous_ancestor()
|
self.closest_non_native_anonymous_ancestor()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
fn first_child_element(&self) -> Option<Self> {
|
fn first_child_element(&self) -> Option<Self> {
|
||||||
let mut child = self.as_node().first_child();
|
let mut child = self.as_node().first_child();
|
||||||
while let Some(child_node) = child {
|
while let Some(child_node) = child {
|
||||||
|
@ -1794,6 +1798,7 @@ impl<'le> ::selectors::Element for GeckoElement<'le> {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
fn last_child_element(&self) -> Option<Self> {
|
fn last_child_element(&self) -> Option<Self> {
|
||||||
let mut child = self.as_node().last_child();
|
let mut child = self.as_node().last_child();
|
||||||
while let Some(child_node) = child {
|
while let Some(child_node) = child {
|
||||||
|
@ -1805,6 +1810,7 @@ impl<'le> ::selectors::Element for GeckoElement<'le> {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
fn prev_sibling_element(&self) -> Option<Self> {
|
fn prev_sibling_element(&self) -> Option<Self> {
|
||||||
let mut sibling = self.as_node().prev_sibling();
|
let mut sibling = self.as_node().prev_sibling();
|
||||||
while let Some(sibling_node) = sibling {
|
while let Some(sibling_node) = sibling {
|
||||||
|
@ -1816,6 +1822,7 @@ impl<'le> ::selectors::Element for GeckoElement<'le> {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
fn next_sibling_element(&self) -> Option<Self> {
|
fn next_sibling_element(&self) -> Option<Self> {
|
||||||
let mut sibling = self.as_node().next_sibling();
|
let mut sibling = self.as_node().next_sibling();
|
||||||
while let Some(sibling_node) = 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 {
|
fn get_local_name(&self) -> &WeakAtom {
|
||||||
unsafe {
|
unsafe {
|
||||||
WeakAtom::new(self.as_node().node_info().mInner.mName)
|
WeakAtom::new(self.as_node().node_info().mInner.mName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
fn get_namespace(&self) -> &WeakNamespace {
|
fn get_namespace(&self) -> &WeakNamespace {
|
||||||
unsafe {
|
unsafe {
|
||||||
WeakNamespace::new(Gecko_Namespace(self.0))
|
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())
|
self.get_state().intersects(NonTSPseudoClass::AnyLink.state_flag())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
fn has_id(&self, id: &Atom, case_sensitivity: CaseSensitivity) -> bool {
|
fn has_id(&self, id: &Atom, case_sensitivity: CaseSensitivity) -> bool {
|
||||||
if !self.has_id() {
|
if !self.has_id() {
|
||||||
return false
|
return false
|
||||||
|
@ -2095,6 +2105,7 @@ impl<'le> ::selectors::Element for GeckoElement<'le> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
fn has_class(&self, name: &Atom, case_sensitivity: CaseSensitivity) -> bool {
|
fn has_class(&self, name: &Atom, case_sensitivity: CaseSensitivity) -> bool {
|
||||||
if !self.may_have_class() {
|
if !self.may_have_class() {
|
||||||
return false;
|
return false;
|
||||||
|
@ -2106,15 +2117,18 @@ impl<'le> ::selectors::Element for GeckoElement<'le> {
|
||||||
Gecko_ClassOrClassList)
|
Gecko_ClassOrClassList)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
fn is_html_element_in_html_document(&self) -> bool {
|
fn is_html_element_in_html_document(&self) -> bool {
|
||||||
self.is_html_element() &&
|
self.is_html_element() &&
|
||||||
self.as_node().owner_doc().is_html_document()
|
self.as_node().owner_doc().is_html_document()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
fn ignores_nth_child_selectors(&self) -> bool {
|
fn ignores_nth_child_selectors(&self) -> bool {
|
||||||
self.is_root_of_anonymous_subtree()
|
self.is_root_of_anonymous_subtree()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
fn blocks_ancestor_combinators(&self) -> bool {
|
fn blocks_ancestor_combinators(&self) -> bool {
|
||||||
if !self.is_root_of_anonymous_subtree() {
|
if !self.is_root_of_anonymous_subtree() {
|
||||||
return false
|
return false
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue