зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1479234 - Factor out a function getting an OMTAValue from the compositor. r=boris
MozReview-Commit-ID: HciPnmLDiYd --HG-- extra : rebase_source : 46866f562774aadadcd540ab392363770e3d231f
This commit is contained in:
Родитель
0020eaf1a1
Коммит
9dd9cf1cc1
|
@ -3655,6 +3655,34 @@ GetTargetFrame(const Element* aElement, const nsAString& aPseudoElement)
|
||||||
return frame;
|
return frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static OMTAValue
|
||||||
|
GetOMTAValue(nsIFrame* aFrame,
|
||||||
|
DisplayItemType aDisplayItemKey,
|
||||||
|
WebRenderBridgeChild* aWebRenderBridgeChild)
|
||||||
|
{
|
||||||
|
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 (aWebRenderBridgeChild) {
|
||||||
|
RefPtr<WebRenderAnimationData> animationData =
|
||||||
|
GetWebRenderUserData<WebRenderAnimationData>(aFrame,
|
||||||
|
(uint32_t)aDisplayItemKey);
|
||||||
|
if (animationData) {
|
||||||
|
aWebRenderBridgeChild->SendGetAnimationValue(
|
||||||
|
animationData->GetAnimationInfo().GetCompositorAnimationsId(),
|
||||||
|
&value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsDOMWindowUtils::GetOMTAStyle(Element* aElement,
|
nsDOMWindowUtils::GetOMTAStyle(Element* aElement,
|
||||||
const nsAString& aProperty,
|
const nsAString& aProperty,
|
||||||
|
@ -3679,49 +3707,17 @@ nsDOMWindowUtils::GetOMTAStyle(Element* aElement,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aProperty.EqualsLiteral("opacity")) {
|
if (aProperty.EqualsLiteral("opacity")) {
|
||||||
OMTAValue value;
|
OMTAValue value = GetOMTAValue(frame,
|
||||||
|
DisplayItemType::TYPE_OPACITY,
|
||||||
Layer* layer =
|
GetWebRenderBridge());
|
||||||
FrameLayerBuilder::GetDedicatedLayer(frame, DisplayItemType::TYPE_OPACITY);
|
|
||||||
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>(frame, (uint32_t)DisplayItemType::TYPE_OPACITY);
|
|
||||||
if (animationData) {
|
|
||||||
wrbc->SendGetAnimationValue(
|
|
||||||
animationData->GetAnimationInfo().GetCompositorAnimationsId(),
|
|
||||||
&value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (value.type() == OMTAValue::Tfloat) {
|
if (value.type() == OMTAValue::Tfloat) {
|
||||||
cssValue = new nsROCSSPrimitiveValue;
|
cssValue = new nsROCSSPrimitiveValue;
|
||||||
cssValue->SetNumber(value.get_float());
|
cssValue->SetNumber(value.get_float());
|
||||||
}
|
}
|
||||||
} else if (aProperty.EqualsLiteral("transform")) {
|
} else if (aProperty.EqualsLiteral("transform")) {
|
||||||
OMTAValue value;
|
OMTAValue value = GetOMTAValue(frame,
|
||||||
|
DisplayItemType::TYPE_TRANSFORM,
|
||||||
Layer* layer =
|
GetWebRenderBridge());
|
||||||
FrameLayerBuilder::GetDedicatedLayer(frame, DisplayItemType::TYPE_TRANSFORM);
|
|
||||||
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>(frame, (uint32_t)DisplayItemType::TYPE_TRANSFORM);
|
|
||||||
if (animationData) {
|
|
||||||
wrbc->SendGetAnimationValue(
|
|
||||||
animationData->GetAnimationInfo().GetCompositorAnimationsId(),
|
|
||||||
&value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (value.type() == OMTAValue::TMatrix4x4) {
|
if (value.type() == OMTAValue::TMatrix4x4) {
|
||||||
cssValue = nsComputedDOMStyle::MatrixToCSSValue(value.get_Matrix4x4());
|
cssValue = nsComputedDOMStyle::MatrixToCSSValue(value.get_Matrix4x4());
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче