Bug 1284350. Backed out changeset 4517cddd204e (Bug 1269934 - Handle visible frame sets more generically in PresShell. r=mstange)

This commit is contained in:
Timothy Nikkel 2016-09-12 00:19:07 -05:00
Родитель dbce89963b
Коммит 88bb36312b
5 изменённых файлов: 21 добавлений и 42 удалений

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

@ -297,7 +297,7 @@ nsImageLoadingContent::OnUnlockedDraw()
return;
}
presShell->MarkFrameVisible(frame, VisibilityCounter::IN_DISPLAYPORT);
presShell->MarkFrameVisibleInDisplayPort(frame);
}
nsresult

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

@ -49,7 +49,6 @@
#include "nsMargin.h"
#include "nsFrameState.h"
#include "Units.h"
#include "Visibility.h"
#ifdef MOZ_B2G
#include "nsIHardwareKeyHandler.h"
@ -186,7 +185,6 @@ public:
protected:
typedef mozilla::layers::LayerManager LayerManager;
typedef mozilla::gfx::SourceSurface SourceSurface;
using VisibilityCounter = mozilla::VisibilityCounter;
enum eRenderFlag {
STATE_IGNORING_VIEWPORT_SCROLLING = 0x1,
@ -1608,11 +1606,11 @@ public:
virtual void RebuildApproximateFrameVisibility(nsRect* aRect = nullptr,
bool aRemoveOnly = false) = 0;
/// Adds @aFrame to the visible frames set specified by @aCounter.
/// VisibilityCounter::MAY_BECOME_VISIBLE is not a valid argument.
virtual void MarkFrameVisible(nsIFrame* aFrame, VisibilityCounter aCounter) = 0;
/// Adds @aFrame to the list of frames which were visible within the
/// displayport during the last paint.
virtual void MarkFrameVisibleInDisplayPort(nsIFrame* aFrame) = 0;
/// Marks @aFrame nonvisible and removes it from all sets of visible frames.
/// Marks @aFrame nonvisible and removes it from all lists of visible frames.
virtual void MarkFrameNonvisible(nsIFrame* aFrame) = 0;
/// Whether we should assume all frames are visible.

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

@ -5793,7 +5793,9 @@ PresShell::AddFrameToVisibleRegions(nsIFrame* aFrame, VisibilityCounter aForCoun
return;
}
VisibleRegions& regions = mVisibleRegions->ForCounter(aForCounter);
VisibleRegions& regions = aForCounter == VisibilityCounter::MAY_BECOME_VISIBLE
? mVisibleRegions->mApproximate
: mVisibleRegions->mInDisplayPort;
CSSIntRegion* regionForView = regions.LookupOrAdd(viewID);
MOZ_ASSERT(regionForView);
@ -5864,7 +5866,9 @@ PresShell::InitVisibleRegionsIfVisualizationEnabled(VisibilityCounter aForCounte
if (mVisibleRegions) {
// Clear the regions we're about to update. We don't want to clear both,
// or the two visibility tracking methods will interfere with each other.
VisibleRegions& regions = mVisibleRegions->ForCounter(aForCounter);
VisibleRegions& regions = aForCounter == VisibilityCounter::MAY_BECOME_VISIBLE
? mVisibleRegions->mApproximate
: mVisibleRegions->mInDisplayPort;
regions.Clear();
return;
}
@ -6215,17 +6219,13 @@ PresShell::ScheduleApproximateFrameVisibilityUpdateNow()
}
void
PresShell::MarkFrameVisible(nsIFrame* aFrame, VisibilityCounter aCounter)
PresShell::MarkFrameVisibleInDisplayPort(nsIFrame* aFrame)
{
MOZ_ASSERT(aCounter != VisibilityCounter::MAY_BECOME_VISIBLE,
"MAY_BECOME_VISIBLE should only be managed from within PresShell");
if (!aFrame->TrackingVisibility()) {
return;
}
if (AssumeAllFramesVisible()) {
// Force to maximum visibility (IN_DISPLAYPORT) regardless of aCounter's value.
if (aFrame->GetVisibility() != Visibility::IN_DISPLAYPORT) {
aFrame->IncVisibilityCount(VisibilityCounter::IN_DISPLAYPORT);
}
@ -6241,15 +6241,13 @@ PresShell::MarkFrameVisible(nsIFrame* aFrame, VisibilityCounter aCounter)
}
#endif
VisibleFrames& frameSet = VisibleFramesForCounter(aCounter);
if (!frameSet.Contains(aFrame)) {
if (!mInDisplayPortFrames.Contains(aFrame)) {
MOZ_ASSERT(!AssumeAllFramesVisible());
frameSet.PutEntry(aFrame);
aFrame->IncVisibilityCount(aCounter);
mInDisplayPortFrames.PutEntry(aFrame);
aFrame->IncVisibilityCount(VisibilityCounter::IN_DISPLAYPORT);
}
AddFrameToVisibleRegions(aFrame, aCounter);
AddFrameToVisibleRegions(aFrame, VisibilityCounter::IN_DISPLAYPORT);
}
static void

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

@ -38,6 +38,7 @@
#include "mozilla/StyleSetHandle.h"
#include "mozilla/UniquePtr.h"
#include "MobileViewportManager.h"
#include "Visibility.h"
#include "ZoomConstraintsClient.h"
class nsIDocShell;
@ -415,7 +416,7 @@ public:
void RebuildApproximateFrameVisibility(nsRect* aRect = nullptr,
bool aRemoveOnly = false) override;
void MarkFrameVisible(nsIFrame* aFrame, VisibilityCounter aCounter) override;
void MarkFrameVisibleInDisplayPort(nsIFrame* aFrame) override;
void MarkFrameNonvisible(nsIFrame* aFrame) override;
bool AssumeAllFramesVisible() override;
@ -799,15 +800,6 @@ protected:
nsRevocableEventPtr<nsRunnableMethod<PresShell>> mUpdateApproximateFrameVisibilityEvent;
nsRevocableEventPtr<nsRunnableMethod<PresShell>> mNotifyCompositorOfVisibleRegionsChangeEvent;
VisibleFrames& VisibleFramesForCounter(VisibilityCounter aCounter)
{
switch (aCounter)
{
case VisibilityCounter::MAY_BECOME_VISIBLE: return mApproximatelyVisibleFrames;
case VisibilityCounter::IN_DISPLAYPORT: return mInDisplayPortFrames;
}
}
// A set of frames that were visible or could be visible soon at the time
// that we last did an approximate frame visibility update.
VisibleFrames mApproximatelyVisibleFrames;
@ -817,15 +809,6 @@ protected:
struct VisibleRegionsContainer
{
VisibleRegions& ForCounter(VisibilityCounter aCounter)
{
switch (aCounter)
{
case VisibilityCounter::MAY_BECOME_VISIBLE: return mApproximate;
case VisibilityCounter::IN_DISPLAYPORT: return mInDisplayPort;
}
}
// The approximately visible regions calculated during the last update to
// approximate frame visibility.
VisibleRegions mApproximate;

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

@ -1505,7 +1505,7 @@ nsIFrame::UpdateVisibilitySynchronously()
}
if (presShell->AssumeAllFramesVisible()) {
presShell->MarkFrameVisible(this, VisibilityCounter::IN_DISPLAYPORT);
presShell->MarkFrameVisibleInDisplayPort(this);
return;
}
@ -1546,7 +1546,7 @@ nsIFrame::UpdateVisibilitySynchronously()
}
if (visible) {
presShell->MarkFrameVisible(this, VisibilityCounter::IN_DISPLAYPORT);
presShell->MarkFrameVisibleInDisplayPort(this);
} else {
presShell->MarkFrameNonvisible(this);
}
@ -2781,7 +2781,7 @@ nsIFrame::BuildDisplayListForChild(nsDisplayListBuilder* aBuilder,
// within the displayport.
if (aBuilder->IsPaintingToWindow() && child->TrackingVisibility()) {
nsIPresShell* shell = child->PresContext()->PresShell();
shell->MarkFrameVisible(child, VisibilityCounter::IN_DISPLAYPORT);
shell->MarkFrameVisibleInDisplayPort(child);
}
// Child is composited if it's transformed, partially transparent, or has