mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out changeset 9f04406171f7 (bug 911889) for reftest failures on Android on a CLOSED TREE
This commit is contained in:
parent
41cda193ab
commit
401e6db2a1
@ -33,7 +33,6 @@
|
||||
#include "nsMathUtils.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsStreamUtils.h"
|
||||
#include "ActiveLayerTracker.h"
|
||||
|
||||
#ifdef MOZ_WEBGL
|
||||
#include "../canvas/src/WebGL2Context.h"
|
||||
@ -836,7 +835,7 @@ HTMLCanvasElement::InvalidateCanvasContent(const gfx::Rect* damageRect)
|
||||
if (!frame)
|
||||
return;
|
||||
|
||||
ActiveLayerTracker::NotifyContentChange(frame);
|
||||
frame->MarkLayersActive(nsChangeHint(0));
|
||||
|
||||
Layer* layer = nullptr;
|
||||
if (damageRect) {
|
||||
|
@ -97,7 +97,7 @@ function waitForPaintHelper(func) {
|
||||
setTimeout(func, 0);
|
||||
return;
|
||||
}
|
||||
setTimeout(function() { waitForPaintHelper(func); }, 1000);
|
||||
setTimeout(function() { waitForPaintHelper(func); }, 100);
|
||||
}
|
||||
|
||||
</script>
|
||||
|
@ -1,175 +0,0 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "ActiveLayerTracker.h"
|
||||
|
||||
#include "nsExpirationTracker.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIContent.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
/**
|
||||
* This tracks the state of a frame that may need active layers due to
|
||||
* ongoing content changes or style changes that indicate animation.
|
||||
*
|
||||
* When no changes of *any* kind are detected after 75-100ms we remove this
|
||||
* object. Because we only track all kinds of activity with a single
|
||||
* nsExpirationTracker, it's possible a frame might remain active somewhat
|
||||
* spuriously if different kinds of changes kept happening, but that almost
|
||||
* certainly doesn't matter.
|
||||
*/
|
||||
class LayerActivity {
|
||||
public:
|
||||
LayerActivity(nsIFrame* aFrame)
|
||||
: mFrame(aFrame)
|
||||
, mOpacityRestyleCount(0)
|
||||
, mTransformRestyleCount(0)
|
||||
, mContentActive(false)
|
||||
{}
|
||||
~LayerActivity();
|
||||
nsExpirationState* GetExpirationState() { return &mState; }
|
||||
uint8_t& RestyleCountForProperty(nsCSSProperty aProperty)
|
||||
{
|
||||
switch (aProperty) {
|
||||
case eCSSProperty_opacity: return mOpacityRestyleCount;
|
||||
case eCSSProperty_transform: return mTransformRestyleCount;
|
||||
default: MOZ_ASSERT(false); return mOpacityRestyleCount;
|
||||
}
|
||||
}
|
||||
|
||||
nsIFrame* mFrame;
|
||||
nsExpirationState mState;
|
||||
// Number of restyle operations detected
|
||||
uint8_t mOpacityRestyleCount;
|
||||
uint8_t mTransformRestyleCount;
|
||||
bool mContentActive;
|
||||
};
|
||||
|
||||
class LayerActivityTracker MOZ_FINAL : public nsExpirationTracker<LayerActivity,4> {
|
||||
public:
|
||||
// 75-100ms is a good timeout period. We use 4 generations of 25ms each.
|
||||
enum { GENERATION_MS = 100 };
|
||||
LayerActivityTracker()
|
||||
: nsExpirationTracker<LayerActivity,4>(GENERATION_MS) {}
|
||||
~LayerActivityTracker() {
|
||||
AgeAllGenerations();
|
||||
}
|
||||
|
||||
virtual void NotifyExpired(LayerActivity* aObject);
|
||||
};
|
||||
|
||||
static LayerActivityTracker* gLayerActivityTracker = nullptr;
|
||||
|
||||
LayerActivity::~LayerActivity()
|
||||
{
|
||||
if (mFrame) {
|
||||
NS_ASSERTION(gLayerActivityTracker, "Should still have a tracker");
|
||||
gLayerActivityTracker->RemoveObject(this);
|
||||
}
|
||||
}
|
||||
|
||||
static void DestroyLayerActivity(void* aPropertyValue)
|
||||
{
|
||||
delete static_cast<LayerActivity*>(aPropertyValue);
|
||||
}
|
||||
|
||||
NS_DECLARE_FRAME_PROPERTY(LayerActivityProperty, DestroyLayerActivity)
|
||||
|
||||
void
|
||||
LayerActivityTracker::NotifyExpired(LayerActivity* aObject)
|
||||
{
|
||||
RemoveObject(aObject);
|
||||
|
||||
nsIFrame* f = aObject->mFrame;
|
||||
aObject->mFrame = nullptr;
|
||||
|
||||
f->SchedulePaint();
|
||||
f->Properties().Delete(LayerActivityProperty());
|
||||
}
|
||||
|
||||
static LayerActivity*
|
||||
GetLayerActivity(nsIFrame* aFrame)
|
||||
{
|
||||
FrameProperties properties = aFrame->Properties();
|
||||
return static_cast<LayerActivity*>(properties.Get(LayerActivityProperty()));
|
||||
}
|
||||
|
||||
static LayerActivity*
|
||||
GetLayerActivityForUpdate(nsIFrame* aFrame)
|
||||
{
|
||||
FrameProperties properties = aFrame->Properties();
|
||||
LayerActivity* layerActivity =
|
||||
static_cast<LayerActivity*>(properties.Get(LayerActivityProperty()));
|
||||
if (layerActivity) {
|
||||
gLayerActivityTracker->MarkUsed(layerActivity);
|
||||
} else {
|
||||
if (!gLayerActivityTracker) {
|
||||
gLayerActivityTracker = new LayerActivityTracker();
|
||||
}
|
||||
layerActivity = new LayerActivity(aFrame);
|
||||
gLayerActivityTracker->AddObject(layerActivity);
|
||||
properties.Set(LayerActivityProperty(), layerActivity);
|
||||
}
|
||||
return layerActivity;
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
ActiveLayerTracker::NotifyRestyle(nsIFrame* aFrame, nsCSSProperty aProperty)
|
||||
{
|
||||
LayerActivity* layerActivity = GetLayerActivityForUpdate(aFrame);
|
||||
uint8_t& mutationCount = layerActivity->RestyleCountForProperty(aProperty);
|
||||
mutationCount = uint8_t(std::min(0xFF, mutationCount + 1));
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
ActiveLayerTracker::NotifyAnimated(nsIFrame* aFrame, nsCSSProperty aProperty)
|
||||
{
|
||||
LayerActivity* layerActivity = GetLayerActivityForUpdate(aFrame);
|
||||
uint8_t& mutationCount = layerActivity->RestyleCountForProperty(aProperty);
|
||||
// We know this is animated, so just hack the mutation count.
|
||||
mutationCount = 0xFF;
|
||||
}
|
||||
|
||||
/* static */ bool
|
||||
ActiveLayerTracker::IsStyleAnimated(nsIFrame* aFrame, nsCSSProperty aProperty)
|
||||
{
|
||||
LayerActivity* layerActivity = GetLayerActivity(aFrame);
|
||||
if (layerActivity) {
|
||||
// XXX should we really treat a single change to transform as animation?
|
||||
uint8_t minStyleChangesToBeConsideredAnimation =
|
||||
aProperty == eCSSProperty_opacity ? 2 : 1;
|
||||
if (layerActivity->RestyleCountForProperty(aProperty) >=
|
||||
minStyleChangesToBeConsideredAnimation) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (aProperty == eCSSProperty_transform && aFrame->Preserves3D()) {
|
||||
return IsStyleAnimated(aFrame->GetParent(), aProperty);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
ActiveLayerTracker::NotifyContentChange(nsIFrame* aFrame)
|
||||
{
|
||||
LayerActivity* layerActivity = GetLayerActivityForUpdate(aFrame);
|
||||
layerActivity->mContentActive = true;
|
||||
}
|
||||
|
||||
/* static */ bool
|
||||
ActiveLayerTracker::IsContentActive(nsIFrame* aFrame)
|
||||
{
|
||||
LayerActivity* layerActivity = GetLayerActivity(aFrame);
|
||||
return layerActivity && layerActivity->mContentActive;
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
ActiveLayerTracker::Shutdown()
|
||||
{
|
||||
delete gLayerActivityTracker;
|
||||
gLayerActivityTracker = nullptr;
|
||||
}
|
||||
|
||||
}
|
@ -1,60 +0,0 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef ACTIVELAYERTRACKER_H_
|
||||
#define ACTIVELAYERTRACKER_H_
|
||||
|
||||
#include "nsCSSProperty.h"
|
||||
|
||||
class nsIFrame;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
/**
|
||||
* This class receives various notifications about style changes and content
|
||||
* changes that affect layerization decisions, and implements the heuristics
|
||||
* that drive those decisions. It manages per-frame state to support those
|
||||
* heuristics.
|
||||
*/
|
||||
class ActiveLayerTracker {
|
||||
public:
|
||||
/*
|
||||
* We track eCSSProperty_transform and eCSSProperty_opacity style changes
|
||||
* and use that information to guess whether style changes are animated.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Notify aFrame's style property as having 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.
|
||||
* @param aProperty the property that has changed
|
||||
*/
|
||||
static void NotifyRestyle(nsIFrame* aFrame, nsCSSProperty aProperty);
|
||||
/**
|
||||
* Mark aFrame as being known to have an animation of aProperty.
|
||||
* Any such marking will time out after a short period.
|
||||
*/
|
||||
static void NotifyAnimated(nsIFrame* aFrame, nsCSSProperty aProperty);
|
||||
/**
|
||||
* Return true if aFrame's aProperty style should be considered as being animated
|
||||
* for constructing active layers.
|
||||
*/
|
||||
static bool IsStyleAnimated(nsIFrame* aFrame, nsCSSProperty aProperty);
|
||||
|
||||
/**
|
||||
* Mark aFrame's content as being active. This marking will time out after
|
||||
* a short period. This is useful for frames such as canvas frames.
|
||||
*/
|
||||
static void NotifyContentChange(nsIFrame* aFrame);
|
||||
/**
|
||||
* Return true if this frame's content is still marked as active.
|
||||
*/
|
||||
static bool IsContentActive(nsIFrame* aFrame);
|
||||
|
||||
static void Shutdown();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* ACTIVELAYERTRACKER_H_ */
|
@ -20,7 +20,6 @@
|
||||
#include "LayerTreeInvalidation.h"
|
||||
#include "nsSVGIntegrationUtils.h"
|
||||
#include "ImageContainer.h"
|
||||
#include "ActiveLayerTracker.h"
|
||||
|
||||
#include "GeckoProfiler.h"
|
||||
#include "mozilla/gfx/Tools.h"
|
||||
@ -2699,7 +2698,7 @@ ChooseScaleAndSetTransform(FrameLayerBuilder* aLayerBuilder,
|
||||
aContainerFrame->GetContent(), eCSSProperty_transform)) {
|
||||
scale = nsLayoutUtils::GetMaximumAnimatedScale(aContainerFrame->GetContent());
|
||||
} else {
|
||||
// Scale factors are normalized to a power of 2 to reduce the number of resolution changes
|
||||
//Scale factors are normalized to a power of 2 to reduce the number of resolution changes
|
||||
scale = RoundToFloatPrecision(transform2d.ScaleFactors(true));
|
||||
// For frames with a changing transform that's not just a translation,
|
||||
// round scale factors up to nearest power-of-2 boundary so that we don't
|
||||
@ -2708,7 +2707,7 @@ ChooseScaleAndSetTransform(FrameLayerBuilder* aLayerBuilder,
|
||||
// jaggies. It also ensures we never scale down by more than a factor of 2,
|
||||
// avoiding bad downscaling quality.
|
||||
gfxMatrix frameTransform;
|
||||
if (ActiveLayerTracker::IsStyleAnimated(aContainerFrame, eCSSProperty_transform) &&
|
||||
if (aContainerFrame->AreLayersMarkedActive(nsChangeHint_UpdateTransformLayer) &&
|
||||
aTransform &&
|
||||
(!aTransform->Is2D(&frameTransform) || frameTransform.HasNonTranslationOrFlip())) {
|
||||
// Don't clamp the scale factor when the new desired scale factor matches the old one
|
||||
@ -2749,7 +2748,7 @@ ChooseScaleAndSetTransform(FrameLayerBuilder* aLayerBuilder,
|
||||
FrameLayerBuilder::ContainerParameters(scale.width, scale.height, -offset, aIncomingScale);
|
||||
if (aTransform) {
|
||||
aOutgoingScale.mInTransformedSubtree = true;
|
||||
if (ActiveLayerTracker::IsStyleAnimated(aContainerFrame, eCSSProperty_transform)) {
|
||||
if (aContainerFrame->AreLayersMarkedActive(nsChangeHint_UpdateTransformLayer)) {
|
||||
aOutgoingScale.mInActiveTransformedSubtree = true;
|
||||
}
|
||||
}
|
||||
|
@ -34,7 +34,6 @@
|
||||
#include "nsIDOMMutationEvent.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsIFrameInlines.h"
|
||||
#include "ActiveLayerTracker.h"
|
||||
|
||||
#ifdef ACCESSIBILITY
|
||||
#include "nsAccessibilityService.h"
|
||||
@ -225,8 +224,7 @@ DoApplyRenderingChangeToTree(nsIFrame* aFrame,
|
||||
// FIXME/bug 796697: we can get away with empty transactions for
|
||||
// opacity updates in many cases.
|
||||
needInvalidatingPaint = true;
|
||||
|
||||
ActiveLayerTracker::NotifyRestyle(aFrame, eCSSProperty_opacity);
|
||||
aFrame->MarkLayersActive(nsChangeHint_UpdateOpacityLayer);
|
||||
if (nsSVGIntegrationUtils::UsingEffectsForFrame(aFrame)) {
|
||||
// SVG effects paints the opacity without using
|
||||
// nsDisplayOpacity. We need to invalidate manually.
|
||||
@ -235,7 +233,7 @@ DoApplyRenderingChangeToTree(nsIFrame* aFrame,
|
||||
}
|
||||
if ((aChange & nsChangeHint_UpdateTransformLayer) &&
|
||||
aFrame->IsTransformed()) {
|
||||
ActiveLayerTracker::NotifyRestyle(aFrame, eCSSProperty_transform);
|
||||
aFrame->MarkLayersActive(nsChangeHint_UpdateTransformLayer);
|
||||
// If we're not already going to do an invalidating paint, see
|
||||
// if we can get away with only updating the transform on a
|
||||
// layer for this frame, and not scheduling an invalidating
|
||||
@ -249,7 +247,7 @@ DoApplyRenderingChangeToTree(nsIFrame* aFrame,
|
||||
nsIFrame* childFrame =
|
||||
GetFrameForChildrenOnlyTransformHint(aFrame)->GetFirstPrincipalChild();
|
||||
for ( ; childFrame; childFrame = childFrame->GetNextSibling()) {
|
||||
ActiveLayerTracker::NotifyRestyle(childFrame, eCSSProperty_transform);
|
||||
childFrame->MarkLayersActive(nsChangeHint_UpdateTransformLayer);
|
||||
}
|
||||
}
|
||||
aFrame->SchedulePaint(needInvalidatingPaint ?
|
||||
|
@ -26,7 +26,6 @@ XPIDL_MODULE = 'layout_base'
|
||||
MODULE = 'layout'
|
||||
|
||||
EXPORTS += [
|
||||
'ActiveLayerTracker.h',
|
||||
'DisplayItemClip.h',
|
||||
'DisplayListClipState.h',
|
||||
'FrameLayerBuilder.h',
|
||||
@ -67,7 +66,6 @@ EXPORTS.mozilla += [
|
||||
]
|
||||
|
||||
SOURCES += [
|
||||
'ActiveLayerTracker.cpp',
|
||||
'DisplayItemClip.cpp',
|
||||
'DisplayListClipState.cpp',
|
||||
'FrameLayerBuilder.cpp',
|
||||
|
@ -47,7 +47,6 @@
|
||||
#include "StickyScrollContainer.h"
|
||||
#include "mozilla/LookAndFeel.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "ActiveLayerTracker.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <algorithm>
|
||||
@ -3091,7 +3090,7 @@ nsDisplayItem::LayerState
|
||||
nsDisplayOpacity::GetLayerState(nsDisplayListBuilder* aBuilder,
|
||||
LayerManager* aManager,
|
||||
const ContainerParameters& aParameters) {
|
||||
if (ActiveLayerTracker::IsStyleAnimated(mFrame, eCSSProperty_opacity) &&
|
||||
if (mFrame->AreLayersMarkedActive(nsChangeHint_UpdateOpacityLayer) &&
|
||||
!IsItemTooSmallForActiveLayer(this))
|
||||
return LAYER_ACTIVE;
|
||||
if (mFrame->GetContent()) {
|
||||
@ -4214,7 +4213,7 @@ nsDisplayTransform::GetResultingTransformMatrixInternal(const FrameTransformProp
|
||||
bool
|
||||
nsDisplayOpacity::CanUseAsyncAnimations(nsDisplayListBuilder* aBuilder)
|
||||
{
|
||||
if (ActiveLayerTracker::IsStyleAnimated(mFrame, eCSSProperty_opacity)) {
|
||||
if (Frame()->AreLayersMarkedActive(nsChangeHint_UpdateOpacityLayer)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -4244,7 +4243,7 @@ nsDisplayTransform::ShouldPrerenderTransformedContent(nsDisplayListBuilder* aBui
|
||||
// have a compositor-animated transform, can be prerendered. An element
|
||||
// might have only just had its transform animated in which case
|
||||
// nsChangeHint_UpdateTransformLayer will not be present yet.
|
||||
if (!ActiveLayerTracker::IsStyleAnimated(aFrame, eCSSProperty_transform) &&
|
||||
if (!aFrame->AreLayersMarkedActive(nsChangeHint_UpdateTransformLayer) &&
|
||||
(!aFrame->GetContent() ||
|
||||
!nsLayoutUtils::HasAnimationsForCompositor(aFrame->GetContent(),
|
||||
eCSSProperty_transform))) {
|
||||
@ -4394,7 +4393,7 @@ nsDisplayTransform::GetLayerState(nsDisplayListBuilder* aBuilder,
|
||||
}
|
||||
// Here we check if the *post-transform* bounds of this item are big enough
|
||||
// to justify an active layer.
|
||||
if (ActiveLayerTracker::IsStyleAnimated(mFrame, eCSSProperty_transform) &&
|
||||
if (mFrame->AreLayersMarkedActive(nsChangeHint_UpdateTransformLayer) &&
|
||||
!IsItemTooSmallForActiveLayer(this))
|
||||
return LAYER_ACTIVE;
|
||||
if (mFrame->GetContent()) {
|
||||
|
@ -61,7 +61,6 @@
|
||||
#include "DOMStorageObserver.h"
|
||||
#include "CacheObserver.h"
|
||||
#include "DisplayItemClip.h"
|
||||
#include "ActiveLayerTracker.h"
|
||||
|
||||
#include "AudioChannelService.h"
|
||||
|
||||
@ -312,7 +311,7 @@ nsLayoutStatics::Shutdown()
|
||||
nsFrame::DisplayReflowShutdown();
|
||||
#endif
|
||||
nsCellMap::Shutdown();
|
||||
ActiveLayerTracker::Shutdown();
|
||||
nsFrame::ShutdownLayerActivityTimer();
|
||||
|
||||
// Release all of our atoms
|
||||
nsColorNames::ReleaseTable();
|
||||
|
@ -62,6 +62,7 @@
|
||||
#include "nsBoxLayoutState.h"
|
||||
#include "nsBlockFrame.h"
|
||||
#include "nsDisplayList.h"
|
||||
#include "nsExpirationTracker.h"
|
||||
#include "nsSVGIntegrationUtils.h"
|
||||
#include "nsSVGEffects.h"
|
||||
#include "nsChangeHint.h"
|
||||
@ -4561,6 +4562,130 @@ nsIFrame::IsLeaf() const
|
||||
return true;
|
||||
}
|
||||
|
||||
class LayerActivity {
|
||||
public:
|
||||
LayerActivity(nsIFrame* aFrame)
|
||||
: mFrame(aFrame)
|
||||
, mChangeHint(nsChangeHint(0))
|
||||
, mMutationCount(0)
|
||||
{}
|
||||
~LayerActivity();
|
||||
nsExpirationState* GetExpirationState() { return &mState; }
|
||||
uint32_t GetMutationCount() { return mMutationCount; }
|
||||
|
||||
nsIFrame* mFrame;
|
||||
nsExpirationState mState;
|
||||
// mChangeHint can be some combination of nsChangeHint_UpdateOpacityLayer and
|
||||
// nsChangeHint_UpdateTransformLayer (or neither)
|
||||
// The presence of those bits indicates whether opacity or transform
|
||||
// changes have been detected.
|
||||
nsChangeHint mChangeHint;
|
||||
uint32_t mMutationCount;
|
||||
};
|
||||
|
||||
class LayerActivityTracker MOZ_FINAL : public nsExpirationTracker<LayerActivity,4> {
|
||||
public:
|
||||
// 75-100ms is a good timeout period. We use 4 generations of 25ms each.
|
||||
enum { GENERATION_MS = 100 };
|
||||
LayerActivityTracker()
|
||||
: nsExpirationTracker<LayerActivity,4>(GENERATION_MS) {}
|
||||
~LayerActivityTracker() {
|
||||
AgeAllGenerations();
|
||||
}
|
||||
|
||||
virtual void NotifyExpired(LayerActivity* aObject);
|
||||
};
|
||||
|
||||
static LayerActivityTracker* gLayerActivityTracker = nullptr;
|
||||
|
||||
LayerActivity::~LayerActivity()
|
||||
{
|
||||
if (mFrame) {
|
||||
NS_ASSERTION(gLayerActivityTracker, "Should still have a tracker");
|
||||
gLayerActivityTracker->RemoveObject(this);
|
||||
}
|
||||
}
|
||||
|
||||
static void DestroyLayerActivity(void* aPropertyValue)
|
||||
{
|
||||
delete static_cast<LayerActivity*>(aPropertyValue);
|
||||
}
|
||||
|
||||
NS_DECLARE_FRAME_PROPERTY(LayerActivityProperty, DestroyLayerActivity)
|
||||
|
||||
void
|
||||
LayerActivityTracker::NotifyExpired(LayerActivity* aObject)
|
||||
{
|
||||
RemoveObject(aObject);
|
||||
|
||||
nsIFrame* f = aObject->mFrame;
|
||||
aObject->mFrame = nullptr;
|
||||
|
||||
// if there are hints other than transform/opacity, invalidate, since we don't know what else to do.
|
||||
if (aObject->mChangeHint & ~(nsChangeHint_UpdateOpacityLayer|nsChangeHint_UpdateTransformLayer)) {
|
||||
f->InvalidateFrameSubtree();
|
||||
} else {
|
||||
if (aObject->mChangeHint & nsChangeHint_UpdateOpacityLayer) {
|
||||
f->InvalidateFrameSubtree(nsDisplayItem::TYPE_OPACITY);
|
||||
}
|
||||
if (aObject->mChangeHint & nsChangeHint_UpdateTransformLayer) {
|
||||
f->InvalidateFrameSubtree(nsDisplayItem::TYPE_TRANSFORM);
|
||||
}
|
||||
}
|
||||
f->Properties().Delete(LayerActivityProperty());
|
||||
}
|
||||
|
||||
void
|
||||
nsIFrame::MarkLayersActive(nsChangeHint aChangeHint)
|
||||
{
|
||||
FrameProperties properties = Properties();
|
||||
LayerActivity* layerActivity =
|
||||
static_cast<LayerActivity*>(properties.Get(LayerActivityProperty()));
|
||||
if (layerActivity) {
|
||||
gLayerActivityTracker->MarkUsed(layerActivity);
|
||||
} else {
|
||||
if (!gLayerActivityTracker) {
|
||||
gLayerActivityTracker = new LayerActivityTracker();
|
||||
}
|
||||
layerActivity = new LayerActivity(this);
|
||||
gLayerActivityTracker->AddObject(layerActivity);
|
||||
properties.Set(LayerActivityProperty(), layerActivity);
|
||||
}
|
||||
layerActivity->mMutationCount++;
|
||||
NS_UpdateHint(layerActivity->mChangeHint, aChangeHint);
|
||||
}
|
||||
|
||||
bool
|
||||
nsIFrame::AreLayersMarkedActive()
|
||||
{
|
||||
return Properties().Get(LayerActivityProperty()) != nullptr;
|
||||
}
|
||||
|
||||
bool
|
||||
nsIFrame::AreLayersMarkedActive(nsChangeHint aChangeHint)
|
||||
{
|
||||
LayerActivity* layerActivity =
|
||||
static_cast<LayerActivity*>(Properties().Get(LayerActivityProperty()));
|
||||
if (layerActivity && (layerActivity->mChangeHint & aChangeHint)) {
|
||||
if (aChangeHint & nsChangeHint_UpdateOpacityLayer) {
|
||||
return layerActivity->GetMutationCount() > 1;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (aChangeHint & nsChangeHint_UpdateTransformLayer &&
|
||||
Preserves3D()) {
|
||||
return GetParent()->AreLayersMarkedActive(nsChangeHint_UpdateTransformLayer);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
nsFrame::ShutdownLayerActivityTimer()
|
||||
{
|
||||
delete gLayerActivityTracker;
|
||||
gLayerActivityTracker = nullptr;
|
||||
}
|
||||
|
||||
gfx3DMatrix
|
||||
nsIFrame::GetTransformMatrix(const nsIFrame* aStopAtAncestor,
|
||||
nsIFrame** aOutAncestor)
|
||||
|
@ -484,6 +484,8 @@ public:
|
||||
static void DisplayReflowShutdown();
|
||||
#endif
|
||||
|
||||
static void ShutdownLayerActivityTimer();
|
||||
|
||||
/**
|
||||
* Adds display items for standard CSS background if necessary.
|
||||
* Does not check IsVisibleForPainting.
|
||||
|
@ -12,7 +12,6 @@
|
||||
#include "nsDisplayList.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
#include "Layers.h"
|
||||
#include "ActiveLayerTracker.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
@ -69,11 +68,10 @@ public:
|
||||
return LAYER_INACTIVE;
|
||||
|
||||
// If compositing is cheap, just do that
|
||||
if (aManager->IsCompositingCheap() ||
|
||||
ActiveLayerTracker::IsContentActive(mFrame))
|
||||
if (aManager->IsCompositingCheap())
|
||||
return mozilla::LAYER_ACTIVE;
|
||||
|
||||
return LAYER_INACTIVE;
|
||||
return mFrame->AreLayersMarkedActive() ? LAYER_ACTIVE : LAYER_INACTIVE;
|
||||
}
|
||||
};
|
||||
|
||||
@ -98,9 +96,9 @@ nsHTMLCanvasFrame::Init(nsIContent* aContent,
|
||||
nsContainerFrame::Init(aContent, aParent, aPrevInFlow);
|
||||
|
||||
// We can fill in the canvas before the canvas frame is created, in
|
||||
// which case we never get around to marking the content as active. Therefore,
|
||||
// which case we never get around to marking the layer active. Therefore,
|
||||
// we mark it active here when we create the frame.
|
||||
ActiveLayerTracker::NotifyContentChange(this);
|
||||
MarkLayersActive(nsChangeHint(0));
|
||||
}
|
||||
|
||||
nsHTMLCanvasFrame::~nsHTMLCanvasFrame()
|
||||
|
@ -2176,6 +2176,30 @@ public:
|
||||
bool IsFlexItem() const
|
||||
{ return mParent && mParent->GetType() == nsGkAtoms::flexContainerFrame; }
|
||||
|
||||
/**
|
||||
* Mark this frame as using active layers. This marking will time out
|
||||
* after a short period. This call does no immediate invalidation,
|
||||
* but when the mark times out, we'll invalidate the frame's overflow
|
||||
* area.
|
||||
* @param aChangeHint nsChangeHint_UpdateTransformLayer or
|
||||
* nsChangeHint_UpdateOpacityLayer or 0, depending on whether the change
|
||||
* triggering the activity is a changing transform, changing opacity, or
|
||||
* something else.
|
||||
*/
|
||||
void MarkLayersActive(nsChangeHint aHint);
|
||||
/**
|
||||
* Return true if this frame is marked as needing active layers.
|
||||
*/
|
||||
bool AreLayersMarkedActive();
|
||||
/**
|
||||
* Return true if this frame is marked as needing active layers.
|
||||
* @param aChangeHint nsChangeHint_UpdateTransformLayer or
|
||||
* nsChangeHint_UpdateOpacityLayer. We return true only if
|
||||
* a change in the transform or opacity has been recorded while layers have
|
||||
* been marked active for this frame.
|
||||
*/
|
||||
bool AreLayersMarkedActive(nsChangeHint aChangeHint);
|
||||
|
||||
/**
|
||||
* Marks all display items created by this frame as needing a repaint,
|
||||
* and calls SchedulePaint() if requested and one is not already pending.
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include "nsLayoutUtils.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "ActiveLayerTracker.h"
|
||||
#include <math.h>
|
||||
|
||||
using namespace mozilla;
|
||||
@ -417,10 +416,10 @@ ElementAnimations::CanPerformOnCompositorThread(CanAnimateFlags aFlags) const
|
||||
// This animation can be done on the compositor. Mark the frame as active, in
|
||||
// case we are able to throttle this animation.
|
||||
if (hasOpacity) {
|
||||
ActiveLayerTracker::NotifyAnimated(frame, eCSSProperty_opacity);
|
||||
frame->MarkLayersActive(nsChangeHint_UpdateOpacityLayer);
|
||||
}
|
||||
if (hasTransform) {
|
||||
ActiveLayerTracker::NotifyAnimated(frame, eCSSProperty_transform);
|
||||
frame->MarkLayersActive(nsChangeHint_UpdateTransformLayer);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -28,7 +28,6 @@
|
||||
#include "nsStyleChangeList.h"
|
||||
#include "nsStyleSet.h"
|
||||
#include "RestyleManager.h"
|
||||
#include "ActiveLayerTracker.h"
|
||||
|
||||
using mozilla::TimeStamp;
|
||||
using mozilla::TimeDuration;
|
||||
@ -198,10 +197,10 @@ ElementTransitions::CanPerformOnCompositorThread(CanAnimateFlags aFlags) const
|
||||
// This transition can be done on the compositor. Mark the frame as active, in
|
||||
// case we are able to throttle this transition.
|
||||
if (hasOpacity) {
|
||||
ActiveLayerTracker::NotifyAnimated(frame, eCSSProperty_opacity);
|
||||
frame->MarkLayersActive(nsChangeHint_UpdateOpacityLayer);
|
||||
}
|
||||
if (hasTransform) {
|
||||
ActiveLayerTracker::NotifyAnimated(frame, eCSSProperty_transform);
|
||||
frame->MarkLayersActive(nsChangeHint_UpdateTransformLayer);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user