aboutsummaryrefslogblamecommitdiff
path: root/www/waterfox/files/patch-bug1406222
blob: 86efe7c15e63ec16bc9d693c06ace6495840d7ea (plain) (tree)






































                                                                                                               
commit 04dfc1bac3e0
Author: Boris Zbarsky <bzbarsky@mit.edu>
Date:   Fri Oct 6 01:53:12 2017 -0500

    Bug 1406222 - servo: Don't assume that inputs to compute_style_with_inputs have any rules. r=heycam, a=ritu
    
    It could be a text style, which never has any rules attached to it.
    
    Source-Repo: https://github.com/servo/servo
    Source-Revision: 117dbfaac20d8a388cf3cf5d2bc103b9d6249ee8
    
    --HG--
    extra : source : 97fcd35b0d3792e7305bcb46b303ce409b30d23e
    extra : histedit_source : 72acaec12ed99fa306148b7679c682abc0abaeea
---
 servo/components/style/stylist.rs | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git servo/components/style/stylist.rs servo/components/style/stylist.rs
index b40c5825a55c..e6feb6f26d15 100644
--- servo/components/style/stylist.rs
+++ servo/components/style/stylist.rs
@@ -896,12 +896,12 @@ impl Stylist {
         // We need to compute visited values if we have visited rules or if our
         // parent has visited values.
         let visited_values = if inputs.visited_rules.is_some() || parent_style.get_visited_style().is_some() {
-            // Slightly annoying: we know that inputs has either rules or
-            // visited rules, but we can't do inputs.rules() up front because
-            // maybe it just has visited rules, so can't unwrap_or.
+            // At this point inputs may have visited rules, or rules, or both,
+            // or neither (e.g. if it's a text style it may have neither).  So
+            // we have to be a bit careful here.
             let rule_node = match inputs.visited_rules.as_ref() {
                 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_ignoring_first_line;