author | Emilio Cobos Álvarez <emilio@crisal.io> |
Sun, 23 Jun 2019 12:39:32 +0200 | |
changeset 479887 | 920eb58d6dfa67b2ba01a5cb6770d0a407dc8993 |
parent 479886 | d646d7beb29db6ccfe4b699952666d12896b2c90 |
child 479888 | 4ba30243e4a2059688d8e7d9a1ab02658e788605 |
push id | 36189 |
push user | cbrindusan@mozilla.com |
push date | Sun, 23 Jun 2019 21:47:52 +0000 |
treeherder | mozilla-central@303b1fcafdeb [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | emilio |
bugs | 1560777 |
milestone | 69.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/servo/components/selectors/bloom.rs +++ b/servo/components/selectors/bloom.rs @@ -13,21 +13,16 @@ pub const BLOOM_HASH_MASK: u32 = 0x00fff const KEY_SIZE: usize = 12; const ARRAY_SIZE: usize = 1 << KEY_SIZE; const KEY_MASK: u32 = (1 << KEY_SIZE) - 1; /// A counting Bloom filter with 8-bit counters. pub type BloomFilter = CountingBloomFilter<BloomStorageU8>; -/// A non-counting Bloom filter. -/// -/// Effectively a counting Bloom filter with 1-bit counters. -pub type NonCountingBloomFilter = CountingBloomFilter<BloomStorageBool>; - /// A counting Bloom filter with parameterized storage to handle /// counters of different sizes. For now we assume that having two hash /// functions is enough, but we may revisit that decision later. /// /// The filter uses an array with 2**KeySize entries. /// /// Assuming a well-distributed hash function, a Bloom filter with /// array size M containing N elements and
--- a/servo/components/style/animation.rs +++ b/servo/components/style/animation.rs @@ -176,24 +176,16 @@ impl KeyframesAnimationState { KeyframesIterationState::Finite(old_iters, _), ) => *iters = old_iters, _ => {}, } self.current_direction = old_direction; self.started_at = new_started_at; } - - #[inline] - fn is_paused(&self) -> bool { - match self.running_state { - KeyframesRunningState::Paused(..) => true, - KeyframesRunningState::Running => false, - } - } } impl fmt::Debug for KeyframesAnimationState { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("KeyframesAnimationState") .field("started_at", &self.started_at) .field("duration", &self.duration) .field("delay", &self.delay) @@ -240,25 +232,16 @@ impl Animation { #[inline] pub fn node(&self) -> &OpaqueNode { match *self { Animation::Transition(ref node, _, _) => node, Animation::Keyframes(ref node, _, _, _) => node, } } - /// Whether this animation is paused. A transition can never be paused. - #[inline] - pub fn is_paused(&self) -> bool { - match *self { - Animation::Transition(..) => false, - Animation::Keyframes(_, _, _, ref state) => state.is_paused(), - } - } - /// Whether this animation is a transition. #[inline] pub fn is_transition(&self) -> bool { match *self { Animation::Transition(..) => true, Animation::Keyframes(..) => false, } }
--- a/servo/components/style/attr.rs +++ b/servo/components/style/attr.rs @@ -293,28 +293,16 @@ impl AttrValue { /// Panics if the `AttrValue` is not a `Color` pub fn as_color(&self) -> Option<&RGBA> { match *self { AttrValue::Color(_, ref color) => color.as_ref(), _ => panic!("Color not found"), } } - /// Assumes the `AttrValue` is a `Length` and returns its value - /// - /// ## Panics - /// - /// Panics if the `AttrValue` is not a `Length` - pub fn as_length(&self) -> Option<&Length> { - match *self { - AttrValue::Length(_, ref length) => length.as_ref(), - _ => panic!("Length not found"), - } - } - /// Assumes the `AttrValue` is a `Dimension` and returns its value /// /// ## Panics /// /// Panics if the `AttrValue` is not a `Dimension` pub fn as_dimension(&self) -> &LengthOrPercentageOrAuto { match *self { AttrValue::Dimension(_, ref l) => l,
--- a/servo/components/style/bloom.rs +++ b/servo/components/style/bloom.rs @@ -189,21 +189,16 @@ impl<E: TElement> StyleBloom<E> { let hash = self.pushed_hashes.pop().unwrap(); debug_assert_eq!(expected_hashes.pop().unwrap(), hash); self.filter.remove_hash(hash); } Some(popped_element) } - /// Returns true if the bloom filter is empty. - pub fn is_empty(&self) -> bool { - self.elements.is_empty() - } - /// Returns the DOM depth of elements that can be correctly /// matched against the bloom filter (that is, the number of /// elements in our list). pub fn matching_depth(&self) -> usize { self.elements.len() } /// Clears the bloom filter.
--- a/servo/components/style/data.rs +++ b/servo/components/style/data.rs @@ -4,19 +4,17 @@ //! Per-node data used in style calculation. use crate::context::{SharedStyleContext, StackLimitChecker}; use crate::dom::TElement; use crate::invalidation::element::invalidator::InvalidationResult; use crate::invalidation::element::restyle_hints::RestyleHint; use crate::properties::ComputedValues; -use crate::rule_tree::StrongRuleNode; use crate::selector_parser::{PseudoElement, RestyleDamage, EAGER_PSEUDO_COUNT}; -use crate::shared_lock::StylesheetGuards; use crate::style_resolver::{PrimaryStyle, ResolvedElementStyles, ResolvedStyle}; #[cfg(feature = "gecko")] use malloc_size_of::MallocSizeOfOps; use selectors::NthIndexCache; use servo_arc::Arc; use std::fmt; use std::mem; use std::ops::{Deref, DerefMut}; @@ -368,39 +366,16 @@ impl ElementData { // selector matching. if self.hint.has_animation_hint() { return RestyleKind::CascadeWithReplacements(self.hint & RestyleHint::for_animations()); } return RestyleKind::CascadeOnly; } - /// Return true if important rules are different. - /// We use this to make sure the cascade of off-main thread animations is correct. - /// Note: Ignore custom properties for now because we only support opacity and transform - /// properties for animations running on compositor. Actually, we only care about opacity - /// and transform for now, but it's fine to compare all properties and let the user - /// the check which properties do they want. - /// If it costs too much, get_properties_overriding_animations() should return a set - /// containing only opacity and transform properties. - pub fn important_rules_are_different( - &self, - rules: &StrongRuleNode, - guards: &StylesheetGuards, - ) -> bool { - debug_assert!(self.has_styles()); - let (important_rules, _custom) = self - .styles - .primary() - .rules() - .get_properties_overriding_animations(&guards); - let (other_important_rules, _custom) = rules.get_properties_overriding_animations(&guards); - important_rules != other_important_rules - } - /// Drops any restyle state from the element. /// /// FIXME(bholley): The only caller of this should probably just assert that /// the hint is empty and call clear_flags_and_damage(). #[inline] pub fn clear_restyle_state(&mut self) { self.hint = RestyleHint::empty(); self.clear_restyle_flags_and_damage(); @@ -408,21 +383,16 @@ impl ElementData { /// Drops restyle flags and damage from the element. #[inline] pub fn clear_restyle_flags_and_damage(&mut self) { self.damage = RestyleDamage::empty(); self.flags.remove(ElementDataFlags::WAS_RESTYLED); } - /// Returns whether this element is going to be reconstructed. - pub fn reconstructed_self(&self) -> bool { - self.damage.contains(RestyleDamage::reconstruct()) - } - /// Mark this element as restyled, which is useful to know whether we need /// to do a post-traversal. pub fn set_restyled(&mut self) { self.flags.insert(ElementDataFlags::WAS_RESTYLED); self.flags .remove(ElementDataFlags::TRAVERSED_WITHOUT_STYLING); } @@ -433,23 +403,16 @@ impl ElementData { } /// Mark that we traversed this element without computing any style for it. pub fn set_traversed_without_styling(&mut self) { self.flags .insert(ElementDataFlags::TRAVERSED_WITHOUT_STYLING); } - /// Returns whether the element was traversed without computing any style for - /// it. - pub fn traversed_without_styling(&self) -> bool { - self.flags - .contains(ElementDataFlags::TRAVERSED_WITHOUT_STYLING) - } - /// Returns whether this element has been part of a restyle. #[inline] pub fn contains_restyle_data(&self) -> bool { self.is_restyle() || !self.hint.is_empty() || !self.damage.is_empty() } /// Returns whether it is safe to perform cousin sharing based on the ComputedValues /// identity of the primary style in this ElementData. There are a few subtle things
--- a/servo/components/style/invalidation/element/restyle_hints.rs +++ b/servo/components/style/invalidation/element/restyle_hints.rs @@ -100,22 +100,16 @@ impl RestyleHint { return Self::restyle_subtree(); } if self.contains(RestyleHint::RECASCADE_DESCENDANTS) { return Self::recascade_subtree(); } Self::empty() } - /// Creates a new `RestyleHint` that indicates the element must be - /// recascaded. - pub fn recascade_self() -> Self { - RestyleHint::RECASCADE_SELF - } - /// Returns a hint that contains all the replacement hints. pub fn replacements() -> Self { RestyleHint::RESTYLE_STYLE_ATTRIBUTE | Self::for_animations() } /// The replacements for the animation cascade levels. #[inline] pub fn for_animations() -> Self {
--- a/servo/components/style/properties/cascade.rs +++ b/servo/components/style/properties/cascade.rs @@ -416,17 +416,17 @@ impl<'a, 'b: 'a> Cascade<'a, 'b> { declaration.id, self.context.builder.custom_properties.as_ref(), self.context.quirks_mode, self.context.device().environment(), )) } #[inline(always)] - fn apply_declaration<Phase: CascadePhase>( + fn apply_declaration( &mut self, longhand_id: LonghandId, declaration: &PropertyDeclaration, ) { // We could (and used to) use a pattern match here, but that bloats this // function to over 100K of compiled code! // // To improve i-cache behavior, we outline the individual functions and @@ -539,17 +539,17 @@ impl<'a, 'b: 'a> Cascade<'a, 'b> { if unset { continue; } // FIXME(emilio): We should avoid generating code for logical // longhands and just use the physical ones, then rename // physical_longhand_id to just longhand_id. - self.apply_declaration::<Phase>(longhand_id, &*declaration); + self.apply_declaration(longhand_id, &*declaration); } if Phase::is_early() { self.fixup_font_stuff(); self.compute_writing_mode(); } else { self.finished_applying_properties(); }
--- a/servo/components/style/rule_tree/mod.rs +++ b/servo/components/style/rule_tree/mod.rs @@ -142,26 +142,16 @@ impl StyleSource { pub fn read<'a>(&'a self, guard: &'a SharedRwLockReadGuard) -> &'a PropertyDeclarationBlock { let block: &Locked<PropertyDeclarationBlock> = match self.0.borrow() { ArcUnionBorrow::First(ref rule) => &rule.get().read_with(guard).block, ArcUnionBorrow::Second(ref block) => block.get(), }; block.read_with(guard) } - /// Indicates if this StyleSource is a style rule. - pub fn is_rule(&self) -> bool { - self.0.is_first() - } - - /// Indicates if this StyleSource is a PropertyDeclarationBlock. - pub fn is_declarations(&self) -> bool { - self.0.is_second() - } - /// Returns the style rule if applicable, otherwise None. pub fn as_rule(&self) -> Option<ArcBorrow<Locked<StyleRule>>> { self.0.as_first() } /// Returns the declaration block if applicable, otherwise None. pub fn as_declarations(&self) -> Option<ArcBorrow<Locked<PropertyDeclarationBlock>>> { self.0.as_second()
--- a/servo/components/style/sharing/mod.rs +++ b/servo/components/style/sharing/mod.rs @@ -97,25 +97,16 @@ mod checks; /// The cache size was chosen by measuring style sharing and resulting /// performance on a few pages; sizes up to about 32 were giving good sharing /// improvements (e.g. 3x fewer styles having to be resolved than at size 8) and /// slight performance improvements. Sizes larger than 32 haven't really been /// tested. pub const SHARING_CACHE_SIZE: usize = 31; const SHARING_CACHE_BACKING_STORE_SIZE: usize = SHARING_CACHE_SIZE + 1; -/// Controls whether the style sharing cache is used. -#[derive(Clone, Copy, PartialEq)] -pub enum StyleSharingBehavior { - /// Style sharing allowed. - Allow, - /// Style sharing disallowed. - Disallow, -} - /// Opaque pointer type to compare ComputedValues identities. #[derive(Clone, Debug, Eq, PartialEq)] pub struct OpaqueComputedValues(NonNull<()>); unsafe impl Send for OpaqueComputedValues {} unsafe impl Sync for OpaqueComputedValues {} impl OpaqueComputedValues {
--- a/servo/components/style/stylesheets/import_rule.rs +++ b/servo/components/style/stylesheets/import_rule.rs @@ -16,16 +16,17 @@ use crate::values::CssUrl; use cssparser::SourceLocation; use std::fmt::{self, Write}; use std::mem::ManuallyDrop; use style_traits::{CssWriter, ToCss}; use to_shmem::{SharedMemoryBuilder, ToShmem}; /// With asynchronous stylesheet parsing, we can't synchronously create a /// GeckoStyleSheet. So we use this placeholder instead. +#[cfg(feature = "gecko")] #[derive(Clone, Debug)] pub struct PendingSheet { origin: Origin, quirks_mode: QuirksMode, } /// A sheet that is held from an import rule. #[cfg(feature = "gecko")]
--- a/servo/components/style/values/specified/source_size_list.rs +++ b/servo/components/style/values/specified/source_size_list.rs @@ -49,21 +49,16 @@ impl SourceSizeList { /// Create an empty `SourceSizeList`, which can be used as a fall-back. pub fn empty() -> Self { Self { source_sizes: vec![], value: None, } } - /// Set content of `value`, which can be used as fall-back during evaluate. - pub fn set_fallback_value(&mut self, width: Option<Length>) { - self.value = width; - } - /// Evaluate this <source-size-list> to get the final viewport length. pub fn evaluate(&self, device: &Device, quirks_mode: QuirksMode) -> Au { let matching_source_size = self .source_sizes .iter() .find(|source_size| source_size.condition.matches(device, quirks_mode)); computed::Context::for_media_query_evaluation(device, quirks_mode, |context| {