diff --git a/layout/base/RestyleManager.cpp b/layout/base/RestyleManager.cpp index c0a99e1ad5e3..53fa780547c5 100644 --- a/layout/base/RestyleManager.cpp +++ b/layout/base/RestyleManager.cpp @@ -941,7 +941,8 @@ RestyleManager::RestyleElement(Element* aElement, // If we're restyling the root element and there are 'rem' units in // use, handle dynamic changes to the definition of a 'rem' here. - if (mPresContext->UsesRootEMUnits() && aPrimaryFrame) { + if (mPresContext->UsesRootEMUnits() && aPrimaryFrame && + !mInRebuildAllStyleData) { nsStyleContext *oldContext = aPrimaryFrame->StyleContext(); if (!oldContext->GetParent()) { // check that we're the root element nsRefPtr newContext = mPresContext->StyleSet()-> @@ -949,10 +950,9 @@ RestyleManager::RestyleElement(Element* aElement, if (oldContext->StyleFont()->mFont.size != newContext->StyleFont()->mFont.size) { // The basis for 'rem' units has changed. - newContext = nullptr; mRebuildAllRestyleHint |= aRestyleHint; NS_UpdateHint(mRebuildAllExtraHint, aMinHint); - DoRebuildAllStyleData(aRestyleTracker); + StartRebuildAllStyleData(aRestyleTracker); return; } }