Bug 1302071 - Part 1: Remove AddPresShellToInvalidateIfHidden since it doesn't appear to be necessary. r=tnikkel

We added this so that MozAfterPaint events would be delivered to hidden documents as part of bug 539356, but I don't remember what needed it.
It doesn't appear to be necessary for any tests any more, so let's just get rid of it

MozReview-Commit-ID: HcmIjstZyLQ

--HG--
extra : rebase_source : 3f58129b3b1588e5d39e00c157e4bdba1afeed0c
This commit is contained in:
Matt Woodrow 2017-02-17 11:49:29 +13:00
Родитель c6de4ab37c
Коммит ba6e966a12
8 изменённых файлов: 0 добавлений и 90 удалений

Просмотреть файл

@ -658,33 +658,6 @@ nsIPresShell::GetVerifyReflowEnable()
return gVerifyReflowEnabled;
}
void
PresShell::AddInvalidateHiddenPresShellObserver(nsRefreshDriver *aDriver)
{
if (!mHiddenInvalidationObserverRefreshDriver && !mIsDestroying && !mHaveShutDown) {
aDriver->AddPresShellToInvalidateIfHidden(this);
mHiddenInvalidationObserverRefreshDriver = aDriver;
}
}
void
nsIPresShell::InvalidatePresShellIfHidden()
{
if (!IsVisible() && mPresContext) {
mPresContext->NotifyInvalidation(0);
}
mHiddenInvalidationObserverRefreshDriver = nullptr;
}
void
nsIPresShell::CancelInvalidatePresShellIfHidden()
{
if (mHiddenInvalidationObserverRefreshDriver) {
mHiddenInvalidationObserverRefreshDriver->RemovePresShellToInvalidateIfHidden(this);
mHiddenInvalidationObserverRefreshDriver = nullptr;
}
}
void
nsIPresShell::SetVerifyReflowEnable(bool aEnabled)
{
@ -771,7 +744,6 @@ nsIPresShell::nsIPresShell()
: mFrameConstructor(nullptr)
, mViewManager(nullptr)
, mFrameManager(nullptr)
, mHiddenInvalidationObserverRefreshDriver(nullptr)
#ifdef ACCESSIBILITY
, mDocAccessible(nullptr)
#endif
@ -1368,9 +1340,6 @@ PresShell::Destroy()
// before we destroy the frame manager, since apparently frame destruction
// sometimes spins the event queue when plug-ins are involved(!).
rd->RemoveLayoutFlushObserver(this);
if (mHiddenInvalidationObserverRefreshDriver) {
mHiddenInvalidationObserverRefreshDriver->RemovePresShellToInvalidateIfHidden(this);
}
if (rd->GetPresContext() == GetPresContext()) {
rd->RevokeViewManagerFlush();
@ -3710,7 +3679,6 @@ public:
NS_IMETHOD Notify(nsITimer* aTimer) final
{
mShell->SetNextPaintCompressed();
mShell->AddInvalidateHiddenPresShellObserver(mShell->GetPresContext()->RefreshDriver());
mShell->ScheduleViewManagerFlush();
return NS_OK;
}

Просмотреть файл

@ -378,8 +378,6 @@ public:
size_t *aPresContextSize) override;
size_t SizeOfTextRuns(mozilla::MallocSizeOf aMallocSizeOf) const;
virtual void AddInvalidateHiddenPresShellObserver(nsRefreshDriver *aDriver) override;
// This data is stored as a content property (nsGkAtoms::scrolling) on
// mContentToScrollTo when we have a pending ScrollIntoView.
struct ScrollIntoViewData {

Просмотреть файл

@ -1596,12 +1596,6 @@ public:
mFontSizeInflationEnabledIsDirty = true;
}
virtual void AddInvalidateHiddenPresShellObserver(nsRefreshDriver *aDriver) = 0;
void InvalidatePresShellIfHidden();
void CancelInvalidatePresShellIfHidden();
//////////////////////////////////////////////////////////////////////////////
// Approximate frame visibility tracking public API.
//////////////////////////////////////////////////////////////////////////////
@ -1761,10 +1755,6 @@ protected:
// GetRootFrame() can be inlined:
nsFrameManagerBase* mFrameManager;
mozilla::WeakPtr<nsDocShell> mForwardingContainer;
nsRefreshDriver* MOZ_UNSAFE_REF("These two objects hold weak references "
"to each other, and the validity of this "
"member is ensured by the logic in nsIPresShell.")
mHiddenInvalidationObserverRefreshDriver;
#ifdef ACCESSIBILITY
mozilla::a11y::DocAccessible* mDocAccessible;
#endif

Просмотреть файл

@ -267,7 +267,6 @@ nsPresContext::nsPresContext(nsIDocument* aDocument, nsPresContextType aType)
mPendingMediaFeatureValuesChanged(false),
mPrefChangePendingNeedsReflow(false),
mIsEmulatingMedia(false),
mAllInvalidated(false),
mIsGlyph(false),
mUsesRootEMUnits(false),
mUsesExChUnits(false),
@ -1556,9 +1555,6 @@ nsPresContext::Detach()
{
SetContainer(nullptr);
SetLinkHandler(nullptr);
if (mShell) {
mShell->CancelInvalidatePresShellIfHidden();
}
}
bool
@ -2448,14 +2444,6 @@ nsPresContext::MayHavePaintEventListenerInSubDocument()
return result;
}
void
nsPresContext::NotifyInvalidation(uint32_t aFlags)
{
nsIFrame* rootFrame = PresShell()->FrameManager()->GetRootFrame();
NotifyInvalidation(rootFrame->GetVisualOverflowRect(), aFlags);
mAllInvalidated = true;
}
void
nsPresContext::NotifyInvalidation(const nsIntRect& aRect, uint32_t aFlags)
{
@ -2488,10 +2476,6 @@ nsPresContext::NotifyInvalidation(const nsRect& aRect, uint32_t aFlags)
// even cheaper by providing a more efficient
// nsPIDOMWindow::GetListenerManager.
if (mAllInvalidated) {
return;
}
nsPresContext* pc;
for (pc = this; pc; pc = pc->GetParentPresContext()) {
if (pc->mFireAfterPaintEvents)
@ -2631,7 +2615,6 @@ nsPresContext::NotifyDidPaintForSubtree(uint32_t aFlags, uint64_t aTransactionId
if (aFlags & nsIPresShell::PAINT_LAYERS) {
mUndeliveredInvalidateRequestsBeforeLastPaint.TakeFrom(
&mInvalidateRequestsSinceLastPaint);
mAllInvalidated = false;
}
if (aFlags & nsIPresShell::PAINT_COMPOSITE) {
nsCOMPtr<nsIRunnable> ev =

Просмотреть файл

@ -971,7 +971,6 @@ public:
// and, if necessary, synchronously rebuilding all style data.
void EnsureSafeToHandOutCSSRules();
void NotifyInvalidation(uint32_t aFlags);
void NotifyInvalidation(const nsRect& aRect, uint32_t aFlags);
// aRect is in device pixels
void NotifyInvalidation(const nsIntRect& aRect, uint32_t aFlags);
@ -991,7 +990,6 @@ public:
void ClearMozAfterPaintEvents() {
mInvalidateRequestsSinceLastPaint.mRequests.Clear();
mUndeliveredInvalidateRequestsBeforeLastPaint.mRequests.Clear();
mAllInvalidated = false;
}
/**
@ -1399,9 +1397,6 @@ protected:
unsigned mPendingMediaFeatureValuesChanged : 1;
unsigned mPrefChangePendingNeedsReflow : 1;
unsigned mIsEmulatingMedia : 1;
// True if the requests in mInvalidateRequestsSinceLastPaint cover the
// entire viewport
unsigned mAllInvalidated : 1;
// Are we currently drawing an SVG glyph?
unsigned mIsGlyph : 1;

Просмотреть файл

@ -1184,10 +1184,6 @@ nsRefreshDriver::~nsRefreshDriver()
mRootRefresh->RemoveRefreshObserver(this, FlushType::Style);
mRootRefresh = nullptr;
}
for (nsIPresShell* shell : mPresShellsToInvalidateIfHidden) {
shell->InvalidatePresShellIfHidden();
}
mPresShellsToInvalidateIfHidden.Clear();
}
// Method for testing. See nsIDOMWindowUtils.advanceTimeAndRefresh
@ -2005,11 +2001,6 @@ nsRefreshDriver::Tick(int64_t aNowEpoch, TimeStamp aNowTime)
}
}
for (nsIPresShell* shell : mPresShellsToInvalidateIfHidden) {
shell->InvalidatePresShellIfHidden();
}
mPresShellsToInvalidateIfHidden.Clear();
bool notifyGC = false;
if (mViewManagerFlushIsPending) {
RefPtr<TimelineConsumers> timelines = TimelineConsumers::Get();

Просмотреть файл

@ -190,16 +190,6 @@ public:
bool IsLayoutFlushObserver(nsIPresShell* aShell) {
return mLayoutFlushObservers.Contains(aShell);
}
bool AddPresShellToInvalidateIfHidden(nsIPresShell* aShell) {
NS_ASSERTION(!mPresShellsToInvalidateIfHidden.Contains(aShell),
"Double-adding style flush observer");
bool appended = mPresShellsToInvalidateIfHidden.AppendElement(aShell) != nullptr;
EnsureTimerStarted();
return appended;
}
void RemovePresShellToInvalidateIfHidden(nsIPresShell* aShell) {
mPresShellsToInvalidateIfHidden.RemoveElement(aShell);
}
/**
* Remember whether our presshell's view manager needs a flush
@ -485,7 +475,6 @@ private:
AutoTArray<nsIPresShell*, 16> mStyleFlushObservers;
AutoTArray<nsIPresShell*, 16> mLayoutFlushObservers;
AutoTArray<nsIPresShell*, 16> mPresShellsToInvalidateIfHidden;
// nsTArray on purpose, because we want to be able to swap.
nsTArray<nsIDocument*> mFrameRequestCallbackDocs;
nsTArray<nsIDocument*> mThrottledFrameRequestCallbackDocs;

Просмотреть файл

@ -6181,10 +6181,6 @@ SchedulePaintInternal(nsIFrame* aFrame, nsIFrame::PaintType aType = nsIFrame::PA
if (aType == nsIFrame::PAINT_DEFAULT) {
displayRoot->AddStateBits(NS_FRAME_UPDATE_LAYER_TREE);
}
nsIPresShell* shell = aFrame->PresContext()->PresShell();
if (shell) {
shell->AddInvalidateHiddenPresShellObserver(pres->RefreshDriver());
}
}
static void InvalidateFrameInternal(nsIFrame *aFrame, bool aHasDisplayItem = true)