Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused code (4/4) #23532

Merged
merged 1 commit into from Jun 8, 2019
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Remove unused code from selector and style crates

  • Loading branch information
est31 committed Jun 7, 2019
commit 642b7c3ea19cefbedbc881894e5679e7a5dd33ce
@@ -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 {
@@ -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
@@ -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).
@@ -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 {
@@ -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()
@@ -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()
@@ -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<()>);
@@ -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,
@@ -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
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.