Bug 1360246 - Propagate the StackingContextHelper to the rest of the displaylist-building code. r=nical

This propagates the StackingContextHelper to the rest of the code that
builds WR display items, because we will need it in future patches to
stop using RelativeToParent.

MozReview-Commit-ID: 3PlQrJRhH36
This commit is contained in:
Kartikaya Gupta 2017-05-03 08:48:08 -04:00
Родитель eb38bf66c1
Коммит 0ec3e2d4dd
15 изменённых файлов: 36 добавлений и 13 удалений

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

@ -115,6 +115,7 @@ WebRenderDisplayItemLayer::SendImageContainer(ImageContainer* aContainer,
bool
WebRenderDisplayItemLayer::PushItemAsImage(wr::DisplayListBuilder& aBuilder,
const StackingContextHelper& aSc,
nsTArray<layers::WebRenderParentCommand>& aParentCommands)
{
if (!mImageContainer) {

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

@ -29,6 +29,7 @@ public:
Maybe<wr::ImageKey> SendImageContainer(ImageContainer* aContainer,
nsTArray<layers::WebRenderParentCommand>& aParentCommands);
bool PushItemAsImage(wr::DisplayListBuilder& aBuilder,
const StackingContextHelper& aSc,
nsTArray<layers::WebRenderParentCommand>& aParentCommands);
protected:

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

@ -216,10 +216,11 @@ nsDisplayButtonBorder::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder&
// paint border.
nsRect buttonRect = nsRect(ToReferenceFrame(), mFrame->GetSize());
nsDisplayBoxShadowInner::CreateInsetBoxShadowWebRenderCommands(aBuilder,
aSc,
aLayer,
mFrame,
buttonRect);
mBorderRenderer->CreateWebRenderCommands(aBuilder, aLayer);
mBorderRenderer->CreateWebRenderCommands(aBuilder, aSc, aLayer);
}
void
@ -379,7 +380,7 @@ nsDisplayButtonForeground::CreateWebRenderCommands(wr::DisplayListBuilder& aBuil
mozilla::layers::WebRenderDisplayItemLayer* aLayer)
{
MOZ_ASSERT(mBorderRenderer.isSome());
mBorderRenderer->CreateWebRenderCommands(aBuilder, aLayer);
mBorderRenderer->CreateWebRenderCommands(aBuilder, aSc, aLayer);
}
nsresult

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

@ -486,7 +486,7 @@ BulletRenderer::CreateWebRenderCommandsForPath(nsDisplayItem* aItem,
MOZ_ASSERT(IsPathType());
MOZ_ASSERT(aLayer->GetDisplayItem() == aItem);
if (!aLayer->PushItemAsImage(aBuilder, aParentCommands)) {
if (!aLayer->PushItemAsImage(aBuilder, aSc, aParentCommands)) {
NS_WARNING("Fail to create WebRender commands for Bullet path.");
}
}

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

@ -108,7 +108,7 @@ nsDisplayColumnRule::CreateWebRenderCommands(wr::DisplayListBuilder& aBuilder,
{
MOZ_ASSERT(!mBorderRenderers.IsEmpty());
for (auto iter = mBorderRenderers.begin(); iter != mBorderRenderers.end(); iter++) {
iter->CreateWebRenderCommands(aBuilder, aLayer);
iter->CreateWebRenderCommands(aBuilder, aSc, aLayer);
}
}

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

@ -1991,6 +1991,7 @@ nsCSSRendering::CanBuildWebRenderDisplayItemsForStyleImageLayer(LayerManager* aM
DrawResult
nsCSSRendering::BuildWebRenderDisplayItemsForStyleImageLayer(const PaintBGParams& aParams,
mozilla::wr::DisplayListBuilder& aBuilder,
const mozilla::layers::StackingContextHelper& aSc,
nsTArray<WebRenderParentCommand>& aParentCommands,
mozilla::layers::WebRenderDisplayItemLayer* aLayer)
{
@ -2016,7 +2017,7 @@ nsCSSRendering::BuildWebRenderDisplayItemsForStyleImageLayer(const PaintBGParams
sc = aParams.frame->StyleContext();
}
return BuildWebRenderDisplayItemsForStyleImageLayerWithSC(aParams, aBuilder, aParentCommands, aLayer,
return BuildWebRenderDisplayItemsForStyleImageLayerWithSC(aParams, aBuilder, aSc, aParentCommands, aLayer,
sc, *aParams.frame->StyleBorder());
}
@ -2732,6 +2733,7 @@ nsCSSRendering::PaintStyleImageLayerWithSC(const PaintBGParams& aParams,
DrawResult
nsCSSRendering::BuildWebRenderDisplayItemsForStyleImageLayerWithSC(const PaintBGParams& aParams,
mozilla::wr::DisplayListBuilder& aBuilder,
const mozilla::layers::StackingContextHelper& aSc,
nsTArray<WebRenderParentCommand>& aParentCommands,
mozilla::layers::WebRenderDisplayItemLayer* aLayer,
nsStyleContext *aBackgroundSC,
@ -2778,7 +2780,7 @@ nsCSSRendering::BuildWebRenderDisplayItemsForStyleImageLayerWithSC(const PaintBG
if (!state.mFillArea.IsEmpty()) {
return state.mImageRenderer.BuildWebRenderDisplayItemsForLayer(&aParams.presCtx,
aBuilder, aParentCommands, aLayer,
aBuilder, aSc, aParentCommands, aLayer,
state.mDestArea, state.mFillArea,
state.mAnchor + paintBorderArea.TopLeft(),
clipState.mDirtyRectInAppUnits,

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

@ -33,6 +33,7 @@ class DrawTarget;
namespace layers {
class ImageContainer;
class StackingContextHelper;
class WebRenderDisplayItemLayer;
class WebRenderParentCommand;
class LayerManager;
@ -500,11 +501,13 @@ struct nsCSSRendering {
int32_t aLayer);
static DrawResult BuildWebRenderDisplayItemsForStyleImageLayer(const PaintBGParams& aParams,
mozilla::wr::DisplayListBuilder& aBuilder,
const mozilla::layers::StackingContextHelper& aSc,
nsTArray<mozilla::layers::WebRenderParentCommand>& aParentCommands,
mozilla::layers::WebRenderDisplayItemLayer* aLayer);
static DrawResult BuildWebRenderDisplayItemsForStyleImageLayerWithSC(const PaintBGParams& aParams,
mozilla::wr::DisplayListBuilder& aBuilder,
const mozilla::layers::StackingContextHelper& aSc,
nsTArray<mozilla::layers::WebRenderParentCommand>& aParentCommands,
mozilla::layers::WebRenderDisplayItemLayer* aLayer,
nsStyleContext *mBackgroundSC,

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

@ -3551,6 +3551,7 @@ nsCSSBorderRenderer::CanCreateWebRenderCommands()
void
nsCSSBorderRenderer::CreateWebRenderCommands(wr::DisplayListBuilder& aBuilder,
const layers::StackingContextHelper& aSc,
layers::WebRenderDisplayItemLayer* aLayer,
gfx::Rect aClipRect)
{

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

@ -30,6 +30,7 @@ namespace gfx {
class GradientStops;
} // namespace gfx
namespace layers {
class StackingContextHelper;
class WebRenderDisplayItemLayer;
} // namespace layers
} // namespace mozilla
@ -107,6 +108,7 @@ public:
bool CanCreateWebRenderCommands();
void CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuilder,
const mozilla::layers::StackingContextHelper& aSc,
mozilla::layers::WebRenderDisplayItemLayer* aLayer,
Rect aClipRect = Rect(0, 0, 0, 0));

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

@ -1027,6 +1027,7 @@ nsCSSGradientRenderer::BuildWebRenderParameters(float aOpacity,
void
nsCSSGradientRenderer::BuildWebRenderDisplayItems(wr::DisplayListBuilder& aBuilder,
const layers::StackingContextHelper& aSc,
layers::WebRenderDisplayItemLayer* aLayer,
const nsRect& aDest,
const nsRect& aFillArea,

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

@ -15,6 +15,7 @@
namespace mozilla {
namespace layers {
class StackingContextHelper;
class WebRenderDisplayItemLayer;
} // namespace layers
@ -80,6 +81,7 @@ public:
* aSrc - the area of the gradient that will fill aDest
*/
void BuildWebRenderDisplayItems(wr::DisplayListBuilder& aBuilder,
const layers::StackingContextHelper& aSc,
layers::WebRenderDisplayItemLayer* aLayer,
const nsRect& aDest,
const nsRect& aFill,

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

@ -3444,7 +3444,7 @@ nsDisplayBackgroundImage::CreateWebRenderCommands(wr::DisplayListBuilder& aBuild
params.bgClipRect = &mBounds;
image::DrawResult result =
nsCSSRendering::BuildWebRenderDisplayItemsForStyleImageLayer(params, aBuilder, aParentCommands, aLayer);
nsCSSRendering::BuildWebRenderDisplayItemsForStyleImageLayer(params, aBuilder, aSc, aParentCommands, aLayer);
nsDisplayBackgroundGeometry::UpdateDrawResult(this, result);
}
@ -4241,7 +4241,7 @@ nsDisplayOutline::CreateWebRenderCommands(wr::DisplayListBuilder& aBuilder,
clip = LayoutDeviceRect::FromAppUnits(
GetClip().GetClipRect(), appUnitsPerDevPixel).ToUnknownRect();
}
mBorderRenderer->CreateWebRenderCommands(aBuilder, aLayer, clip);
mBorderRenderer->CreateWebRenderCommands(aBuilder, aSc, aLayer, clip);
}
bool
@ -4760,6 +4760,7 @@ nsDisplayBorder::BuildLayer(nsDisplayListBuilder* aBuilder,
void
nsDisplayBorder::CreateBorderImageWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuilder,
const StackingContextHelper& aSc,
nsTArray<WebRenderParentCommand>& aParentCommands,
WebRenderDisplayItemLayer* aLayer)
{
@ -4877,7 +4878,7 @@ nsDisplayBorder::CreateWebRenderCommands(wr::DisplayListBuilder& aBuilder,
MOZ_ASSERT(mBorderImageRenderer || mBorderRenderer);
if (mBorderImageRenderer) {
CreateBorderImageWebRenderCommands(aBuilder, aParentCommands, aLayer);
CreateBorderImageWebRenderCommands(aBuilder, aSc, aParentCommands, aLayer);
} else if (mBorderRenderer) {
gfx::Rect clip(0, 0, 0, 0);
if (GetClip().HasClip()) {
@ -4886,7 +4887,7 @@ nsDisplayBorder::CreateWebRenderCommands(wr::DisplayListBuilder& aBuilder,
GetClip().GetClipRect(), appUnitsPerDevPixel).ToUnknownRect();
}
mBorderRenderer->CreateWebRenderCommands(aBuilder, aLayer, clip);
mBorderRenderer->CreateWebRenderCommands(aBuilder, aSc, aLayer, clip);
}
}
@ -5341,6 +5342,7 @@ nsDisplayBoxShadowInner::BuildLayer(nsDisplayListBuilder* aBuilder,
/* static */ void
nsDisplayBoxShadowInner::CreateInsetBoxShadowWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuilder,
const StackingContextHelper& aSc,
WebRenderDisplayItemLayer* aLayer,
nsIFrame* aFrame,
const nsRect aBorderRect)
@ -5411,7 +5413,7 @@ nsDisplayBoxShadowInner::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder
nsPoint offset = ToReferenceFrame();
nsRect borderRect = nsRect(offset, mFrame->GetSize());
nsDisplayBoxShadowInner::CreateInsetBoxShadowWebRenderCommands(aBuilder, aLayer, mFrame, borderRect);
nsDisplayBoxShadowInner::CreateInsetBoxShadowWebRenderCommands(aBuilder, aSc, aLayer, mFrame, borderRect);
}
bool

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

@ -2866,6 +2866,7 @@ public:
protected:
void CreateBorderImageWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuilder,
const StackingContextHelper& aSc,
nsTArray<WebRenderParentCommand>& aParentCommands,
WebRenderDisplayItemLayer* aLayer);
nsRegion CalculateBounds(const nsStyleBorder& aStyleBorder);
@ -3457,6 +3458,7 @@ public:
nsIFrame* aFrame,
nsPoint aReferencePoint);
static void CreateInsetBoxShadowWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuilder,
const StackingContextHelper& aSc,
WebRenderDisplayItemLayer* aLayer,
nsIFrame* aFrame,
const nsRect aBorderRect);

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

@ -579,6 +579,7 @@ nsImageRenderer::Draw(nsPresContext* aPresContext,
DrawResult
nsImageRenderer::BuildWebRenderDisplayItems(nsPresContext* aPresContext,
mozilla::wr::DisplayListBuilder& aBuilder,
const mozilla::layers::StackingContextHelper& aSc,
nsTArray<WebRenderParentCommand>& aParentCommands,
mozilla::layers::WebRenderDisplayItemLayer* aLayer,
const nsRect& aDirtyRect,
@ -604,7 +605,7 @@ nsImageRenderer::BuildWebRenderDisplayItems(nsPresContext* aPresContext,
nsCSSGradientRenderer renderer =
nsCSSGradientRenderer::Create(aPresContext, mGradientData, mSize);
renderer.BuildWebRenderDisplayItems(aBuilder, aLayer, aDest, aFill, aRepeatSize, aSrc, aOpacity);
renderer.BuildWebRenderDisplayItems(aBuilder, aSc, aLayer, aDest, aFill, aRepeatSize, aSrc, aOpacity);
break;
}
case eStyleImageType_Image:
@ -713,6 +714,7 @@ nsImageRenderer::DrawLayer(nsPresContext* aPresContext,
DrawResult
nsImageRenderer::BuildWebRenderDisplayItemsForLayer(nsPresContext* aPresContext,
mozilla::wr::DisplayListBuilder& aBuilder,
const mozilla::layers::StackingContextHelper& aSc,
nsTArray<WebRenderParentCommand>& aParentCommands,
WebRenderDisplayItemLayer* aLayer,
const nsRect& aDest,
@ -731,7 +733,7 @@ nsImageRenderer::BuildWebRenderDisplayItemsForLayer(nsPresContext* aPresCo
return DrawResult::SUCCESS;
}
return BuildWebRenderDisplayItems(aPresContext, aBuilder, aParentCommands, aLayer,
return BuildWebRenderDisplayItems(aPresContext, aBuilder, aSc, aParentCommands, aLayer,
aDirty, aDest, aFill, aAnchor, aRepeatSize,
CSSIntRect(0, 0,
nsPresContext::AppUnitsToIntCSSPixels(mSize.width),

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

@ -14,6 +14,7 @@ class gfxDrawable;
namespace mozilla {
namespace layers {
class StackingContextHelper;
class WebRenderParentCommand;
class WebRenderDisplayItemLayer;
} // namespace layers
@ -208,6 +209,7 @@ public:
*/
DrawResult BuildWebRenderDisplayItemsForLayer(nsPresContext* aPresContext,
mozilla::wr::DisplayListBuilder& aBuilder,
const mozilla::layers::StackingContextHelper& aSc,
nsTArray<layers::WebRenderParentCommand>& aParentCommands,
mozilla::layers::WebRenderDisplayItemLayer* aLayer,
const nsRect& aDest,
@ -292,6 +294,7 @@ private:
*/
DrawResult BuildWebRenderDisplayItems(nsPresContext* aPresContext,
mozilla::wr::DisplayListBuilder& aBuilder,
const mozilla::layers::StackingContextHelper& aSc,
nsTArray<layers::WebRenderParentCommand>& aParentCommands,
mozilla::layers::WebRenderDisplayItemLayer* aLayer,
const nsRect& aDirtyRect,