зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1772692 - AnimationInfo::EnumerateGenerationOnFrame shouldn't need to create a window renderer. r=hiro
There's no need to lazily create a renderer here. We already avoided this in content processes, but there's no need to do so in the parent process either. This shouldn't change behavior, but might help with bug 1772691, and generally seems cleaner. Differential Revision: https://phabricator.services.mozilla.com/D148337
This commit is contained in:
Родитель
9b518ab15c
Коммит
94ea7b0820
|
@ -171,31 +171,25 @@ void AnimationInfo::EnumerateGenerationOnFrame(
|
|||
const nsIFrame* aFrame, const nsIContent* aContent,
|
||||
const CompositorAnimatableDisplayItemTypes& aDisplayItemTypes,
|
||||
AnimationGenerationCallback aCallback) {
|
||||
if (XRE_IsContentProcess()) {
|
||||
if (nsIWidget* widget = nsContentUtils::WidgetForContent(aContent)) {
|
||||
// In case of child processes, we might not have yet created the layer
|
||||
// manager. That means there is no animation generation we have, thus
|
||||
// we call the callback function with |Nothing()| for the generation.
|
||||
//
|
||||
// Note that we need to use nsContentUtils::WidgetForContent() instead of
|
||||
// BrowserChild::GetFrom(aFrame->PresShell())->WebWidget() because in the
|
||||
// case of child popup content PuppetWidget::mBrowserChild is the same as
|
||||
// the parent's one, which means mBrowserChild->IsLayersConnected() check
|
||||
// in PuppetWidget::GetLayerManager queries the parent state, it results
|
||||
// the assertion in the function failure.
|
||||
if (widget->GetOwningBrowserChild() &&
|
||||
!static_cast<widget::PuppetWidget*>(widget)->HasWindowRenderer()) {
|
||||
nsIWidget* widget = nsContentUtils::WidgetForContent(aContent);
|
||||
if (!widget) {
|
||||
return;
|
||||
}
|
||||
// If we haven't created a window renderer there's no animation generation
|
||||
// that we can have, thus we call the callback function with |Nothing()| for
|
||||
// the generation.
|
||||
if (!widget->HasWindowRenderer()) {
|
||||
for (auto displayItem : LayerAnimationInfo::sDisplayItemTypes) {
|
||||
aCallback(Nothing(), displayItem);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
WindowRenderer* renderer = widget->GetWindowRenderer();
|
||||
MOZ_ASSERT(renderer);
|
||||
if (!renderer->AsWebRender()) {
|
||||
return;
|
||||
}
|
||||
|
||||
WindowRenderer* renderer = nsContentUtils::WindowRendererForContent(aContent);
|
||||
|
||||
if (renderer && renderer->AsWebRender()) {
|
||||
// In case of continuation, nsDisplayItem uses its last continuation, so we
|
||||
// have to use the last continuation frame here.
|
||||
if (nsLayoutUtils::IsFirstContinuationOrIBSplitSibling(aFrame)) {
|
||||
|
@ -218,8 +212,6 @@ void AnimationInfo::EnumerateGenerationOnFrame(
|
|||
}
|
||||
aCallback(generation, displayItem);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
static StyleTransformOperation ResolveTranslate(
|
||||
|
|
|
@ -185,8 +185,6 @@ class PuppetWidget : public nsBaseWidget,
|
|||
bool CreateRemoteLayerManager(
|
||||
const std::function<bool(WebRenderLayerManager*)>& aInitializeFunc);
|
||||
|
||||
bool HasWindowRenderer() { return !!mWindowRenderer; }
|
||||
|
||||
virtual void SetInputContext(const InputContext& aContext,
|
||||
const InputContextAction& aAction) override;
|
||||
virtual InputContext GetInputContext() override;
|
||||
|
|
|
@ -212,6 +212,7 @@ class nsBaseWidget : public nsIWidget, public nsSupportsWeakReference {
|
|||
void InfallibleMakeFullScreen(bool aFullScreen);
|
||||
|
||||
WindowRenderer* GetWindowRenderer() override;
|
||||
bool HasWindowRenderer() const final { return !!mWindowRenderer; }
|
||||
|
||||
// A remote compositor session tied to this window has been lost and IPC
|
||||
// messages will no longer work. The widget must clean up any lingering
|
||||
|
|
|
@ -1199,11 +1199,18 @@ class nsIWidget : public nsISupports {
|
|||
};
|
||||
|
||||
/**
|
||||
* Return the widget's LayerManager. The layer tree for that
|
||||
* LayerManager is what gets rendered to the widget.
|
||||
* Return the widget's LayerManager. The layer tree for that LayerManager is
|
||||
* what gets rendered to the widget.
|
||||
*
|
||||
* Note that this tries to create a renderer if it doesn't exist.
|
||||
*/
|
||||
virtual WindowRenderer* GetWindowRenderer() = 0;
|
||||
|
||||
/**
|
||||
* Returns whether there's an existing window renderer.
|
||||
*/
|
||||
virtual bool HasWindowRenderer() const = 0;
|
||||
|
||||
/**
|
||||
* Called before each layer manager transaction to allow any preparation
|
||||
* for DrawWindowUnderlay/Overlay that needs to be on the main thread.
|
||||
|
|
Загрузка…
Ссылка в новой задаче