Bug 1426649: Stop tracking DOM changes from painting. r=dbaron

I'm pretty sure this is not a problem now, since we don't mutate the DOM from
painting, and we don't have legacy extensions anymore.

Just to confirm, I did a try run with a RELEASE_ASSERT(!CheckDOMModified()), and
it passed.

MozReview-Commit-ID: HTekD8tsz9v

--HG--
extra : rebase_source : 3ae51ff73b921fd720bd09ae9e294f2d85c71644
This commit is contained in:
Emilio Cobos Álvarez 2017-12-21 14:09:32 +01:00
parent 39c3ecdd59
commit 1273bba03f
5 changed files with 1 additions and 65 deletions

View File

@ -8916,12 +8916,6 @@ nsCSSFrameConstructor::BeginUpdate() {
NS_ASSERTION(!nsContentUtils::IsSafeToRunScript(),
"Someone forgot a script blocker");
nsRootPresContext* rootPresContext =
mPresShell->GetPresContext()->GetRootPresContext();
if (rootPresContext) {
rootPresContext->IncrementDOMGeneration();
}
#ifdef DEBUG
++mUpdateCount;
#endif

View File

@ -3176,8 +3176,7 @@ nsPresContext::RebuildFontFeatureValues()
nsRootPresContext::nsRootPresContext(nsIDocument* aDocument,
nsPresContextType aType)
: nsPresContext(aDocument, aType),
mDOMGeneration(0)
: nsPresContext(aDocument, aType)
{
}

View File

@ -1609,18 +1609,6 @@ public:
virtual bool IsRoot() override { return true; }
/**
* Increment DOM-modification generation counter to indicate that
* the DOM has changed in a way that might lead to style changes/
* reflows/frame creation and destruction.
*/
void IncrementDOMGeneration() { mDOMGeneration++; }
/**
* Get the current DOM generation counter.
*/
uint32_t GetDOMGeneration() { return mDOMGeneration; }
/**
* Add a runnable that will get called before the next paint. They will get
* run eventually even if painting doesn't happen. They might run well before
@ -1674,7 +1662,6 @@ protected:
nsTHashtable<nsRefPtrHashKey<nsIContent> > mRegisteredPlugins;
nsTArray<nsCOMPtr<nsIRunnable> > mWillPaintObservers;
nsRevocableEventPtr<RunWillPaintObservers> mWillPaintFallbackEvent;
uint32_t mDOMGeneration;
};
#ifdef MOZ_REFLOW_PERF

View File

@ -121,7 +121,6 @@ FrameLayerBuilder::FrameLayerBuilder()
: mRetainingManager(nullptr)
, mContainingPaintedLayer(nullptr)
, mInactiveLayerClip(nullptr)
, mDetectedDOMModification(false)
, mInvalidateAllLayers(false)
, mInLayerTreeCompressionMode(false)
, mIsInactiveLayerManager(false)
@ -1791,9 +1790,6 @@ FrameLayerBuilder::Init(nsDisplayListBuilder* aBuilder, LayerManager* aManager,
{
mDisplayListBuilder = aBuilder;
mRootPresContext = aBuilder->RootReferenceFrame()->PresContext()->GetRootPresContext();
if (mRootPresContext) {
mInitialDOMGeneration = mRootPresContext->GetDOMGeneration();
}
mContainingPaintedLayer = aLayerData;
mIsInactiveLayerManager = aIsInactiveLayerManager;
mInactiveLayerClip = aInactiveLayerClip;
@ -6033,9 +6029,6 @@ FrameLayerBuilder::PaintItems(nsTArray<ClippedDisplayItem>& aItems,
cdi->mItem->Paint(aBuilder, aContext);
}
}
if (CheckDOMModified())
break;
}
if (currentClipIsSetInContext) {
@ -6116,9 +6109,6 @@ FrameLayerBuilder::DrawPaintedLayer(PaintedLayer* aLayer,
FrameLayerBuilder *layerBuilder = aLayer->Manager()->GetLayerBuilder();
NS_ASSERTION(layerBuilder, "Unexpectedly null layer builder!");
if (layerBuilder->CheckDOMModified())
return;
PaintedLayerItemsEntry* entry = layerBuilder->mPaintedLayerItems.GetEntry(aLayer);
NS_ASSERTION(entry, "We shouldn't be drawing into a layer with no items!");
if (!entry->mContainerLayerFrame) {
@ -6234,24 +6224,6 @@ FrameLayerBuilder::DrawPaintedLayer(PaintedLayer* aLayer,
}
}
bool
FrameLayerBuilder::CheckDOMModified()
{
if (!mRootPresContext ||
mInitialDOMGeneration == mRootPresContext->GetDOMGeneration())
return false;
if (mDetectedDOMModification) {
// Don't spam the console with extra warnings
return true;
}
mDetectedDOMModification = true;
// Painting is not going to complete properly. There's not much
// we can do here though. Invalidating the window to get another repaint
// is likely to lead to an infinite repaint loop.
NS_WARNING("Detected DOM modification during paint, bailing out!");
return true;
}
/* static */ void
FrameLayerBuilder::DumpRetainedLayerTree(LayerManager* aManager, std::stringstream& aStream, bool aDumpHtml)
{

View File

@ -745,13 +745,6 @@ public:
void ComputeGeometryChangeForItem(DisplayItemData* aData);
protected:
/**
* Returns true if the DOM has been modified since we started painting,
* in which case we should bail out and not paint anymore. This should
* never happen, but plugins can trigger it in some cases.
*/
bool CheckDOMModified();
/**
* The layer manager belonging to the widget that is being retained
* across paints.
@ -784,15 +777,6 @@ protected:
*/
const DisplayItemClip* mInactiveLayerClip;
/**
* Saved generation counter so we can detect DOM changes.
*/
uint32_t mInitialDOMGeneration;
/**
* Set to true if we have detected and reported DOM modification during
* the current paint.
*/
bool mDetectedDOMModification;
/**
* Indicates that the entire layer tree should be rerendered
* during this paint.