Bug 1751806. Remove background position and offset tracking from ActiveLayerManager as they are unused. r=mstange

Depends on D136815

Differential Revision: https://phabricator.services.mozilla.com/D136816
This commit is contained in:
Timothy Nikkel 2022-01-26 11:39:13 +00:00
Родитель d1a54b0a05
Коммит 2933d9ccc7
4 изменённых файлов: 1 добавлений и 101 удалений

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

@ -1669,7 +1669,6 @@ void RestyleManager::ProcessRestyledFrames(nsStyleChangeList& aChangeList) {
ApplyRenderingChangeToTree(presContext->PresShell(), frame, hint);
}
if ((hint & nsChangeHint_RecomputePosition) && !didReflowThisFrame) {
ActiveLayerTracker::NotifyOffsetRestyle(frame);
// It is possible for this to fall back to a reflow
if (!RecomputePosition(frame)) {
StyleChangeReflow(frame, nsChangeHint_NeedReflow |

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

@ -47,11 +47,6 @@ class LayerActivity {
enum ActivityIndex {
ACTIVITY_OPACITY,
ACTIVITY_TRANSFORM,
ACTIVITY_LEFT,
ACTIVITY_TOP,
ACTIVITY_RIGHT,
ACTIVITY_BOTTOM,
ACTIVITY_BACKGROUND_POSITION,
ACTIVITY_SCALE,
ACTIVITY_TRIGGERED_REPAINT,
@ -84,20 +79,6 @@ class LayerActivity {
case eCSSProperty_offset_anchor:
// TODO: Bug 1559232: Add offset-position.
return ACTIVITY_TRANSFORM;
case eCSSProperty_left:
return ACTIVITY_LEFT;
case eCSSProperty_top:
return ACTIVITY_TOP;
case eCSSProperty_right:
return ACTIVITY_RIGHT;
case eCSSProperty_bottom:
return ACTIVITY_BOTTOM;
case eCSSProperty_background_position:
return ACTIVITY_BACKGROUND_POSITION;
case eCSSProperty_background_position_x:
return ACTIVITY_BACKGROUND_POSITION;
case eCSSProperty_background_position_y:
return ACTIVITY_BACKGROUND_POSITION;
default:
MOZ_ASSERT(false);
return ACTIVITY_OPACITY;
@ -289,19 +270,6 @@ void ActiveLayerTracker::NotifyRestyle(nsIFrame* aFrame,
}
}
/* static */
void ActiveLayerTracker::NotifyOffsetRestyle(nsIFrame* aFrame) {
LayerActivity* layerActivity = GetLayerActivityForUpdate(aFrame);
IncrementMutationCount(
&layerActivity->mRestyleCounts[LayerActivity::ACTIVITY_LEFT]);
IncrementMutationCount(
&layerActivity->mRestyleCounts[LayerActivity::ACTIVITY_TOP]);
IncrementMutationCount(
&layerActivity->mRestyleCounts[LayerActivity::ACTIVITY_RIGHT]);
IncrementMutationCount(
&layerActivity->mRestyleCounts[LayerActivity::ACTIVITY_BOTTOM]);
}
/* static */
void ActiveLayerTracker::NotifyAnimated(nsIFrame* aFrame,
nsCSSPropertyID aProperty,
@ -354,30 +322,6 @@ void ActiveLayerTracker::NotifyNeedsRepaint(nsIFrame* aFrame) {
}
}
/* static */
bool ActiveLayerTracker::IsBackgroundPositionAnimated(
nsDisplayListBuilder* aBuilder, nsIFrame* aFrame) {
LayerActivity* layerActivity = GetLayerActivity(aFrame);
if (layerActivity) {
LayerActivity::ActivityIndex activityIndex =
LayerActivity::ActivityIndex::ACTIVITY_BACKGROUND_POSITION;
if (layerActivity->mRestyleCounts[activityIndex] >= 2) {
// If the frame needs to be repainted frequently, we probably don't get
// much from treating the property as animated, *unless* this frame's
// 'scale' (which includes the bounds changes of a rotation) is changing.
// Marking a scaling transform as animating allows us to avoid resizing
// the texture, even if we have to repaint the contents of that texture.
if (layerActivity
->mRestyleCounts[LayerActivity::ACTIVITY_TRIGGERED_REPAINT] < 2) {
return true;
}
}
}
return nsLayoutUtils::HasEffectiveAnimation(
aFrame, nsCSSPropertyIDSet({eCSSProperty_background_position_x,
eCSSProperty_background_position_y}));
}
static bool IsMotionPathAnimated(nsDisplayListBuilder* aBuilder,
nsIFrame* aFrame) {
return ActiveLayerTracker::IsStyleAnimated(
@ -472,25 +416,6 @@ bool ActiveLayerTracker::IsStyleAnimated(
return IsStyleAnimated(aBuilder, aFrame->GetParent(), aPropertySet);
}
/* static */
bool ActiveLayerTracker::IsOffsetStyleAnimated(nsIFrame* aFrame) {
LayerActivity* layerActivity = GetLayerActivity(aFrame);
if (layerActivity) {
if (layerActivity->mRestyleCounts[LayerActivity::ACTIVITY_LEFT] >= 2 ||
layerActivity->mRestyleCounts[LayerActivity::ACTIVITY_TOP] >= 2 ||
layerActivity->mRestyleCounts[LayerActivity::ACTIVITY_RIGHT] >= 2 ||
layerActivity->mRestyleCounts[LayerActivity::ACTIVITY_BOTTOM] >= 2) {
return true;
}
}
// We should also check for running CSS animations of these properties once
// bug 1009693 is fixed. Until that happens, layerization isn't useful for
// animations of these properties because we'll invalidate the layer contents
// on every change anyway.
// See bug 1151346 for a patch that adds a check for CSS animations.
return false;
}
/* static */
bool ActiveLayerTracker::IsScaleSubjectToAnimation(nsIFrame* aFrame) {
// Check whether JavaScript is animating this frame's scale.

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

@ -35,8 +35,6 @@ class ActiveLayerTracker {
* eCSSProperty_offset_path, eCSSProperty_offset_distance,
* eCSSProperty_offset_rotate, eCSSProperty_offset_anchor,
* eCSSProperty_opacity
* eCSSProperty_left, eCSSProperty_top,
* eCSSProperty_right, eCSSProperty_bottom
* and use that information to guess whether style changes are animated.
*/
@ -47,12 +45,6 @@ class ActiveLayerTracker {
* @param aProperty the property that has changed
*/
static void NotifyRestyle(nsIFrame* aFrame, nsCSSPropertyID aProperty);
/**
* Notify aFrame's left/top/right/bottom properties as having (maybe)
* changed due to a restyle, and therefore possibly wanting an active layer
* to render that style. Any such marking will time out after a short period.
*/
static void NotifyOffsetRestyle(nsIFrame* aFrame);
/**
* Mark aFrame as being known to have an animation of aProperty.
* Any such marking will time out after a short period.
@ -87,17 +79,6 @@ class ActiveLayerTracker {
*/
static bool IsStyleAnimated(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
const nsCSSPropertyIDSet& aPropertySet);
/**
* Return true if any of aFrame's offset property styles should be considered
* as being animated for constructing active layers.
*/
static bool IsOffsetStyleAnimated(nsIFrame* aFrame);
/**
* Return true if aFrame's background-position-x or background-position-y
* property is animated.
*/
static bool IsBackgroundPositionAnimated(nsDisplayListBuilder* aBuilder,
nsIFrame* aFrame);
/**
* Return true if aFrame's transform-like property,
* i.e. transform/translate/rotate/scale, is animated.

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

@ -201,12 +201,7 @@ void nsDOMCSSAttributeDeclaration::SetPropertyValue(
aPropID == eCSSProperty_scale || aPropID == eCSSProperty_offset_path ||
aPropID == eCSSProperty_offset_distance ||
aPropID == eCSSProperty_offset_rotate ||
aPropID == eCSSProperty_offset_anchor || aPropID == eCSSProperty_left ||
aPropID == eCSSProperty_top || aPropID == eCSSProperty_right ||
aPropID == eCSSProperty_bottom ||
aPropID == eCSSProperty_background_position_x ||
aPropID == eCSSProperty_background_position_y ||
aPropID == eCSSProperty_background_position) {
aPropID == eCSSProperty_offset_anchor) {
nsIFrame* frame = mElement->GetPrimaryFrame();
if (frame) {
ActiveLayerTracker::NotifyInlineStyleRuleModified(frame, aPropID, aValue,