mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
style: Sprinkle some #[inline] on trivial methods.
This commit is contained in:
parent
f896cb63a6
commit
c676b52448
1 changed files with 11 additions and 1 deletions
|
@ -207,11 +207,13 @@ impl fmt::Debug for PropertyDeclarationBlock {
|
||||||
|
|
||||||
impl PropertyDeclarationBlock {
|
impl PropertyDeclarationBlock {
|
||||||
/// Returns the number of declarations in the block.
|
/// Returns the number of declarations in the block.
|
||||||
|
#[inline]
|
||||||
pub fn len(&self) -> usize {
|
pub fn len(&self) -> usize {
|
||||||
self.declarations.len()
|
self.declarations.len()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Create an empty block
|
/// Create an empty block
|
||||||
|
#[inline]
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
PropertyDeclarationBlock {
|
PropertyDeclarationBlock {
|
||||||
declarations: Vec::new(),
|
declarations: Vec::new(),
|
||||||
|
@ -229,31 +231,36 @@ impl PropertyDeclarationBlock {
|
||||||
PropertyDeclarationBlock {
|
PropertyDeclarationBlock {
|
||||||
declarations: vec![declaration],
|
declarations: vec![declaration],
|
||||||
declarations_importance: SmallBitVec::from_elem(1, importance.important()),
|
declarations_importance: SmallBitVec::from_elem(1, importance.important()),
|
||||||
longhands: longhands,
|
longhands,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The declarations in this block
|
/// The declarations in this block
|
||||||
|
#[inline]
|
||||||
pub fn declarations(&self) -> &[PropertyDeclaration] {
|
pub fn declarations(&self) -> &[PropertyDeclaration] {
|
||||||
&self.declarations
|
&self.declarations
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The `important` flags for declarations in this block
|
/// The `important` flags for declarations in this block
|
||||||
|
#[inline]
|
||||||
pub fn declarations_importance(&self) -> &SmallBitVec {
|
pub fn declarations_importance(&self) -> &SmallBitVec {
|
||||||
&self.declarations_importance
|
&self.declarations_importance
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Iterate over `(PropertyDeclaration, Importance)` pairs
|
/// Iterate over `(PropertyDeclaration, Importance)` pairs
|
||||||
|
#[inline]
|
||||||
pub fn declaration_importance_iter(&self) -> DeclarationImportanceIterator {
|
pub fn declaration_importance_iter(&self) -> DeclarationImportanceIterator {
|
||||||
DeclarationImportanceIterator::new(&self.declarations, &self.declarations_importance)
|
DeclarationImportanceIterator::new(&self.declarations, &self.declarations_importance)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Iterate over `PropertyDeclaration` for Importance::Normal
|
/// Iterate over `PropertyDeclaration` for Importance::Normal
|
||||||
|
#[inline]
|
||||||
pub fn normal_declaration_iter(&self) -> NormalDeclarationIterator {
|
pub fn normal_declaration_iter(&self) -> NormalDeclarationIterator {
|
||||||
NormalDeclarationIterator::new(&self.declarations, &self.declarations_importance)
|
NormalDeclarationIterator::new(&self.declarations, &self.declarations_importance)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return an iterator of (AnimatableLonghand, AnimationValue).
|
/// Return an iterator of (AnimatableLonghand, AnimationValue).
|
||||||
|
#[inline]
|
||||||
pub fn to_animation_value_iter<'a, 'cx, 'cx_a:'cx>(
|
pub fn to_animation_value_iter<'a, 'cx, 'cx_a:'cx>(
|
||||||
&'a self,
|
&'a self,
|
||||||
context: &'cx mut Context<'cx_a>,
|
context: &'cx mut Context<'cx_a>,
|
||||||
|
@ -267,6 +274,7 @@ impl PropertyDeclarationBlock {
|
||||||
///
|
///
|
||||||
/// This is based on the `declarations_importance` bit-vector,
|
/// This is based on the `declarations_importance` bit-vector,
|
||||||
/// which should be maintained whenever `declarations` is changed.
|
/// which should be maintained whenever `declarations` is changed.
|
||||||
|
#[inline]
|
||||||
pub fn any_important(&self) -> bool {
|
pub fn any_important(&self) -> bool {
|
||||||
!self.declarations_importance.all_false()
|
!self.declarations_importance.all_false()
|
||||||
}
|
}
|
||||||
|
@ -275,11 +283,13 @@ impl PropertyDeclarationBlock {
|
||||||
///
|
///
|
||||||
/// This is based on the `declarations_importance` bit-vector,
|
/// This is based on the `declarations_importance` bit-vector,
|
||||||
/// which should be maintained whenever `declarations` is changed.
|
/// which should be maintained whenever `declarations` is changed.
|
||||||
|
#[inline]
|
||||||
pub fn any_normal(&self) -> bool {
|
pub fn any_normal(&self) -> bool {
|
||||||
!self.declarations_importance.all_true()
|
!self.declarations_importance.all_true()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns whether this block contains a declaration of a given longhand.
|
/// Returns whether this block contains a declaration of a given longhand.
|
||||||
|
#[inline]
|
||||||
pub fn contains(&self, id: LonghandId) -> bool {
|
pub fn contains(&self, id: LonghandId) -> bool {
|
||||||
self.longhands.contains(id)
|
self.longhands.contains(id)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue