Bug 1115812 patch 3 - Pass the hints to DoRebuildAllStyleData via the member variables, in preparation for future refactoring. r=heycam

Part of this refactoring involves the ability to start the rebuild-all
process within the processing of restyles.  This means we can't pass
parameters directly from RebuildAllStyleData into DoRebuildAllStyleData.
So this continues storing the hints as member variables a little bit
deeper into the process.

(I tried to move in a different direction in this patch queue, and store
these hints in mPendingRestyles, for the root element.  But that broke
layout/style/test/test_counter_style.html and
layout/style/test/test_font_loading_api.html, and I didn't want to
figure out why.  It would be somewhat better in the long run, since
currently these hints will get processed if we do a rebuild-all on a
RestyleTracker other than mPendingRestyles, which can happen if we have
'rem' units and have a root element font size change in the
animation-only update or in mPendingAnimationRestyles.)
This commit is contained in:
L. David Baron 2015-01-13 21:03:11 -08:00
Родитель 5d1c7926f6
Коммит a6b18a766a
2 изменённых файлов: 19 добавлений и 19 удалений

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

@ -949,7 +949,8 @@ RestyleManager::RestyleElement(Element* aElement,
newContext->StyleFont()->mFont.size) {
// The basis for 'rem' units has changed.
newContext = nullptr;
DoRebuildAllStyleData(aRestyleTracker, nsChangeHint(0), aRestyleHint);
mRebuildAllRestyleHint |= aRestyleHint;
DoRebuildAllStyleData(aRestyleTracker);
if (aMinHint == 0) {
return;
}
@ -1478,10 +1479,8 @@ RestyleManager::RebuildAllStyleData(nsChangeHint aExtraHint,
"Use ReconstructDocElementHierarchy instead.");
mRebuildAllStyleData = false;
NS_UpdateHint(aExtraHint, mRebuildAllExtraHint);
aRestyleHint |= mRebuildAllRestyleHint;
mRebuildAllExtraHint = nsChangeHint(0);
mRebuildAllRestyleHint = nsRestyleHint(0);
NS_UpdateHint(mRebuildAllExtraHint, aExtraHint);
mRebuildAllRestyleHint |= aRestyleHint;
nsIPresShell* presShell = mPresContext->GetPresShell();
if (!presShell || !presShell->GetRootFrame())
@ -1512,7 +1511,7 @@ RestyleManager::RebuildAllStyleData(nsChangeHint aExtraHint,
mSkipAnimationRules = true;
mPostAnimationRestyles = true;
DoRebuildAllStyleData(mPendingRestyles, aExtraHint, aRestyleHint);
DoRebuildAllStyleData(mPendingRestyles);
mPostAnimationRestyles = false;
mSkipAnimationRules = false;
@ -1528,9 +1527,7 @@ RestyleManager::RebuildAllStyleData(nsChangeHint aExtraHint,
}
void
RestyleManager::DoRebuildAllStyleData(RestyleTracker& aRestyleTracker,
nsChangeHint aExtraHint,
nsRestyleHint aRestyleHint)
RestyleManager::DoRebuildAllStyleData(RestyleTracker& aRestyleTracker)
{
// Tell the style set to get the old rule tree out of the way
// so we can recalculate while maintaining rule tree immutability
@ -1539,15 +1536,20 @@ RestyleManager::DoRebuildAllStyleData(RestyleTracker& aRestyleTracker,
return;
}
nsRestyleHint restyleHint = mRebuildAllRestyleHint;
nsChangeHint changeHint = mRebuildAllExtraHint;
mRebuildAllExtraHint = nsChangeHint(0);
mRebuildAllRestyleHint = nsRestyleHint(0);
// Until we get rid of these phases in bug 960465, we need to add
// eRestyle_ChangeAnimationPhaseDescendants so that we actually honor
// these booleans in all cases.
aRestyleHint |= eRestyle_ChangeAnimationPhaseDescendants;
restyleHint |= eRestyle_ChangeAnimationPhaseDescendants;
aRestyleHint = aRestyleHint | eRestyle_ForceDescendants;
restyleHint |= eRestyle_ForceDescendants;
if (!(aRestyleHint & eRestyle_Subtree) &&
(aRestyleHint & ~(eRestyle_Force | eRestyle_ForceDescendants))) {
if (!(restyleHint & eRestyle_Subtree) &&
(restyleHint & ~(eRestyle_Force | eRestyle_ForceDescendants))) {
// We want this hint to apply to the root node's primary frame
// rather than the root frame, since it's the primary frame that has
// the styles for the root element (rather than the ancestors of the
@ -1559,9 +1561,9 @@ RestyleManager::DoRebuildAllStyleData(RestyleTracker& aRestyleTracker,
if (root) {
// If the root element is gone, dropping the hint on the floor
// should be fine.
aRestyleTracker.AddPendingRestyle(root, aRestyleHint, nsChangeHint(0));
aRestyleTracker.AddPendingRestyle(root, restyleHint, nsChangeHint(0));
}
aRestyleHint = nsRestyleHint(0);
restyleHint = nsRestyleHint(0);
}
// Recalculate all of the style contexts for the document
@ -1572,7 +1574,7 @@ RestyleManager::DoRebuildAllStyleData(RestyleTracker& aRestyleTracker,
// roughly what we do for aRestyleHint above.)
// Note: The restyle tracker we pass in here doesn't matter.
ComputeAndProcessStyleChange(mPresContext->PresShell()->GetRootFrame(),
aExtraHint, aRestyleTracker, aRestyleHint);
changeHint, aRestyleTracker, restyleHint);
FlushOverflowChangedTracker();
// Tell the style set it's safe to destroy the old rule tree. We

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

@ -329,9 +329,7 @@ public:
// Helper that does part of the work of RebuildAllStyleData, shared by
// RestyleElement for 'rem' handling.
void DoRebuildAllStyleData(RestyleTracker& aRestyleTracker,
nsChangeHint aExtraHint,
nsRestyleHint aRestyleHint);
void DoRebuildAllStyleData(RestyleTracker& aRestyleTracker);
// See PostRestyleEventCommon below.
void PostRestyleEvent(Element* aElement,