зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1405465 - Handle WR paint codepath with no frame r=kats
This commit is contained in:
Родитель
ae4d702ed7
Коммит
58705ea969
|
@ -240,16 +240,15 @@ WebRenderLayerManager::EndTransaction(DrawPaintedLayerCallback aCallback,
|
|||
void
|
||||
WebRenderLayerManager::EndTransactionWithoutLayer(nsDisplayList* aDisplayList,
|
||||
nsDisplayListBuilder* aDisplayListBuilder,
|
||||
const nsTArray<wr::WrFilterOp>& aFilters)
|
||||
const nsTArray<wr::WrFilterOp>& aFilters,
|
||||
WebRenderBackgroundData* aBackground)
|
||||
{
|
||||
MOZ_ASSERT(aDisplayList && aDisplayListBuilder);
|
||||
|
||||
AUTO_PROFILER_TRACING("Paint", "RenderLayers");
|
||||
|
||||
#if DUMP_LISTS
|
||||
// Useful for debugging, it dumps the display list *before* we try to build
|
||||
// WR commands from it
|
||||
if (XRE_IsContentProcess()) nsFrame::PrintDisplayList(aDisplayListBuilder, *aDisplayList);
|
||||
if (XRE_IsContentProcess() && aDisplayList) nsFrame::PrintDisplayList(aDisplayListBuilder, *aDisplayList);
|
||||
#endif
|
||||
|
||||
#ifdef XP_WIN
|
||||
|
@ -266,7 +265,9 @@ WebRenderLayerManager::EndTransactionWithoutLayer(nsDisplayList* aDisplayList,
|
|||
wr::DisplayListBuilder builder(WrBridge()->GetPipeline(), contentSize, mLastDisplayListSize);
|
||||
wr::IpcResourceUpdateQueue resourceUpdates(WrBridge());
|
||||
|
||||
{ // Record the time spent "layerizing". WR doesn't actually layerize but
|
||||
if (aDisplayList) {
|
||||
MOZ_ASSERT(aDisplayListBuilder && !aBackground);
|
||||
// Record the time spent "layerizing". WR doesn't actually layerize but
|
||||
// generating the WR display list is the closest equivalent
|
||||
PaintTelemetry::AutoRecord record(PaintTelemetry::Metric::Layerization);
|
||||
|
||||
|
@ -277,6 +278,10 @@ WebRenderLayerManager::EndTransactionWithoutLayer(nsDisplayList* aDisplayList,
|
|||
mScrollData,
|
||||
contentSize,
|
||||
aFilters);
|
||||
} else {
|
||||
// ViewToPaint does not have frame yet, then render only background clolor.
|
||||
MOZ_ASSERT(!aDisplayListBuilder && aBackground);
|
||||
aBackground->AddWebRenderCommands(builder);
|
||||
}
|
||||
|
||||
DiscardCompositorAnimations();
|
||||
|
|
|
@ -71,7 +71,8 @@ public:
|
|||
virtual bool EndEmptyTransaction(EndTransactionFlags aFlags = END_DEFAULT) override;
|
||||
void EndTransactionWithoutLayer(nsDisplayList* aDisplayList,
|
||||
nsDisplayListBuilder* aDisplayListBuilder,
|
||||
const nsTArray<wr::WrFilterOp>& aFilters = nsTArray<wr::WrFilterOp>());
|
||||
const nsTArray<wr::WrFilterOp>& aFilters = nsTArray<wr::WrFilterOp>(),
|
||||
WebRenderBackgroundData* aBackground = nullptr);
|
||||
virtual void EndTransaction(DrawPaintedLayerCallback aCallback,
|
||||
void* aCallbackData,
|
||||
EndTransactionFlags aFlags = END_DEFAULT) override;
|
||||
|
|
|
@ -20,6 +20,15 @@
|
|||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
||||
void
|
||||
WebRenderBackgroundData::AddWebRenderCommands(wr::DisplayListBuilder& aBuilder)
|
||||
{
|
||||
aBuilder.PushRect(mBounds,
|
||||
mBounds,
|
||||
true,
|
||||
mColor);
|
||||
}
|
||||
|
||||
/* static */ bool
|
||||
WebRenderUserData::SupportsAsyncUpdate(nsIFrame* aFrame)
|
||||
{
|
||||
|
|
|
@ -37,6 +37,19 @@ class WebRenderFallbackData;
|
|||
class WebRenderLayerManager;
|
||||
class WebRenderGroupData;
|
||||
|
||||
class WebRenderBackgroundData
|
||||
{
|
||||
public:
|
||||
WebRenderBackgroundData(wr::LayoutRect aBounds, wr::ColorF aColor)
|
||||
: mBounds(aBounds)
|
||||
, mColor(aColor)
|
||||
{ }
|
||||
void AddWebRenderCommands(wr::DisplayListBuilder& aBuilder);
|
||||
protected:
|
||||
wr::LayoutRect mBounds;
|
||||
wr::ColorF mColor;
|
||||
};
|
||||
|
||||
class WebRenderUserData
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -176,6 +176,8 @@
|
|||
#include "nsLayoutStylesheetCache.h"
|
||||
#include "mozilla/layers/InputAPZContext.h"
|
||||
#include "mozilla/layers/FocusTarget.h"
|
||||
#include "mozilla/layers/WebRenderLayerManager.h"
|
||||
#include "mozilla/layers/WebRenderUserData.h"
|
||||
#include "mozilla/ServoBindings.h"
|
||||
#include "mozilla/ServoStyleSet.h"
|
||||
#include "mozilla/StyleSheet.h"
|
||||
|
@ -6319,7 +6321,15 @@ PresShell::Paint(nsView* aViewToPaint,
|
|||
}
|
||||
|
||||
if (layerManager->GetBackendType() == layers::LayersBackend::LAYERS_WR) {
|
||||
// TODO: bug 1405465 - create a WR display list which simulates the color layer below.
|
||||
nsPresContext* pc = GetPresContext();
|
||||
LayoutDeviceRect bounds =
|
||||
LayoutDeviceRect::FromAppUnits(pc->GetVisibleArea(), pc->AppUnitsPerDevPixel());
|
||||
bgcolor = NS_ComposeColors(bgcolor, mCanvasBackgroundColor);
|
||||
WebRenderBackgroundData data(wr::ToLayoutRect(bounds), wr::ToColorF(ToDeviceColor(bgcolor)));
|
||||
nsTArray<wr::WrFilterOp> wrFilters;
|
||||
|
||||
MaybeSetupTransactionIdAllocator(layerManager, presContext);
|
||||
layerManager->AsWebRenderLayerManager()->EndTransactionWithoutLayer(nullptr, nullptr, wrFilters, &data);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче