From 2e08ab14920aab58a7077001500483efc22bb469 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Sat, 3 Feb 2018 20:45:56 +0100 Subject: [PATCH] style: Handle correctly nested links. Followup to #19935, since I'm dumb and missed that orange. --- components/style/style_adjuster.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/components/style/style_adjuster.rs b/components/style/style_adjuster.rs index df80cb83723..7a637dcf842 100644 --- a/components/style/style_adjuster.rs +++ b/components/style/style_adjuster.rs @@ -552,8 +552,15 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> { self.style.pseudo.is_none() && element.map_or(false, |e| e.is_link()); - if is_link_element && element.unwrap().is_visited_link() { + if !is_link_element { + return; + } + + if element.unwrap().is_visited_link() { self.style.flags.insert(ComputedValueFlags::IS_RELEVANT_LINK_VISITED); + } else { + // Need to remove to handle unvisited link inside visited. + self.style.flags.remove(ComputedValueFlags::IS_RELEVANT_LINK_VISITED); } }