зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1411238 - Make OMTA queries work with layers-free webrender. r=mtseng
MozReview-Commit-ID: Jq57GtjNO3E --HG-- extra : rebase_source : 15c2e3a4acbc61c60827bf1748ef691f2275fb66
This commit is contained in:
Родитель
0a3125a592
Коммит
4c7c7873e4
|
@ -3931,48 +3931,62 @@ nsDOMWindowUtils::GetOMTAStyle(nsIDOMElement* aElement,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (frame && nsLayoutUtils::AreAsyncAnimationsEnabled()) {
|
if (frame && nsLayoutUtils::AreAsyncAnimationsEnabled()) {
|
||||||
|
RefPtr<LayerManager> widgetLayerManager;
|
||||||
|
if (nsIWidget* widget = GetWidget()) {
|
||||||
|
widgetLayerManager = widget->GetLayerManager();
|
||||||
|
}
|
||||||
|
|
||||||
if (aProperty.EqualsLiteral("opacity")) {
|
if (aProperty.EqualsLiteral("opacity")) {
|
||||||
|
float value = 0;
|
||||||
|
bool hadAnimatedOpacity = false;
|
||||||
|
|
||||||
Layer* layer =
|
Layer* layer =
|
||||||
FrameLayerBuilder::GetDedicatedLayer(frame, DisplayItemType::TYPE_OPACITY);
|
FrameLayerBuilder::GetDedicatedLayer(frame, DisplayItemType::TYPE_OPACITY);
|
||||||
if (layer) {
|
if (layer) {
|
||||||
float value = 0;
|
|
||||||
bool hadAnimatedOpacity = false;
|
|
||||||
ShadowLayerForwarder* forwarder = layer->Manager()->AsShadowForwarder();
|
ShadowLayerForwarder* forwarder = layer->Manager()->AsShadowForwarder();
|
||||||
if (forwarder && forwarder->HasShadowManager()) {
|
if (forwarder && forwarder->HasShadowManager()) {
|
||||||
forwarder->GetShadowManager()->
|
forwarder->GetShadowManager()->
|
||||||
SendGetAnimationOpacity(layer->GetCompositorAnimationsId(),
|
SendGetAnimationOpacity(layer->GetCompositorAnimationsId(),
|
||||||
&value,
|
&value,
|
||||||
&hadAnimatedOpacity);
|
&hadAnimatedOpacity);
|
||||||
|
}
|
||||||
} else if (WebRenderLayerManager* wrlm = layer->Manager()->AsWebRenderLayerManager()) {
|
} else if (WebRenderLayerManager* wrlm = widgetLayerManager->AsWebRenderLayerManager()) {
|
||||||
|
RefPtr<WebRenderAnimationData> animationData = wrlm->CommandBuilder()
|
||||||
|
.GetWebRenderUserData<WebRenderAnimationData>(frame, (uint32_t)DisplayItemType::TYPE_OPACITY);
|
||||||
|
if (animationData) {
|
||||||
wrlm->WrBridge()->SendGetAnimationOpacity(
|
wrlm->WrBridge()->SendGetAnimationOpacity(
|
||||||
layer->GetCompositorAnimationsId(),
|
animationData->GetAnimationInfo().GetCompositorAnimationsId(),
|
||||||
&value,
|
&value,
|
||||||
&hadAnimatedOpacity);
|
&hadAnimatedOpacity);
|
||||||
}
|
}
|
||||||
if (hadAnimatedOpacity) {
|
}
|
||||||
cssValue = new nsROCSSPrimitiveValue;
|
if (hadAnimatedOpacity) {
|
||||||
cssValue->SetNumber(value);
|
cssValue = new nsROCSSPrimitiveValue;
|
||||||
}
|
cssValue->SetNumber(value);
|
||||||
}
|
}
|
||||||
} else if (aProperty.EqualsLiteral("transform")) {
|
} else if (aProperty.EqualsLiteral("transform")) {
|
||||||
|
MaybeTransform transform;
|
||||||
|
|
||||||
Layer* layer =
|
Layer* layer =
|
||||||
FrameLayerBuilder::GetDedicatedLayer(frame, DisplayItemType::TYPE_TRANSFORM);
|
FrameLayerBuilder::GetDedicatedLayer(frame, DisplayItemType::TYPE_TRANSFORM);
|
||||||
if (layer) {
|
if (layer) {
|
||||||
MaybeTransform transform;
|
|
||||||
ShadowLayerForwarder* forwarder = layer->Manager()->AsShadowForwarder();
|
ShadowLayerForwarder* forwarder = layer->Manager()->AsShadowForwarder();
|
||||||
if (forwarder && forwarder->HasShadowManager()) {
|
if (forwarder && forwarder->HasShadowManager()) {
|
||||||
forwarder->GetShadowManager()->
|
forwarder->GetShadowManager()->
|
||||||
SendGetAnimationTransform(layer->GetCompositorAnimationsId(), &transform);
|
SendGetAnimationTransform(layer->GetCompositorAnimationsId(), &transform);
|
||||||
} else if (WebRenderLayerManager* wrlm = layer->Manager()->AsWebRenderLayerManager()) {
|
}
|
||||||
|
} else if (WebRenderLayerManager* wrlm = widgetLayerManager->AsWebRenderLayerManager()) {
|
||||||
|
RefPtr<WebRenderAnimationData> animationData = wrlm->CommandBuilder()
|
||||||
|
.GetWebRenderUserData<WebRenderAnimationData>(frame, (uint32_t)DisplayItemType::TYPE_TRANSFORM);
|
||||||
|
if (animationData) {
|
||||||
wrlm->WrBridge()->SendGetAnimationTransform(
|
wrlm->WrBridge()->SendGetAnimationTransform(
|
||||||
layer->GetCompositorAnimationsId(),
|
animationData->GetAnimationInfo().GetCompositorAnimationsId(),
|
||||||
&transform);
|
&transform);
|
||||||
}
|
}
|
||||||
if (transform.type() == MaybeTransform::TMatrix4x4) {
|
}
|
||||||
Matrix4x4 matrix = transform.get_Matrix4x4();
|
if (transform.type() == MaybeTransform::TMatrix4x4) {
|
||||||
cssValue = nsComputedDOMStyle::MatrixToCSSValue(matrix);
|
Matrix4x4 matrix = transform.get_Matrix4x4();
|
||||||
}
|
cssValue = nsComputedDOMStyle::MatrixToCSSValue(matrix);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -146,6 +146,26 @@ public:
|
||||||
return res.forget();
|
return res.forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class T> already_AddRefed<T>
|
||||||
|
GetWebRenderUserData(nsIFrame* aFrame, uint32_t aPerFrameKey)
|
||||||
|
{
|
||||||
|
RefPtr<T> result;
|
||||||
|
MOZ_ASSERT(aFrame);
|
||||||
|
nsIFrame::WebRenderUserDataTable* userDataTable =
|
||||||
|
aFrame->GetProperty(nsIFrame::WebRenderUserDataProperty());
|
||||||
|
if (!userDataTable) {
|
||||||
|
return result.forget();
|
||||||
|
}
|
||||||
|
|
||||||
|
WebRenderUserData* data = nullptr;
|
||||||
|
if (userDataTable->Get(aPerFrameKey, &data)) {
|
||||||
|
if (data->GetType() == T::Type() && data->IsDataValid(mManager)) {
|
||||||
|
result = static_cast<T*>(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result.forget();
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
WebRenderLayerManager* mManager;
|
WebRenderLayerManager* mManager;
|
||||||
ScrollingLayersHelper mScrollingHelper;
|
ScrollingLayersHelper mScrollingHelper;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче