Auto merge of #23532 - est31:unused_code_removal_4, r=emilio

Remove unused code (4/4)

<!-- Please describe your changes on the following line: -->

Fourth and final PR in a series of PRs to remove unused/dead code from servo, powered by an (upcoming) tool of mine. Please take a look and tell me if you want to keep something.

* First PR: #23477
* Second PR: #23498
* Third PR: #23499

Shortstat of the combined PR series:
```
47 files changed, 7 insertions(+), 805 deletions(-)
```

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors

<!-- Either: -->
- [ ] There are tests for these changes OR
- [x] These changes do not require tests because they only remove dead code

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/23532)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2019-06-07 20:27:53 -04:00 committed by GitHub
commit 0d5c6a0c37
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 1 additions and 101 deletions

View file

@ -181,14 +181,6 @@ impl KeyframesAnimationState {
self.current_direction = old_direction; self.current_direction = old_direction;
self.started_at = new_started_at; 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 { 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. /// Whether this animation is a transition.
#[inline] #[inline]
pub fn is_transition(&self) -> bool { pub fn is_transition(&self) -> bool {

View file

@ -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 /// Assumes the `AttrValue` is a `Dimension` and returns its value
/// ///
/// ## Panics /// ## Panics

View file

@ -194,11 +194,6 @@ impl<E: TElement> StyleBloom<E> {
Some(popped_element) 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 /// Returns the DOM depth of elements that can be correctly
/// matched against the bloom filter (that is, the number of /// matched against the bloom filter (that is, the number of
/// elements in our list). /// elements in our list).

View file

@ -9,9 +9,7 @@ use crate::dom::TElement;
use crate::invalidation::element::invalidator::InvalidationResult; use crate::invalidation::element::invalidator::InvalidationResult;
use crate::invalidation::element::restyle_hints::RestyleHint; use crate::invalidation::element::restyle_hints::RestyleHint;
use crate::properties::ComputedValues; use crate::properties::ComputedValues;
use crate::rule_tree::StrongRuleNode;
use crate::selector_parser::{PseudoElement, RestyleDamage, EAGER_PSEUDO_COUNT}; use crate::selector_parser::{PseudoElement, RestyleDamage, EAGER_PSEUDO_COUNT};
use crate::shared_lock::StylesheetGuards;
use crate::style_resolver::{PrimaryStyle, ResolvedElementStyles, ResolvedStyle}; use crate::style_resolver::{PrimaryStyle, ResolvedElementStyles, ResolvedStyle};
#[cfg(feature = "gecko")] #[cfg(feature = "gecko")]
use malloc_size_of::MallocSizeOfOps; use malloc_size_of::MallocSizeOfOps;
@ -373,29 +371,6 @@ impl ElementData {
return RestyleKind::CascadeOnly; 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. /// Drops any restyle state from the element.
/// ///
/// FIXME(bholley): The only caller of this should probably just assert that /// FIXME(bholley): The only caller of this should probably just assert that
@ -413,11 +388,6 @@ impl ElementData {
self.flags.remove(ElementDataFlags::WAS_RESTYLED); 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 /// Mark this element as restyled, which is useful to know whether we need
/// to do a post-traversal. /// to do a post-traversal.
pub fn set_restyled(&mut self) { pub fn set_restyled(&mut self) {
@ -438,13 +408,6 @@ impl ElementData {
.insert(ElementDataFlags::TRAVERSED_WITHOUT_STYLING); .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. /// Returns whether this element has been part of a restyle.
#[inline] #[inline]
pub fn contains_restyle_data(&self) -> bool { pub fn contains_restyle_data(&self) -> bool {

View file

@ -105,12 +105,6 @@ impl RestyleHint {
Self::empty() 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. /// Returns a hint that contains all the replacement hints.
pub fn replacements() -> Self { pub fn replacements() -> Self {
RestyleHint::RESTYLE_STYLE_ATTRIBUTE | Self::for_animations() RestyleHint::RESTYLE_STYLE_ATTRIBUTE | Self::for_animations()

View file

@ -154,16 +154,6 @@ impl StyleSource {
block.read_with(guard) 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. /// Returns the style rule if applicable, otherwise None.
pub fn as_rule(&self) -> Option<ArcBorrow<Locked<StyleRule>>> { pub fn as_rule(&self) -> Option<ArcBorrow<Locked<StyleRule>>> {
self.0.as_first() self.0.as_first()

View file

@ -102,15 +102,6 @@ mod checks;
pub const SHARING_CACHE_SIZE: usize = 31; pub const SHARING_CACHE_SIZE: usize = 31;
const SHARING_CACHE_BACKING_STORE_SIZE: usize = SHARING_CACHE_SIZE + 1; 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. /// Opaque pointer type to compare ComputedValues identities.
#[derive(Clone, Debug, Eq, PartialEq)] #[derive(Clone, Debug, Eq, PartialEq)]
pub struct OpaqueComputedValues(NonNull<()>); pub struct OpaqueComputedValues(NonNull<()>);

View file

@ -21,6 +21,7 @@ use to_shmem::{SharedMemoryBuilder, ToShmem};
/// With asynchronous stylesheet parsing, we can't synchronously create a /// With asynchronous stylesheet parsing, we can't synchronously create a
/// GeckoStyleSheet. So we use this placeholder instead. /// GeckoStyleSheet. So we use this placeholder instead.
#[cfg(feature = "gecko")]
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub struct PendingSheet { pub struct PendingSheet {
origin: Origin, origin: Origin,

View file

@ -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. /// Evaluate this <source-size-list> to get the final viewport length.
pub fn evaluate(&self, device: &Device, quirks_mode: QuirksMode) -> Au { pub fn evaluate(&self, device: &Device, quirks_mode: QuirksMode) -> Au {
let matching_source_size = self let matching_source_size = self