Rename PropertyBitField to LonghandIdSet

This commit is contained in:
Simon Sapin 2017-02-26 18:50:06 +01:00
parent c81ebca7df
commit 4ad844f7bd
4 changed files with 14 additions and 14 deletions

View file

@ -12,10 +12,10 @@ use parking_lot::RwLock;
use parser::{ParserContext, ParserContextExtraData, log_css_error}; use parser::{ParserContext, ParserContextExtraData, log_css_error};
use properties::{Importance, PropertyDeclaration, PropertyDeclarationBlock, PropertyId}; use properties::{Importance, PropertyDeclaration, PropertyDeclarationBlock, PropertyId};
use properties::{PropertyDeclarationId, LonghandId, DeclaredValue}; use properties::{PropertyDeclarationId, LonghandId, DeclaredValue};
use properties::LonghandIdSet;
use properties::PropertyDeclarationParseResult; use properties::PropertyDeclarationParseResult;
use properties::animated_properties::TransitionProperty; use properties::animated_properties::TransitionProperty;
use properties::longhands::transition_timing_function::single_value::SpecifiedValue as SpecifiedTimingFunction; use properties::longhands::transition_timing_function::single_value::SpecifiedValue as SpecifiedTimingFunction;
use properties::PropertyBitField;
use std::fmt; use std::fmt;
use std::sync::Arc; use std::sync::Arc;
use style_traits::ToCss; use style_traits::ToCss;
@ -248,7 +248,7 @@ pub struct KeyframesAnimation {
/// Get all the animated properties in a keyframes animation. /// Get all the animated properties in a keyframes animation.
fn get_animated_properties(keyframes: &[Arc<RwLock<Keyframe>>]) -> Vec<TransitionProperty> { fn get_animated_properties(keyframes: &[Arc<RwLock<Keyframe>>]) -> Vec<TransitionProperty> {
let mut ret = vec![]; let mut ret = vec![];
let mut seen = PropertyBitField::new(); let mut seen = LonghandIdSet::new();
// NB: declarations are already deduplicated, so we don't have to check for // NB: declarations are already deduplicated, so we don't have to check for
// it here. // it here.
for keyframe in keyframes { for keyframe in keyframes {

View file

@ -230,7 +230,7 @@
use cascade_info::CascadeInfo; use cascade_info::CascadeInfo;
use error_reporting::ParseErrorReporter; use error_reporting::ParseErrorReporter;
use properties::longhands; use properties::longhands;
use properties::PropertyBitField; use properties::LonghandIdSet;
use properties::{ComputedValues, PropertyDeclaration}; use properties::{ComputedValues, PropertyDeclaration};
use properties::style_structs; use properties::style_structs;
use std::boxed::Box as StdBox; use std::boxed::Box as StdBox;

View file

@ -179,15 +179,15 @@ pub mod animated_properties {
} }
/// A set of longhand properties /// A set of longhand properties
pub struct PropertyBitField { pub struct LonghandIdSet {
storage: [u32; (${len(data.longhands)} - 1 + 32) / 32] storage: [u32; (${len(data.longhands)} - 1 + 32) / 32]
} }
impl PropertyBitField { impl LonghandIdSet {
/// Create an empty set /// Create an empty set
#[inline] #[inline]
pub fn new() -> PropertyBitField { pub fn new() -> LonghandIdSet {
PropertyBitField { storage: [0; (${len(data.longhands)} - 1 + 32) / 32] } LonghandIdSet { storage: [0; (${len(data.longhands)} - 1 + 32) / 32] }
} }
/// Return whether the given property is in the set /// Return whether the given property is in the set
@ -233,7 +233,7 @@ impl PropertyBitField {
/// A specialized set of PropertyDeclarationId /// A specialized set of PropertyDeclarationId
pub struct PropertyDeclarationIdSet { pub struct PropertyDeclarationIdSet {
longhands: PropertyBitField, longhands: LonghandIdSet,
// FIXME: Use a HashSet instead? This Vec is usually small, so linear scan might be ok. // FIXME: Use a HashSet instead? This Vec is usually small, so linear scan might be ok.
custom: Vec<::custom_properties::Name>, custom: Vec<::custom_properties::Name>,
@ -243,7 +243,7 @@ impl PropertyDeclarationIdSet {
/// Empty set /// Empty set
pub fn new() -> Self { pub fn new() -> Self {
PropertyDeclarationIdSet { PropertyDeclarationIdSet {
longhands: PropertyBitField::new(), longhands: LonghandIdSet::new(),
custom: Vec::new(), custom: Vec::new(),
} }
} }
@ -1835,7 +1835,7 @@ pub fn apply_declarations<'a, F, I>(viewport_size: Size2D<Au>,
// NB: The cacheable boolean is not used right now, but will be once we // NB: The cacheable boolean is not used right now, but will be once we
// start caching computed values in the rule nodes. // start caching computed values in the rule nodes.
let mut cacheable = true; let mut cacheable = true;
let mut seen = PropertyBitField::new(); let mut seen = LonghandIdSet::new();
// Declaration blocks are stored in increasing precedence order, we want // Declaration blocks are stored in increasing precedence order, we want
// them in decreasing order here. // them in decreasing order here.

View file

@ -1338,8 +1338,8 @@ pub extern "C" fn Servo_GetComputedKeyframeValues(keyframes: RawGeckoKeyframeLis
pres_context: RawGeckoPresContextBorrowed, pres_context: RawGeckoPresContextBorrowed,
computed_keyframes: RawGeckoComputedKeyframeValuesListBorrowedMut) computed_keyframes: RawGeckoComputedKeyframeValuesListBorrowedMut)
{ {
use style::properties::LonghandIdSet;
use style::properties::declaration_block::Importance; use style::properties::declaration_block::Importance;
use style::properties::PropertyBitField;
use style::values::computed::Context; use style::values::computed::Context;
let style = ComputedValues::as_arc(&style); let style = ComputedValues::as_arc(&style);
@ -1359,7 +1359,7 @@ pub extern "C" fn Servo_GetComputedKeyframeValues(keyframes: RawGeckoKeyframeLis
for (index, keyframe) in keyframes.iter().enumerate() { for (index, keyframe) in keyframes.iter().enumerate() {
let ref mut animation_values = computed_keyframes[index]; let ref mut animation_values = computed_keyframes[index];
let mut seen = PropertyBitField::new(); let mut seen = LonghandIdSet::new();
// mServoDeclarationBlock is null in the case where we have an invalid css property. // mServoDeclarationBlock is null in the case where we have an invalid css property.
let iter = keyframe.mPropertyValues.iter() let iter = keyframe.mPropertyValues.iter()
@ -1429,7 +1429,7 @@ pub extern "C" fn Servo_StyleSet_FillKeyframesForName(raw_data: RawServoStyleSet
style: ServoComputedValuesBorrowed, style: ServoComputedValuesBorrowed,
keyframes: RawGeckoKeyframeListBorrowedMut) -> bool { keyframes: RawGeckoKeyframeListBorrowedMut) -> bool {
use style::gecko_bindings::structs::Keyframe; use style::gecko_bindings::structs::Keyframe;
use style::properties::PropertyBitField; use style::properties::LonghandIdSet;
let data = PerDocumentStyleData::from_ffi(raw_data).borrow_mut(); let data = PerDocumentStyleData::from_ffi(raw_data).borrow_mut();
let name = unsafe { Atom::from(name.as_ref().unwrap().as_str_unchecked()) }; let name = unsafe { Atom::from(name.as_ref().unwrap().as_str_unchecked()) };
@ -1482,7 +1482,7 @@ pub extern "C" fn Servo_StyleSet_FillKeyframesForName(raw_data: RawServoStyleSet
declaration.is_animatable() declaration.is_animatable()
}); });
let mut seen = PropertyBitField::new(); let mut seen = LonghandIdSet::new();
for (index, &(ref declaration, _)) in animatable.enumerate() { for (index, &(ref declaration, _)) in animatable.enumerate() {
unsafe { unsafe {