mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 783835 - Compositor needs to know the css property being animated r=roc
This commit is contained in:
parent
4e46bc1290
commit
724b4882ac
@ -443,14 +443,14 @@ Layer::SetAnimations(const AnimationArray& aAnimations)
|
||||
endValue.SetAndAdoptCSSValueListValue(endList, nsStyleAnimation::eUnit_Transform);
|
||||
endValues->AppendElement(endValue);
|
||||
} else {
|
||||
NS_ASSERTION(segment.endState().type() == Animatable::TOpacity,
|
||||
NS_ASSERTION(segment.endState().type() == Animatable::Tfloat,
|
||||
"Unknown Animatable type");
|
||||
nsStyleAnimation::Value startValue;
|
||||
startValue.SetFloatValue(segment.startState().get_Opacity().value());
|
||||
startValue.SetFloatValue(segment.startState().get_float());
|
||||
startValues->AppendElement(startValue);
|
||||
|
||||
nsStyleAnimation::Value endValue;
|
||||
endValue.SetFloatValue(segment.endState().get_Opacity().value());
|
||||
endValue.SetFloatValue(segment.endState().get_float());
|
||||
endValues->AppendElement(endValue);
|
||||
}
|
||||
}
|
||||
|
@ -580,9 +580,6 @@ SetShadowProperties(Layer* aLayer)
|
||||
}
|
||||
}
|
||||
|
||||
// SampleValue should eventually take the CSS property as an argument. This
|
||||
// will be needed if we ever animate two values with the same type but different
|
||||
// interpolation rules.
|
||||
static void
|
||||
SampleValue(float aPortion, Animation& aAnimation, nsStyleAnimation::Value& aStart,
|
||||
nsStyleAnimation::Value& aEnd, Animatable* aValue)
|
||||
@ -591,28 +588,24 @@ SampleValue(float aPortion, Animation& aAnimation, nsStyleAnimation::Value& aSta
|
||||
NS_ASSERTION(aStart.GetUnit() == aEnd.GetUnit() ||
|
||||
aStart.GetUnit() == nsStyleAnimation::eUnit_None ||
|
||||
aEnd.GetUnit() == nsStyleAnimation::eUnit_None, "Must have same unit");
|
||||
if (aStart.GetUnit() == nsStyleAnimation::eUnit_Transform ||
|
||||
aEnd.GetUnit() == nsStyleAnimation::eUnit_Transform) {
|
||||
nsStyleAnimation::Interpolate(eCSSProperty_transform, aStart, aEnd,
|
||||
aPortion, interpolatedValue);
|
||||
nsCSSValueList* interpolatedList = interpolatedValue.GetCSSValueListValue();
|
||||
|
||||
TransformData& data = aAnimation.data().get_TransformData();
|
||||
gfx3DMatrix transform =
|
||||
nsDisplayTransform::GetResultingTransformMatrix(nullptr, data.origin(), nsDeviceContext::AppUnitsPerCSSPixel(),
|
||||
&data.bounds(), interpolatedList, &data.mozOrigin(),
|
||||
&data.perspectiveOrigin(), &data.perspective());
|
||||
|
||||
InfallibleTArray<TransformFunction>* functions = new InfallibleTArray<TransformFunction>();
|
||||
functions->AppendElement(TransformMatrix(transform));
|
||||
*aValue = *functions;
|
||||
nsStyleAnimation::Interpolate(aAnimation.property(), aStart, aEnd,
|
||||
aPortion, interpolatedValue);
|
||||
if (aAnimation.property() == eCSSProperty_opacity) {
|
||||
*aValue = interpolatedValue.GetFloatValue();
|
||||
return;
|
||||
}
|
||||
|
||||
NS_ASSERTION(aStart.GetUnit() == nsStyleAnimation::eUnit_Float, "Should be opacity");
|
||||
nsStyleAnimation::Interpolate(eCSSProperty_opacity, aStart, aEnd,
|
||||
aPortion, interpolatedValue);
|
||||
*aValue = interpolatedValue.GetFloatValue();
|
||||
nsCSSValueList* interpolatedList = interpolatedValue.GetCSSValueListValue();
|
||||
|
||||
TransformData& data = aAnimation.data().get_TransformData();
|
||||
gfx3DMatrix transform =
|
||||
nsDisplayTransform::GetResultingTransformMatrix(nullptr, data.origin(), nsDeviceContext::AppUnitsPerCSSPixel(),
|
||||
&data.bounds(), interpolatedList, &data.mozOrigin(),
|
||||
&data.perspectiveOrigin(), &data.perspective());
|
||||
|
||||
InfallibleTArray<TransformFunction>* functions = new InfallibleTArray<TransformFunction>();
|
||||
functions->AppendElement(TransformMatrix(transform));
|
||||
*aValue = *functions;
|
||||
}
|
||||
|
||||
static bool
|
||||
@ -665,11 +658,11 @@ SampleAnimations(Layer* aLayer, TimeStamp aPoint)
|
||||
SampleValue(portion, animation, animData.mStartValues[segmentIndex],
|
||||
animData.mEndValues[segmentIndex], &interpolatedValue);
|
||||
ShadowLayer* shadow = aLayer->AsShadowLayer();
|
||||
switch (interpolatedValue.type()) {
|
||||
case Animatable::TOpacity:
|
||||
shadow->SetShadowOpacity(interpolatedValue.get_Opacity().value());
|
||||
switch (animation.property()) {
|
||||
case eCSSProperty_opacity:
|
||||
shadow->SetShadowOpacity(interpolatedValue.get_float());
|
||||
break;
|
||||
case Animatable::TArrayOfTransformFunction: {
|
||||
case eCSSProperty_transform: {
|
||||
gfx3DMatrix matrix = interpolatedValue.get_ArrayOfTransformFunction()[0].get_TransformMatrix().value();
|
||||
shadow->SetShadowTransform(matrix);
|
||||
break;
|
||||
|
@ -6,7 +6,6 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
include LayersSurfaces;
|
||||
using mozilla::ScreenRotation;
|
||||
include protocol PCompositor;
|
||||
include protocol PGrallocBuffer;
|
||||
include protocol PLayer;
|
||||
@ -15,6 +14,7 @@ include protocol PRenderFrame;
|
||||
include "gfxipc/ShadowLayerUtils.h";
|
||||
include "mozilla/WidgetUtils.h";
|
||||
include "mozilla/TimeStamp.h";
|
||||
include "nsCSSProperty.h";
|
||||
|
||||
using gfxPoint3D;
|
||||
using nscoord;
|
||||
@ -22,6 +22,8 @@ using nsRect;
|
||||
using nsPoint;
|
||||
using mozilla::TimeDuration;
|
||||
using mozilla::TimeStamp;
|
||||
using mozilla::ScreenRotation;
|
||||
using nsCSSProperty;
|
||||
|
||||
/**
|
||||
* The layers protocol is spoken between thread contexts that manage
|
||||
@ -78,7 +80,6 @@ union TimingFunction {
|
||||
};
|
||||
|
||||
struct Color { gfxRGBA value; };
|
||||
struct Opacity { float value; };
|
||||
struct Perspective { float value; };
|
||||
struct RotationX { float radians; };
|
||||
struct RotationY { float radians; };
|
||||
@ -119,8 +120,7 @@ union TransformFunction {
|
||||
};
|
||||
|
||||
union Animatable {
|
||||
Color;
|
||||
Opacity;
|
||||
float;
|
||||
TransformFunction[];
|
||||
};
|
||||
|
||||
@ -158,6 +158,7 @@ struct Animation {
|
||||
float numIterations;
|
||||
// This uses the NS_STYLE_ANIMATION_DIRECTION_* constants.
|
||||
int32_t direction;
|
||||
nsCSSProperty property;
|
||||
AnimationData data;
|
||||
};
|
||||
|
||||
@ -168,7 +169,7 @@ struct CommonLayerAttributes {
|
||||
float postXScale;
|
||||
float postYScale;
|
||||
PRUint32 contentFlags;
|
||||
Opacity opacity;
|
||||
float opacity;
|
||||
bool useClipRect;
|
||||
nsIntRect clipRect;
|
||||
bool isFixedPosition;
|
||||
|
@ -215,7 +215,7 @@ ShadowLayersParent::RecvUpdate(const InfallibleTArray<Edit>& cset,
|
||||
const CommonLayerAttributes& common = attrs.common();
|
||||
layer->SetVisibleRegion(common.visibleRegion());
|
||||
layer->SetContentFlags(common.contentFlags());
|
||||
layer->SetOpacity(common.opacity().value());
|
||||
layer->SetOpacity(common.opacity());
|
||||
layer->SetClipRect(common.useClipRect() ? &common.clipRect() : NULL);
|
||||
layer->SetBaseTransform(common.transform().value());
|
||||
layer->SetPostScale(common.postXScale(), common.postYScale());
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "jsapi.h"
|
||||
#include "LayersTypes.h"
|
||||
#include "FrameMetrics.h"
|
||||
#include "nsCSSProperty.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning( disable : 4800 )
|
||||
@ -602,6 +603,14 @@ struct ParamTraits<mozilla::PixelFormat>
|
||||
gfxASurface::ImageFormatUnknown>
|
||||
{};
|
||||
|
||||
template <>
|
||||
struct ParamTraits<nsCSSProperty>
|
||||
: public EnumSerializer<nsCSSProperty,
|
||||
eCSSProperty_UNKNOWN,
|
||||
eCSSProperty_COUNT>
|
||||
{};
|
||||
|
||||
|
||||
template<>
|
||||
struct ParamTraits<gfxRGBA>
|
||||
{
|
||||
|
@ -310,8 +310,8 @@ AddAnimationsForProperty(nsIFrame* aFrame, nsCSSProperty aProperty,
|
||||
segment->mFromKey, segment->mToKey,
|
||||
ToTimingFunction(segment->mTimingFunction)));
|
||||
} else if (aProperty == eCSSProperty_opacity) {
|
||||
segments.AppendElement(AnimationSegment(Opacity(segment->mFromValue.GetFloatValue()),
|
||||
Opacity(segment->mToValue.GetFloatValue()),
|
||||
segments.AppendElement(AnimationSegment(segment->mFromValue.GetFloatValue(),
|
||||
segment->mToValue.GetFloatValue(),
|
||||
segment->mFromKey,
|
||||
segment->mToKey,
|
||||
ToTimingFunction(segment->mTimingFunction)));
|
||||
@ -323,6 +323,7 @@ AddAnimationsForProperty(nsIFrame* aFrame, nsCSSProperty aProperty,
|
||||
segments,
|
||||
iterations,
|
||||
ea->mDirection,
|
||||
aProperty,
|
||||
aData));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user