From 27e04008918acb939eeef74e1eb535d564b5f692 Mon Sep 17 00:00:00 2001 From: Martin Robinson Date: Mon, 20 Jan 2020 13:54:23 +0100 Subject: [PATCH] Fix an issue with `unset_boxes_in_subtree` in layout_2020 If the root node of the subtree doesn't have any boxes to unset, we should exit early instead of unsetting boxes on siblings of the root. This eliminates an infinite loop in this method, since the siblings of the root are not in the subtree. --- components/layout_2020/dom_traversal.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/components/layout_2020/dom_traversal.rs b/components/layout_2020/dom_traversal.rs index 5ccf8310d53..9d8f54f057e 100644 --- a/components/layout_2020/dom_traversal.rs +++ b/components/layout_2020/dom_traversal.rs @@ -426,8 +426,13 @@ where node = child; continue; } + } else if node == self { + // If this is the root of the subtree and we aren't descending + // into our children return now. + return; } } + let mut next_is_a_sibling_of = node; node = loop { if let Some(sibling) = next_is_a_sibling_of.next_sibling() {