mirror of
https://github.com/servo/servo.git
synced 2025-07-03 13:33:39 +01:00
Don't assume that inputs to compute_style_with_inputs have any rules.
It could be a text style, which never has any rules attached to it. Fixes https://bugzilla.mozilla.org/show_bug.cgi?id=1406222
This commit is contained in:
parent
f3191db2b1
commit
b488b321ed
1 changed files with 4 additions and 4 deletions
|
@ -894,12 +894,12 @@ impl Stylist {
|
||||||
// We need to compute visited values if we have visited rules or if our
|
// We need to compute visited values if we have visited rules or if our
|
||||||
// parent has visited values.
|
// parent has visited values.
|
||||||
let visited_values = if inputs.visited_rules.is_some() || parent_style.visited_style().is_some() {
|
let visited_values = if inputs.visited_rules.is_some() || parent_style.visited_style().is_some() {
|
||||||
// Slightly annoying: we know that inputs has either rules or
|
// At this point inputs may have visited rules, or rules, or both,
|
||||||
// visited rules, but we can't do inputs.rules() up front because
|
// or neither (e.g. if it's a text style it may have neither). So
|
||||||
// maybe it just has visited rules, so can't unwrap_or.
|
// we have to be a bit careful here.
|
||||||
let rule_node = match inputs.visited_rules.as_ref() {
|
let rule_node = match inputs.visited_rules.as_ref() {
|
||||||
Some(rules) => rules,
|
Some(rules) => rules,
|
||||||
None => inputs.rules.as_ref().unwrap(),
|
None => inputs.rules.as_ref().unwrap_or(self.rule_tree().root()),
|
||||||
};
|
};
|
||||||
let inherited_style;
|
let inherited_style;
|
||||||
let inherited_style_ignoring_first_line;
|
let inherited_style_ignoring_first_line;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue