From ac6ac81c6f9a554e1a8f71b0b44e7faade21fe7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Wed, 31 Jul 2019 19:29:19 +0200 Subject: [PATCH] Bug 1404140 - Return early when trying to flush to get the style of a disconnected element. r=heycam We just don't return a styles for them anyway, and this simplifies the following patches a bit. Differential Revision: https://phabricator.services.mozilla.com/D40297 --- layout/style/nsComputedDOMStyle.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/layout/style/nsComputedDOMStyle.cpp b/layout/style/nsComputedDOMStyle.cpp index a480daba2391..c4621210a610 100644 --- a/layout/style/nsComputedDOMStyle.cpp +++ b/layout/style/nsComputedDOMStyle.cpp @@ -828,6 +828,13 @@ void nsComputedDOMStyle::UpdateCurrentStyleSources(bool aNeedsLayoutFlush) { return; } + // We don't return styles for disconnected elements anymore, so don't go + // through the trouble of flushing or what not. + if (!mElement->IsInComposedDoc()) { + ClearComputedStyle(); + return; + } + // TODO(emilio): We may want to handle a few special-cases here: // // * https://github.com/w3c/csswg-drafts/issues/1964