Backed out 4 changesets (bug 1479234) for build bustage at build/src/gfx/vr/ipc/VRLayerChild.cpp on a CLOSED TREE

Backed out changeset 6ecc1666f571 (bug 1479234)
Backed out changeset c3bab1bc97cf (bug 1479234)
Backed out changeset c8c2625a33ba (bug 1479234)
Backed out changeset 2ffc8e9d5686 (bug 1479234)
This commit is contained in:
Coroiu Cristina 2018-07-31 00:32:04 +03:00
parent bee636fdcd
commit 7634333ced
13 changed files with 192 additions and 98 deletions

View File

@ -3655,33 +3655,6 @@ GetTargetFrame(const Element* aElement, const nsAString& aPseudoElement)
return frame;
}
OMTAValue
nsDOMWindowUtils::GetOMTAValue(nsIFrame* aFrame,
DisplayItemType aDisplayItemKey)
{
OMTAValue value = mozilla::null_t();
Layer* layer =
FrameLayerBuilder::GetDedicatedLayer(aFrame, aDisplayItemKey);
if (layer) {
ShadowLayerForwarder* forwarder = layer->Manager()->AsShadowForwarder();
if (forwarder && forwarder->HasShadowManager()) {
forwarder->GetShadowManager()->
SendGetAnimationValue(layer->GetCompositorAnimationsId(), &value);
}
} else if (WebRenderBridgeChild* wrbc = GetWebRenderBridge()) {
RefPtr<WebRenderAnimationData> animationData =
GetWebRenderUserData<WebRenderAnimationData>(aFrame,
(uint32_t)aDisplayItemKey);
if (animationData) {
wrbc->SendGetAnimationValue(
animationData->GetAnimationInfo().GetCompositorAnimationsId(),
&value);
}
}
return value;
}
NS_IMETHODIMP
nsDOMWindowUtils::GetOMTAStyle(Element* aElement,
const nsAString& aProperty,
@ -3706,15 +3679,56 @@ nsDOMWindowUtils::GetOMTAStyle(Element* aElement,
}
if (aProperty.EqualsLiteral("opacity")) {
OMTAValue value = GetOMTAValue(frame, DisplayItemType::TYPE_OPACITY);
if (value.type() == OMTAValue::Tfloat) {
float value = 0;
bool hadAnimatedOpacity = false;
Layer* layer =
FrameLayerBuilder::GetDedicatedLayer(frame, DisplayItemType::TYPE_OPACITY);
if (layer) {
ShadowLayerForwarder* forwarder = layer->Manager()->AsShadowForwarder();
if (forwarder && forwarder->HasShadowManager()) {
forwarder->GetShadowManager()->
SendGetAnimationOpacity(layer->GetCompositorAnimationsId(),
&value,
&hadAnimatedOpacity);
}
} else if (WebRenderBridgeChild* wrbc = GetWebRenderBridge()) {
RefPtr<WebRenderAnimationData> animationData =
GetWebRenderUserData<WebRenderAnimationData>(frame, (uint32_t)DisplayItemType::TYPE_OPACITY);
if (animationData) {
wrbc->SendGetAnimationOpacity(
animationData->GetAnimationInfo().GetCompositorAnimationsId(),
&value,
&hadAnimatedOpacity);
}
}
if (hadAnimatedOpacity) {
cssValue = new nsROCSSPrimitiveValue;
cssValue->SetNumber(value.get_float());
cssValue->SetNumber(value);
}
} else if (aProperty.EqualsLiteral("transform")) {
OMTAValue value = GetOMTAValue(frame, DisplayItemType::TYPE_TRANSFORM);
if (value.type() == OMTAValue::TMatrix4x4) {
cssValue = nsComputedDOMStyle::MatrixToCSSValue(value.get_Matrix4x4());
MaybeTransform transform;
Layer* layer =
FrameLayerBuilder::GetDedicatedLayer(frame, DisplayItemType::TYPE_TRANSFORM);
if (layer) {
ShadowLayerForwarder* forwarder = layer->Manager()->AsShadowForwarder();
if (forwarder && forwarder->HasShadowManager()) {
forwarder->GetShadowManager()->
SendGetAnimationTransform(layer->GetCompositorAnimationsId(), &transform);
}
} else if (WebRenderBridgeChild* wrbc = GetWebRenderBridge()) {
RefPtr<WebRenderAnimationData> animationData =
GetWebRenderUserData<WebRenderAnimationData>(frame, (uint32_t)DisplayItemType::TYPE_TRANSFORM);
if (animationData) {
wrbc->SendGetAnimationTransform(
animationData->GetAnimationInfo().GetCompositorAnimationsId(),
&transform);
}
}
if (transform.type() == MaybeTransform::TMatrix4x4) {
Matrix4x4 matrix = transform.get_Matrix4x4();
cssValue = nsComputedDOMStyle::MatrixToCSSValue(matrix);
}
}
}

View File

@ -10,13 +10,10 @@
#include "nsWeakReference.h"
#include "nsIDOMWindowUtils.h"
#include "nsDisplayItemTypes.h"
#include "mozilla/Attributes.h"
#include "mozilla/BasicEvents.h"
#include "mozilla/layers/LayersMessages.h" // For OMTAValue
class nsGlobalWindowOuter;
class nsIFrame;
class nsIPresShell;
class nsIWidget;
class nsPresContext;
@ -121,9 +118,6 @@ protected:
bool aIgnoreRootScrollFrame,
bool aToWindow,
bool* aPreventDefault);
mozilla::layers::OMTAValue GetOMTAValue(nsIFrame* aFrame,
DisplayItemType aDisplayItemKey);
};
#endif

View File

@ -45,45 +45,44 @@ CompositorAnimationStorage::GetAnimatedValue(const uint64_t& aId) const
return mAnimatedValues.Get(aId);
}
OMTAValue
CompositorAnimationStorage::GetOMTAValue(const uint64_t& aId) const
Maybe<float>
CompositorAnimationStorage::GetAnimationOpacity(const uint64_t& aId) const
{
OMTAValue omtaValue = mozilla::null_t();
auto animatedValue = GetAnimatedValue(aId);
if (!animatedValue) {
return omtaValue;
auto value = GetAnimatedValue(aId);
if (!value || value->mType != AnimatedValue::OPACITY) {
return Nothing();
}
switch (animatedValue->mType) {
case AnimatedValue::OPACITY:
omtaValue = animatedValue->mOpacity;
break;
case AnimatedValue::TRANSFORM: {
gfx::Matrix4x4 transform = animatedValue->mTransform.mFrameTransform;
const TransformData& data = animatedValue->mTransform.mData;
float scale = data.appUnitsPerDevPixel();
gfx::Point3D transformOrigin = data.transformOrigin();
return Some(value->mOpacity);
}
// Undo the rebasing applied by
// nsDisplayTransform::GetResultingTransformMatrixInternal
transform.ChangeBasis(-transformOrigin);
// Convert to CSS pixels (this undoes the operations performed by
// nsStyleTransformMatrix::ProcessTranslatePart which is called from
// nsDisplayTransform::GetResultingTransformMatrix)
double devPerCss =
double(scale) / double(nsDeviceContext::AppUnitsPerCSSPixel());
transform._41 *= devPerCss;
transform._42 *= devPerCss;
transform._43 *= devPerCss;
omtaValue = transform;
break;
}
case AnimatedValue::NONE:
break;
Maybe<gfx::Matrix4x4>
CompositorAnimationStorage::GetAnimationTransform(const uint64_t& aId) const
{
auto value = GetAnimatedValue(aId);
if (!value || value->mType != AnimatedValue::TRANSFORM) {
return Nothing();
}
return omtaValue;
gfx::Matrix4x4 transform = value->mTransform.mFrameTransform;
const TransformData& data = value->mTransform.mData;
float scale = data.appUnitsPerDevPixel();
gfx::Point3D transformOrigin = data.transformOrigin();
// Undo the rebasing applied by
// nsDisplayTransform::GetResultingTransformMatrixInternal
transform.ChangeBasis(-transformOrigin);
// Convert to CSS pixels (this undoes the operations performed by
// nsStyleTransformMatrix::ProcessTranslatePart which is called from
// nsDisplayTransform::GetResultingTransformMatrix)
double devPerCss =
double(scale) / double(nsDeviceContext::AppUnitsPerCSSPixel());
transform._41 *= devPerCss;
transform._42 *= devPerCss;
transform._43 *= devPerCss;
return Some(transform);
}
void

View File

@ -132,7 +132,19 @@ public:
*/
AnimatedValue* GetAnimatedValue(const uint64_t& aId) const;
OMTAValue GetOMTAValue(const uint64_t& aId) const;
/**
* Like GetAnimatedValue(), but ensures the value is an opacity and returns
* the float value if possible, or Nothing() otherwise.
*/
Maybe<float> GetAnimationOpacity(const uint64_t& aId) const;
/**
* Like GetAnimatedValue(), but ensures the value is a transform and returns
* the transform matrix if possible, or Nothing() otherwise. It also does
* some post-processing on the transform matrix as well. See the comments
* inside the function for details.
*/
Maybe<gfx::Matrix4x4> GetAnimationTransform(const uint64_t& aId) const;
/**
* Return the iterator of animated value table

View File

@ -48,7 +48,6 @@ class CompositableParentManager;
class WebRenderImageHost;
class ContentHost;
class ContentHostTexture;
class HostLayerManager;
struct EffectChain;
struct ImageCompositeNotificationInfo {

View File

@ -681,8 +681,33 @@ LayerTransactionParent::RecvLeaveTestMode()
}
mozilla::ipc::IPCResult
LayerTransactionParent::RecvGetAnimationValue(const uint64_t& aCompositorAnimationsId,
OMTAValue* aValue)
LayerTransactionParent::RecvGetAnimationOpacity(const uint64_t& aCompositorAnimationsId,
float* aOpacity,
bool* aHasAnimationOpacity)
{
*aHasAnimationOpacity = false;
if (mDestroyed || !mLayerManager || mLayerManager->IsDestroyed()) {
return IPC_FAIL_NO_REASON(this);
}
mCompositorBridge->ApplyAsyncProperties(
this, CompositorBridgeParentBase::TransformsToSkip::APZ);
if (!mAnimStorage) {
return IPC_FAIL_NO_REASON(this);
}
Maybe<float> opacity = mAnimStorage->GetAnimationOpacity(aCompositorAnimationsId);
if (opacity) {
*aOpacity = *opacity;
*aHasAnimationOpacity = true;
}
return IPC_OK();
}
mozilla::ipc::IPCResult
LayerTransactionParent::RecvGetAnimationTransform(const uint64_t& aCompositorAnimationsId,
MaybeTransform* aTransform)
{
if (mDestroyed || !mLayerManager || mLayerManager->IsDestroyed()) {
return IPC_FAIL_NO_REASON(this);
@ -699,7 +724,12 @@ LayerTransactionParent::RecvGetAnimationValue(const uint64_t& aCompositorAnimati
return IPC_FAIL_NO_REASON(this);
}
*aValue = mAnimStorage->GetOMTAValue(aCompositorAnimationsId);
Maybe<Matrix4x4> transform = mAnimStorage->GetAnimationTransform(aCompositorAnimationsId);
if (transform) {
*aTransform = *transform;
} else {
*aTransform = mozilla::void_t();
}
return IPC_OK();
}

View File

@ -125,8 +125,11 @@ protected:
mozilla::ipc::IPCResult RecvScheduleComposite() override;
mozilla::ipc::IPCResult RecvSetTestSampleTime(const TimeStamp& aTime) override;
mozilla::ipc::IPCResult RecvLeaveTestMode() override;
mozilla::ipc::IPCResult RecvGetAnimationValue(const uint64_t& aCompositorAnimationsId,
OMTAValue* aValue) override;
mozilla::ipc::IPCResult RecvGetAnimationOpacity(const uint64_t& aCompositorAnimationsId,
float* aOpacity,
bool* aHasAnimationOpacity) override;
mozilla::ipc::IPCResult RecvGetAnimationTransform(const uint64_t& aCompositorAnimationsId,
MaybeTransform* aTransform) override;
mozilla::ipc::IPCResult RecvGetTransform(const LayerHandle& aHandle,
MaybeTransform* aTransform) override;
mozilla::ipc::IPCResult RecvSetAsyncScrollOffset(const FrameMetrics::ViewID& aId,

View File

@ -14,7 +14,6 @@ include "gfxipc/ShadowLayerUtils.h";
include "mozilla/GfxMessageUtils.h";
include "ImageLayers.h";
using mozilla::gfx::Glyph from "mozilla/gfx/2D.h";
using mozilla::gfx::SamplingFilter from "mozilla/gfx/2D.h";
using struct mozilla::gfx::Color from "mozilla/gfx/2D.h";
using struct mozilla::gfx::Point3D from "mozilla/gfx/Point.h";
@ -46,6 +45,7 @@ using struct mozilla::layers::ScrollMetadata from "FrameMetrics.h";
using mozilla::layers::FrameMetrics::ViewID from "FrameMetrics.h";
using mozilla::layers::LayersBackend from "mozilla/layers/LayersTypes.h";
using mozilla::layers::MaybeLayerClip from "FrameMetrics.h";
using mozilla::gfx::Glyph from "Layers.h";
using mozilla::layers::LayerHandle from "mozilla/layers/LayersTypes.h";
using mozilla::layers::CompositableHandle from "mozilla/layers/LayersTypes.h";
using mozilla::layers::SimpleLayerAttributes from "mozilla/layers/LayerAttributes.h";
@ -570,11 +570,5 @@ union MaybeTransform {
void_t;
};
union OMTAValue {
null_t;
float;
Matrix4x4;
};
} // namespace
} // namespace

View File

@ -16,7 +16,6 @@ include "mozilla/layers/LayersMessageUtils.h";
using struct mozilla::layers::TextureInfo from "mozilla/layers/CompositorTypes.h";
using struct mozilla::void_t from "ipc/IPCMessageUtils.h";
using struct mozilla::null_t from "ipc/IPCMessageUtils.h";
using class mozilla::layers::APZTestData from "mozilla/layers/APZTestData.h";
using mozilla::layers::FrameMetrics::ViewID from "FrameMetrics.h";
using struct mozilla::layers::ScrollableLayerGuid from "FrameMetrics.h";
@ -77,8 +76,18 @@ parent:
// Leave test mode and resume normal compositing
sync LeaveTestMode();
// Returns |OMTAValue| applied to the layer.
sync GetAnimationValue(uint64_t aCompositorAnimationId) returns (OMTAValue value);
// Returns the value of the opacity applied to the layer by animation.
// |hasAnimationOpacity| is true if the layer has an opacity value
// specified by animation. If it's false, |opacity| value is indefinite.
sync GetAnimationOpacity(uint64_t aCompositorAnimationsId) returns (float opacity,
bool hasAnimationOpacity);
// Returns the value of the transform applied to the layer by animation after
// factoring out translation components introduced to account for the offset
// of the corresponding frame and transform origin and after converting to CSS
// pixels. If the layer is not transformed by animation, the return value will
// be void_t.
sync GetAnimationTransform(uint64_t aCompositorAnimationId) returns (MaybeTransform transform);
// Returns the value of the transform applied to the layer by animation and
// APZC.

View File

@ -70,7 +70,9 @@ parent:
// More copied from PLayerTransaction, but these are only used for testing.
sync SetTestSampleTime(TimeStamp sampleTime);
sync LeaveTestMode();
sync GetAnimationValue(uint64_t aCompositorAnimationsId) returns (OMTAValue value);
sync GetAnimationOpacity(uint64_t aCompositorAnimationsId) returns (float opacity,
bool hasAnimationOpacity);
sync GetAnimationTransform(uint64_t aCompositorAnimationId) returns (MaybeTransform transform);
sync SetAsyncScrollOffset(ViewID scrollId, float x, float y);
sync SetAsyncZoom(ViewID scrollId, float zoom);
async FlushApzRepaints();

View File

@ -1361,8 +1361,9 @@ WebRenderBridgeParent::RecvLeaveTestMode()
}
mozilla::ipc::IPCResult
WebRenderBridgeParent::RecvGetAnimationValue(const uint64_t& aCompositorAnimationsId,
OMTAValue* aValue)
WebRenderBridgeParent::RecvGetAnimationOpacity(const uint64_t& aCompositorAnimationsId,
float* aOpacity,
bool* aHasAnimationOpacity)
{
if (mDestroyed) {
return IPC_FAIL_NO_REASON(this);
@ -1375,7 +1376,37 @@ WebRenderBridgeParent::RecvGetAnimationValue(const uint64_t& aCompositorAnimatio
AdvanceAnimations();
}
*aValue = mAnimStorage->GetOMTAValue(aCompositorAnimationsId);
Maybe<float> opacity = mAnimStorage->GetAnimationOpacity(aCompositorAnimationsId);
if (opacity) {
*aOpacity = *opacity;
*aHasAnimationOpacity = true;
} else {
*aHasAnimationOpacity = false;
}
return IPC_OK();
}
mozilla::ipc::IPCResult
WebRenderBridgeParent::RecvGetAnimationTransform(const uint64_t& aCompositorAnimationsId,
MaybeTransform* aTransform)
{
if (mDestroyed) {
return IPC_FAIL_NO_REASON(this);
}
MOZ_ASSERT(mAnimStorage);
if (RefPtr<WebRenderBridgeParent> root = GetRootWebRenderBridgeParent()) {
root->AdvanceAnimations();
} else {
AdvanceAnimations();
}
Maybe<Matrix4x4> transform = mAnimStorage->GetAnimationTransform(aCompositorAnimationsId);
if (transform) {
*aTransform = *transform;
} else {
*aTransform = mozilla::void_t();
}
return IPC_OK();
}

View File

@ -118,8 +118,11 @@ public:
mozilla::ipc::IPCResult RecvSetTestSampleTime(const TimeStamp& aTime) override;
mozilla::ipc::IPCResult RecvLeaveTestMode() override;
mozilla::ipc::IPCResult RecvGetAnimationValue(const uint64_t& aCompositorAnimationsId,
OMTAValue* aValue) override;
mozilla::ipc::IPCResult RecvGetAnimationOpacity(const uint64_t& aCompositorAnimationsId,
float* aOpacity,
bool* aHasAnimationOpacity) override;
mozilla::ipc::IPCResult RecvGetAnimationTransform(const uint64_t& aCompositorAnimationsId,
MaybeTransform* aTransform) override;
mozilla::ipc::IPCResult RecvSetAsyncScrollOffset(const FrameMetrics::ViewID& aScrollId,
const float& aX,
const float& aY) override;

View File

@ -995,8 +995,10 @@ description =
description =
[PLayerTransaction::LeaveTestMode]
description =
[PLayerTransaction::GetAnimationValue]
description = test only
[PLayerTransaction::GetAnimationOpacity]
description =
[PLayerTransaction::GetAnimationTransform]
description =
[PLayerTransaction::GetTransform]
description = test only
[PLayerTransaction::SetAsyncScrollOffset]
@ -1023,7 +1025,9 @@ description =
description = test only
[PWebRenderBridge::LeaveTestMode]
description = test only
[PWebRenderBridge::GetAnimationValue]
[PWebRenderBridge::GetAnimationOpacity]
description = test only
[PWebRenderBridge::GetAnimationTransform]
description = test only
[PWebRenderBridge::SetAsyncScrollOffset]
description = test only