From 3e3d930acb9f54a3f5426c5cbd920b9bdf5ecc99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Thu, 19 Apr 2018 18:18:35 +0200 Subject: [PATCH] Bug 1455108: Don't reparent first-line stuff in display: none subtrees. r=heycam We may no longer know what the right parent style is, and it's not like it matters anyway, the frame tree under us is dead, including placeholders and such holding from us. MozReview-Commit-ID: 1RHTwvKy0zQ --HG-- extra : rebase_source : 26e9d393d8edc0f068736cfa1cf1cf630e8d55fa --- layout/base/RestyleManager.cpp | 8 +++++++- layout/style/crashtests/1455108.html | 17 +++++++++++++++++ layout/style/crashtests/crashtests.list | 1 + 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 layout/style/crashtests/1455108.html diff --git a/layout/base/RestyleManager.cpp b/layout/base/RestyleManager.cpp index 386a823e7987..dd37beeed48c 100644 --- a/layout/base/RestyleManager.cpp +++ b/layout/base/RestyleManager.cpp @@ -3522,7 +3522,7 @@ RestyleManager::DoReparentComputedStyleForFirstLine(nsIFrame* aFrame, ReparentFrameDescendants(aFrame, providerChild, aStyleSet); // We do not need to do the equivalent of UpdateFramePseudoElementStyles, - // because those are hadled by our descendant walk. + // because those are handled by our descendant walk. } void @@ -3530,6 +3530,12 @@ RestyleManager::ReparentFrameDescendants(nsIFrame* aFrame, nsIFrame* aProviderChild, ServoStyleSet& aStyleSet) { + if (aFrame->GetContent()->IsElement() && + !aFrame->GetContent()->AsElement()->HasServoData()) { + // We're getting into a display: none subtree, avoid reparenting into stuff + // that is going to go away anyway in seconds. + return; + } nsIFrame::ChildListIterator lists(aFrame); for (; !lists.IsDone(); lists.Next()) { for (nsIFrame* child : lists.CurrentList()) { diff --git a/layout/style/crashtests/1455108.html b/layout/style/crashtests/1455108.html new file mode 100644 index 000000000000..29b146779704 --- /dev/null +++ b/layout/style/crashtests/1455108.html @@ -0,0 +1,17 @@ + + +
Yo, I'm a first-line really + diff --git a/layout/style/crashtests/crashtests.list b/layout/style/crashtests/crashtests.list index bf19178b9566..7300e05c27ec 100644 --- a/layout/style/crashtests/crashtests.list +++ b/layout/style/crashtests/crashtests.list @@ -273,3 +273,4 @@ pref(dom.webcomponents.shadowdom.enabled,true) load 1445682.html load 1450691.html pref(dom.webcomponents.shadowdom.enabled,true) load 1453206.html load 1454140.html +load 1455108.html