Bug 1115812 patch 15 - Change the rebuild-all that we do for 'rem' unit changes to use the new way. r=heycam

This means that instead of recurring into DoRebuildAllStyleData, we'll
call StartRebuildAllStyleData in the middle of processing the restyle
queue (which is fine).  StartRebuildAllStyleData will move the old rule
tree out of the way and immediately do a full-tree restyle, before
returning to any queue processing that might be left (the full-tree
restyle should have consumed all remaining restyle hints, but might have
posted some new ones for handling reframes that require reframing
ancestors).  And, more importantly, the EndReconstruct() call to get rid
of the old rule tree won't happen until after we're done processing the
containing RestyleTracker's queue of restyles, which reduces the risk of
having dangling old style contexts and makes it easier (in bug 1110277)
to have a ReframingStyleContexts with the right lifetime.
This commit is contained in:
L. David Baron 2015-01-13 21:03:12 -08:00
Родитель eed121aaa9
Коммит f9abbf6ae0
1 изменённых файлов: 3 добавлений и 3 удалений

Просмотреть файл

@ -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<nsStyleContext> 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;
}
}