Bug 1451217: Remove VerifyStyleTree stuff. r?xidorn
MozReview-Commit-ID: DDXMq9WkUkE
--- a/layout/base/PresShell.cpp
+++ b/layout/base/PresShell.cpp
@@ -592,29 +592,16 @@ bool PresShell::sDisableNonTestMouseEven
mozilla::LazyLogModule PresShell::gLog("PresShell");
mozilla::TimeStamp PresShell::sLastInputCreated;
mozilla::TimeStamp PresShell::sLastInputProcessed;
bool PresShell::sProcessInteractable = false;
-#ifdef DEBUG
-static void
-VerifyStyleTree(nsPresContext* aPresContext, nsFrameManager* aFrameManager)
-{
- if (nsFrame::GetVerifyStyleTreeEnable()) {
- NS_ERROR("stylo: cannot verify style tree with a ServoRestyleManager");
- }
-}
-#define VERIFY_STYLE_TREE ::VerifyStyleTree(mPresContext, mFrameConstructor)
-#else
-#define VERIFY_STYLE_TREE
-#endif
-
static bool gVerifyReflowEnabled;
bool
nsIPresShell::GetVerifyReflowEnable()
{
#ifdef DEBUG
static bool firstTime = true;
if (firstTime) {
@@ -1813,17 +1800,16 @@ PresShell::Initialize()
if (Element* root = mDocument->GetRootElement()) {
{
nsAutoCauseReflowNotifier reflowNotifier(this);
// Have the style sheet processor construct frame for the root
// content object down
mFrameConstructor->ContentInserted(
root, nullptr, nsCSSFrameConstructor::InsertionKind::Sync);
- VERIFY_STYLE_TREE;
// Something in mFrameConstructor->ContentInserted may have caused
// Destroy() to get called, bug 337586.
NS_ENSURE_STATE(!mHaveShutDown);
}
// nsAutoCauseReflowNotifier (which sets up a script blocker) going out of
// scope may have killed us too
@@ -4405,31 +4391,29 @@ PresShell::CharacterDataChanged(nsIConte
{
NS_PRECONDITION(!mIsDocumentGone, "Unexpected CharacterDataChanged");
NS_PRECONDITION(aContent->OwnerDoc() == mDocument, "Unexpected document");
nsAutoCauseReflowNotifier crNotifier(this);
mPresContext->RestyleManager()->CharacterDataChanged(aContent, aInfo);
mFrameConstructor->CharacterDataChanged(aContent, aInfo);
- VERIFY_STYLE_TREE;
}
void
PresShell::ContentStateChanged(nsIDocument* aDocument,
nsIContent* aContent,
EventStates aStateMask)
{
NS_PRECONDITION(!mIsDocumentGone, "Unexpected ContentStateChanged");
NS_PRECONDITION(aDocument == mDocument, "Unexpected aDocument");
if (mDidInitialize) {
nsAutoCauseReflowNotifier crNotifier(this);
mPresContext->RestyleManager()->ContentStateChanged(aContent, aStateMask);
- VERIFY_STYLE_TREE;
}
}
void
PresShell::DocumentStatesChanged(nsIDocument* aDocument, EventStates aStateMask)
{
NS_PRECONDITION(!mIsDocumentGone, "Unexpected DocumentStatesChanged");
NS_PRECONDITION(aDocument == mDocument, "Unexpected aDocument");
@@ -4459,17 +4443,16 @@ PresShell::AttributeWillChange(Element*
// XXXwaterson it might be more elegant to wait until after the
// initial reflow to begin observing the document. That would
// squelch any other inappropriate notifications as well.
if (mDidInitialize) {
nsAutoCauseReflowNotifier crNotifier(this);
mPresContext->RestyleManager()->AttributeWillChange(aElement, aNameSpaceID,
aAttribute, aModType,
aNewValue);
- VERIFY_STYLE_TREE;
}
}
void
PresShell::AttributeChanged(Element* aElement,
int32_t aNameSpaceID,
nsAtom* aAttribute,
int32_t aModType,
@@ -4481,17 +4464,16 @@ PresShell::AttributeChanged(Element* aEl
// XXXwaterson it might be more elegant to wait until after the
// initial reflow to begin observing the document. That would
// squelch any other inappropriate notifications as well.
if (mDidInitialize) {
nsAutoCauseReflowNotifier crNotifier(this);
mPresContext->RestyleManager()->AttributeChanged(aElement, aNameSpaceID,
aAttribute, aModType,
aOldValue);
- VERIFY_STYLE_TREE;
}
}
void
PresShell::ContentAppended(nsIContent* aFirstNewContent)
{
NS_PRECONDITION(!mIsDocumentGone, "Unexpected ContentAppended");
NS_PRECONDITION(aFirstNewContent->OwnerDoc() == mDocument,
@@ -4511,18 +4493,16 @@ PresShell::ContentAppended(nsIContent* a
// Call this here so it only happens for real content mutations and
// not cases when the frame constructor calls its own methods to force
// frame reconstruction.
mPresContext->RestyleManager()->ContentAppended(aFirstNewContent);
mFrameConstructor->ContentAppended(
aFirstNewContent,
nsCSSFrameConstructor::InsertionKind::Async);
-
- VERIFY_STYLE_TREE;
}
void
PresShell::ContentInserted(nsIContent* aChild)
{
NS_PRECONDITION(!mIsDocumentGone, "Unexpected ContentInserted");
NS_PRECONDITION(aChild->OwnerDoc() == mDocument, "Unexpected document");
@@ -4536,18 +4516,16 @@ PresShell::ContentInserted(nsIContent* a
// not cases when the frame constructor calls its own methods to force
// frame reconstruction.
mPresContext->RestyleManager()->ContentInserted(aChild);
mFrameConstructor->ContentInserted(
aChild,
nullptr,
nsCSSFrameConstructor::InsertionKind::Async);
-
- VERIFY_STYLE_TREE;
}
void
PresShell::ContentRemoved(nsIContent* aChild, nsIContent* aPreviousSibling)
{
NS_PRECONDITION(!mIsDocumentGone, "Unexpected ContentRemoved");
NS_PRECONDITION(aChild->OwnerDoc() == mDocument, "Unexpected document");
nsINode* container = aChild->GetParentNode();
@@ -4583,19 +4561,16 @@ PresShell::ContentRemoved(nsIContent* aC
oldNextSibling,
nsCSSFrameConstructor::REMOVE_CONTENT);
// NOTE(emilio): It's important that this goes after the frame constructor
// stuff, otherwise the frame constructor can't see elements which are
// display: contents / display: none, because we'd have cleared all the style
// data from there.
mPresContext->RestyleManager()->ContentRemoved(aChild, oldNextSibling);
-
-
- VERIFY_STYLE_TREE;
}
void
PresShell::NotifyCounterStylesAreDirty()
{
nsAutoCauseReflowNotifier reflowNotifier(this);
mFrameConstructor->NotifyCounterStylesAreDirty();
}
@@ -4620,17 +4595,16 @@ PresShell::ReconstructFrames()
mDocument->FlushPendingNotifications(FlushType::Style);
if (mIsDestroying) {
return;
}
nsAutoCauseReflowNotifier crNotifier(this);
mFrameConstructor->ReconstructDocElementHierarchy(nsCSSFrameConstructor::InsertionKind::Sync);
- VERIFY_STYLE_TREE;
}
void
nsIPresShell::RestyleForCSSRuleChanges()
{
if (mIsDestroying) {
// We don't want to mess with restyles at this point
return;
@@ -9772,22 +9746,16 @@ void
PresShell::ListStyleSheets(FILE *out, int32_t aIndent)
{
int32_t sheetCount = mStyleSet->SheetCount(SheetType::Doc);
for (int32_t i = 0; i < sheetCount; ++i) {
mStyleSet->StyleSheetAt(SheetType::Doc, i)->List(out, aIndent);
fputs("\n", out);
}
}
-
-void
-PresShell::VerifyStyleTree()
-{
- VERIFY_STYLE_TREE;
-}
#endif
//=============================================================
//=============================================================
//-- Debug Reflow Counts
//=============================================================
//=============================================================
#ifdef MOZ_REFLOW_PERF
--- a/layout/base/PresShell.h
+++ b/layout/base/PresShell.h
@@ -315,17 +315,16 @@ public:
void SetPaintFrameCount(bool aOn) override;
bool IsPaintingFrameCounts() override;
#endif
#ifdef DEBUG
void ListComputedStyles(FILE *out, int32_t aIndent = 0) override;
void ListStyleSheets(FILE *out, int32_t aIndent = 0) override;
- void VerifyStyleTree() override;
#endif
static LazyLogModule gLog;
void DisableNonTestMouseEvents(bool aDisable) override;
void UpdateCanvasBackground() override;
--- a/layout/base/RestyleManager.cpp
+++ b/layout/base/RestyleManager.cpp
@@ -621,28 +621,16 @@ RestyleManager::ChangeHintToString(nsCha
/**
* Frame construction helpers follow.
*/
#ifdef DEBUG
static bool gInApplyRenderingChangeToTree = false;
#endif
-#ifdef DEBUG
-
-void
-RestyleManager::DebugVerifyStyleTree(nsIFrame* aFrame)
-{
- // XXXheycam For now, we know that we don't use the same inheritance
- // hierarchy for certain cases, so just skip these assertions until
- // we work out what we want to assert (bug 1322570).
-}
-
-#endif // DEBUG
-
/**
* Sync views on aFrame and all of aFrame's descendants (following placeholders),
* if aChange has nsChangeHint_SyncFrameView.
* Calls DoApplyRenderingChangeToTree on all aFrame's out-of-flow descendants
* (following placeholders), if aChange has nsChangeHint_RepaintFrame.
* aFrame should be some combination of nsChangeHint_SyncFrameView,
* nsChangeHint_RepaintFrame, nsChangeHint_UpdateOpacityLayer and
* nsChangeHint_SchedulePaint, nothing else.
@@ -1706,34 +1694,16 @@ RestyleManager::ProcessRestyledFrames(ns
frameConstructor->UpdateTableCellSpans(content);
}
if (hint & nsChangeHint_VisibilityChange) {
frame->UpdateVisibleDescendantsState();
}
}
}
-#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
- // consistent state.
- for (const nsStyleChangeData& data : aChangeList) {
- // reget frame from content since it may have been regenerated...
- if (data.mContent) {
- nsIFrame* frame = data.mContent->GetPrimaryFrame();
- if (frame) {
- DebugVerifyStyleTree(frame);
- }
- } else if (!data.mFrame || !data.mFrame->IsViewportFrame()) {
- NS_WARNING("Unable to test style tree integrity -- no content node "
- "(and not a viewport frame)");
- }
- }
-#endif
-
aChangeList.Clear();
}
/* static */ uint64_t
RestyleManager::GetAnimationGenerationForFrame(nsIFrame* aFrame)
{
EffectSet* effectSet = EffectSet::GetEffectSet(aFrame);
return effectSet ? effectSet->GetAnimationGeneration() : 0;
--- a/layout/base/nsIPresShell.h
+++ b/layout/base/nsIPresShell.h
@@ -1064,17 +1064,16 @@ public:
virtual bool IsPaintingFrameCounts() = 0;
#endif
#ifdef DEBUG
// Debugging hooks
virtual void ListComputedStyles(FILE *out, int32_t aIndent = 0) = 0;
virtual void ListStyleSheets(FILE *out, int32_t aIndent = 0) = 0;
- virtual void VerifyStyleTree() = 0;
#endif
#ifdef ACCESSIBILITY
/**
* Return true if accessibility is active.
*/
static bool IsAccessibilityActive();
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -305,35 +305,16 @@ bool nsFrame::GetShowEventTargetFrameBor
}
/**
* Note: the log module is created during library initialization which
* means that you cannot perform logging before then.
*/
mozilla::LazyLogModule nsFrame::sFrameLogModule("frame");
-static mozilla::LazyLogModule sStyleVerifyTreeLogModuleInfo("styleverifytree");
-
-static uint32_t gStyleVerifyTreeEnable = 0x55;
-
-bool
-nsFrame::GetVerifyStyleTreeEnable()
-{
- if (gStyleVerifyTreeEnable == 0x55) {
- gStyleVerifyTreeEnable = 0 != (int)((mozilla::LogModule*)sStyleVerifyTreeLogModuleInfo)->Level();
- }
- return gStyleVerifyTreeEnable;
-}
-
-void
-nsFrame::SetVerifyStyleTreeEnable(bool aEnabled)
-{
- gStyleVerifyTreeEnable = aEnabled;
-}
-
#endif
NS_DECLARE_FRAME_PROPERTY_DELETABLE(AbsoluteContainingBlockProperty,
nsAbsoluteContainingBlock)
bool
nsIFrame::HasAbsolutelyPositionedChildren() const {
return IsAbsoluteContainer() && GetAbsoluteContainingBlock()->HasAbsoluteFrames();
--- a/layout/generic/nsFrame.h
+++ b/layout/generic/nsFrame.h
@@ -701,58 +701,42 @@ private:
NS_IMETHODIMP RefreshSizeCache(nsBoxLayoutState& aState);
// Returns true if this frame has any kind of CSS animations.
bool HasCSSAnimations();
// Returns true if this frame has any kind of CSS transitions.
bool HasCSSTransitions();
+public:
+
#ifdef DEBUG_FRAME_DUMP
-public:
/**
* Get a printable from of the name of the frame type.
* XXX This should be eliminated and we use GetType() instead...
*/
nsresult GetFrameName(nsAString& aResult) const override;
nsresult MakeFrameName(const nsAString& aKind, nsAString& aResult) const;
// Helper function to return the index in parent of the frame's content
// object. Returns -1 on error or if the frame doesn't have a content object
static int32_t ContentIndexInContainer(const nsIFrame* aFrame);
#endif
#ifdef DEBUG
-public:
- /**
- * See if style tree verification is enabled. To enable style tree
- * verification add "styleverifytree:1" to your MOZ_LOG
- * environment variable (any non-zero debug level will work). Or,
- * call SetVerifyStyleTreeEnable with true.
- */
- static bool GetVerifyStyleTreeEnable();
-
- /**
- * Set the verify-style-tree enable flag.
- */
- static void SetVerifyStyleTreeEnable(bool aEnabled);
-
static mozilla::LazyLogModule sFrameLogModule;
// Show frame borders when rendering
static void ShowFrameBorders(bool aEnable);
static bool GetShowFrameBorders();
// Show frame border of event target
static void ShowEventTargetFrameBorder(bool aEnable);
static bool GetShowEventTargetFrameBorder();
-
#endif
-public:
-
static void PrintDisplayList(nsDisplayListBuilder* aBuilder,
const nsDisplayList& aList,
bool aDumpHtml = false)
{
std::stringstream ss;
PrintDisplayList(aBuilder, aList, ss, aDumpHtml);
fprintf_stderr(stderr, "%s", ss.str().c_str());
}