From 2fdf1a9679f16c371604b52ec68652745e81a11f Mon Sep 17 00:00:00 2001 From: Cameron McCormack Date: Thu, 6 Aug 2015 09:16:00 +1000 Subject: [PATCH] Bug 1190254 - Use same conditions to call ReparentStyleContext in RestyleUndisplayedNodes as in RestyleSelf. r=mats --- layout/base/RestyleManager.cpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/layout/base/RestyleManager.cpp b/layout/base/RestyleManager.cpp index 678d0d3e401a..fce068058502 100644 --- a/layout/base/RestyleManager.cpp +++ b/layout/base/RestyleManager.cpp @@ -3997,11 +3997,12 @@ ElementRestyler::RestyleUndisplayedNodes(nsRestyleHint aChildRestyleHint, if (MustRestyleSelf(thisChildHint, element)) { undisplayedContext = styleSet->ResolveStyleFor(element, aParentContext, mTreeMatchContext); - } else if (thisChildHint || - styleSet->IsInRuleTreeReconstruct()) { - // XXX Should the above condition ignore eRestyle_Force(Descendants) - // like the corresponding check in RestyleSelf? - + } else if (CanReparentStyleContext(thisChildHint)) { + undisplayedContext = + styleSet->ReparentStyleContext(undisplayed->mStyle, + aParentContext, + element); + } else { // Use ResolveStyleWithReplacement either for actual // replacements, or as a substitute for ReparentStyleContext // that rebuilds the path in the rule tree rather than reusing @@ -4013,11 +4014,6 @@ ElementRestyler::RestyleUndisplayedNodes(nsRestyleHint aChildRestyleHint, aParentContext, undisplayed->mStyle, rshint); - } else { - undisplayedContext = - styleSet->ReparentStyleContext(undisplayed->mStyle, - aParentContext, - element); } const nsStyleDisplay* display = undisplayedContext->StyleDisplay(); if (display->mDisplay != aDisplay) {