mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
style: Inline some things that should never ever appear in a profile.
This commit is contained in:
parent
9da7663e29
commit
2bbeda97d3
3 changed files with 13 additions and 5 deletions
|
@ -211,6 +211,7 @@ impl<'ln> GeckoNode<'ln> {
|
||||||
|
|
||||||
/// WARNING: This logic is duplicated in Gecko's FlattenedTreeParentIsParent.
|
/// WARNING: This logic is duplicated in Gecko's FlattenedTreeParentIsParent.
|
||||||
/// Make sure to mirror any modifications in both places.
|
/// Make sure to mirror any modifications in both places.
|
||||||
|
#[inline]
|
||||||
fn flattened_tree_parent_is_parent(&self) -> bool {
|
fn flattened_tree_parent_is_parent(&self) -> bool {
|
||||||
use gecko_bindings::structs::*;
|
use gecko_bindings::structs::*;
|
||||||
let flags = self.flags();
|
let flags = self.flags();
|
||||||
|
@ -236,6 +237,7 @@ impl<'ln> GeckoNode<'ln> {
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
fn flattened_tree_parent(&self) -> Option<Self> {
|
fn flattened_tree_parent(&self) -> Option<Self> {
|
||||||
let fast_path = self.flattened_tree_parent_is_parent();
|
let fast_path = self.flattened_tree_parent_is_parent();
|
||||||
debug_assert!(fast_path == unsafe { bindings::Gecko_FlattenedTreeParentIsParent(self.0) });
|
debug_assert!(fast_path == unsafe { bindings::Gecko_FlattenedTreeParentIsParent(self.0) });
|
||||||
|
@ -246,6 +248,7 @@ impl<'ln> GeckoNode<'ln> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
fn contains_non_whitespace_content(&self) -> bool {
|
fn contains_non_whitespace_content(&self) -> bool {
|
||||||
unsafe { Gecko_IsSignificantChild(self.0, true, false) }
|
unsafe { Gecko_IsSignificantChild(self.0, true, false) }
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,7 +91,7 @@ pub struct DeclarationImportanceIterator<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> DeclarationImportanceIterator<'a> {
|
impl<'a> DeclarationImportanceIterator<'a> {
|
||||||
/// Constructor
|
/// Constructor.
|
||||||
pub fn new(declarations: &'a [PropertyDeclaration], important: &'a SmallBitVec) -> Self {
|
pub fn new(declarations: &'a [PropertyDeclaration], important: &'a SmallBitVec) -> Self {
|
||||||
DeclarationImportanceIterator {
|
DeclarationImportanceIterator {
|
||||||
iter: declarations.iter().zip(important.iter()),
|
iter: declarations.iter().zip(important.iter()),
|
||||||
|
@ -102,17 +102,20 @@ impl<'a> DeclarationImportanceIterator<'a> {
|
||||||
impl<'a> Iterator for DeclarationImportanceIterator<'a> {
|
impl<'a> Iterator for DeclarationImportanceIterator<'a> {
|
||||||
type Item = (&'a PropertyDeclaration, Importance);
|
type Item = (&'a PropertyDeclaration, Importance);
|
||||||
|
|
||||||
|
#[inline]
|
||||||
fn next(&mut self) -> Option<Self::Item> {
|
fn next(&mut self) -> Option<Self::Item> {
|
||||||
self.iter.next().map(|(decl, important)|
|
self.iter.next().map(|(decl, important)|
|
||||||
(decl, if important { Importance::Important } else { Importance::Normal }))
|
(decl, if important { Importance::Important } else { Importance::Normal }))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
fn size_hint(&self) -> (usize, Option<usize>) {
|
fn size_hint(&self) -> (usize, Option<usize>) {
|
||||||
self.iter.size_hint()
|
self.iter.size_hint()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> DoubleEndedIterator for DeclarationImportanceIterator<'a> {
|
impl<'a> DoubleEndedIterator for DeclarationImportanceIterator<'a> {
|
||||||
|
#[inline(always)]
|
||||||
fn next_back(&mut self) -> Option<Self::Item> {
|
fn next_back(&mut self) -> Option<Self::Item> {
|
||||||
self.iter.next_back().map(|(decl, important)|
|
self.iter.next_back().map(|(decl, important)|
|
||||||
(decl, if important { Importance::Important } else { Importance::Normal }))
|
(decl, if important { Importance::Important } else { Importance::Normal }))
|
||||||
|
@ -123,7 +126,8 @@ impl<'a> DoubleEndedIterator for DeclarationImportanceIterator<'a> {
|
||||||
pub struct NormalDeclarationIterator<'a>(DeclarationImportanceIterator<'a>);
|
pub struct NormalDeclarationIterator<'a>(DeclarationImportanceIterator<'a>);
|
||||||
|
|
||||||
impl<'a> NormalDeclarationIterator<'a> {
|
impl<'a> NormalDeclarationIterator<'a> {
|
||||||
/// Constructor
|
/// Constructor.
|
||||||
|
#[inline]
|
||||||
pub fn new(declarations: &'a [PropertyDeclaration], important: &'a SmallBitVec) -> Self {
|
pub fn new(declarations: &'a [PropertyDeclaration], important: &'a SmallBitVec) -> Self {
|
||||||
NormalDeclarationIterator(
|
NormalDeclarationIterator(
|
||||||
DeclarationImportanceIterator::new(declarations, important)
|
DeclarationImportanceIterator::new(declarations, important)
|
||||||
|
|
|
@ -3129,6 +3129,9 @@ pub fn cascade(
|
||||||
) -> Arc<ComputedValues> {
|
) -> Arc<ComputedValues> {
|
||||||
debug_assert_eq!(parent_style.is_some(), parent_style_ignoring_first_line.is_some());
|
debug_assert_eq!(parent_style.is_some(), parent_style_ignoring_first_line.is_some());
|
||||||
let empty = SmallBitVec::new();
|
let empty = SmallBitVec::new();
|
||||||
|
|
||||||
|
let property_restriction = pseudo.and_then(|p| p.property_restriction());
|
||||||
|
|
||||||
let iter_declarations = || {
|
let iter_declarations = || {
|
||||||
rule_node.self_and_ancestors().flat_map(|node| {
|
rule_node.self_and_ancestors().flat_map(|node| {
|
||||||
let cascade_level = node.cascade_level();
|
let cascade_level = node.cascade_level();
|
||||||
|
@ -3142,8 +3145,6 @@ pub fn cascade(
|
||||||
};
|
};
|
||||||
let node_importance = node.importance();
|
let node_importance = node.importance();
|
||||||
|
|
||||||
let property_restriction = pseudo.and_then(|p| p.property_restriction());
|
|
||||||
|
|
||||||
declarations
|
declarations
|
||||||
// Yield declarations later in source order (with more precedence) first.
|
// Yield declarations later in source order (with more precedence) first.
|
||||||
.rev()
|
.rev()
|
||||||
|
@ -3168,6 +3169,7 @@ pub fn cascade(
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
apply_declarations(
|
apply_declarations(
|
||||||
device,
|
device,
|
||||||
pseudo,
|
pseudo,
|
||||||
|
@ -3187,7 +3189,6 @@ pub fn cascade(
|
||||||
|
|
||||||
/// NOTE: This function expects the declaration with more priority to appear
|
/// NOTE: This function expects the declaration with more priority to appear
|
||||||
/// first.
|
/// first.
|
||||||
#[allow(unused_mut)] // conditionally compiled code for "position"
|
|
||||||
pub fn apply_declarations<'a, F, I>(
|
pub fn apply_declarations<'a, F, I>(
|
||||||
device: &Device,
|
device: &Device,
|
||||||
pseudo: Option<<&PseudoElement>,
|
pseudo: Option<<&PseudoElement>,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue