Skip to content

Commit 0d5c6a0

Browse files
author
bors-servo
authored
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 -->
2 parents 626c431 + 642b7c3 commit 0d5c6a0

File tree

9 files changed

+1
-101
lines changed

9 files changed

+1
-101
lines changed

components/style/animation.rs

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -181,14 +181,6 @@ impl KeyframesAnimationState {
181181
self.current_direction = old_direction;
182182
self.started_at = new_started_at;
183183
}
184-
185-
#[inline]
186-
fn is_paused(&self) -> bool {
187-
match self.running_state {
188-
KeyframesRunningState::Paused(..) => true,
189-
KeyframesRunningState::Running => false,
190-
}
191-
}
192184
}
193185

194186
impl fmt::Debug for KeyframesAnimationState {
@@ -245,15 +237,6 @@ impl Animation {
245237
}
246238
}
247239

248-
/// Whether this animation is paused. A transition can never be paused.
249-
#[inline]
250-
pub fn is_paused(&self) -> bool {
251-
match *self {
252-
Animation::Transition(..) => false,
253-
Animation::Keyframes(_, _, _, ref state) => state.is_paused(),
254-
}
255-
}
256-
257240
/// Whether this animation is a transition.
258241
#[inline]
259242
pub fn is_transition(&self) -> bool {

components/style/attr.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -298,18 +298,6 @@ impl AttrValue {
298298
}
299299
}
300300

301-
/// Assumes the `AttrValue` is a `Length` and returns its value
302-
///
303-
/// ## Panics
304-
///
305-
/// Panics if the `AttrValue` is not a `Length`
306-
pub fn as_length(&self) -> Option<&Length> {
307-
match *self {
308-
AttrValue::Length(_, ref length) => length.as_ref(),
309-
_ => panic!("Length not found"),
310-
}
311-
}
312-
313301
/// Assumes the `AttrValue` is a `Dimension` and returns its value
314302
///
315303
/// ## Panics

components/style/bloom.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -194,11 +194,6 @@ impl<E: TElement> StyleBloom<E> {
194194
Some(popped_element)
195195
}
196196

197-
/// Returns true if the bloom filter is empty.
198-
pub fn is_empty(&self) -> bool {
199-
self.elements.is_empty()
200-
}
201-
202197
/// Returns the DOM depth of elements that can be correctly
203198
/// matched against the bloom filter (that is, the number of
204199
/// elements in our list).

components/style/data.rs

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ use crate::dom::TElement;
99
use crate::invalidation::element::invalidator::InvalidationResult;
1010
use crate::invalidation::element::restyle_hints::RestyleHint;
1111
use crate::properties::ComputedValues;
12-
use crate::rule_tree::StrongRuleNode;
1312
use crate::selector_parser::{PseudoElement, RestyleDamage, EAGER_PSEUDO_COUNT};
14-
use crate::shared_lock::StylesheetGuards;
1513
use crate::style_resolver::{PrimaryStyle, ResolvedElementStyles, ResolvedStyle};
1614
#[cfg(feature = "gecko")]
1715
use malloc_size_of::MallocSizeOfOps;
@@ -373,29 +371,6 @@ impl ElementData {
373371
return RestyleKind::CascadeOnly;
374372
}
375373

376-
/// Return true if important rules are different.
377-
/// We use this to make sure the cascade of off-main thread animations is correct.
378-
/// Note: Ignore custom properties for now because we only support opacity and transform
379-
/// properties for animations running on compositor. Actually, we only care about opacity
380-
/// and transform for now, but it's fine to compare all properties and let the user
381-
/// the check which properties do they want.
382-
/// If it costs too much, get_properties_overriding_animations() should return a set
383-
/// containing only opacity and transform properties.
384-
pub fn important_rules_are_different(
385-
&self,
386-
rules: &StrongRuleNode,
387-
guards: &StylesheetGuards,
388-
) -> bool {
389-
debug_assert!(self.has_styles());
390-
let (important_rules, _custom) = self
391-
.styles
392-
.primary()
393-
.rules()
394-
.get_properties_overriding_animations(&guards);
395-
let (other_important_rules, _custom) = rules.get_properties_overriding_animations(&guards);
396-
important_rules != other_important_rules
397-
}
398-
399374
/// Drops any restyle state from the element.
400375
///
401376
/// FIXME(bholley): The only caller of this should probably just assert that
@@ -413,11 +388,6 @@ impl ElementData {
413388
self.flags.remove(ElementDataFlags::WAS_RESTYLED);
414389
}
415390

416-
/// Returns whether this element is going to be reconstructed.
417-
pub fn reconstructed_self(&self) -> bool {
418-
self.damage.contains(RestyleDamage::reconstruct())
419-
}
420-
421391
/// Mark this element as restyled, which is useful to know whether we need
422392
/// to do a post-traversal.
423393
pub fn set_restyled(&mut self) {
@@ -438,13 +408,6 @@ impl ElementData {
438408
.insert(ElementDataFlags::TRAVERSED_WITHOUT_STYLING);
439409
}
440410

441-
/// Returns whether the element was traversed without computing any style for
442-
/// it.
443-
pub fn traversed_without_styling(&self) -> bool {
444-
self.flags
445-
.contains(ElementDataFlags::TRAVERSED_WITHOUT_STYLING)
446-
}
447-
448411
/// Returns whether this element has been part of a restyle.
449412
#[inline]
450413
pub fn contains_restyle_data(&self) -> bool {

components/style/invalidation/element/restyle_hints.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,6 @@ impl RestyleHint {
105105
Self::empty()
106106
}
107107

108-
/// Creates a new `RestyleHint` that indicates the element must be
109-
/// recascaded.
110-
pub fn recascade_self() -> Self {
111-
RestyleHint::RECASCADE_SELF
112-
}
113-
114108
/// Returns a hint that contains all the replacement hints.
115109
pub fn replacements() -> Self {
116110
RestyleHint::RESTYLE_STYLE_ATTRIBUTE | Self::for_animations()

components/style/rule_tree/mod.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -154,16 +154,6 @@ impl StyleSource {
154154
block.read_with(guard)
155155
}
156156

157-
/// Indicates if this StyleSource is a style rule.
158-
pub fn is_rule(&self) -> bool {
159-
self.0.is_first()
160-
}
161-
162-
/// Indicates if this StyleSource is a PropertyDeclarationBlock.
163-
pub fn is_declarations(&self) -> bool {
164-
self.0.is_second()
165-
}
166-
167157
/// Returns the style rule if applicable, otherwise None.
168158
pub fn as_rule(&self) -> Option<ArcBorrow<Locked<StyleRule>>> {
169159
self.0.as_first()

components/style/sharing/mod.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -102,15 +102,6 @@ mod checks;
102102
pub const SHARING_CACHE_SIZE: usize = 31;
103103
const SHARING_CACHE_BACKING_STORE_SIZE: usize = SHARING_CACHE_SIZE + 1;
104104

105-
/// Controls whether the style sharing cache is used.
106-
#[derive(Clone, Copy, PartialEq)]
107-
pub enum StyleSharingBehavior {
108-
/// Style sharing allowed.
109-
Allow,
110-
/// Style sharing disallowed.
111-
Disallow,
112-
}
113-
114105
/// Opaque pointer type to compare ComputedValues identities.
115106
#[derive(Clone, Debug, Eq, PartialEq)]
116107
pub struct OpaqueComputedValues(NonNull<()>);

components/style/stylesheets/import_rule.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ use to_shmem::{SharedMemoryBuilder, ToShmem};
2121

2222
/// With asynchronous stylesheet parsing, we can't synchronously create a
2323
/// GeckoStyleSheet. So we use this placeholder instead.
24+
#[cfg(feature = "gecko")]
2425
#[derive(Clone, Debug)]
2526
pub struct PendingSheet {
2627
origin: Origin,

components/style/values/specified/source_size_list.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,6 @@ impl SourceSizeList {
5454
}
5555
}
5656

57-
/// Set content of `value`, which can be used as fall-back during evaluate.
58-
pub fn set_fallback_value(&mut self, width: Option<Length>) {
59-
self.value = width;
60-
}
61-
6257
/// Evaluate this <source-size-list> to get the final viewport length.
6358
pub fn evaluate(&self, device: &Device, quirks_mode: QuirksMode) -> Au {
6459
let matching_source_size = self

0 commit comments

Comments
 (0)