зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1359360 - Handle draw result for webrender background image layer. r=mattwoodrow
This commit is contained in:
Родитель
5490a9c0ff
Коммит
2b6ab30c4d
|
@ -1968,7 +1968,7 @@ nsCSSRendering::CanBuildWebRenderDisplayItemsForStyleImageLayer(nsPresContext& a
|
|||
aBackgroundStyle->mImage.mLayers[aLayer].mImage.GetType() == eStyleImageType_Image;
|
||||
}
|
||||
|
||||
void
|
||||
DrawResult
|
||||
nsCSSRendering::BuildWebRenderDisplayItemsForStyleImageLayer(const PaintBGParams& aParams,
|
||||
mozilla::wr::DisplayListBuilder& aBuilder,
|
||||
nsTArray<WebRenderParentCommand>& aParentCommands,
|
||||
|
@ -1985,12 +1985,12 @@ nsCSSRendering::BuildWebRenderDisplayItemsForStyleImageLayer(const PaintBGParams
|
|||
// draw the background. The canvas really should be drawing the
|
||||
// bg, but there's no way to hook that up via css.
|
||||
if (!aParams.frame->StyleDisplay()->UsedAppearance()) {
|
||||
return;
|
||||
return DrawResult::NOT_READY;
|
||||
}
|
||||
|
||||
nsIContent* content = aParams.frame->GetContent();
|
||||
if (!content || content->GetParent()) {
|
||||
return;
|
||||
return DrawResult::NOT_READY;
|
||||
}
|
||||
|
||||
sc = aParams.frame->StyleContext();
|
||||
|
@ -2709,7 +2709,7 @@ nsCSSRendering::PaintStyleImageLayerWithSC(const PaintBGParams& aParams,
|
|||
return result;
|
||||
}
|
||||
|
||||
void
|
||||
DrawResult
|
||||
nsCSSRendering::BuildWebRenderDisplayItemsForStyleImageLayerWithSC(const PaintBGParams& aParams,
|
||||
mozilla::wr::DisplayListBuilder& aBuilder,
|
||||
nsTArray<WebRenderParentCommand>& aParentCommands,
|
||||
|
@ -2747,7 +2747,7 @@ nsCSSRendering::BuildWebRenderDisplayItemsForStyleImageLayerWithSC(const PaintBG
|
|||
// Skip the following layer painting code if we found the dirty region is
|
||||
// empty or the current layer is not selected for drawing.
|
||||
if (clipState.mDirtyRectInDevPx.IsEmpty()) {
|
||||
return;
|
||||
return DrawResult::SUCCESS;
|
||||
}
|
||||
|
||||
nsBackgroundLayerState state =
|
||||
|
@ -2756,13 +2756,15 @@ nsCSSRendering::BuildWebRenderDisplayItemsForStyleImageLayerWithSC(const PaintBG
|
|||
clipState.mBGClipArea, layer, nullptr);
|
||||
|
||||
if (!state.mFillArea.IsEmpty()) {
|
||||
state.mImageRenderer.BuildWebRenderDisplayItemsForLayer(&aParams.presCtx,
|
||||
aBuilder, aParentCommands, aLayer,
|
||||
state.mDestArea, state.mFillArea,
|
||||
state.mAnchor + paintBorderArea.TopLeft(),
|
||||
clipState.mDirtyRectInAppUnits,
|
||||
state.mRepeatSize, aParams.opacity);
|
||||
return state.mImageRenderer.BuildWebRenderDisplayItemsForLayer(&aParams.presCtx,
|
||||
aBuilder, aParentCommands, aLayer,
|
||||
state.mDestArea, state.mFillArea,
|
||||
state.mAnchor + paintBorderArea.TopLeft(),
|
||||
clipState.mDirtyRectInAppUnits,
|
||||
state.mRepeatSize, aParams.opacity);
|
||||
}
|
||||
|
||||
return DrawResult::SUCCESS;
|
||||
}
|
||||
|
||||
nsRect
|
||||
|
|
|
@ -495,17 +495,17 @@ struct nsCSSRendering {
|
|||
nsIFrame *aFrame,
|
||||
const nsStyleBackground* aBackgroundStyle,
|
||||
int32_t aLayer);
|
||||
static void BuildWebRenderDisplayItemsForStyleImageLayer(const PaintBGParams& aParams,
|
||||
mozilla::wr::DisplayListBuilder& aBuilder,
|
||||
nsTArray<mozilla::layers::WebRenderParentCommand>& aParentCommands,
|
||||
mozilla::layers::WebRenderDisplayItemLayer* aLayer);
|
||||
|
||||
static void BuildWebRenderDisplayItemsForStyleImageLayerWithSC(const PaintBGParams& aParams,
|
||||
static DrawResult BuildWebRenderDisplayItemsForStyleImageLayer(const PaintBGParams& aParams,
|
||||
mozilla::wr::DisplayListBuilder& aBuilder,
|
||||
nsTArray<mozilla::layers::WebRenderParentCommand>& aParentCommands,
|
||||
mozilla::layers::WebRenderDisplayItemLayer* aLayer,
|
||||
nsStyleContext *mBackgroundSC,
|
||||
const nsStyleBorder& aBorder);
|
||||
mozilla::layers::WebRenderDisplayItemLayer* aLayer);
|
||||
|
||||
static DrawResult BuildWebRenderDisplayItemsForStyleImageLayerWithSC(const PaintBGParams& aParams,
|
||||
mozilla::wr::DisplayListBuilder& aBuilder,
|
||||
nsTArray<mozilla::layers::WebRenderParentCommand>& aParentCommands,
|
||||
mozilla::layers::WebRenderDisplayItemLayer* aLayer,
|
||||
nsStyleContext *mBackgroundSC,
|
||||
const nsStyleBorder& aBorder);
|
||||
|
||||
/**
|
||||
* Returns the rectangle covered by the given background layer image, taking
|
||||
|
|
|
@ -3436,7 +3436,10 @@ nsDisplayBackgroundImage::CreateWebRenderCommands(wr::DisplayListBuilder& aBuild
|
|||
CompositionOp::OP_OVER);
|
||||
params.bgClipRect = &mBounds;
|
||||
|
||||
nsCSSRendering::BuildWebRenderDisplayItemsForStyleImageLayer(params, aBuilder, aParentCommands, aLayer);
|
||||
image::DrawResult result =
|
||||
nsCSSRendering::BuildWebRenderDisplayItemsForStyleImageLayer(params, aBuilder, aParentCommands, aLayer);
|
||||
|
||||
nsDisplayBackgroundGeometry::UpdateDrawResult(this, result);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -577,7 +577,7 @@ nsImageRenderer::Draw(nsPresContext* aPresContext,
|
|||
return result;
|
||||
}
|
||||
|
||||
void
|
||||
DrawResult
|
||||
nsImageRenderer::BuildWebRenderDisplayItems(nsPresContext* aPresContext,
|
||||
mozilla::wr::DisplayListBuilder& aBuilder,
|
||||
nsTArray<WebRenderParentCommand>& aParentCommands,
|
||||
|
@ -592,11 +592,11 @@ nsImageRenderer::BuildWebRenderDisplayItems(nsPresContext* aPresContext,
|
|||
{
|
||||
if (!IsReady()) {
|
||||
NS_NOTREACHED("Ensure PrepareImage() has returned true before calling me");
|
||||
return;
|
||||
return DrawResult::NOT_READY;
|
||||
}
|
||||
if (aDest.IsEmpty() || aFill.IsEmpty() ||
|
||||
mSize.width <= 0 || mSize.height <= 0) {
|
||||
return;
|
||||
return DrawResult::SUCCESS;
|
||||
}
|
||||
|
||||
switch (mType) {
|
||||
|
@ -614,11 +614,11 @@ nsImageRenderer::BuildWebRenderDisplayItems(nsPresContext* aPresContext,
|
|||
ConvertImageRendererToDrawFlags(mFlags));
|
||||
if (!container) {
|
||||
NS_WARNING("Failed to get image container");
|
||||
return;
|
||||
return DrawResult::BAD_IMAGE;
|
||||
}
|
||||
Maybe<wr::ImageKey> key = aLayer->SendImageContainer(container, aParentCommands);
|
||||
if (key.isNothing()) {
|
||||
return;
|
||||
return DrawResult::BAD_IMAGE;
|
||||
}
|
||||
|
||||
const int32_t appUnitsPerDevPixel = mForFrame->PresContext()->AppUnitsPerDevPixel();
|
||||
|
@ -639,6 +639,8 @@ nsImageRenderer::BuildWebRenderDisplayItems(nsPresContext* aPresContext,
|
|||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return DrawResult::SUCCESS;
|
||||
}
|
||||
|
||||
already_AddRefed<gfxDrawable>
|
||||
|
@ -701,7 +703,7 @@ nsImageRenderer::DrawLayer(nsPresContext* aPresContext,
|
|||
aOpacity);
|
||||
}
|
||||
|
||||
void
|
||||
DrawResult
|
||||
nsImageRenderer::BuildWebRenderDisplayItemsForLayer(nsPresContext* aPresContext,
|
||||
mozilla::wr::DisplayListBuilder& aBuilder,
|
||||
nsTArray<WebRenderParentCommand>& aParentCommands,
|
||||
|
@ -715,19 +717,19 @@ nsImageRenderer::BuildWebRenderDisplayItemsForLayer(nsPresContext* aPresCo
|
|||
{
|
||||
if (!IsReady()) {
|
||||
NS_NOTREACHED("Ensure PrepareImage() has returned true before calling me");
|
||||
return;
|
||||
return mPrepareResult;
|
||||
}
|
||||
if (aDest.IsEmpty() || aFill.IsEmpty() ||
|
||||
mSize.width <= 0 || mSize.height <= 0) {
|
||||
return;
|
||||
return DrawResult::SUCCESS;
|
||||
}
|
||||
|
||||
BuildWebRenderDisplayItems(aPresContext, aBuilder, aParentCommands, aLayer,
|
||||
aDirty, aDest, aFill, aAnchor, aRepeatSize,
|
||||
CSSIntRect(0, 0,
|
||||
nsPresContext::AppUnitsToIntCSSPixels(mSize.width),
|
||||
nsPresContext::AppUnitsToIntCSSPixels(mSize.height)),
|
||||
aOpacity);
|
||||
return BuildWebRenderDisplayItems(aPresContext, aBuilder, aParentCommands, aLayer,
|
||||
aDirty, aDest, aFill, aAnchor, aRepeatSize,
|
||||
CSSIntRect(0, 0,
|
||||
nsPresContext::AppUnitsToIntCSSPixels(mSize.width),
|
||||
nsPresContext::AppUnitsToIntCSSPixels(mSize.height)),
|
||||
aOpacity);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -206,16 +206,16 @@ public:
|
|||
* {background|mask}-specific arguments.
|
||||
* @see nsLayoutUtils::DrawImage() for parameters.
|
||||
*/
|
||||
void BuildWebRenderDisplayItemsForLayer(nsPresContext* aPresContext,
|
||||
mozilla::wr::DisplayListBuilder& aBuilder,
|
||||
nsTArray<layers::WebRenderParentCommand>& aParentCommands,
|
||||
mozilla::layers::WebRenderDisplayItemLayer* aLayer,
|
||||
const nsRect& aDest,
|
||||
const nsRect& aFill,
|
||||
const nsPoint& aAnchor,
|
||||
const nsRect& aDirty,
|
||||
const nsSize& aRepeatSize,
|
||||
float aOpacity);
|
||||
DrawResult BuildWebRenderDisplayItemsForLayer(nsPresContext* aPresContext,
|
||||
mozilla::wr::DisplayListBuilder& aBuilder,
|
||||
nsTArray<layers::WebRenderParentCommand>& aParentCommands,
|
||||
mozilla::layers::WebRenderDisplayItemLayer* aLayer,
|
||||
const nsRect& aDest,
|
||||
const nsRect& aFill,
|
||||
const nsPoint& aAnchor,
|
||||
const nsRect& aDirty,
|
||||
const nsSize& aRepeatSize,
|
||||
float aOpacity);
|
||||
|
||||
/**
|
||||
* Draw the image to a single component of a border-image style rendering.
|
||||
|
@ -290,17 +290,17 @@ private:
|
|||
*
|
||||
* @see nsLayoutUtils::DrawImage() for other parameters.
|
||||
*/
|
||||
void BuildWebRenderDisplayItems(nsPresContext* aPresContext,
|
||||
mozilla::wr::DisplayListBuilder& aBuilder,
|
||||
nsTArray<layers::WebRenderParentCommand>& aParentCommands,
|
||||
mozilla::layers::WebRenderDisplayItemLayer* aLayer,
|
||||
const nsRect& aDirtyRect,
|
||||
const nsRect& aDest,
|
||||
const nsRect& aFill,
|
||||
const nsPoint& aAnchor,
|
||||
const nsSize& aRepeatSize,
|
||||
const mozilla::CSSIntRect& aSrc,
|
||||
float aOpacity = 1.0);
|
||||
DrawResult BuildWebRenderDisplayItems(nsPresContext* aPresContext,
|
||||
mozilla::wr::DisplayListBuilder& aBuilder,
|
||||
nsTArray<layers::WebRenderParentCommand>& aParentCommands,
|
||||
mozilla::layers::WebRenderDisplayItemLayer* aLayer,
|
||||
const nsRect& aDirtyRect,
|
||||
const nsRect& aDest,
|
||||
const nsRect& aFill,
|
||||
const nsPoint& aAnchor,
|
||||
const nsSize& aRepeatSize,
|
||||
const mozilla::CSSIntRect& aSrc,
|
||||
float aOpacity = 1.0);
|
||||
|
||||
/**
|
||||
* Helper method for creating a gfxDrawable from mPaintServerFrame or
|
||||
|
|
Загрузка…
Ссылка в новой задаче