--- a/layout/forms/nsButtonFrameRenderer.cpp
+++ b/layout/forms/nsButtonFrameRenderer.cpp
@@ -311,23 +311,17 @@ nsDisplayButtonBorder::CreateWebRenderCo
nullptr,
mFrame,
nsRect(),
nsRect(ToReferenceFrame(), mFrame->GetSize()),
mFrame->StyleContext(),
&borderIsEmpty,
mFrame->GetSkipSides());
if (!br) {
- if (borderIsEmpty) {
- return true;
- }
- return false;
- }
- if (!br->CanCreateWebRenderCommands()) {
- return false;
+ return borderIsEmpty;
}
br->CreateWebRenderCommands(this, aBuilder, aResources, aSc);
return true;
}
void
@@ -465,23 +459,17 @@ nsDisplayButtonForeground::CreateWebRend
if (!mFrame->IsThemed(disp) ||
!presContext->GetTheme()->ThemeDrawsFocusForWidget(disp->mAppearance)) {
nsRect r = nsRect(ToReferenceFrame(), mFrame->GetSize());
br = mBFR->CreateInnerFocusBorderRenderer(aDisplayListBuilder, presContext, nullptr,
mVisibleRect, r, &borderIsEmpty);
}
if (!br) {
- if (borderIsEmpty) {
- return true;
- }
- return false;
- }
- if (!br->CanCreateWebRenderCommands()) {
- return false;
+ return borderIsEmpty;
}
br->CreateWebRenderCommands(this, aBuilder, aResources, aSc);
return true;
}
nsresult
nsButtonFrameRenderer::DisplayButton(nsDisplayListBuilder* aBuilder,
--- a/layout/generic/nsColumnSetFrame.cpp
+++ b/layout/generic/nsColumnSetFrame.cpp
@@ -82,22 +82,16 @@ nsDisplayColumnRule::GetLayerState(nsDis
static_cast<nsColumnSetFrame*>(mFrame)->
CreateBorderRenderers(mBorderRenderers, screenRefCtx, mVisibleRect, ToReferenceFrame());
if (mBorderRenderers.IsEmpty()) {
return LAYER_NONE;
}
- for (auto iter = mBorderRenderers.begin(); iter != mBorderRenderers.end(); iter++) {
- if (!iter->CanCreateWebRenderCommands()) {
- return LAYER_NONE;
- }
- }
-
return LAYER_ACTIVE;
}
already_AddRefed<Layer>
nsDisplayColumnRule::BuildLayer(nsDisplayListBuilder* aBuilder,
LayerManager* aManager,
const ContainerLayerParameters& aContainerParameters)
{
@@ -116,24 +110,18 @@ nsDisplayColumnRule::CreateWebRenderComm
static_cast<nsColumnSetFrame*>(mFrame)->
CreateBorderRenderers(mBorderRenderers, screenRefCtx, mVisibleRect, ToReferenceFrame());
if (mBorderRenderers.IsEmpty()) {
return true;
}
- for (auto iter = mBorderRenderers.begin(); iter != mBorderRenderers.end(); iter++) {
- if (!iter->CanCreateWebRenderCommands()) {
- return false;
- }
- }
-
- for (auto iter = mBorderRenderers.begin(); iter != mBorderRenderers.end(); iter++) {
- iter->CreateWebRenderCommands(this, aBuilder, aResources, aSc);
+ for (auto& renderer : mBorderRenderers) {
+ renderer.CreateWebRenderCommands(this, aBuilder, aResources, aSc);
}
return true;
}
/**
* Tracking issues:
*
--- a/layout/painting/nsCSSRendering.cpp
+++ b/layout/painting/nsCSSRendering.cpp
@@ -718,26 +718,23 @@ nsCSSRendering::CreateWebRenderCommandsF
aForFrame->StyleContext(),
&borderIsEmpty,
aForFrame->GetSkipSides());
if (borderIsEmpty) {
return true;
}
if (br) {
- if (!br->CanCreateWebRenderCommands()) {
- return false;
- }
br->CreateWebRenderCommands(aItem, aBuilder, aResources, aSc);
return true;
}
}
// Next try to draw an image border
- const nsStyleBorder *styleBorder = aForFrame->StyleContext()->StyleBorder();
+ const nsStyleBorder* styleBorder = aForFrame->StyleContext()->StyleBorder();
const nsStyleImage* image = &styleBorder->mBorderImageSource;
// Filter out unsupported image/border types
if (!image) {
return false;
}
// All this code bitrotted too much (but is almost right); disabled for now.
@@ -874,17 +871,16 @@ ConstructBorderRenderer(nsPresContext* a
document,
aDrawTarget,
dirtyRect,
joinedBorderAreaPx,
borderStyles,
borderWidths,
bgRadii,
borderColors,
- aStyleBorder.mBorderColors.get(),
bgColor,
!aForFrame->BackfaceIsHidden(),
*aNeedsClip ? Some(NSRectToRect(aBorderArea, oneDevPixel)) : Nothing());
}
ImgDrawResult
nsCSSRendering::PaintBorderWithStyleBorder(nsPresContext* aPresContext,
@@ -1156,17 +1152,16 @@ nsCSSRendering::CreateBorderRendererForO
document,
dt,
dirtyRect,
oRect,
outlineStyles,
outlineWidths,
outlineRadii,
outlineColors,
- nullptr,
bgColor,
!aForFrame->BackfaceIsHidden(),
Nothing());
return Some(br);
}
void
@@ -1233,17 +1228,16 @@ nsCSSRendering::PaintFocus(nsPresContext
nullptr,
aDrawTarget,
focusRect,
focusRect,
focusStyles,
focusWidths,
focusRadii,
focusColors,
- nullptr,
NS_RGB(255, 0, 0),
true,
Nothing());
br.DrawBorders();
PrintAsStringNewline();
}
@@ -2170,18 +2164,16 @@ IsOpaqueBorderEdge(const nsStyleBorder&
}
/**
* Returns true if all border edges are either missing or opaque.
*/
static bool
IsOpaqueBorder(const nsStyleBorder& aBorder)
{
- if (aBorder.mBorderColors)
- return false;
NS_FOR_CSS_SIDES(i) {
if (!IsOpaqueBorderEdge(aBorder, i))
return false;
}
return true;
}
static inline void
--- a/layout/painting/nsCSSRenderingBorders.cpp
+++ b/layout/painting/nsCSSRenderingBorders.cpp
@@ -170,41 +170,32 @@ nsCSSBorderRenderer::nsCSSBorderRenderer
const nsIDocument* aDocument,
DrawTarget* aDrawTarget,
const Rect& aDirtyRect,
Rect& aOuterRect,
const uint8_t* aBorderStyles,
const Float* aBorderWidths,
RectCornerRadii& aBorderRadii,
const nscolor* aBorderColors,
- const nsBorderColors* aCompositeColors,
nscolor aBackgroundColor,
bool aBackfaceIsVisible,
const Maybe<Rect>& aClipRect)
: mPresContext(aPresContext),
mDocument(aDocument),
mDrawTarget(aDrawTarget),
mDirtyRect(aDirtyRect),
mOuterRect(aOuterRect),
mBorderRadii(aBorderRadii),
mBackgroundColor(aBackgroundColor),
mBackfaceIsVisible(aBackfaceIsVisible),
mLocalClip(aClipRect)
{
PodCopy(mBorderStyles, aBorderStyles, 4);
PodCopy(mBorderWidths, aBorderWidths, 4);
PodCopy(mBorderColors, aBorderColors, 4);
- NS_FOR_CSS_SIDES(side) {
- if (aCompositeColors && !(*aCompositeColors)[side].IsEmpty()) {
- mCompositeColors[side] = &(*aCompositeColors)[side];
- } else {
- mCompositeColors[side] = nullptr;
- }
- }
-
mInnerRect = mOuterRect;
mInnerRect.Deflate(
Margin(mBorderStyles[0] != NS_STYLE_BORDER_STYLE_NONE ? mBorderWidths[0] : 0,
mBorderStyles[1] != NS_STYLE_BORDER_STYLE_NONE ? mBorderWidths[1] : 0,
mBorderStyles[2] != NS_STYLE_BORDER_STYLE_NONE ? mBorderWidths[2] : 0,
mBorderStyles[3] != NS_STYLE_BORDER_STYLE_NONE ? mBorderWidths[3] : 0));
ComputeBorderCornerDimensions(mBorderWidths,
@@ -315,20 +306,17 @@ nsCSSBorderRenderer::AreBorderSideFinalS
continue;
}
if (((1 << i) & aSides) == 0) {
continue;
}
if (mBorderStyles[firstStyle] != mBorderStyles[i] ||
- mBorderColors[firstStyle] != mBorderColors[i] ||
- !mCompositeColors[firstStyle] != !mCompositeColors[i] ||
- (mCompositeColors[firstStyle] &&
- *mCompositeColors[firstStyle] != *mCompositeColors[i])) {
+ mBorderColors[firstStyle] != mBorderColors[i]) {
return false;
}
}
/* Then if it's one of the two-tone styles and we're not
* just comparing the TL or BR sides */
switch (mBorderStyles[firstStyle]) {
case NS_STYLE_BORDER_STYLE_GROOVE:
@@ -1265,92 +1253,35 @@ ComputeColorForLine(uint32_t aLineIndex,
{
NS_ASSERTION(aLineIndex < aBorderColorStyleCount, "Invalid lineIndex given");
return MakeBorderColor(aBorderColor, aBackgroundColor,
aBorderColorStyle[aLineIndex]);
}
void
-nsCSSBorderRenderer::DrawBorderSidesCompositeColors(
- int aSides, const nsTArray<nscolor>& aCompositeColors)
-{
- RectCornerRadii radii = mBorderRadii;
-
- // the generic composite colors path; each border is 1px in size
- Rect soRect = mOuterRect;
- Float maxBorderWidth = 0;
- NS_FOR_CSS_SIDES (i) {
- maxBorderWidth = std::max(maxBorderWidth, Float(mBorderWidths[i]));
- }
-
- Float fakeBorderSizes[4];
-
- Point itl = mInnerRect.TopLeft();
- Point ibr = mInnerRect.BottomRight();
-
- MOZ_ASSERT(!aCompositeColors.IsEmpty());
- Color compositeColor;
- for (uint32_t i = 0; i < uint32_t(maxBorderWidth); i++) {
- // advance to next color if exists.
- if (i < aCompositeColors.Length()) {
- compositeColor = ToDeviceColor(Color::FromABGR(aCompositeColors[i]));
- }
- ColorPattern color(compositeColor);
-
- Rect siRect = soRect;
- siRect.Deflate(1.0);
-
- // now cap the rects to the real mInnerRect
- Point tl = siRect.TopLeft();
- Point br = siRect.BottomRight();
-
- tl.x = std::min(tl.x, itl.x);
- tl.y = std::min(tl.y, itl.y);
-
- br.x = std::max(br.x, ibr.x);
- br.y = std::max(br.y, ibr.y);
-
- siRect = Rect(tl.x, tl.y, br.x - tl.x , br.y - tl.y);
-
- fakeBorderSizes[eSideTop] = siRect.TopLeft().y - soRect.TopLeft().y;
- fakeBorderSizes[eSideRight] = soRect.TopRight().x - siRect.TopRight().x;
- fakeBorderSizes[eSideBottom] = soRect.BottomRight().y - siRect.BottomRight().y;
- fakeBorderSizes[eSideLeft] = siRect.BottomLeft().x - soRect.BottomLeft().x;
-
- FillSolidBorder(soRect, siRect, radii, fakeBorderSizes, aSides, color);
-
- soRect = siRect;
-
- ComputeInnerRadii(radii, fakeBorderSizes, &radii);
- }
-}
-
-void
nsCSSBorderRenderer::DrawBorderSides(int aSides)
{
if (aSides == 0 || (aSides & ~eSideBitsAll) != 0) {
NS_WARNING("DrawBorderSides: invalid sides!");
return;
}
uint8_t borderRenderStyle = NS_STYLE_BORDER_STYLE_NONE;
nscolor borderRenderColor;
- const nsTArray<nscolor>* compositeColors = nullptr;
uint32_t borderColorStyleCount = 0;
BorderColorStyle borderColorStyleTopLeft[3], borderColorStyleBottomRight[3];
BorderColorStyle *borderColorStyle = nullptr;
NS_FOR_CSS_SIDES (i) {
if ((aSides & (1 << i)) == 0)
continue;
borderRenderStyle = mBorderStyles[i];
borderRenderColor = mBorderColors[i];
- compositeColors = mCompositeColors[i];
break;
}
if (borderRenderStyle == NS_STYLE_BORDER_STYLE_NONE ||
borderRenderStyle == NS_STYLE_BORDER_STYLE_HIDDEN)
return;
if (borderRenderStyle == NS_STYLE_BORDER_STYLE_DASHED ||
@@ -1377,35 +1308,17 @@ nsCSSBorderRenderer::DrawBorderSides(int
if (aSides & eSideBitsBottom) {
DrawDashedOrDottedCorner(eSideBottom, C_BR);
} else if (aSides & eSideBitsRight) {
DrawDashedOrDottedCorner(eSideRight, C_BR);
}
return;
}
- // -moz-border-colors is a hack; if we have it for a border, then
- // it's always drawn solid, and each color is given 1px. The last
- // color is used for the remainder of the border's size. Just
- // hand off to another function to do all that.
- if (compositeColors) {
- Float maxBorderWidth(0);
- NS_FOR_CSS_SIDES (i) {
- maxBorderWidth = std::max(maxBorderWidth, mBorderWidths[i]);
- }
- if (maxBorderWidth <= MAX_COMPOSITE_BORDER_WIDTH) {
- DrawBorderSidesCompositeColors(aSides, *compositeColors);
- return;
- }
- NS_WARNING("DrawBorderSides: too large border width for composite colors");
- }
-
- // We're not doing compositeColors, so we can calculate the
- // borderColorStyle based on the specified style. The
- // borderColorStyle array goes from the outer to the inner style.
+ // The borderColorStyle array goes from the outer to the inner style.
//
// If the border width is 1, we need to change the borderRenderStyle
// a bit to make sure that we get the right colors -- e.g. 'ridge'
// with a 1px border needs to look like solid, not like 'outset'.
if (mOneUnitBorder &&
(borderRenderStyle == NS_STYLE_BORDER_STYLE_RIDGE ||
borderRenderStyle == NS_STYLE_BORDER_STYLE_GROOVE ||
borderRenderStyle == NS_STYLE_BORDER_STYLE_DOUBLE))
@@ -2681,23 +2594,19 @@ nsCSSBorderRenderer::AllBordersSameWidth
{
return true;
}
return false;
}
bool
-nsCSSBorderRenderer::AllBordersSolid(bool *aHasCompositeColors)
+nsCSSBorderRenderer::AllBordersSolid()
{
- *aHasCompositeColors = false;
NS_FOR_CSS_SIDES(i) {
- if (mCompositeColors[i] != nullptr) {
- *aHasCompositeColors = true;
- }
if (mBorderStyles[i] == NS_STYLE_BORDER_STYLE_SOLID ||
mBorderStyles[i] == NS_STYLE_BORDER_STYLE_NONE ||
mBorderStyles[i] == NS_STYLE_BORDER_STYLE_HIDDEN)
{
continue;
}
return false;
}
@@ -3031,17 +2940,17 @@ DrawCorner(DrawTarget* aDrawTarget,
builder->LineTo(aInnerCorner);
builder->Close();
path = builder->Finish();
aDrawTarget->Fill(path, ColorPattern(aFirstColor));
}
}
void
-nsCSSBorderRenderer::DrawNoCompositeColorSolidBorder()
+nsCSSBorderRenderer::DrawSolidBorder()
{
const twoFloats cornerMults[4] = { { -1, 0 },
{ 0, -1 },
{ +1, 0 },
{ 0, +1 } };
const twoFloats centerAdjusts[4] = { { 0, +0.5 },
{ -0.5, 0 },
@@ -3138,81 +3047,25 @@ nsCSSBorderRenderer::DrawNoCompositeColo
cornerMults[i], cornerMults[i3],
mBorderCornerDimensions[c],
firstColor, secondColor, skirtSize, skirtSlope);
}
}
}
void
-nsCSSBorderRenderer::DrawRectangularCompositeColors()
-{
- nscolor currentColors[4];
- NS_FOR_CSS_SIDES(side) {
- currentColors[side] = mBorderColors[side];
- }
- Rect rect = mOuterRect;
- rect.Deflate(0.5);
-
- const twoFloats cornerAdjusts[4] = { { +0.5, 0 },
- { 0, +0.5 },
- { -0.5, 0 },
- { 0, -0.5 } };
-
- for (int i = 0; i < mBorderWidths[0]; i++) {
- NS_FOR_CSS_SIDES(side) {
- // advance to the next composite color if one exists
- if (mCompositeColors[side] &&
- uint32_t(i) < mCompositeColors[side]->Length()) {
- currentColors[side] = (*mCompositeColors[side])[i];
- }
- }
- NS_FOR_CSS_SIDES(side) {
- int sideNext = (side + 1) % 4;
-
- Point firstCorner = rect.CCWCorner(side) + cornerAdjusts[side];
- Point secondCorner = rect.CWCorner(side) - cornerAdjusts[side];
-
- Color currentColor = Color::FromABGR(currentColors[side]);
-
- mDrawTarget->StrokeLine(firstCorner, secondCorner,
- ColorPattern(ToDeviceColor(currentColor)));
-
- Point cornerTopLeft = rect.CWCorner(side) - Point(0.5, 0.5);
- Color nextColor = Color::FromABGR(currentColors[sideNext]);
-
- Color cornerColor((currentColor.r + nextColor.r) / 2.f,
- (currentColor.g + nextColor.g) / 2.f,
- (currentColor.b + nextColor.b) / 2.f,
- (currentColor.a + nextColor.a) / 2.f);
- mDrawTarget->FillRect(Rect(cornerTopLeft, Size(1, 1)),
- ColorPattern(ToDeviceColor(cornerColor)));
- }
- rect.Deflate(1);
- }
-}
-
-void
nsCSSBorderRenderer::DrawBorders()
{
- bool forceSeparateCorners = false;
-
if (mAllBordersSameStyle &&
- ((mCompositeColors[0] == nullptr &&
- (mBorderStyles[0] == NS_STYLE_BORDER_STYLE_NONE ||
- mBorderStyles[0] == NS_STYLE_BORDER_STYLE_HIDDEN ||
- mBorderColors[0] == NS_RGBA(0,0,0,0))) ||
- (mCompositeColors[0] && mCompositeColors[0]->Length() == 1 &&
- (*mCompositeColors[0])[0] == NS_RGBA(0,0,0,0))))
+ (mBorderStyles[0] == NS_STYLE_BORDER_STYLE_NONE ||
+ mBorderStyles[0] == NS_STYLE_BORDER_STYLE_HIDDEN ||
+ mBorderColors[0] == NS_RGBA(0,0,0,0)))
{
// All borders are the same style, and the style is either none or hidden, or the color
// is transparent.
- // This also checks if the first composite color is transparent, and there are
- // no others. It doesn't check if there are subsequent transparent ones, because
- // that would be very silly.
return;
}
if (mAllBordersSameWidth && mBorderWidths[0] == 0.0) {
// Some of the mAllBordersSameWidth codepaths depend on the border
// width being greater than zero.
return;
}
@@ -3247,31 +3100,29 @@ nsCSSBorderRenderer::DrawBorders()
// Initial values only used when the border colors/widths are all the same:
ColorPattern color(ToDeviceColor(mBorderColors[eSideTop]));
StrokeOptions strokeOptions(mBorderWidths[eSideTop]); // stroke width
// First there's a couple of 'special cases' that have specifically optimized
// drawing paths, when none of these can be used we move on to the generalized
// border drawing code.
if (mAllBordersSameStyle &&
- mCompositeColors[0] == nullptr &&
mAllBordersSameWidth &&
mBorderStyles[0] == NS_STYLE_BORDER_STYLE_SOLID &&
mNoBorderRadius &&
!mAvoidStroke)
{
// Very simple case.
Rect rect = mOuterRect;
rect.Deflate(mBorderWidths[0] / 2.0);
mDrawTarget->StrokeRect(rect, color, strokeOptions);
return;
}
if (mAllBordersSameStyle &&
- mCompositeColors[0] == nullptr &&
mBorderStyles[0] == NS_STYLE_BORDER_STYLE_SOLID &&
!mAvoidStroke &&
!mNoBorderRadius)
{
// Relatively simple case.
gfxRect outerRect = ThebesRect(mOuterRect);
RoundedRect borderInnerRect(outerRect, mBorderRadii);
borderInnerRect.Deflate(mBorderWidths[eSideTop],
@@ -3291,55 +3142,35 @@ nsCSSBorderRenderer::DrawBorders()
RefPtr<PathBuilder> builder = mDrawTarget->CreatePathBuilder();
AppendRoundedRectToPath(builder, mOuterRect, mBorderRadii, true);
AppendRoundedRectToPath(builder, ToRect(borderInnerRect.rect), borderInnerRect.corners, false);
RefPtr<Path> path = builder->Finish();
mDrawTarget->Fill(path, color);
return;
}
- bool hasCompositeColors;
- const bool allBordersSolid = AllBordersSolid(&hasCompositeColors);
+ const bool allBordersSolid = AllBordersSolid();
// This leaves the border corners non-interpolated for single width borders.
// Doing this is slightly faster and shouldn't be a problem visually.
if (allBordersSolid &&
mAllBordersSameWidth &&
- mCompositeColors[0] == nullptr &&
mBorderWidths[0] == 1 &&
mNoBorderRadius &&
!mAvoidStroke)
{
DrawSingleWidthSolidBorder();
return;
}
- if (allBordersSolid && !hasCompositeColors &&
- !mAvoidStroke)
- {
- DrawNoCompositeColorSolidBorder();
+ if (allBordersSolid && !mAvoidStroke) {
+ DrawSolidBorder();
return;
}
- if (allBordersSolid &&
- mAllBordersSameWidth &&
- mNoBorderRadius &&
- !mAvoidStroke)
- {
- // Easy enough to deal with.
- DrawRectangularCompositeColors();
- return;
- }
-
- // If we have composite colors -and- border radius,
- // then use separate corners so we get OP_ADD for the corners.
- // Otherwise, we'll get artifacts as we draw stacked 1px-wide curves.
- if (mAllBordersSameStyle && mCompositeColors[0] != nullptr && !mNoBorderRadius)
- forceSeparateCorners = true;
-
PrintAsString(" mOuterRect: "); PrintAsString(mOuterRect); PrintAsStringNewline();
PrintAsString(" mInnerRect: "); PrintAsString(mInnerRect); PrintAsStringNewline();
PrintAsFormatString(" mBorderColors: 0x%08x 0x%08x 0x%08x 0x%08x\n", mBorderColors[0], mBorderColors[1], mBorderColors[2], mBorderColors[3]);
// if conditioning the outside rect failed, then bail -- the outside
// rect is supposed to enclose the entire border
{
gfxRect outerRect = ThebesRect(mOuterRect);
@@ -3349,16 +3180,17 @@ nsCSSBorderRenderer::DrawBorders()
mOuterRect = ToRect(outerRect);
gfxRect innerRect = ThebesRect(mInnerRect);
gfxUtils::ConditionRect(innerRect);
mInnerRect = ToRect(innerRect);
}
int dashedSides = 0;
+ bool forceSeparateCorners = false;
NS_FOR_CSS_SIDES(i) {
uint8_t style = mBorderStyles[i];
if (style == NS_STYLE_BORDER_STYLE_DASHED ||
style == NS_STYLE_BORDER_STYLE_DOTTED)
{
// we need to draw things separately for dashed/dotting
forceSeparateCorners = true;
@@ -3451,19 +3283,17 @@ nsCSSBorderRenderer::DrawBorders()
NS_FOR_CSS_FULL_CORNERS(corner) {
// if there's no corner, don't do all this work for it
if (IsZeroSize(mBorderCornerDimensions[corner]))
continue;
const int sides[2] = { corner, PREV_SIDE(corner) };
int sideBits = (1 << sides[0]) | (1 << sides[1]);
- bool simpleCornerStyle = mCompositeColors[sides[0]] == nullptr &&
- mCompositeColors[sides[1]] == nullptr &&
- AreBorderSideFinalStylesSame(sideBits);
+ bool simpleCornerStyle = AreBorderSideFinalStylesSame(sideBits);
// If we don't have anything complex going on in this corner,
// then we can just fill the corner with a solid color, and avoid
// the potentially expensive clip.
if (simpleCornerStyle &&
IsZeroSize(mBorderRadii[corner]) &&
IsSolidCornerStyle(mBorderStyles[sides[0]], corner))
{
@@ -3579,31 +3409,16 @@ nsCSSBorderRenderer::DrawBorders()
mDrawTarget->PopClip();
PrintAsStringNewline("---------------- (*)");
}
}
}
-bool
-nsCSSBorderRenderer::CanCreateWebRenderCommands()
-{
- NS_FOR_CSS_SIDES(i) {
- if (mCompositeColors[i] != nullptr &&
- mBorderWidths[i] > 0.0f &&
- mBorderStyles[i] != NS_STYLE_BORDER_STYLE_HIDDEN &&
- mBorderStyles[i] != NS_STYLE_BORDER_STYLE_NONE) {
- return false;
- }
- }
-
- return true;
-}
-
void
nsCSSBorderRenderer::CreateWebRenderCommands(nsDisplayItem* aItem,
wr::DisplayListBuilder& aBuilder,
wr::IpcResourceUpdateQueue& aResources,
const layers::StackingContextHelper& aSc)
{
LayoutDeviceRect outerRect = LayoutDeviceRect::FromUnknownRect(mOuterRect);
wr::LayoutRect transformedRect = aSc.ToRelativeLayoutRect(outerRect);
--- a/layout/painting/nsCSSRenderingBorders.h
+++ b/layout/painting/nsCSSRenderingBorders.h
@@ -46,18 +46,16 @@ class StackingContextHelper;
* For any parameter where an array of side values is passed in,
* they are in top, right, bottom, left order.
*
* borderStyles -- one border style enum per side
* borderWidths -- one border width per side
* borderRadii -- a RectCornerRadii struct describing the w/h for each rounded corner.
* If the corner doesn't have a border radius, 0,0 should be given for it.
* borderColors -- one nscolor per side
- * compositeColors -- a pointer to an array of composite color structs, or
- * nullptr if none.
*
* skipSides -- a bit mask specifying which sides, if any, to skip
* backgroundColor -- the background color of the element.
* Used in calculating colors for 2-tone borders, such as inset and outset
* gapRect - a rectangle that should be clipped out to leave a gap in a border,
* or nullptr if none.
*/
@@ -94,25 +92,23 @@ public:
const nsIDocument* aDocument,
DrawTarget* aDrawTarget,
const Rect& aDirtyRect,
Rect& aOuterRect,
const uint8_t* aBorderStyles,
const Float* aBorderWidths,
RectCornerRadii& aBorderRadii,
const nscolor* aBorderColors,
- const nsBorderColors* aCompositeColors,
nscolor aBackgroundColor,
bool aBackfaceIsVisible,
const mozilla::Maybe<Rect>& aClipRect);
// draw the entire border
void DrawBorders();
- bool CanCreateWebRenderCommands();
void CreateWebRenderCommands(nsDisplayItem* aItem,
mozilla::wr::DisplayListBuilder& aBuilder,
mozilla::wr::IpcResourceUpdateQueue& aResources,
const mozilla::layers::StackingContextHelper& aSc);
// utility function used for background painting as well as borders
static void ComputeInnerRadii(const RectCornerRadii& aRadii,
const Float* aBorderSizes,
@@ -147,21 +143,16 @@ private:
// the style and size of the border
uint8_t mBorderStyles[4];
Float mBorderWidths[4];
RectCornerRadii mBorderRadii;
// the colors for 'border-top-color' et. al.
nscolor mBorderColors[4];
- // the lists of colors for '-moz-border-top-colors' et. al.
- // the pointers here are either nullptr, or referring to a non-empty
- // nsTArray, so no additional empty check is needed.
- const nsTArray<nscolor>* mCompositeColors[4];
-
// the background color
nscolor mBackgroundColor;
// calculated values
bool mAllBordersSameStyle;
bool mAllBordersSameWidth;
bool mOneUnitBorder;
bool mNoBorderRadius;
@@ -235,20 +226,16 @@ private:
//
// core rendering
//
// draw the border for the given sides, using the style of the first side
// present in the bitmask
void DrawBorderSides (int aSides);
- // function used by the above to handle -moz-border-colors
- void DrawBorderSidesCompositeColors(
- int aSides, const nsTArray<nscolor>& compositeColors);
-
// Setup the stroke options for the given dashed/dotted side
void SetupDashedOptions(StrokeOptions* aStrokeOptions,
Float aDash[2], mozilla::Side aSide,
Float aBorderLength, bool isCorner);
// Draw the given dashed/dotte side
void DrawDashedOrDottedSide(mozilla::Side aSide);
@@ -272,28 +259,23 @@ private:
mozilla::Corner aCorner);
// Analyze if all border sides have the same width.
bool AllBordersSameWidth();
// Analyze if all borders are 'solid' this also considers hidden or 'none'
// borders because they can be considered 'solid' borders of 0 width and
// with no color effect.
- bool AllBordersSolid(bool *aHasCompositeColors);
+ bool AllBordersSolid();
// Draw a solid color border that is uniformly the same width.
void DrawSingleWidthSolidBorder();
- // Draw any border which is solid on all sides and does not use
- // CompositeColors.
- void DrawNoCompositeColorSolidBorder();
-
- // Draw a solid border that has no border radius (i.e. is rectangular) and
- // uses CompositeColors.
- void DrawRectangularCompositeColors();
+ // Draw any border which is solid on all sides.
+ void DrawSolidBorder();
};
class nsCSSBorderImageRenderer final
{
typedef mozilla::nsImageRenderer nsImageRenderer;
public:
static mozilla::Maybe<nsCSSBorderImageRenderer>
CreateBorderImageRenderer(nsPresContext* aPresContext,
--- a/layout/painting/nsDisplayList.cpp
+++ b/layout/painting/nsDisplayList.cpp
@@ -5433,18 +5433,17 @@ nsDisplayBorder::GetLayerState(nsDisplay
mBorderImageRenderer = Nothing();
if (!br) {
if (mBorderIsEmpty) {
return LAYER_ACTIVE;
}
return LAYER_NONE;
}
- bool hasCompositeColors;
- if (!br->AllBordersSolid(&hasCompositeColors) || hasCompositeColors) {
+ if (!br->AllBordersSolid()) {
return LAYER_NONE;
}
// We don't support this yet as we don't copy the values to
// the layer, and BasicBorderLayer doesn't support it yet.
if (!br->mNoBorderRadius) {
return LAYER_NONE;
}