зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1292930: stylo: Reuse RestyleManager::PostRestyleEventInternal. r=heycam
MozReview-Commit-ID: J6rw1feAYWh
This commit is contained in:
Родитель
8f44c86099
Коммит
3f8ce6d753
|
@ -86,7 +86,6 @@ RestyleManager::RestyleManager(nsPresContext* aPresContext)
|
|||
: RestyleManagerBase(aPresContext)
|
||||
, mDoRebuildAllStyleData(false)
|
||||
, mInRebuildAllStyleData(false)
|
||||
, mInStyleRefresh(false)
|
||||
, mSkipAnimationRules(false)
|
||||
, mHavePendingNonAnimationRestyles(false)
|
||||
, mRebuildAllExtraHint(nsChangeHint(0))
|
||||
|
@ -950,25 +949,6 @@ RestyleManager::PostRestyleEvent(Element* aElement,
|
|||
PostRestyleEventInternal(false);
|
||||
}
|
||||
|
||||
void
|
||||
RestyleManager::PostRestyleEventInternal(bool aForLazyConstruction)
|
||||
{
|
||||
// Make sure we're not in a style refresh; if we are, we still have
|
||||
// a call to ProcessPendingRestyles coming and there's no need to
|
||||
// add ourselves as a refresh observer until then.
|
||||
bool inRefresh = !aForLazyConstruction && mInStyleRefresh;
|
||||
nsIPresShell* presShell = PresContext()->PresShell();
|
||||
if (!ObservingRefreshDriver() && !inRefresh) {
|
||||
SetObservingRefreshDriver(PresContext()->RefreshDriver()->
|
||||
AddStyleFlushObserver(presShell));
|
||||
}
|
||||
|
||||
// Unconditionally flag our document as needing a flush. The other
|
||||
// option here would be a dedicated boolean to track whether we need
|
||||
// to do so (set here and unset in ProcessPendingRestyles).
|
||||
presShell->GetDocument()->SetNeedStyleFlush();
|
||||
}
|
||||
|
||||
void
|
||||
RestyleManager::PostRebuildAllStyleDataEvent(nsChangeHint aExtraHint,
|
||||
nsRestyleHint aRestyleHint)
|
||||
|
|
|
@ -384,9 +384,6 @@ public:
|
|||
static nsCString ChangeHintToString(nsChangeHint aHint);
|
||||
#endif
|
||||
|
||||
private:
|
||||
void PostRestyleEventInternal(bool aForLazyConstruction);
|
||||
|
||||
public:
|
||||
/**
|
||||
* Asynchronously clear style data from the root frame downwards and ensure
|
||||
|
@ -490,8 +487,6 @@ private:
|
|||
bool mDoRebuildAllStyleData : 1;
|
||||
// True if we're currently in the process of reconstructing the rule tree.
|
||||
bool mInRebuildAllStyleData : 1;
|
||||
// True if we're in the middle of a nsRefreshDriver refresh
|
||||
bool mInStyleRefresh : 1;
|
||||
// Whether rule matching should skip styles associated with animation
|
||||
bool mSkipAnimationRules : 1;
|
||||
bool mHavePendingNonAnimationRestyles : 1;
|
||||
|
|
|
@ -15,6 +15,7 @@ RestyleManagerBase::RestyleManagerBase(nsPresContext* aPresContext)
|
|||
, mRestyleGeneration(1)
|
||||
, mHoverGeneration(0)
|
||||
, mObservingRefreshDriver(false)
|
||||
, mInStyleRefresh(false)
|
||||
{
|
||||
MOZ_ASSERT(mPresContext);
|
||||
}
|
||||
|
@ -135,6 +136,25 @@ RestyleManagerBase::RestyleHintToString(nsRestyleHint aHint)
|
|||
return result;
|
||||
}
|
||||
|
||||
void
|
||||
RestyleManagerBase::PostRestyleEventInternal(bool aForLazyConstruction)
|
||||
{
|
||||
// Make sure we're not in a style refresh; if we are, we still have
|
||||
// a call to ProcessPendingRestyles coming and there's no need to
|
||||
// add ourselves as a refresh observer until then.
|
||||
bool inRefresh = !aForLazyConstruction && mInStyleRefresh;
|
||||
nsIPresShell* presShell = PresContext()->PresShell();
|
||||
if (!ObservingRefreshDriver() && !inRefresh) {
|
||||
SetObservingRefreshDriver(PresContext()->RefreshDriver()->
|
||||
AddStyleFlushObserver(presShell));
|
||||
}
|
||||
|
||||
// Unconditionally flag our document as needing a flush. The other
|
||||
// option here would be a dedicated boolean to track whether we need
|
||||
// to do so (set here and unset in ProcessPendingRestyles).
|
||||
presShell->GetDocument()->SetNeedStyleFlush();
|
||||
}
|
||||
|
||||
/**
|
||||
* Frame construction helpers follow.
|
||||
*/
|
||||
|
|
|
@ -121,8 +121,13 @@ private:
|
|||
bool mObservingRefreshDriver;
|
||||
|
||||
protected:
|
||||
// True if we're in the middle of a nsRefreshDriver refresh
|
||||
bool mInStyleRefresh;
|
||||
|
||||
OverflowChangedTracker mOverflowChangedTracker;
|
||||
|
||||
void PostRestyleEventInternal(bool aForLazyConstruction);
|
||||
|
||||
/**
|
||||
* These are protected static methods that help with the change hint
|
||||
* processing bits of the restyle managers.
|
||||
|
|
|
@ -38,19 +38,13 @@ ServoRestyleManager::PostRestyleEvent(Element* aElement,
|
|||
snapshot->AddExplicitChangeHint(aMinChangeHint);
|
||||
}
|
||||
|
||||
nsIPresShell* presShell = PresContext()->PresShell();
|
||||
if (!ObservingRefreshDriver()) {
|
||||
SetObservingRefreshDriver(
|
||||
PresContext()->RefreshDriver()->AddStyleFlushObserver(presShell));
|
||||
}
|
||||
|
||||
presShell->GetDocument()->SetNeedStyleFlush();
|
||||
PostRestyleEventInternal(false);
|
||||
}
|
||||
|
||||
void
|
||||
ServoRestyleManager::PostRestyleEventForLazyConstruction()
|
||||
{
|
||||
NS_WARNING("stylo: ServoRestyleManager::PostRestyleEventForLazyConstruction not implemented");
|
||||
PostRestyleEventInternal(true);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -243,6 +237,7 @@ ServoRestyleManager::ProcessPendingRestyles()
|
|||
}
|
||||
|
||||
if (root->IsDirtyForServo() || root->HasDirtyDescendantsForServo()) {
|
||||
mInStyleRefresh = true;
|
||||
styleSet->RestyleSubtree(root);
|
||||
|
||||
// First do any queued-up frame creation. (see bugs 827239 and 997506).
|
||||
|
@ -256,9 +251,10 @@ ServoRestyleManager::ProcessPendingRestyles()
|
|||
PresContext()->FrameConstructor()->CreateNeededFrames();
|
||||
|
||||
nsStyleChangeList changeList;
|
||||
|
||||
RecreateStyleContexts(root, nullptr, styleSet, changeList);
|
||||
ProcessRestyledFrames(changeList);
|
||||
|
||||
mInStyleRefresh = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче