зеркало из https://github.com/mozilla/gecko-dev.git
Bug 931668 - Part 16: Give ElementRestyler::RestyleSelf a return value that indicates how restyling should proceed. r=dbaron
--HG-- extra : rebase_source : e9bcb021f40bef402b7bcb00a097d18efa4a813b
This commit is contained in:
Родитель
55da6bb01e
Коммит
0c2afd3177
|
@ -2434,11 +2434,34 @@ ElementRestyler::Restyle(nsRestyleHint aRestyleHint)
|
|||
// TEMPORARY (until bug 918064): Call RestyleSelf for each
|
||||
// continuation or block-in-inline sibling.
|
||||
|
||||
// We must make a single decision on how to process this frame and
|
||||
// its descendants, yet RestyleSelf might return different RestyleResult
|
||||
// values for the different same-style continuations. |result| is our
|
||||
// overall decision.
|
||||
RestyleResult result = RestyleResult(0);
|
||||
|
||||
bool haveMoreContinuations = false;
|
||||
for (nsIFrame* f = mFrame; f;
|
||||
f = GetNextContinuationWithSameStyle(f, oldContext,
|
||||
&haveMoreContinuations)) {
|
||||
RestyleSelf(f, aRestyleHint);
|
||||
|
||||
RestyleResult thisResult = RestyleSelf(f, aRestyleHint);
|
||||
|
||||
// XXX we'll handle eRestyleResult_Stop in a later patch
|
||||
NS_ASSERTION(thisResult != eRestyleResult_Stop,
|
||||
"cannot handle eRestyleResult_Stop yet");
|
||||
|
||||
if (thisResult > result) {
|
||||
// We take the highest RestyleResult value when working out what to do
|
||||
// with this frame and its descendants. Higher RestyleResult values
|
||||
// represent a superset of the work done by lower values.
|
||||
result = thisResult;
|
||||
}
|
||||
}
|
||||
|
||||
if (result == eRestyleResult_ContinueAndForceDescendants) {
|
||||
childRestyleHint =
|
||||
nsRestyleHint(childRestyleHint | eRestyle_ForceDescendants);
|
||||
}
|
||||
|
||||
if (haveMoreContinuations && hintToRestore) {
|
||||
|
@ -2453,7 +2476,7 @@ ElementRestyler::Restyle(nsRestyleHint aRestyleHint)
|
|||
RestyleChildren(childRestyleHint);
|
||||
}
|
||||
|
||||
void
|
||||
ElementRestyler::RestyleResult
|
||||
ElementRestyler::RestyleSelf(nsIFrame* aSelf, nsRestyleHint aRestyleHint)
|
||||
{
|
||||
MOZ_ASSERT(!(aRestyleHint & eRestyle_LaterSiblings),
|
||||
|
@ -2717,6 +2740,8 @@ ElementRestyler::RestyleSelf(nsIFrame* aSelf, nsRestyleHint aRestyleHint)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
return eRestyleResult_Continue;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -452,10 +452,27 @@ public:
|
|||
nsChangeHint HintsHandledForFrame() { return mHintsHandled; }
|
||||
|
||||
private:
|
||||
// Enum for the result of RestyleSelf, which indicates whether the
|
||||
// restyle procedure should continue to the children, and how.
|
||||
//
|
||||
// These values must be ordered so that later values imply that all
|
||||
// the work of the earlier values is also done.
|
||||
enum RestyleResult {
|
||||
|
||||
// do not restyle children
|
||||
eRestyleResult_Stop = 1,
|
||||
|
||||
// continue restyling children
|
||||
eRestyleResult_Continue,
|
||||
|
||||
// continue restyling children with eRestyle_ForceDescendants set
|
||||
eRestyleResult_ContinueAndForceDescendants
|
||||
};
|
||||
|
||||
/**
|
||||
* First half of Restyle().
|
||||
*/
|
||||
void RestyleSelf(nsIFrame* aSelf, nsRestyleHint aRestyleHint);
|
||||
RestyleResult RestyleSelf(nsIFrame* aSelf, nsRestyleHint aRestyleHint);
|
||||
|
||||
/**
|
||||
* Restyle the children of this frame (and, in turn, their children).
|
||||
|
|
Загрузка…
Ссылка в новой задаче