Skip to content

Commit

Permalink
Backed out changeset d5d68c0258f3 (bug 1201330)
Browse files Browse the repository at this point in the history
--HG--
extra : rebase_source : 2b98ebd0dd0ccd247b50e4b45210137622ef4441
  • Loading branch information
BavarianTomcat committed Oct 30, 2015
1 parent ff6d079 commit 2fe6ba3
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 99 deletions.
80 changes: 4 additions & 76 deletions layout/base/ActiveLayerTracker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,6 @@ class LayerActivity {
// Previous scale due to the CSS transform property.
Maybe<gfxSize> mPreviousTransformScale;

// The scroll frame during for which we most recently received a call to
// NotifyAnimatedFromScrollHandler.
nsWeakFrame mAnimatingScrollHandlerFrame;
// The set of activities that were triggered during
// mAnimatingScrollHandlerFrame's scroll event handler.
EnumSet<ActivityIndex> mScrollHandlerInducedActivity;

// Number of restyle operations detected
uint8_t mRestyleCounts[ACTIVITY_COUNT];
bool mContentActive;
Expand All @@ -116,21 +109,15 @@ class LayerActivityTracker final : public nsExpirationTracker<LayerActivity,4> {
LayerActivityTracker()
: nsExpirationTracker<LayerActivity,4>(GENERATION_MS,
"LayerActivityTracker")
, mDestroying(false)
{}
~LayerActivityTracker() {
mDestroying = true;
AgeAllGenerations();
}

virtual void NotifyExpired(LayerActivity* aObject);

private:
bool mDestroying;
};

static LayerActivityTracker* gLayerActivityTracker = nullptr;
static nsIFrame* gCurrentScrollHandlerFrame = nullptr;

LayerActivity::~LayerActivity()
{
Expand All @@ -146,13 +133,6 @@ NS_DECLARE_FRAME_PROPERTY(LayerActivityProperty, DeleteValue<LayerActivity>)
void
LayerActivityTracker::NotifyExpired(LayerActivity* aObject)
{
if (!mDestroying && aObject->mAnimatingScrollHandlerFrame.IsAlive()) {
// Reset the restyle counts, but let the layer activity survive.
PodArrayZero(aObject->mRestyleCounts);
MarkUsed(aObject);
return;
}

RemoveObject(aObject);

nsIFrame* f = aObject->mFrame;
Expand Down Expand Up @@ -314,23 +294,6 @@ ActiveLayerTracker::NotifyAnimated(nsIFrame* aFrame, nsCSSProperty aProperty)
mutationCount = 0xFF;
}

/* static */ void
ActiveLayerTracker::NotifyAnimatedFromScrollHandler(nsIFrame* aFrame, nsCSSProperty aProperty,
nsIFrame* aScrollFrame)
{
LayerActivity* layerActivity = GetLayerActivityForUpdate(aFrame);
LayerActivity::ActivityIndex activityIndex = LayerActivity::GetActivityIndexForProperty(aProperty);

if (layerActivity->mAnimatingScrollHandlerFrame.GetFrame() != aScrollFrame) {
// Discard any activity of a different scroll frame. We only track the
// most recent scroll handler induced activity.
layerActivity->mScrollHandlerInducedActivity.clear();
layerActivity->mAnimatingScrollHandlerFrame = aScrollFrame;
}

layerActivity->mScrollHandlerInducedActivity += activityIndex;
}

static bool
IsPresContextInScriptAnimationCallback(nsPresContext* aPresContext)
{
Expand All @@ -347,12 +310,10 @@ IsPresContextInScriptAnimationCallback(nsPresContext* aPresContext)
ActiveLayerTracker::NotifyInlineStyleRuleModified(nsIFrame* aFrame,
nsCSSProperty aProperty)
{
if (IsPresContextInScriptAnimationCallback(aFrame->PresContext())) {
NotifyAnimated(aFrame, aProperty);
}
if (gCurrentScrollHandlerFrame) {
NotifyAnimatedFromScrollHandler(aFrame, aProperty, gCurrentScrollHandlerFrame);
if (!IsPresContextInScriptAnimationCallback(aFrame->PresContext())) {
return;
}
NotifyAnimated(aFrame, aProperty);
}

/* static */ bool
Expand All @@ -361,29 +322,6 @@ ActiveLayerTracker::IsStyleMaybeAnimated(nsIFrame* aFrame, nsCSSProperty aProper
return IsStyleAnimated(nullptr, aFrame, aProperty);
}

static bool
CheckScrollInducedActivity(LayerActivity* aLayerActivity,
LayerActivity::ActivityIndex aActivityIndex,
nsDisplayListBuilder* aBuilder)
{
if (!aLayerActivity->mScrollHandlerInducedActivity.contains(aActivityIndex) ||
!aLayerActivity->mAnimatingScrollHandlerFrame.IsAlive()) {
return false;
}

nsIScrollableFrame* scrollFrame =
do_QueryFrame(aLayerActivity->mAnimatingScrollHandlerFrame.GetFrame());
if (scrollFrame && (!aBuilder || scrollFrame->IsScrollingActive(aBuilder))) {
return true;
}

// The scroll frame has been destroyed or has become inactive. Clear it from
// the layer activity so that it can expire.
aLayerActivity->mAnimatingScrollHandlerFrame = nullptr;
aLayerActivity->mScrollHandlerInducedActivity.clear();
return false;
}

/* static */ bool
ActiveLayerTracker::IsStyleAnimated(nsDisplayListBuilder* aBuilder,
nsIFrame* aFrame, nsCSSProperty aProperty)
Expand All @@ -402,11 +340,7 @@ ActiveLayerTracker::IsStyleAnimated(nsDisplayListBuilder* aBuilder,

LayerActivity* layerActivity = GetLayerActivity(aFrame);
if (layerActivity) {
LayerActivity::ActivityIndex activityIndex = LayerActivity::GetActivityIndexForProperty(aProperty);
if (layerActivity->mRestyleCounts[activityIndex] >= 2) {
return true;
}
if (CheckScrollInducedActivity(layerActivity, activityIndex, aBuilder)) {
if (layerActivity->RestyleCountForProperty(aProperty) >= 2) {
return true;
}
}
Expand Down Expand Up @@ -524,12 +458,6 @@ ActiveLayerTracker::IsContentActive(nsIFrame* aFrame)
return layerActivity && layerActivity->mContentActive;
}

/* static */ void
ActiveLayerTracker::SetCurrentScrollHandlerFrame(nsIFrame* aFrame)
{
gCurrentScrollHandlerFrame = aFrame;
}

/* static */ void
ActiveLayerTracker::Shutdown()
{
Expand Down
13 changes: 0 additions & 13 deletions layout/base/ActiveLayerTracker.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,6 @@ class ActiveLayerTracker {
* Any such marking will time out after a short period.
*/
static void NotifyAnimated(nsIFrame* aFrame, nsCSSProperty aProperty);
/**
* Notify aFrame as being known to have an animation of aProperty through an
* inline style modification during aScrollFrame's scroll event handler.
*/
static void NotifyAnimatedFromScrollHandler(nsIFrame* aFrame, nsCSSProperty aProperty,
nsIFrame* aScrollFrame);
/**
* Notify that a property in the inline style rule of aFrame's element
* has been modified.
Expand Down Expand Up @@ -113,13 +107,6 @@ class ActiveLayerTracker {
* Return true if this frame's content is still marked as active.
*/
static bool IsContentActive(nsIFrame* aFrame);

/**
* Called before and after a scroll event handler is executed, with the
* scrollframe or nullptr, respectively. This acts as a hint to treat
* inline style changes during the handler differently.
*/
static void SetCurrentScrollHandlerFrame(nsIFrame* aFrame);
};

} // namespace mozilla
Expand Down
2 changes: 0 additions & 2 deletions layout/generic/nsGfxScrollFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4199,7 +4199,6 @@ ScrollFrameHelper::FireScrollEvent()
{
mScrollEvent.Forget();

ActiveLayerTracker::SetCurrentScrollHandlerFrame(mOuter);
WidgetGUIEvent event(true, eScroll, nullptr);
nsEventStatus status = nsEventStatus_eIgnore;
nsIContent* content = mOuter->GetContent();
Expand All @@ -4217,7 +4216,6 @@ ScrollFrameHelper::FireScrollEvent()
event.mFlags.mBubbles = false;
EventDispatcher::Dispatch(content, prescontext, &event, nullptr, &status);
}
ActiveLayerTracker::SetCurrentScrollHandlerFrame(nullptr);
}

void
Expand Down
8 changes: 0 additions & 8 deletions mfbt/EnumSet.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,6 @@ class EnumSet
return result;
}

/**
* Clear
*/
void clear()
{
mBitField = 0;
}

/**
* Intersection
*/
Expand Down

0 comments on commit 2fe6ba3

Please sign in to comment.