mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1151694 - Part 1 - Move CommonAnimationManager::sLayerAnimationInfo into LayerAnimationInfo.(cpp|h). r=bbirtles
This commit is contained in:
parent
4f5c0f0757
commit
e92ce11cd1
@ -15,6 +15,7 @@
|
|||||||
#include "AnimationCommon.h" // For GetLayerAnimationInfo
|
#include "AnimationCommon.h" // For GetLayerAnimationInfo
|
||||||
#include "FrameLayerBuilder.h"
|
#include "FrameLayerBuilder.h"
|
||||||
#include "GeckoProfiler.h"
|
#include "GeckoProfiler.h"
|
||||||
|
#include "LayerAnimationInfo.h" // For LayerAnimationInfo::sRecords
|
||||||
#include "nsStyleChangeList.h"
|
#include "nsStyleChangeList.h"
|
||||||
#include "nsRuleProcessorData.h"
|
#include "nsRuleProcessorData.h"
|
||||||
#include "nsStyleUtil.h"
|
#include "nsStyleUtil.h"
|
||||||
@ -2666,10 +2667,10 @@ ElementRestyler::AddLayerChangesForAnimation()
|
|||||||
RestyleManager::GetMaxAnimationGenerationForFrame(mFrame);
|
RestyleManager::GetMaxAnimationGenerationForFrame(mFrame);
|
||||||
|
|
||||||
nsChangeHint hint = nsChangeHint(0);
|
nsChangeHint hint = nsChangeHint(0);
|
||||||
const auto& layerInfo = CommonAnimationManager::sLayerAnimationInfo;
|
for (const LayerAnimationInfo::Record& layerInfo :
|
||||||
for (size_t i = 0; i < ArrayLength(layerInfo); i++) {
|
LayerAnimationInfo::sRecords) {
|
||||||
Layer* layer =
|
Layer* layer =
|
||||||
FrameLayerBuilder::GetDedicatedLayer(mFrame, layerInfo[i].mLayerType);
|
FrameLayerBuilder::GetDedicatedLayer(mFrame, layerInfo.mLayerType);
|
||||||
if (layer && frameGeneration > layer->GetAnimationGeneration()) {
|
if (layer && frameGeneration > layer->GetAnimationGeneration()) {
|
||||||
// If we have a transform layer but don't have any transform style, we
|
// If we have a transform layer but don't have any transform style, we
|
||||||
// probably just removed the transform but haven't destroyed the layer
|
// probably just removed the transform but haven't destroyed the layer
|
||||||
@ -2678,11 +2679,11 @@ ElementRestyler::AddLayerChangesForAnimation()
|
|||||||
// so we can skip adding any change hint here. (If we *were* to add
|
// so we can skip adding any change hint here. (If we *were* to add
|
||||||
// nsChangeHint_UpdateTransformLayer, ApplyRenderingChangeToTree would
|
// nsChangeHint_UpdateTransformLayer, ApplyRenderingChangeToTree would
|
||||||
// complain that we're updating a transform layer without a transform).
|
// complain that we're updating a transform layer without a transform).
|
||||||
if (layerInfo[i].mLayerType == nsDisplayItem::TYPE_TRANSFORM &&
|
if (layerInfo.mLayerType == nsDisplayItem::TYPE_TRANSFORM &&
|
||||||
!mFrame->StyleDisplay()->HasTransformStyle()) {
|
!mFrame->StyleDisplay()->HasTransformStyle()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
NS_UpdateHint(hint, layerInfo[i].mChangeHint);
|
NS_UpdateHint(hint, layerInfo.mChangeHint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (hint) {
|
if (hint) {
|
||||||
|
@ -68,6 +68,7 @@
|
|||||||
#include "FrameLayerBuilder.h"
|
#include "FrameLayerBuilder.h"
|
||||||
#include "mozilla/dom/RequestSyncWifiService.h"
|
#include "mozilla/dom/RequestSyncWifiService.h"
|
||||||
#include "AnimationCommon.h"
|
#include "AnimationCommon.h"
|
||||||
|
#include "LayerAnimationInfo.h"
|
||||||
|
|
||||||
#include "AudioChannelService.h"
|
#include "AudioChannelService.h"
|
||||||
#include "mozilla/dom/DataStoreService.h"
|
#include "mozilla/dom/DataStoreService.h"
|
||||||
@ -311,7 +312,7 @@ nsLayoutStatics::Initialize()
|
|||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
nsStyleContext::Initialize();
|
nsStyleContext::Initialize();
|
||||||
mozilla::CommonAnimationManager::Initialize();
|
mozilla::LayerAnimationInfo::Initialize();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
MediaDecoder::InitStatics();
|
MediaDecoder::InitStatics();
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
#include "nsIFrame.h"
|
#include "nsIFrame.h"
|
||||||
#include "nsLayoutUtils.h"
|
#include "nsLayoutUtils.h"
|
||||||
#include "mozilla/LookAndFeel.h"
|
#include "mozilla/LookAndFeel.h"
|
||||||
|
#include "LayerAnimationInfo.h" // For LayerAnimationInfo::sRecords
|
||||||
#include "Layers.h"
|
#include "Layers.h"
|
||||||
#include "FrameLayerBuilder.h"
|
#include "FrameLayerBuilder.h"
|
||||||
#include "nsDisplayList.h"
|
#include "nsDisplayList.h"
|
||||||
@ -406,30 +407,6 @@ CommonAnimationManager::GetAnimationRule(mozilla::dom::Element* aElement,
|
|||||||
return collection->mStyleRule;
|
return collection->mStyleRule;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */ const CommonAnimationManager::LayerAnimationRecord
|
|
||||||
CommonAnimationManager::sLayerAnimationInfo[] =
|
|
||||||
{ { eCSSProperty_transform,
|
|
||||||
nsDisplayItem::TYPE_TRANSFORM,
|
|
||||||
nsChangeHint_UpdateTransformLayer },
|
|
||||||
{ eCSSProperty_opacity,
|
|
||||||
nsDisplayItem::TYPE_OPACITY,
|
|
||||||
nsChangeHint_UpdateOpacityLayer } };
|
|
||||||
|
|
||||||
/* static */ const CommonAnimationManager::LayerAnimationRecord*
|
|
||||||
CommonAnimationManager::LayerAnimationRecordFor(nsCSSProperty aProperty)
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(nsCSSProps::PropHasFlags(aProperty,
|
|
||||||
CSS_PROPERTY_CAN_ANIMATE_ON_COMPOSITOR),
|
|
||||||
"unexpected property");
|
|
||||||
const auto& info = sLayerAnimationInfo;
|
|
||||||
for (size_t i = 0; i < ArrayLength(info); ++i) {
|
|
||||||
if (aProperty == info[i].mProperty) {
|
|
||||||
return &info[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* virtual */ void
|
/* virtual */ void
|
||||||
CommonAnimationManager::WillRefresh(TimeStamp aTime)
|
CommonAnimationManager::WillRefresh(TimeStamp aTime)
|
||||||
{
|
{
|
||||||
@ -455,42 +432,6 @@ CommonAnimationManager::WillRefresh(TimeStamp aTime)
|
|||||||
MaybeStartOrStopObservingRefreshDriver();
|
MaybeStartOrStopObservingRefreshDriver();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
/* static */ void
|
|
||||||
CommonAnimationManager::Initialize()
|
|
||||||
{
|
|
||||||
const auto& info = CommonAnimationManager::sLayerAnimationInfo;
|
|
||||||
for (size_t i = 0; i < ArrayLength(info); i++) {
|
|
||||||
auto record = info[i];
|
|
||||||
MOZ_ASSERT(nsCSSProps::PropHasFlags(record.mProperty,
|
|
||||||
CSS_PROPERTY_CAN_ANIMATE_ON_COMPOSITOR),
|
|
||||||
"CSS property with entry in sLayerAnimationInfo does not "
|
|
||||||
"have the CSS_PROPERTY_CAN_ANIMATE_ON_COMPOSITOR flag");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check that every property with the flag for animating on the
|
|
||||||
// compositor has an entry in sLayerAnimationInfo.
|
|
||||||
for (nsCSSProperty prop = nsCSSProperty(0);
|
|
||||||
prop < eCSSProperty_COUNT;
|
|
||||||
prop = nsCSSProperty(prop + 1)) {
|
|
||||||
if (nsCSSProps::PropHasFlags(prop,
|
|
||||||
CSS_PROPERTY_CAN_ANIMATE_ON_COMPOSITOR)) {
|
|
||||||
bool found = false;
|
|
||||||
for (size_t i = 0; i < ArrayLength(info); i++) {
|
|
||||||
auto record = info[i];
|
|
||||||
if (record.mProperty == prop) {
|
|
||||||
found = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
MOZ_ASSERT(found,
|
|
||||||
"CSS property with the CSS_PROPERTY_CAN_ANIMATE_ON_COMPOSITOR "
|
|
||||||
"flag does not have an entry in sLayerAnimationInfo");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
NS_IMPL_ISUPPORTS(AnimValuesStyleRule, nsIStyleRule)
|
NS_IMPL_ISUPPORTS(AnimValuesStyleRule, nsIStyleRule)
|
||||||
|
|
||||||
/* virtual */ void
|
/* virtual */ void
|
||||||
@ -901,9 +842,8 @@ AnimationCollection::CanThrottleAnimation(TimeStamp aTime)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto& info = CommonAnimationManager::sLayerAnimationInfo;
|
for (const LayerAnimationInfo::Record& record :
|
||||||
for (size_t i = 0; i < ArrayLength(info); i++) {
|
LayerAnimationInfo::sRecords) {
|
||||||
auto record = info[i];
|
|
||||||
// We only need to worry about *current* animations here.
|
// We only need to worry about *current* animations here.
|
||||||
// - If we have a newly-finished animation, Animation::CanThrottle will
|
// - If we have a newly-finished animation, Animation::CanThrottle will
|
||||||
// detect that and force an unthrottled sample.
|
// detect that and force an unthrottled sample.
|
||||||
|
@ -65,10 +65,6 @@ public:
|
|||||||
// nsARefreshObserver
|
// nsARefreshObserver
|
||||||
void WillRefresh(TimeStamp aTime) override;
|
void WillRefresh(TimeStamp aTime) override;
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
static void Initialize();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// NOTE: This can return null after Disconnect().
|
// NOTE: This can return null after Disconnect().
|
||||||
nsPresContext* PresContext() const { return mPresContext; }
|
nsPresContext* PresContext() const { return mPresContext; }
|
||||||
|
|
||||||
@ -120,18 +116,6 @@ public:
|
|||||||
nsChangeHint mChangeHint;
|
nsChangeHint mChangeHint;
|
||||||
};
|
};
|
||||||
|
|
||||||
protected:
|
|
||||||
static const size_t kLayerRecords = 2;
|
|
||||||
|
|
||||||
public:
|
|
||||||
static const LayerAnimationRecord sLayerAnimationInfo[kLayerRecords];
|
|
||||||
|
|
||||||
// Will return non-null for any property with the
|
|
||||||
// CSS_PROPERTY_CAN_ANIMATE_ON_COMPOSITOR flag; should only be called
|
|
||||||
// on such properties.
|
|
||||||
static const LayerAnimationRecord*
|
|
||||||
LayerAnimationRecordFor(nsCSSProperty aProperty);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual ~CommonAnimationManager();
|
virtual ~CommonAnimationManager();
|
||||||
|
|
||||||
|
53
layout/style/LayerAnimationInfo.cpp
Normal file
53
layout/style/LayerAnimationInfo.cpp
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
/* vim: set shiftwidth=2 tabstop=8 autoindent cindent expandtab: */
|
||||||
|
/* 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 "LayerAnimationInfo.h"
|
||||||
|
|
||||||
|
#include "nsCSSProps.h" // For nsCSSProps::PropHasFlags
|
||||||
|
|
||||||
|
namespace mozilla {
|
||||||
|
|
||||||
|
/* static */ const LayerAnimationInfo::Record LayerAnimationInfo::sRecords[] =
|
||||||
|
{ { eCSSProperty_transform,
|
||||||
|
nsDisplayItem::TYPE_TRANSFORM,
|
||||||
|
nsChangeHint_UpdateTransformLayer },
|
||||||
|
{ eCSSProperty_opacity,
|
||||||
|
nsDisplayItem::TYPE_OPACITY,
|
||||||
|
nsChangeHint_UpdateOpacityLayer } };
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
/* static */ void
|
||||||
|
LayerAnimationInfo::Initialize()
|
||||||
|
{
|
||||||
|
for (const Record& record : sRecords) {
|
||||||
|
MOZ_ASSERT(nsCSSProps::PropHasFlags(record.mProperty,
|
||||||
|
CSS_PROPERTY_CAN_ANIMATE_ON_COMPOSITOR),
|
||||||
|
"CSS property with entry in LayerAnimation::sRecords does not "
|
||||||
|
"have the CSS_PROPERTY_CAN_ANIMATE_ON_COMPOSITOR flag");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check that every property with the flag for animating on the
|
||||||
|
// compositor has an entry in LayerAnimationInfo::sRecords.
|
||||||
|
for (nsCSSProperty prop = nsCSSProperty(0);
|
||||||
|
prop < eCSSProperty_COUNT;
|
||||||
|
prop = nsCSSProperty(prop + 1)) {
|
||||||
|
if (nsCSSProps::PropHasFlags(prop,
|
||||||
|
CSS_PROPERTY_CAN_ANIMATE_ON_COMPOSITOR)) {
|
||||||
|
bool found = false;
|
||||||
|
for (const Record& record : sRecords) {
|
||||||
|
if (record.mProperty == prop) {
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
MOZ_ASSERT(found,
|
||||||
|
"CSS property with the CSS_PROPERTY_CAN_ANIMATE_ON_COMPOSITOR "
|
||||||
|
"flag does not have an entry in LayerAnimationInfo::sRecords");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
} // namespace mozilla
|
33
layout/style/LayerAnimationInfo.h
Normal file
33
layout/style/LayerAnimationInfo.h
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
/* vim: set shiftwidth=2 tabstop=8 autoindent cindent expandtab: */
|
||||||
|
/* 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 mozilla_LayerAnimationInfo_h
|
||||||
|
#define mozilla_LayerAnimationInfo_h
|
||||||
|
|
||||||
|
#include "nsChangeHint.h"
|
||||||
|
#include "nsCSSProperty.h"
|
||||||
|
#include "nsDisplayList.h" // For nsDisplayItem::Type
|
||||||
|
|
||||||
|
namespace mozilla {
|
||||||
|
|
||||||
|
struct LayerAnimationInfo {
|
||||||
|
#ifdef DEBUG
|
||||||
|
static void Initialize();
|
||||||
|
#endif
|
||||||
|
// For CSS properties that may be animated on a separate layer, represents
|
||||||
|
// a record of the corresponding layer type and change hint.
|
||||||
|
struct Record {
|
||||||
|
nsCSSProperty mProperty;
|
||||||
|
nsDisplayItem::Type mLayerType;
|
||||||
|
nsChangeHint mChangeHint;
|
||||||
|
};
|
||||||
|
|
||||||
|
static const size_t kRecords = 2;
|
||||||
|
static const Record sRecords[kRecords];
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace mozilla
|
||||||
|
|
||||||
|
#endif /* !defined(mozilla_LayerAnimationInfo_h) */
|
@ -85,6 +85,7 @@ EXPORTS.mozilla += [
|
|||||||
'CSSVariableResolver.h',
|
'CSSVariableResolver.h',
|
||||||
'CSSVariableValues.h',
|
'CSSVariableValues.h',
|
||||||
'IncrementalClearCOMRuleArray.h',
|
'IncrementalClearCOMRuleArray.h',
|
||||||
|
'LayerAnimationInfo.h',
|
||||||
'RuleNodeCacheConditions.h',
|
'RuleNodeCacheConditions.h',
|
||||||
'RuleProcessorCache.h',
|
'RuleProcessorCache.h',
|
||||||
'StyleAnimationValue.h',
|
'StyleAnimationValue.h',
|
||||||
@ -130,6 +131,7 @@ UNIFIED_SOURCES += [
|
|||||||
'FontFaceSetIterator.cpp',
|
'FontFaceSetIterator.cpp',
|
||||||
'ImageLoader.cpp',
|
'ImageLoader.cpp',
|
||||||
'IncrementalClearCOMRuleArray.cpp',
|
'IncrementalClearCOMRuleArray.cpp',
|
||||||
|
'LayerAnimationInfo.cpp',
|
||||||
'Loader.cpp',
|
'Loader.cpp',
|
||||||
'MediaQueryList.cpp',
|
'MediaQueryList.cpp',
|
||||||
'nsAnimationManager.cpp',
|
'nsAnimationManager.cpp',
|
||||||
|
Loading…
Reference in New Issue
Block a user