mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
style: Use Option::as_deref() in style code.
And drive-by simplify another function that was only doing Option::clone(). Differential Revision: https://phabricator.services.mozilla.com/D92839
This commit is contained in:
parent
379fb984f1
commit
384fd59ad0
4 changed files with 10 additions and 16 deletions
|
@ -472,7 +472,7 @@ impl<'a, 'i> ::selectors::Parser<'i> for SelectorParser<'a> {
|
|||
}
|
||||
|
||||
fn default_namespace(&self) -> Option<Namespace> {
|
||||
self.namespaces.default.as_ref().map(|ns| ns.clone())
|
||||
self.namespaces.default.clone()
|
||||
}
|
||||
|
||||
fn namespace_for_prefix(&self, prefix: &Atom) -> Option<Namespace> {
|
||||
|
|
|
@ -395,7 +395,7 @@ trait PrivateMatchMethods: TElement {
|
|||
if context.shared.traversal_flags.for_animation_only() {
|
||||
self.handle_display_change_for_smil_if_needed(
|
||||
context,
|
||||
old_values.as_ref().map(|v| &**v),
|
||||
old_values.as_deref(),
|
||||
new_values,
|
||||
restyle_hint,
|
||||
);
|
||||
|
@ -408,7 +408,7 @@ trait PrivateMatchMethods: TElement {
|
|||
let mut tasks = UpdateAnimationsTasks::empty();
|
||||
if self.needs_animations_update(
|
||||
context,
|
||||
old_values.as_ref().map(|s| &**s),
|
||||
old_values.as_deref(),
|
||||
new_values,
|
||||
/* pseudo_element = */ None,
|
||||
) {
|
||||
|
@ -417,7 +417,7 @@ trait PrivateMatchMethods: TElement {
|
|||
|
||||
let before_change_style = if self.might_need_transitions_update(
|
||||
context,
|
||||
old_values.as_ref().map(|s| &**s),
|
||||
old_values.as_deref(),
|
||||
new_values,
|
||||
/* pseudo_element = */ None,
|
||||
) {
|
||||
|
@ -460,7 +460,7 @@ trait PrivateMatchMethods: TElement {
|
|||
if important_rules_changed {
|
||||
tasks.insert(UpdateAnimationsTasks::CASCADE_RESULTS);
|
||||
}
|
||||
if new_values.is_display_property_changed_from_none(old_values.as_ref().map(|s| &**s)) {
|
||||
if new_values.is_display_property_changed_from_none(old_values.as_deref()) {
|
||||
tasks.insert(UpdateAnimationsTasks::DISPLAY_CHANGED_FROM_NONE);
|
||||
}
|
||||
}
|
||||
|
@ -638,14 +638,14 @@ trait PrivateMatchMethods: TElement {
|
|||
// map because this call will do a RwLock::read().
|
||||
let needs_animations_update = self.needs_animations_update(
|
||||
context,
|
||||
old_values.as_ref().map(|s| &**s),
|
||||
old_values.as_deref(),
|
||||
new_values,
|
||||
pseudo_element,
|
||||
);
|
||||
|
||||
let might_need_transitions_update = self.might_need_transitions_update(
|
||||
context,
|
||||
old_values.as_ref().map(|s| &**s),
|
||||
old_values.as_deref(),
|
||||
new_values,
|
||||
pseudo_element,
|
||||
);
|
||||
|
|
|
@ -2966,7 +2966,7 @@ impl ComputedValues {
|
|||
|
||||
/// Returns the visited style, if any.
|
||||
pub fn visited_style(&self) -> Option<<&ComputedValues> {
|
||||
self.visited_style.as_ref().map(|s| &**s)
|
||||
self.visited_style.as_deref()
|
||||
}
|
||||
|
||||
/// Returns the visited rules, if applicable.
|
||||
|
|
|
@ -351,10 +351,7 @@ where
|
|||
rule_inclusion,
|
||||
PseudoElementResolution::IfApplicable,
|
||||
)
|
||||
.resolve_primary_style(
|
||||
style.as_ref().map(|s| &**s),
|
||||
layout_parent_style.as_ref().map(|s| &**s),
|
||||
);
|
||||
.resolve_primary_style(style.as_deref(), layout_parent_style.as_deref());
|
||||
|
||||
let is_display_contents = primary_style.style().is_display_contents();
|
||||
|
||||
|
@ -373,10 +370,7 @@ where
|
|||
rule_inclusion,
|
||||
PseudoElementResolution::Force,
|
||||
)
|
||||
.resolve_style(
|
||||
style.as_ref().map(|s| &**s),
|
||||
layout_parent_style.as_ref().map(|s| &**s),
|
||||
)
|
||||
.resolve_style(style.as_deref(), layout_parent_style.as_deref())
|
||||
.into()
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue