Bug 1388235 - Support fallback path for nsDisplayFilter. r=jrmuizel

Use FrameLayerBuilder and BasicLayerManager for rendering filter effects
that webrender not supported.

MozReview-Commit-ID: FCa6BWNpnbR
This commit is contained in:
Morris Tseng 2017-08-18 15:24:30 +08:00
Родитель 5da4bc5316
Коммит b2906160cb
1 изменённых файлов: 26 добавлений и 2 удалений

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

@ -5,6 +5,7 @@
#include "WebRenderLayerManager.h"
#include "BasicLayers.h"
#include "gfxPrefs.h"
#include "GeckoProfiler.h"
#include "LayersLogging.h"
@ -14,6 +15,7 @@
#include "mozilla/layers/TextureClient.h"
#include "mozilla/layers/WebRenderBridgeChild.h"
#include "mozilla/layers/UpdateImageHelper.h"
#include "nsDisplayList.h"
#include "WebRenderCanvasLayer.h"
#include "WebRenderCanvasRenderer.h"
#include "WebRenderColorLayer.h"
@ -392,11 +394,33 @@ PaintItemByDrawTarget(nsDisplayItem* aItem,
RefPtr<gfxContext> context = gfxContext::CreateOrNull(aDT, aOffset.ToUnknownPoint());
MOZ_ASSERT(context);
if (aItem->GetType() == DisplayItemType::TYPE_MASK) {
switch (aItem->GetType()) {
case DisplayItemType::TYPE_MASK:
context->SetMatrix(gfxMatrix::Translation(-aOffset.x, -aOffset.y));
static_cast<nsDisplayMask*>(aItem)->PaintMask(aDisplayListBuilder, context);
} else {
break;
case DisplayItemType::TYPE_FILTER:
{
RefPtr<BasicLayerManager> tempManager = new BasicLayerManager(BasicLayerManager::BLM_INACTIVE);
FrameLayerBuilder* layerBuilder = new FrameLayerBuilder();
layerBuilder->Init(aDisplayListBuilder, tempManager);
tempManager->BeginTransactionWithTarget(context);
ContainerLayerParameters param;
RefPtr<Layer> layer = aItem->BuildLayer(aDisplayListBuilder, tempManager, param);
if (layer) {
tempManager->SetRoot(layer);
static_cast<nsDisplayFilter*>(aItem)->PaintAsLayer(aDisplayListBuilder, context, tempManager);
}
if (tempManager->InTransaction()) {
tempManager->AbortTransaction();
}
break;
}
default:
aItem->Paint(aDisplayListBuilder, context);
break;
}
if (gfxPrefs::WebRenderHighlightPaintedLayers()) {