mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 755084 Part 3: Move checks for whether to animate opacity and transforms on the compositor thread to nsLayoutUtils, and make them also check whether the compositor is actually running r=cjones,dbaron
This commit is contained in:
parent
30025de69a
commit
d84e52f500
@ -31,16 +31,18 @@ EXPORTS = \
|
||||
BasicLayers.h \
|
||||
BasicTiledThebesLayer.h \
|
||||
BasicImplData.h \
|
||||
CompositorParent.h \
|
||||
ImageLayers.h \
|
||||
Layers.h \
|
||||
LayersBackend.h \
|
||||
LayerManagerOGLShaders.h \
|
||||
LayerManagerOGL.h \
|
||||
LayerManagerOGLProgram.h \
|
||||
ReadbackLayer.h \
|
||||
LayerSorter.h \
|
||||
TexturePoolOGL.h \
|
||||
ReadbackLayer.h \
|
||||
ShadowLayersManager.h \
|
||||
SharedTextureImage.h \
|
||||
TexturePoolOGL.h \
|
||||
$(NULL)
|
||||
|
||||
CPPSRCS = \
|
||||
|
@ -4,6 +4,7 @@
|
||||
* 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 "base/basictypes.h"
|
||||
#include "mozilla/Util.h"
|
||||
|
||||
#include "nsLayoutUtils.h"
|
||||
@ -70,7 +71,7 @@
|
||||
#include "nsTextFrame.h"
|
||||
#include "nsFontFaceList.h"
|
||||
#include "nsFontInflationData.h"
|
||||
|
||||
#include "CompositorParent.h"
|
||||
#include "nsSVGUtils.h"
|
||||
#include "nsSVGIntegrationUtils.h"
|
||||
#include "nsSVGForeignObjectFrame.h"
|
||||
@ -150,13 +151,43 @@ nsLayoutUtils::Are3DTransformsEnabled()
|
||||
|
||||
if (!s3DTransformPrefCached) {
|
||||
s3DTransformPrefCached = true;
|
||||
mozilla::Preferences::AddBoolVarCache(&s3DTransformsEnabled,
|
||||
mozilla::Preferences::AddBoolVarCache(&s3DTransformsEnabled,
|
||||
"layout.3d-transforms.enabled");
|
||||
}
|
||||
|
||||
return s3DTransformsEnabled;
|
||||
}
|
||||
|
||||
bool
|
||||
nsLayoutUtils::AreOpacityAnimationsEnabled()
|
||||
{
|
||||
static bool sAreOpacityAnimationsEnabled;
|
||||
static bool sOpacityPrefCached = false;
|
||||
|
||||
if (!sOpacityPrefCached) {
|
||||
sOpacityPrefCached = true;
|
||||
Preferences::AddBoolVarCache(&sAreOpacityAnimationsEnabled,
|
||||
"layers.offmainthreadcomposition.animate-opacity");
|
||||
}
|
||||
|
||||
return sAreOpacityAnimationsEnabled && CompositorParent::CompositorLoop();
|
||||
}
|
||||
|
||||
bool
|
||||
nsLayoutUtils::AreTransformAnimationsEnabled()
|
||||
{
|
||||
static bool sAreTransformAnimationsEnabled;
|
||||
static bool sTransformPrefCached = false;
|
||||
|
||||
if (!sTransformPrefCached) {
|
||||
sTransformPrefCached = true;
|
||||
Preferences::AddBoolVarCache(&sAreTransformAnimationsEnabled,
|
||||
"layers.offmainthreadcomposition.animate-transform");
|
||||
}
|
||||
|
||||
return sAreTransformAnimationsEnabled && CompositorParent::CompositorLoop();
|
||||
}
|
||||
|
||||
bool
|
||||
nsLayoutUtils::UseBackgroundNearestFiltering()
|
||||
{
|
||||
|
@ -1509,6 +1509,12 @@ public:
|
||||
*/
|
||||
static bool Are3DTransformsEnabled();
|
||||
|
||||
/**
|
||||
* Checks if off-main-thread transform and opacity animations are enabled.
|
||||
*/
|
||||
static bool AreOpacityAnimationsEnabled();
|
||||
static bool AreTransformAnimationsEnabled();
|
||||
|
||||
/**
|
||||
* Checks if we should forcibly use nearest pixel filtering for the
|
||||
* background.
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "nsStyleContext.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsAnimationManager.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace css {
|
||||
@ -41,7 +42,7 @@ CommonAnimationManager::AddElementData(CommonElementAnimationData* aData)
|
||||
nsRefreshDriver *rd = mPresContext->RefreshDriver();
|
||||
rd->AddRefreshObserver(this, Flush_Style);
|
||||
}
|
||||
|
||||
|
||||
PR_INSERT_BEFORE(aData, &mElementData);
|
||||
}
|
||||
|
||||
@ -221,7 +222,7 @@ CommonElementAnimationData::CanAnimatePropertyOnCompositor(const dom::Element *a
|
||||
{
|
||||
nsIFrame* frame = aElement->GetPrimaryFrame();
|
||||
if (aProperty == eCSSProperty_opacity) {
|
||||
return nsAnimationManager::CanAnimateOpacity();
|
||||
return nsLayoutUtils::AreOpacityAnimationsEnabled();
|
||||
}
|
||||
if (aProperty == eCSSProperty_transform && !(frame &&
|
||||
frame->Preserves3D() &&
|
||||
@ -229,7 +230,7 @@ CommonElementAnimationData::CanAnimatePropertyOnCompositor(const dom::Element *a
|
||||
if (frame && frame->IsSVGTransformed()) {
|
||||
return false;
|
||||
}
|
||||
return nsAnimationManager::CanAnimateTransform();
|
||||
return nsLayoutUtils::AreTransformAnimationsEnabled();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -182,20 +182,6 @@ public:
|
||||
mKeyframesRules.Init(16); // FIXME: make infallible!
|
||||
}
|
||||
|
||||
static bool CanAnimateOpacity() {
|
||||
static bool canAnimateOpacity =
|
||||
mozilla::Preferences::GetBool("layers.offmainthreadcomposition.animate-opacity", false) &&
|
||||
mozilla::Preferences::GetBool("layers.offmainthreadcomposition.enabled", false);
|
||||
return canAnimateOpacity;
|
||||
}
|
||||
|
||||
static bool CanAnimateTransform() {
|
||||
static bool canAnimateTransform =
|
||||
mozilla::Preferences::GetBool("layers.offmainthreadcomposition.animate-transform", false) &&
|
||||
mozilla::Preferences::GetBool("layers.offmainthreadcomposition.enabled", false);
|
||||
return canAnimateTransform;
|
||||
}
|
||||
|
||||
static ElementAnimations* GetAnimationsForCompositor(nsIContent* aContent,
|
||||
nsCSSProperty aProperty)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user