Bug 1345017 - pass animation data from content to WebRenderBridgeParent, r=kats

MozReview-Commit-ID: 7p5ocyr1ywV
This commit is contained in:
peter chang 2017-03-28 17:11:03 +08:00
Родитель 9945c16d87
Коммит 2fdfc8c722
3 изменённых файлов: 27 добавлений и 1 удалений

Просмотреть файл

@ -37,9 +37,14 @@ struct OpAddExternalImage {
ImageKey key; ImageKey key;
}; };
struct OpAddCompositorAnimations {
CompositorAnimations data;
};
union WebRenderParentCommand { union WebRenderParentCommand {
OpAddExternalImage; OpAddExternalImage;
CompositableOperation; CompositableOperation;
OpAddCompositorAnimations;
}; };
} // namespace } // namespace

Просмотреть файл

@ -10,6 +10,7 @@
#include "GLContext.h" #include "GLContext.h"
#include "GLContextProvider.h" #include "GLContextProvider.h"
#include "mozilla/Range.h" #include "mozilla/Range.h"
#include "mozilla/layers/AnimationHelper.h"
#include "mozilla/layers/Compositor.h" #include "mozilla/layers/Compositor.h"
#include "mozilla/layers/CompositorBridgeParent.h" #include "mozilla/layers/CompositorBridgeParent.h"
#include "mozilla/layers/CompositorThread.h" #include "mozilla/layers/CompositorThread.h"
@ -415,6 +416,19 @@ WebRenderBridgeParent::ProcessWebRenderCommands(const gfx::IntSize &aSize,
} }
break; break;
} }
case WebRenderParentCommand::TOpAddCompositorAnimations: {
const OpAddCompositorAnimations& op = cmd.get_OpAddCompositorAnimations();
CompositorAnimations data(Move(op.data()));
if (data.animations().Length()) {
uint64_t id = mWidget ? 0 : mPipelineId.mHandle;
CompositorAnimationStorage* storage =
mCompositorBridge->GetAnimationStorage(id);
if (storage) {
storage->SetAnimations(data.id(), data.animations());
}
}
break;
}
default: { default: {
// other commands are handle on the child // other commands are handle on the child
break; break;

Просмотреть файл

@ -37,12 +37,19 @@ WebRenderContainerLayer::RenderLayer(wr::DisplayListBuilder& aBuilder)
} }
aBuilder.PushStackingContext(wr::ToWrRect(relBounds), aBuilder.PushStackingContext(wr::ToWrRect(relBounds),
GetLocalOpacity(), GetLocalOpacity(),
//GetLayer()->GetAnimations(),
transform, transform,
mixBlendMode); mixBlendMode);
aBuilder.PushScrollLayer(wr::ToWrRect(overflow), aBuilder.PushScrollLayer(wr::ToWrRect(overflow),
wr::ToWrRect(overflow), wr::ToWrRect(overflow),
mask.ptrOr(nullptr)); mask.ptrOr(nullptr));
if (GetCompositorAnimationsId()) {
CompositorAnimations anim;
anim.animations() = GetAnimations();
anim.id() = GetCompositorAnimationsId();
WrBridge()->AddWebRenderParentCommand(OpAddCompositorAnimations(anim));
}
for (LayerPolygon& child : children) { for (LayerPolygon& child : children) {
if (child.layer->IsBackfaceHidden()) { if (child.layer->IsBackfaceHidden()) {
continue; continue;