diff options
author | est31 <MTest31@outlook.com> | 2019-06-07 10:49:07 +0200 |
---|---|---|
committer | est31 <MTest31@outlook.com> | 2019-06-07 15:14:21 +0200 |
commit | 642b7c3ea19cefbedbc881894e5679e7a5dd33ce (patch) | |
tree | 3bcba1097e72694541acfd2a2acc25c726b078e6 /components/style | |
parent | 8dc7a25893cbe9a2c958966618d28757201899b6 (diff) | |
download | servo-642b7c3ea19cefbedbc881894e5679e7a5dd33ce.tar.gz servo-642b7c3ea19cefbedbc881894e5679e7a5dd33ce.zip |
Remove unused code from selector and style crates
Diffstat (limited to 'components/style')
-rw-r--r-- | components/style/animation.rs | 17 | ||||
-rw-r--r-- | components/style/attr.rs | 12 | ||||
-rw-r--r-- | components/style/bloom.rs | 5 | ||||
-rw-r--r-- | components/style/data.rs | 37 | ||||
-rw-r--r-- | components/style/invalidation/element/restyle_hints.rs | 6 | ||||
-rw-r--r-- | components/style/rule_tree/mod.rs | 10 | ||||
-rw-r--r-- | components/style/sharing/mod.rs | 9 | ||||
-rw-r--r-- | components/style/stylesheets/import_rule.rs | 1 | ||||
-rw-r--r-- | components/style/values/specified/source_size_list.rs | 5 |
9 files changed, 1 insertions, 101 deletions
diff --git a/components/style/animation.rs b/components/style/animation.rs index 6fac559a777..a325b46e6cd 100644 --- a/components/style/animation.rs +++ b/components/style/animation.rs @@ -181,14 +181,6 @@ impl KeyframesAnimationState { 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 { @@ -245,15 +237,6 @@ impl Animation { } } - /// 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 { diff --git a/components/style/attr.rs b/components/style/attr.rs index 926d52cd5f8..22f524bc52e 100644 --- a/components/style/attr.rs +++ b/components/style/attr.rs @@ -298,18 +298,6 @@ impl AttrValue { } } - /// 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 diff --git a/components/style/bloom.rs b/components/style/bloom.rs index d75d548ff71..bd2d7954881 100644 --- a/components/style/bloom.rs +++ b/components/style/bloom.rs @@ -194,11 +194,6 @@ impl<E: TElement> StyleBloom<E> { 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). diff --git a/components/style/data.rs b/components/style/data.rs index fc346156a67..76d64956f19 100644 --- a/components/style/data.rs +++ b/components/style/data.rs @@ -9,9 +9,7 @@ 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; @@ -373,29 +371,6 @@ impl ElementData { 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 @@ -413,11 +388,6 @@ impl ElementData { 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) { @@ -438,13 +408,6 @@ impl ElementData { .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 { diff --git a/components/style/invalidation/element/restyle_hints.rs b/components/style/invalidation/element/restyle_hints.rs index 9dbd12bab59..c0bf2424d52 100644 --- a/components/style/invalidation/element/restyle_hints.rs +++ b/components/style/invalidation/element/restyle_hints.rs @@ -105,12 +105,6 @@ impl RestyleHint { 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() diff --git a/components/style/rule_tree/mod.rs b/components/style/rule_tree/mod.rs index d653b6be99d..a68732cd98c 100644 --- a/components/style/rule_tree/mod.rs +++ b/components/style/rule_tree/mod.rs @@ -135,16 +135,6 @@ impl StyleSource { 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() diff --git a/components/style/sharing/mod.rs b/components/style/sharing/mod.rs index 3ce2a717dc8..2b490a39363 100644 --- a/components/style/sharing/mod.rs +++ b/components/style/sharing/mod.rs @@ -102,15 +102,6 @@ mod checks; 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<()>); diff --git a/components/style/stylesheets/import_rule.rs b/components/style/stylesheets/import_rule.rs index ca82dcb864b..982572673a9 100644 --- a/components/style/stylesheets/import_rule.rs +++ b/components/style/stylesheets/import_rule.rs @@ -21,6 +21,7 @@ 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, diff --git a/components/style/values/specified/source_size_list.rs b/components/style/values/specified/source_size_list.rs index b27bc2875a6..3cb558809ad 100644 --- a/components/style/values/specified/source_size_list.rs +++ b/components/style/values/specified/source_size_list.rs @@ -54,11 +54,6 @@ impl SourceSizeList { } } - /// 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 |