Bug 1026768 - Pass the restyle hint through from ProcessOneRestyle to ComputeStyleChangeFor rather than converting it to a boolean and back. r=heycam

This was originally bug 996796 patch 6, but it's also needed bug 931668,
so I'm moving it into its own bug.
This commit is contained in:
L. David Baron 2014-06-18 17:07:26 -07:00
parent 31d0f794c2
commit 4afc1f2e9a
3 changed files with 14 additions and 9 deletions

View File

@ -849,7 +849,7 @@ RestyleManager::RestyleElement(Element* aElement,
nsIFrame* aPrimaryFrame,
nsChangeHint aMinHint,
RestyleTracker& aRestyleTracker,
bool aRestyleDescendants)
nsRestyleHint aRestyleHint)
{
NS_ASSERTION(aPrimaryFrame == aElement->GetPrimaryFrame(),
"frame/content mismatch");
@ -886,7 +886,7 @@ RestyleManager::RestyleElement(Element* aElement,
} else if (aPrimaryFrame) {
nsStyleChangeList changeList;
ComputeStyleChangeFor(aPrimaryFrame, &changeList, aMinHint,
aRestyleTracker, aRestyleDescendants);
aRestyleTracker, aRestyleHint);
ProcessRestyledFrames(changeList);
} else {
// no frames, reconstruct for content
@ -1422,7 +1422,7 @@ RestyleManager::DoRebuildAllStyleData(RestyleTracker& aRestyleTracker,
// Note: The restyle tracker we pass in here doesn't matter.
ComputeStyleChangeFor(mPresContext->PresShell()->GetRootFrame(),
&changeList, aExtraHint,
aRestyleTracker, true);
aRestyleTracker, eRestyle_Subtree);
// Process the required changes
ProcessRestyledFrames(changeList);
FlushOverflowChangedTracker();
@ -2301,6 +2301,9 @@ ElementRestyler::Restyle(nsRestyleHint aRestyleHint)
NS_ASSERTION(!GetPrevContinuationWithSameStyle(mFrame),
"should not be trying to restyle this frame separately");
MOZ_ASSERT(!(aRestyleHint & eRestyle_LaterSiblings),
"eRestyle_LaterSiblings must not be part of aRestyleHint");
if (mContent && mContent->IsElement()) {
mContent->OwnerDoc()->FlushPendingLinkUpdates();
RestyleTracker::RestyleData restyleData;
@ -2336,6 +2339,9 @@ ElementRestyler::Restyle(nsRestyleHint aRestyleHint)
void
ElementRestyler::RestyleSelf(nsIFrame* aSelf, nsRestyleHint aRestyleHint)
{
MOZ_ASSERT(!(aRestyleHint & eRestyle_LaterSiblings),
"eRestyle_LaterSiblings must not be part of aRestyleHint");
// XXXldb get new context from prev-in-flow if possible, to avoid
// duplication. (Or should we just let |GetContext| handle that?)
// Getting the hint would be nice too, but that's harder.
@ -2929,7 +2935,7 @@ RestyleManager::ComputeStyleChangeFor(nsIFrame* aFrame,
nsStyleChangeList* aChangeList,
nsChangeHint aMinChange,
RestyleTracker& aRestyleTracker,
bool aRestyleDescendants)
nsRestyleHint aRestyleHint)
{
PROFILER_LABEL("RestyleManager", "ComputeStyleChangeFor",
js::ProfileEntry::Category::CSS);
@ -2978,7 +2984,7 @@ RestyleManager::ComputeStyleChangeFor(nsIFrame* aFrame,
treeMatchContext,
visibleKidsOfHiddenElement);
restyler.Restyle(aRestyleDescendants ? eRestyle_Subtree : eRestyle_Self);
restyler.Restyle(aRestyleHint);
if (restyler.HintsHandledForFrame() & nsChangeHint_ReconstructFrame) {
// If it's going to cause a framechange, then don't bother

View File

@ -107,7 +107,7 @@ public:
nsStyleChangeList* aChangeList,
nsChangeHint aMinChange,
RestyleTracker& aRestyleTracker,
bool aRestyleDescendants);
nsRestyleHint aRestyleHint);
#ifdef DEBUG
/**
@ -241,7 +241,7 @@ private:
nsIFrame* aPrimaryFrame,
nsChangeHint aMinHint,
RestyleTracker& aRestyleTracker,
bool aRestyleDescendants);
nsRestyleHint aRestyleHint);
void StyleChangeReflow(nsIFrame* aFrame, nsChangeHint aHint);

View File

@ -119,8 +119,7 @@ RestyleTracker::ProcessOneRestyle(Element* aElement,
nsIFrame* primaryFrame = aElement->GetPrimaryFrame();
if (aRestyleHint & (eRestyle_Self | eRestyle_Subtree)) {
mRestyleManager->RestyleElement(aElement, primaryFrame, aChangeHint,
*this,
(aRestyleHint & eRestyle_Subtree) != 0);
*this, aRestyleHint);
} else if (aChangeHint &&
(primaryFrame ||
(aChangeHint & nsChangeHint_ReconstructFrame))) {