зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1413397 - Avoid empty border's fallback. r=kats
MozReview-Commit-ID: 1KXYjcObJdi --HG-- extra : rebase_source : ea36d0f77dff76175dbc6d2a27cb0017e703e0bf
This commit is contained in:
Родитель
d6e8ccb310
Коммит
f18aa8ed14
|
@ -330,8 +330,8 @@ nsDisplayButtonBorder::GetLayerState(nsDisplayListBuilder* aBuilder,
|
|||
nsRect(),
|
||||
nsRect(offset, mFrame->GetSize()),
|
||||
mFrame->StyleContext(),
|
||||
mFrame->GetSkipSides(),
|
||||
&mBorderIsEmpty);
|
||||
&mBorderIsEmpty,
|
||||
mFrame->GetSkipSides());
|
||||
if (!br) {
|
||||
if (mBorderIsEmpty) {
|
||||
return LAYER_ACTIVE;
|
||||
|
@ -520,8 +520,13 @@ nsDisplayButtonForeground::GetLayerState(nsDisplayListBuilder* aBuilder,
|
|||
const nsStyleDisplay *disp = mFrame->StyleDisplay();
|
||||
if (!mFrame->IsThemed(disp) ||
|
||||
!presContext->GetTheme()->ThemeDrawsFocusForWidget(disp->mAppearance)) {
|
||||
bool borderIsEmpty = false;
|
||||
nsRect r = nsRect(ToReferenceFrame(), mFrame->GetSize());
|
||||
br = mBFR->CreateInnerFocusBorderRenderer(aBuilder, presContext, nullptr, mVisibleRect, r);
|
||||
br = mBFR->CreateInnerFocusBorderRenderer(aBuilder, presContext, nullptr,
|
||||
mVisibleRect, r, &borderIsEmpty);
|
||||
if (borderIsEmpty) {
|
||||
return LAYER_ACTIVE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -554,6 +559,11 @@ nsDisplayButtonForeground::CreateWebRenderCommands(mozilla::wr::DisplayListBuild
|
|||
return false;
|
||||
}
|
||||
|
||||
// empty border, nothing to do
|
||||
if (!mBorderRenderer) {
|
||||
return true;
|
||||
}
|
||||
|
||||
mBorderRenderer->CreateWebRenderCommands(this, aBuilder, aResources, aSc);
|
||||
return true;
|
||||
}
|
||||
|
@ -634,7 +644,8 @@ nsButtonFrameRenderer::CreateInnerFocusBorderRenderer(
|
|||
nsPresContext* aPresContext,
|
||||
gfxContext* aRenderingContext,
|
||||
const nsRect& aDirtyRect,
|
||||
const nsRect& aRect)
|
||||
const nsRect& aRect,
|
||||
bool* aBorderIsEmpty)
|
||||
{
|
||||
if (mInnerFocusStyle) {
|
||||
nsRect rect;
|
||||
|
@ -646,7 +657,8 @@ nsButtonFrameRenderer::CreateInnerFocusBorderRenderer(
|
|||
mFrame,
|
||||
aDirtyRect,
|
||||
rect,
|
||||
mInnerFocusStyle);
|
||||
mInnerFocusStyle,
|
||||
aBorderIsEmpty);
|
||||
}
|
||||
|
||||
return Nothing();
|
||||
|
|
|
@ -49,7 +49,8 @@ public:
|
|||
nsPresContext* aPresContext,
|
||||
gfxContext* aRenderingContext,
|
||||
const nsRect& aDirtyRect,
|
||||
const nsRect& aRect);
|
||||
const nsRect& aRect,
|
||||
bool* aBorderIsEmpty);
|
||||
|
||||
DrawResult PaintBorder(nsDisplayListBuilder* aBuilder,
|
||||
nsPresContext* aPresContext,
|
||||
|
|
|
@ -284,12 +284,16 @@ nsColumnSetFrame::CreateBorderRenderers(nsTArray<nsCSSBorderRenderer>& aBorderRe
|
|||
MOZ_ASSERT(border.mBorderImageSource.GetType() == eStyleImageType_Null);
|
||||
|
||||
gfx::DrawTarget* dt = aCtx ? aCtx->GetDrawTarget() : nullptr;
|
||||
bool borderIsEmpty = false;
|
||||
Maybe<nsCSSBorderRenderer> br =
|
||||
nsCSSRendering::CreateBorderRendererWithStyleBorder(presContext, dt,
|
||||
this, aDirtyRect,
|
||||
aLineRect, border,
|
||||
StyleContext(), skipSides);
|
||||
StyleContext(),
|
||||
&borderIsEmpty,
|
||||
skipSides);
|
||||
if (br.isSome()) {
|
||||
MOZ_ASSERT(!borderIsEmpty);
|
||||
aBorderRenderers.AppendElement(br.value());
|
||||
}
|
||||
}, aPt);
|
||||
|
|
|
@ -331,6 +331,15 @@ public:
|
|||
|
||||
nsDisplayItemGenericImageGeometry::UpdateDrawResult(this, result);
|
||||
}
|
||||
|
||||
bool CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuilder,
|
||||
mozilla::wr::IpcResourceUpdateQueue& aResources,
|
||||
const StackingContextHelper& aSc,
|
||||
mozilla::layers::WebRenderLayerManager* aManager,
|
||||
nsDisplayListBuilder* aDisplayListBuilder) override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
#ifdef DEBUG
|
||||
|
|
|
@ -667,8 +667,8 @@ nsCSSRendering::CreateBorderRenderer(nsPresContext* aPresContext,
|
|||
const nsRect& aDirtyRect,
|
||||
const nsRect& aBorderArea,
|
||||
nsStyleContext* aStyleContext,
|
||||
Sides aSkipSides,
|
||||
bool* aOutBorderIsEmpty)
|
||||
bool* aOutBorderIsEmpty,
|
||||
Sides aSkipSides)
|
||||
{
|
||||
nsStyleContext *styleIfVisited = aStyleContext->GetStyleIfVisited();
|
||||
const nsStyleBorder *styleBorder = aStyleContext->StyleBorder();
|
||||
|
@ -678,8 +678,8 @@ nsCSSRendering::CreateBorderRenderer(nsPresContext* aPresContext,
|
|||
return CreateBorderRendererWithStyleBorder(aPresContext, aDrawTarget,
|
||||
aForFrame, aDirtyRect,
|
||||
aBorderArea, *styleBorder,
|
||||
aStyleContext, aSkipSides,
|
||||
aOutBorderIsEmpty);
|
||||
aStyleContext, aOutBorderIsEmpty,
|
||||
aSkipSides);
|
||||
}
|
||||
|
||||
nsStyleBorder newStyleBorder(*styleBorder);
|
||||
|
@ -692,7 +692,7 @@ nsCSSRendering::CreateBorderRenderer(nsPresContext* aPresContext,
|
|||
return CreateBorderRendererWithStyleBorder(aPresContext, aDrawTarget,
|
||||
aForFrame, aDirtyRect, aBorderArea,
|
||||
newStyleBorder, aStyleContext,
|
||||
aSkipSides, aOutBorderIsEmpty);
|
||||
aOutBorderIsEmpty, aSkipSides);
|
||||
}
|
||||
|
||||
|
||||
|
@ -708,6 +708,7 @@ nsCSSRendering::CreateWebRenderCommandsForBorder(nsDisplayItem* aItem,
|
|||
{
|
||||
// First try to draw a normal border
|
||||
{
|
||||
bool borderIsEmpty = false;
|
||||
Maybe<nsCSSBorderRenderer> br =
|
||||
nsCSSRendering::CreateBorderRenderer(aForFrame->PresContext(),
|
||||
nullptr,
|
||||
|
@ -715,7 +716,11 @@ nsCSSRendering::CreateWebRenderCommandsForBorder(nsDisplayItem* aItem,
|
|||
nsRect(),
|
||||
aBorderArea,
|
||||
aForFrame->StyleContext(),
|
||||
&borderIsEmpty,
|
||||
aForFrame->GetSkipSides());
|
||||
if (borderIsEmpty) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (br) {
|
||||
if (!br->CanCreateWebRenderCommands()) {
|
||||
|
@ -984,8 +989,8 @@ nsCSSRendering::CreateBorderRendererWithStyleBorder(nsPresContext* aPresContext,
|
|||
const nsRect& aBorderArea,
|
||||
const nsStyleBorder& aStyleBorder,
|
||||
nsStyleContext* aStyleContext,
|
||||
Sides aSkipSides,
|
||||
bool* aOutBorderIsEmpty)
|
||||
bool* aOutBorderIsEmpty,
|
||||
Sides aSkipSides)
|
||||
{
|
||||
const nsStyleDisplay* displayData = aStyleContext->StyleDisplay();
|
||||
if (displayData->mAppearance) {
|
||||
|
|
|
@ -193,8 +193,8 @@ struct nsCSSRendering {
|
|||
const nsRect& aDirtyRect,
|
||||
const nsRect& aBorderArea,
|
||||
nsStyleContext* aStyleContext,
|
||||
Sides aSkipSides = Sides(),
|
||||
bool* aOutBorderIsEmpty = nullptr);
|
||||
bool* aOutBorderIsEmpty,
|
||||
Sides aSkipSides = Sides());
|
||||
|
||||
static mozilla::Maybe<nsCSSBorderRenderer>
|
||||
CreateBorderRendererWithStyleBorder(nsPresContext* aPresContext,
|
||||
|
@ -204,8 +204,8 @@ struct nsCSSRendering {
|
|||
const nsRect& aBorderArea,
|
||||
const nsStyleBorder& aBorderStyle,
|
||||
nsStyleContext* aStyleContext,
|
||||
Sides aSkipSides = Sides(),
|
||||
bool* aOutBorderIsEmpty = nullptr);
|
||||
bool* aOutBorderIsEmpty,
|
||||
Sides aSkipSides = Sides());
|
||||
|
||||
static mozilla::Maybe<nsCSSBorderRenderer>
|
||||
CreateBorderRendererForOutline(nsPresContext* aPresContext,
|
||||
|
|
|
@ -5115,6 +5115,7 @@ nsDisplayCaret::BuildLayer(nsDisplayListBuilder* aBuilder,
|
|||
|
||||
nsDisplayBorder::nsDisplayBorder(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame)
|
||||
: nsDisplayItem(aBuilder, aFrame)
|
||||
, mBorderIsEmpty(false)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsDisplayBorder);
|
||||
|
||||
|
@ -5179,6 +5180,7 @@ nsDisplayBorder::GetLayerState(nsDisplayListBuilder* aBuilder,
|
|||
return LAYER_NONE;
|
||||
}
|
||||
|
||||
mBorderIsEmpty = false;
|
||||
nsPoint offset = ToReferenceFrame();
|
||||
Maybe<nsCSSBorderRenderer> br =
|
||||
nsCSSRendering::CreateBorderRenderer(mFrame->PresContext(),
|
||||
|
@ -5187,19 +5189,15 @@ nsDisplayBorder::GetLayerState(nsDisplayListBuilder* aBuilder,
|
|||
nsRect(),
|
||||
nsRect(offset, mFrame->GetSize()),
|
||||
mFrame->StyleContext(),
|
||||
&mBorderIsEmpty,
|
||||
mFrame->GetSkipSides());
|
||||
|
||||
const nsStyleBorder *styleBorder = mFrame->StyleContext()->StyleBorder();
|
||||
const nsStyleImage* image = &styleBorder->mBorderImageSource;
|
||||
mBorderRenderer = Nothing();
|
||||
mBorderImageRenderer = Nothing();
|
||||
if ((!image ||
|
||||
image->GetType() != eStyleImageType_Image ||
|
||||
image->GetType() != eStyleImageType_Gradient) && !br) {
|
||||
return LAYER_NONE;
|
||||
}
|
||||
|
||||
if (!br) {
|
||||
if (mBorderIsEmpty) {
|
||||
return LAYER_ACTIVE;
|
||||
}
|
||||
return LAYER_NONE;
|
||||
}
|
||||
|
||||
|
@ -5243,6 +5241,10 @@ nsDisplayBorder::BuildLayer(nsDisplayListBuilder* aBuilder,
|
|||
LayerManager* aManager,
|
||||
const ContainerLayerParameters& aContainerParameters)
|
||||
{
|
||||
if (mBorderIsEmpty) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (ShouldUseAdvancedLayer(aManager, gfxPrefs::LayersAllowBorderLayers)) {
|
||||
return BuildDisplayItemLayer(aBuilder, aManager, aContainerParameters);
|
||||
} else {
|
||||
|
|
|
@ -3437,6 +3437,7 @@ protected:
|
|||
mozilla::Maybe<nsCSSBorderImageRenderer> mBorderImageRenderer;
|
||||
|
||||
nsRect mBounds;
|
||||
bool mBorderIsEmpty;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Загрузка…
Ссылка в новой задаче