Bug 1426649: Remove nsCSSFrameConstructor updates. r=mats

They used to do quote updates and such but they where moved long ago, and do
nothing now.

MozReview-Commit-ID: 188vzGctbty

--HG--
extra : rebase_source : dd638875f9ef9ceb2343df5f8677a23d820c7a36
This commit is contained in:
Emilio Cobos Álvarez 2017-12-21 19:34:48 +01:00
parent 1273bba03f
commit 927ea89c0d
7 changed files with 9 additions and 112 deletions

View File

@ -269,10 +269,7 @@ AccessibleCaret::RemoveCaretElement(nsIDocument* aDocument)
frame = frame->GetPlaceholderFrame();
}
nsAutoScriptBlocker scriptBlocker;
nsCSSFrameConstructor* fc = frame->PresShell()->FrameConstructor();
fc->BeginUpdate();
frame->GetParent()->RemoveFrame(nsIFrame::kPrincipalList, frame);
fc->EndUpdate();
}
ErrorResult rv;

View File

@ -637,10 +637,6 @@ GeckoRestyleManager::ProcessPendingRestyles()
void
GeckoRestyleManager::BeginProcessingRestyles(RestyleTracker& aRestyleTracker)
{
// Make sure to not rebuild quote or counter lists while we're
// processing restyles
PresContext()->FrameConstructor()->BeginUpdate();
mInStyleRefresh = true;
if (ShouldStartRebuildAllFor(aRestyleTracker)) {
@ -666,8 +662,6 @@ GeckoRestyleManager::EndProcessingRestyles()
FinishRebuildAllStyleData();
}
PresContext()->FrameConstructor()->EndUpdate();
#ifdef DEBUG
PresContext()->PresShell()->VerifyStyleTree();
#endif

View File

@ -1772,10 +1772,8 @@ PresShell::Initialize(nscoord aWidth, nscoord aHeight)
if (!rootFrame) {
nsAutoScriptBlocker scriptBlocker;
mFrameConstructor->BeginUpdate();
rootFrame = mFrameConstructor->ConstructRootFrame();
mFrameConstructor->SetRootFrame(rootFrame);
mFrameConstructor->EndUpdate();
}
NS_ENSURE_STATE(!mHaveShutDown);
@ -1811,8 +1809,6 @@ PresShell::Initialize(nscoord aWidth, nscoord aHeight)
if (root) {
{
nsAutoCauseReflowNotifier reflowNotifier(this);
mFrameConstructor->BeginUpdate();
// Have the style sheet processor construct frame for the root
// content object down
mFrameConstructor->ContentInserted(
@ -1822,8 +1818,6 @@ PresShell::Initialize(nscoord aWidth, nscoord aHeight)
// Something in mFrameConstructor->ContentInserted may have caused
// Destroy() to get called, bug 337586.
NS_ENSURE_STATE(!mHaveShutDown);
mFrameConstructor->EndUpdate();
}
// nsAutoCauseReflowNotifier (which sets up a script blocker) going out of
@ -2535,8 +2529,6 @@ PresShell::BeginUpdate(nsIDocument *aDocument, nsUpdateType aUpdateType)
#ifdef DEBUG
mUpdateCount++;
#endif
mFrameConstructor->BeginUpdate();
if (aUpdateType & UPDATE_STYLE)
mStyleSet->BeginUpdate();
}
@ -2555,8 +2547,6 @@ PresShell::EndUpdate(nsIDocument *aDocument, nsUpdateType aUpdateType)
RestyleForCSSRuleChanges();
}
}
mFrameConstructor->EndUpdate();
}
void
@ -2950,11 +2940,7 @@ PresShell::DestroyFramesForAndRestyle(Element* aElement)
// Mark ourselves as not safe to flush while we're doing frame destruction.
++mChangeNestCount;
nsCSSFrameConstructor* fc = FrameConstructor();
fc->BeginUpdate();
bool didReconstruct = fc->DestroyFramesFor(aElement);
fc->EndUpdate();
const bool didReconstruct = FrameConstructor()->DestroyFramesFor(aElement);
if (aElement->IsStyledByServo()) {
if (aElement->GetFlattenedTreeParentNode()) {
// The element is still in the flat tree, but their children may not be
@ -4561,9 +4547,7 @@ void
PresShell::NotifyCounterStylesAreDirty()
{
nsAutoCauseReflowNotifier reflowNotifier(this);
mFrameConstructor->BeginUpdate();
mFrameConstructor->NotifyCounterStylesAreDirty();
mFrameConstructor->EndUpdate();
}
void
@ -4590,10 +4574,8 @@ PresShell::ReconstructFrames()
}
nsAutoCauseReflowNotifier crNotifier(this);
mFrameConstructor->BeginUpdate();
mFrameConstructor->ReconstructDocElementHierarchy(nsCSSFrameConstructor::InsertionKind::Sync);
VERIFY_STYLE_TREE;
mFrameConstructor->EndUpdate();
}
void
@ -8813,16 +8795,12 @@ PresShell::WillDoReflow()
mPresContext->FlushFontFeatureValues();
mFrameConstructor->BeginUpdate();
mLastReflowStart = GetPerformanceNow();
}
void
PresShell::DidDoReflow(bool aInterruptible)
{
mFrameConstructor->EndUpdate();
HandlePostedReflowCallbacks(aInterruptible);
nsCOMPtr<nsIDocShell> docShell = mPresContext->GetDocShell();

View File

@ -1373,10 +1373,6 @@ RestyleManager::ProcessRestyledFrames(nsStyleChangeList& aChangeList)
}
}
// Make sure to not rebuild quote or counter lists while we're
// processing restyles
frameConstructor->BeginUpdate();
bool didUpdateCursor = false;
for (size_t i = 0; i < aChangeList.Length(); ++i) {
@ -1722,8 +1718,6 @@ RestyleManager::ProcessRestyledFrames(nsStyleChangeList& aChangeList)
}
}
frameConstructor->EndUpdate();
#ifdef DEBUG
// Verify the style tree. Note that this needs to happen once we've
// processed the whole list, since until then the tree is not in fact in a

View File

@ -1608,9 +1608,6 @@ nsCSSFrameConstructor::nsCSSFrameConstructor(nsIDocument* aDocument,
, mFirstFreeFCItem(nullptr)
, mFCItemsInUse(0)
, mCurrentDepth(0)
#ifdef DEBUG
, mUpdateCount(0)
#endif
, mQuotesDirty(false)
, mCountersDirty(false)
, mIsDestroyingFrameTree(false)
@ -1671,9 +1668,6 @@ nsCSSFrameConstructor::nsCSSFrameConstructor(nsIDocument* aDocument,
void
nsCSSFrameConstructor::NotifyDestroyingFrame(nsIFrame* aFrame)
{
NS_PRECONDITION(mUpdateCount != 0,
"Should be in an update while destroying frames");
if (aFrame->GetStateBits() & NS_FRAME_GENERATED_CONTENT) {
if (mQuoteList.DestroyNodesFor(aFrame))
QuotesDirty();
@ -5174,7 +5168,6 @@ nsCSSFrameConstructor::InitAndRestoreFrame(const nsFrameConstructorState& aState
nsIFrame* aNewFrame,
bool aAllowCounters)
{
MOZ_ASSERT(mUpdateCount != 0, "Should be in an update while creating frames");
MOZ_ASSERT(aNewFrame, "Null frame cannot be initialized");
// Initialize the frame
@ -7386,12 +7379,10 @@ nsCSSFrameConstructor::CreateNeededFrames()
NS_ASSERTION(!rootElement || !rootElement->HasFlag(NODE_NEEDS_FRAME),
"root element should not have frame created lazily");
if (rootElement && rootElement->HasFlag(NODE_DESCENDANTS_NEED_FRAMES)) {
BeginUpdate();
TreeMatchContext treeMatchContext(
mDocument, TreeMatchContext::ForFrameConstruction);
treeMatchContext.InitAncestors(rootElement);
CreateNeededFrames(rootElement, treeMatchContext);
EndUpdate();
}
}
@ -7556,7 +7547,6 @@ nsCSSFrameConstructor::ContentAppended(nsIContent* aContainer,
!RestyleManager()->IsInStyleRefresh());
AUTO_LAYOUT_PHASE_ENTRY_POINT(mPresShell->GetPresContext(), FrameC);
MOZ_ASSERT(mUpdateCount != 0, "Should be in an update while creating frames");
#ifdef DEBUG
if (gNoisyContentUpdates) {
@ -7958,7 +7948,6 @@ nsCSSFrameConstructor::ContentRangeInserted(nsIContent* aContainer,
!RestyleManager()->IsInStyleRefresh());
AUTO_LAYOUT_PHASE_ENTRY_POINT(mPresShell->GetPresContext(), FrameC);
MOZ_ASSERT(mUpdateCount != 0, "Should be in an update while creating frames");
NS_PRECONDITION(aStartChild, "must always pass a child");
@ -8457,8 +8446,6 @@ nsCSSFrameConstructor::ContentRemoved(nsIContent* aContainer,
{
MOZ_ASSERT(aChild);
AUTO_LAYOUT_PHASE_ENTRY_POINT(mPresShell->GetPresContext(), FrameC);
NS_PRECONDITION(mUpdateCount != 0,
"Should be in an update while destroying frames");
nsPresContext* presContext = mPresShell->GetPresContext();
MOZ_ASSERT(presContext, "Our presShell should have a valid presContext");
@ -8911,25 +8898,6 @@ nsCSSFrameConstructor::CharacterDataChanged(nsIContent* aContent,
}
}
void
nsCSSFrameConstructor::BeginUpdate() {
NS_ASSERTION(!nsContentUtils::IsSafeToRunScript(),
"Someone forgot a script blocker");
#ifdef DEBUG
++mUpdateCount;
#endif
}
void
nsCSSFrameConstructor::EndUpdate()
{
#ifdef DEBUG
NS_ASSERTION(mUpdateCount, "Negative mUpdateCount!");
--mUpdateCount;
#endif
}
void
nsCSSFrameConstructor::RecalcQuotesAndCounters()
{
@ -8952,7 +8920,6 @@ nsCSSFrameConstructor::RecalcQuotesAndCounters()
void
nsCSSFrameConstructor::NotifyCounterStylesAreDirty()
{
NS_PRECONDITION(mUpdateCount != 0, "Should be in an update");
mCounterManager.SetAllDirty();
CountersDirty();
}
@ -11975,8 +11942,6 @@ nsCSSFrameConstructor::CreateListBoxContent(nsContainerFrame* aParentFrame,
return;
}
BeginUpdate();
AutoFrameConstructionItemList items(this);
AddFrameConstructionItemsInternal(state, aChild, aParentFrame,
aChild->NodeInfo()->NameAtom(),
@ -11998,8 +11963,6 @@ nsCSSFrameConstructor::CreateListBoxContent(nsContainerFrame* aParentFrame,
((nsListBoxBodyFrame*)aParentFrame)->ListBoxInsertFrames(aPrevFrame, frameItems);
}
EndUpdate();
#ifdef ACCESSIBILITY
if (newFrame) {
nsAccessibilityService* accService = nsIPresShell::AccService();
@ -12831,8 +12794,6 @@ nsCSSFrameConstructor::GenerateChildFrames(nsContainerFrame* aFrame)
{
{
nsAutoScriptBlocker scriptBlocker;
BeginUpdate();
nsFrameItems childItems;
TreeMatchContextHolder matchContext(mDocument);
nsFrameConstructorState state(mPresShell, matchContext, nullptr, nullptr, nullptr);
@ -12844,8 +12805,6 @@ nsCSSFrameConstructor::GenerateChildFrames(nsContainerFrame* aFrame)
nullptr);
aFrame->SetInitialChildList(kPrincipalList, childItems);
EndUpdate();
}
#ifdef ACCESSIBILITY
@ -13120,7 +13079,6 @@ Iterator::DeleteItemsTo(nsCSSFrameConstructor* aFCtor, const Iterator& aEnd)
void
nsCSSFrameConstructor::QuotesDirty()
{
NS_PRECONDITION(mUpdateCount != 0, "Instant quote updates are bad news");
mQuotesDirty = true;
mPresShell->SetNeedLayoutFlush();
}
@ -13128,7 +13086,6 @@ nsCSSFrameConstructor::QuotesDirty()
void
nsCSSFrameConstructor::CountersDirty()
{
NS_PRECONDITION(mUpdateCount != 0, "Instant counter updates are bad news");
mCountersDirty = true;
mPresShell->SetNeedLayoutFlush();
}

View File

@ -62,7 +62,6 @@ public:
nsCSSFrameConstructor(nsIDocument* aDocument, nsIPresShell* aPresShell);
~nsCSSFrameConstructor() {
MOZ_ASSERT(mUpdateCount == 0, "Dying in the middle of our own update?");
MOZ_ASSERT(mFCItemsInUse == 0);
}
@ -334,8 +333,6 @@ public:
// WillDestroyFrameTree hasn't been called yet.
void NotifyDestroyingFrame(nsIFrame* aFrame);
void BeginUpdate();
void EndUpdate();
void RecalcQuotesAndCounters();
// Called when any counter style is changed.
@ -2254,9 +2251,6 @@ private:
nsCounterManager mCounterManager;
// Current ProcessChildren depth.
uint16_t mCurrentDepth;
#ifdef DEBUG
uint16_t mUpdateCount;
#endif
bool mQuotesDirty : 1;
bool mCountersDirty : 1;
bool mIsDestroyingFrameTree : 1;

View File

@ -714,11 +714,10 @@ nsListBoxBodyFrame::ComputeIntrinsicISize(nsBoxLayoutState& aBoxLayoutState)
nsCOMPtr<nsIContent> firstRowContent(do_QueryInterface(firstRowEl));
if (firstRowContent) {
RefPtr<nsStyleContext> styleContext;
nsPresContext *presContext = aBoxLayoutState.PresContext();
styleContext = presContext->StyleSet()->
ResolveStyleFor(firstRowContent->AsElement(), nullptr,
LazyComputeBehavior::Allow);
nsPresContext* presContext = aBoxLayoutState.PresContext();
RefPtr<nsStyleContext> styleContext =
presContext->StyleSet()->ResolveStyleFor(
firstRowContent->AsElement(), nullptr, LazyComputeBehavior::Allow);
nscoord width = 0;
nsMargin margin(0,0,0,0);
@ -920,14 +919,11 @@ nsListBoxBodyFrame::DoInternalPositionChanged(bool aUp, int32_t aDelta)
// We have scrolled so much that all of our current frames will
// go off screen, so blow them all away. Weeee!
nsIFrame *currBox = mFrames.FirstChild();
nsCSSFrameConstructor* fc = presContext->PresShell()->FrameConstructor();
fc->BeginUpdate();
while (currBox) {
nsIFrame *nextBox = currBox->GetNextSibling();
RemoveChildFrame(state, currBox);
currBox = nextBox;
}
fc->EndUpdate();
}
// clear frame markers so that CreateRows will re-create
@ -1072,8 +1068,6 @@ nsListBoxBodyFrame::DestroyRows(int32_t& aRowsToLose)
nsIFrame* childFrame = GetFirstFrame();
nsBoxLayoutState state(PresContext());
nsCSSFrameConstructor* fc = PresShell()->FrameConstructor();
fc->BeginUpdate();
while (childFrame && aRowsToLose > 0) {
--aRowsToLose;
@ -1082,7 +1076,6 @@ nsListBoxBodyFrame::DestroyRows(int32_t& aRowsToLose)
mTopFrame = childFrame = nextFrame;
}
fc->EndUpdate();
PresShell()->
FrameNeedsReflow(this, nsIPresShell::eTreeChange,
@ -1097,8 +1090,6 @@ nsListBoxBodyFrame::ReverseDestroyRows(int32_t& aRowsToLose)
nsIFrame* childFrame = GetLastFrame();
nsBoxLayoutState state(PresContext());
nsCSSFrameConstructor* fc = PresShell()->FrameConstructor();
fc->BeginUpdate();
while (childFrame && aRowsToLose > 0) {
--aRowsToLose;
@ -1108,7 +1099,6 @@ nsListBoxBodyFrame::ReverseDestroyRows(int32_t& aRowsToLose)
mBottomFrame = childFrame = prevFrame;
}
fc->EndUpdate();
PresShell()->
FrameNeedsReflow(this, nsIPresShell::eTreeChange,
@ -1191,10 +1181,9 @@ nsListBoxBodyFrame::GetFirstItemBox(int32_t aOffset, bool* aCreated)
// display: none was on listitem content
bool isAppend = mRowsToPrepend <= 0;
nsPresContext* presContext = PresContext();
nsCSSFrameConstructor* fc = presContext->PresShell()->FrameConstructor();
nsIFrame* topFrame = nullptr;
fc->CreateListBoxContent(this, nullptr, startContent, &topFrame, isAppend);
PresContext()->FrameConstructor()->CreateListBoxContent(
this, nullptr, startContent, &topFrame, isAppend);
mTopFrame = topFrame;
if (mTopFrame) {
if (aCreated)
@ -1244,10 +1233,8 @@ nsListBoxBodyFrame::GetNextItemBox(nsIFrame* aBox, int32_t aOffset,
bool isAppend = result != mLinkupFrame && mRowsToPrepend <= 0;
nsIFrame* prevFrame = isAppend ? nullptr : aBox;
nsPresContext* presContext = PresContext();
nsCSSFrameConstructor* fc = presContext->PresShell()->FrameConstructor();
fc->CreateListBoxContent(this, prevFrame, nextContent,
&result, isAppend);
PresContext()->FrameConstructor()->CreateListBoxContent(
this, prevFrame, nextContent, &result, isAppend);
if (result) {
if (aCreated)
@ -1298,15 +1285,11 @@ nsListBoxBodyFrame::ContinueReflow(nscoord height)
nsIFrame* currFrame = startingPoint->GetNextSibling();
nsBoxLayoutState state(PresContext());
nsCSSFrameConstructor* fc =
PresShell()->FrameConstructor();
fc->BeginUpdate();
while (currFrame) {
nsIFrame* nextFrame = currFrame->GetNextSibling();
RemoveChildFrame(state, currFrame);
currFrame = nextFrame;
}
fc->EndUpdate();
PresShell()->
FrameNeedsReflow(this, nsIPresShell::eTreeChange,