Bug 1460439 - Conversion from NS_STYLE_BORDER_STYLE_* macro to StyleBorderStyle::* enum class r=emilio

Converted NS_STYLE_BORDER_STYLE_* consts to enum class. Updated corresponding values to enum class. reduced BCCornerInfo struct values to fit StyleBorderStyle values inside struct. Added defaults to switches that do not fully cover all instances of StyleBorderStyle.
This commit is contained in:
Kristen Wright 2018-11-07 11:56:17 -08:00
parent 874059cbeb
commit f22175b197
27 changed files with 335 additions and 323 deletions

View File

@ -139,14 +139,14 @@ HTMLHRElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
if (!aDecls.PropertyIsSet(eCSSProperty_border_top_style))
aDecls.SetKeywordValue(eCSSProperty_border_top_style,
NS_STYLE_BORDER_STYLE_SOLID);
StyleBorderStyle::Solid);
if (allSides) {
aDecls.SetKeywordValueIfUnset(eCSSProperty_border_right_style,
NS_STYLE_BORDER_STYLE_SOLID);
StyleBorderStyle::Solid);
aDecls.SetKeywordValueIfUnset(eCSSProperty_border_bottom_style,
NS_STYLE_BORDER_STYLE_SOLID);
StyleBorderStyle::Solid);
aDecls.SetKeywordValueIfUnset(eCSSProperty_border_left_style,
NS_STYLE_BORDER_STYLE_SOLID);
StyleBorderStyle::Solid);
// If it would be noticeable, set the border radius to
// 10000px on all corners; this triggers the clamping to make

View File

@ -1442,13 +1442,13 @@ nsGenericHTMLElement::MapImageBorderAttributeInto(const nsMappedAttributes* aAtt
aDecls.SetPixelValueIfUnset(eCSSProperty_border_left_width, (float)val);
aDecls.SetKeywordValueIfUnset(eCSSProperty_border_top_style,
NS_STYLE_BORDER_STYLE_SOLID);
StyleBorderStyle::Solid);
aDecls.SetKeywordValueIfUnset(eCSSProperty_border_right_style,
NS_STYLE_BORDER_STYLE_SOLID);
StyleBorderStyle::Solid);
aDecls.SetKeywordValueIfUnset(eCSSProperty_border_bottom_style,
NS_STYLE_BORDER_STYLE_SOLID);
StyleBorderStyle::Solid);
aDecls.SetKeywordValueIfUnset(eCSSProperty_border_left_style,
NS_STYLE_BORDER_STYLE_SOLID);
StyleBorderStyle::Solid);
aDecls.SetCurrentColorIfUnset(eCSSProperty_border_top_color);
aDecls.SetCurrentColorIfUnset(eCSSProperty_border_right_color);

View File

@ -15,6 +15,7 @@
#include "mozilla/Maybe.h"
#include "mozilla/TypedEnumBits.h"
#include "nsRegion.h"
#include "nsStyleConsts.h"
#include <stdio.h> // FILE
#include "mozilla/Logging.h" // for PR_LOG
@ -392,7 +393,7 @@ typedef gfx::Matrix4x4Typed<CSSTransformedLayerPixel, ParentLayerPixel> AsyncTra
typedef Array<gfx::Color, 4> BorderColors;
typedef Array<LayerSize, 4> BorderCorners;
typedef Array<LayerCoord, 4> BorderWidths;
typedef Array<uint8_t, 4> BorderStyles;
typedef Array<StyleBorderStyle, 4> BorderStyles;
typedef Maybe<LayerRect> MaybeLayerRect;

View File

@ -452,28 +452,28 @@ static inline wr::LayoutTransform ToLayoutTransform(const gfx::Matrix4x4Typed<S,
return transform;
}
static inline wr::BorderStyle ToBorderStyle(const uint8_t& style)
static inline wr::BorderStyle ToBorderStyle(const StyleBorderStyle& style)
{
switch (style) {
case NS_STYLE_BORDER_STYLE_NONE:
case StyleBorderStyle::None:
return wr::BorderStyle::None;
case NS_STYLE_BORDER_STYLE_SOLID:
case StyleBorderStyle::Solid:
return wr::BorderStyle::Solid;
case NS_STYLE_BORDER_STYLE_DOUBLE:
case StyleBorderStyle::Double:
return wr::BorderStyle::Double;
case NS_STYLE_BORDER_STYLE_DOTTED:
case StyleBorderStyle::Dotted:
return wr::BorderStyle::Dotted;
case NS_STYLE_BORDER_STYLE_DASHED:
case StyleBorderStyle::Dashed:
return wr::BorderStyle::Dashed;
case NS_STYLE_BORDER_STYLE_HIDDEN:
case StyleBorderStyle::Hidden:
return wr::BorderStyle::Hidden;
case NS_STYLE_BORDER_STYLE_GROOVE:
case StyleBorderStyle::Groove:
return wr::BorderStyle::Groove;
case NS_STYLE_BORDER_STYLE_RIDGE:
case StyleBorderStyle::Ridge:
return wr::BorderStyle::Ridge;
case NS_STYLE_BORDER_STYLE_INSET:
case StyleBorderStyle::Inset:
return wr::BorderStyle::Inset;
case NS_STYLE_BORDER_STYLE_OUTSET:
case StyleBorderStyle::Outset:
return wr::BorderStyle::Outset;
default:
MOZ_ASSERT(false);
@ -481,7 +481,7 @@ static inline wr::BorderStyle ToBorderStyle(const uint8_t& style)
return wr::BorderStyle::None;
}
static inline wr::BorderSide ToBorderSide(const gfx::Color& color, const uint8_t& style)
static inline wr::BorderSide ToBorderSide(const gfx::Color& color, const StyleBorderStyle& style)
{
wr::BorderSide bs;
bs.color = ToColorF(color);

View File

@ -1771,12 +1771,12 @@ public:
static SamplingFilter GetSamplingFilterForFrame(nsIFrame* aFrame);
static inline void InitDashPattern(StrokeOptions& aStrokeOptions,
uint8_t aBorderStyle) {
if (aBorderStyle == NS_STYLE_BORDER_STYLE_DOTTED) {
mozilla::StyleBorderStyle aBorderStyle) {
if (aBorderStyle == mozilla::StyleBorderStyle::Dotted) {
static Float dot[] = { 1.f, 1.f };
aStrokeOptions.mDashLength = MOZ_ARRAY_LENGTH(dot);
aStrokeOptions.mDashPattern = dot;
} else if (aBorderStyle == NS_STYLE_BORDER_STYLE_DASHED) {
} else if (aBorderStyle == mozilla::StyleBorderStyle::Dashed) {
static Float dash[] = { 5.f, 5.f };
aStrokeOptions.mDashLength = MOZ_ARRAY_LENGTH(dash);
aStrokeOptions.mDashPattern = dash;

View File

@ -1638,7 +1638,7 @@ void nsComboboxControlFrame::PaintFocus(DrawTarget& aDrawTarget, nsPoint aPt)
// draw focus
StrokeOptions strokeOptions;
nsLayoutUtils::InitDashPattern(strokeOptions, NS_STYLE_BORDER_STYLE_DOTTED);
nsLayoutUtils::InitDashPattern(strokeOptions, StyleBorderStyle::Dotted);
ColorPattern color(ToDeviceColor(StyleColor()->mColor));
nscoord onePixel = nsPresContext::CSSPixelsToAppUnits(1);
clipRect.width -= onePixel;

View File

@ -195,13 +195,13 @@ nsColumnSetFrame::CreateBorderRenderers(nsTArray<nsCSSBorderRenderer>& aBorderRe
WritingMode wm = GetWritingMode();
bool isVertical = wm.IsVertical();
const nsStyleColumn* colStyle = StyleColumn();
uint8_t ruleStyle;
StyleBorderStyle ruleStyle;
// Per spec, inset => ridge and outset => groove
if (colStyle->mColumnRuleStyle == NS_STYLE_BORDER_STYLE_INSET)
ruleStyle = NS_STYLE_BORDER_STYLE_RIDGE;
else if (colStyle->mColumnRuleStyle == NS_STYLE_BORDER_STYLE_OUTSET)
ruleStyle = NS_STYLE_BORDER_STYLE_GROOVE;
if (colStyle->mColumnRuleStyle == StyleBorderStyle::Inset)
ruleStyle = StyleBorderStyle::Ridge;
else if (colStyle->mColumnRuleStyle == StyleBorderStyle::Outset)
ruleStyle = StyleBorderStyle::Groove;
else
ruleStyle = colStyle->mColumnRuleStyle;

View File

@ -9480,7 +9480,7 @@ ComputeAndIncludeOutlineArea(nsIFrame* aFrame, nsOverflowAreas& aOverflowAreas,
nsRect outerRect(innerRect);
bool useOutlineAuto = false;
if (nsLayoutUtils::IsOutlineStyleAutoEnabled()) {
useOutlineAuto = outline->mOutlineStyle == NS_STYLE_BORDER_STYLE_AUTO;
useOutlineAuto = outline->mOutlineStyle == StyleBorderStyle::Auto;
if (MOZ_UNLIKELY(useOutlineAuto)) {
nsPresContext* presContext = aFrame->PresContext();
nsITheme* theme = presContext->GetTheme();

View File

@ -1365,7 +1365,7 @@ struct nsRecessedBorder : public nsStyleBorder {
mBorder.Side(side) = aBorderWidth;
// Note: use SetBorderStyle here because we want to affect
// mComputedBorder
SetBorderStyle(side, NS_STYLE_BORDER_STYLE_INSET);
SetBorderStyle(side, StyleBorderStyle::Inset);
}
}
};
@ -1912,7 +1912,7 @@ nsImageFrame::PaintImage(gfxContext& aRenderingContext, nsPoint aPt,
// then dashed black stroke over the top:
ColorPattern black(ToDeviceColor(Color(0.f, 0.f, 0.f, 1.f)));
StrokeOptions strokeOptions;
nsLayoutUtils::InitDashPattern(strokeOptions, NS_STYLE_BORDER_STYLE_DOTTED);
nsLayoutUtils::InitDashPattern(strokeOptions, StyleBorderStyle::Dotted);
map->Draw(this, *drawTarget, black, strokeOptions);
}

View File

@ -51,11 +51,11 @@ ParseStyleValue(nsAtom* aAttribute, const nsAString& aAttributeValue)
} else if (aAttribute == nsGkAtoms::rowlines_ ||
aAttribute == nsGkAtoms::columnlines_) {
if (aAttributeValue.EqualsLiteral("solid"))
return NS_STYLE_BORDER_STYLE_SOLID;
return static_cast<int8_t>(StyleBorderStyle::Solid);
else if (aAttributeValue.EqualsLiteral("dashed"))
return NS_STYLE_BORDER_STYLE_DASHED;
return static_cast<int8_t>(StyleBorderStyle::Dashed);
else
return NS_STYLE_BORDER_STYLE_NONE;
return static_cast<int8_t>(StyleBorderStyle::None);
} else {
MOZ_CRASH("Unrecognized attribute.");
}
@ -200,11 +200,11 @@ ApplyBorderToStyle(const nsMathMLmtdFrame* aFrame,
// values, we simply repeat the last value.
uint32_t listLength = rowLinesList->Length();
if (rowIndex < listLength) {
aStyleBorder.SetBorderStyle(eSideTop,
rowLinesList->ElementAt(rowIndex - 1));
aStyleBorder.SetBorderStyle(eSideTop, static_cast<StyleBorderStyle>(
rowLinesList->ElementAt(rowIndex - 1)));
} else {
aStyleBorder.SetBorderStyle(eSideTop,
rowLinesList->ElementAt(listLength - 1));
aStyleBorder.SetBorderStyle(eSideTop, static_cast<StyleBorderStyle>(
rowLinesList->ElementAt(listLength - 1)));
}
aStyleBorder.SetBorderWidth(eSideTop, borderWidth);
}
@ -215,11 +215,11 @@ ApplyBorderToStyle(const nsMathMLmtdFrame* aFrame,
// values, we simply repeat the last value.
uint32_t listLength = columnLinesList->Length();
if (columnIndex < listLength) {
aStyleBorder.SetBorderStyle(eSideLeft,
columnLinesList->ElementAt(columnIndex - 1));
aStyleBorder.SetBorderStyle(eSideLeft, static_cast<StyleBorderStyle>(
columnLinesList->ElementAt(columnIndex - 1)));
} else {
aStyleBorder.SetBorderStyle(eSideLeft,
columnLinesList->ElementAt(listLength - 1));
aStyleBorder.SetBorderStyle(eSideLeft, static_cast<StyleBorderStyle>(
columnLinesList->ElementAt(listLength - 1)));
}
aStyleBorder.SetBorderWidth(eSideLeft, borderWidth);
}

View File

@ -456,7 +456,7 @@ nsCSSRendering::Shutdown()
*/
static nscolor
MakeBevelColor(mozilla::Side whichSide,
uint8_t style,
StyleBorderStyle style,
nscolor aBorderColor)
{
@ -467,8 +467,8 @@ MakeBevelColor(mozilla::Side whichSide,
// calculate the color used for the shading
NS_GetSpecial3DColors(colors, aBorderColor);
if ((style == NS_STYLE_BORDER_STYLE_OUTSET) ||
(style == NS_STYLE_BORDER_STYLE_RIDGE)) {
if ((style == StyleBorderStyle::Outset) ||
(style == StyleBorderStyle::Ridge)) {
// Flip colors for these two border styles
switch (whichSide) {
case eSideBottom:
@ -894,7 +894,7 @@ ConstructBorderRenderer(nsPresContext* aPresContext,
Float(border.left) / oneDevPixel };
Rect dirtyRect = NSRectToRect(aDirtyRect, oneDevPixel);
uint8_t borderStyles[4];
StyleBorderStyle borderStyles[4];
nscolor borderColors[4];
// pull out styles, colors
@ -905,10 +905,10 @@ ConstructBorderRenderer(nsPresContext* aPresContext,
}
PrintAsFormatString(" borderStyles: %d %d %d %d\n",
borderStyles[0],
borderStyles[1],
borderStyles[2],
borderStyles[3]);
static_cast<int>(borderStyles[0]),
static_cast<int>(borderStyles[1]),
static_cast<int>(borderStyles[2]),
static_cast<int>(borderStyles[3]));
nsIDocument* document = nullptr;
nsIContent* content = aForFrame->GetContent();
@ -1153,8 +1153,8 @@ nsCSSRendering::CreateBorderRendererForOutline(nsPresContext* aPresContext,
RectCornerRadii outlineRadii;
ComputePixelRadii(twipsRadii, oneDevPixel, &outlineRadii);
uint8_t outlineStyle = ourOutline->mOutlineStyle;
if (outlineStyle == NS_STYLE_BORDER_STYLE_AUTO) {
StyleBorderStyle outlineStyle = ourOutline->mOutlineStyle;
if (outlineStyle == StyleBorderStyle::Auto) {
if (nsLayoutUtils::IsOutlineStyleAutoEnabled()) {
nsITheme* theme = aPresContext->GetTheme();
if (theme && theme->ThemeSupportsWidget(
@ -1172,10 +1172,10 @@ nsCSSRendering::CreateBorderRendererForOutline(nsPresContext* aPresContext,
}
// http://dev.w3.org/csswg/css-ui/#outline
// "User agents may treat 'auto' as 'solid'."
outlineStyle = NS_STYLE_BORDER_STYLE_SOLID;
outlineStyle = StyleBorderStyle::Solid;
}
uint8_t outlineStyles[4] = {
StyleBorderStyle outlineStyles[4] = {
outlineStyle, outlineStyle, outlineStyle, outlineStyle
};
@ -1263,10 +1263,10 @@ nsCSSRendering::PaintFocus(nsPresContext* aPresContext,
Float(oneCSSPixel) / oneDevPixel,
Float(oneCSSPixel) / oneDevPixel };
uint8_t focusStyles[4] = { NS_STYLE_BORDER_STYLE_DOTTED,
NS_STYLE_BORDER_STYLE_DOTTED,
NS_STYLE_BORDER_STYLE_DOTTED,
NS_STYLE_BORDER_STYLE_DOTTED };
StyleBorderStyle focusStyles[4] = { StyleBorderStyle::Dotted,
StyleBorderStyle::Dotted,
StyleBorderStyle::Dotted,
StyleBorderStyle::Dotted };
nscolor focusColors[4] = { aColor, aColor, aColor, aColor };
// Because this renders a dotted border, the background color
@ -2230,11 +2230,11 @@ IsOpaqueBorderEdge(const nsStyleBorder& aBorder, mozilla::Side aSide)
if (aBorder.GetComputedBorder().Side(aSide) == 0)
return true;
switch (aBorder.GetBorderStyle(aSide)) {
case NS_STYLE_BORDER_STYLE_SOLID:
case NS_STYLE_BORDER_STYLE_GROOVE:
case NS_STYLE_BORDER_STYLE_RIDGE:
case NS_STYLE_BORDER_STYLE_INSET:
case NS_STYLE_BORDER_STYLE_OUTSET:
case StyleBorderStyle::Solid:
case StyleBorderStyle::Groove:
case StyleBorderStyle::Ridge:
case StyleBorderStyle::Inset:
case StyleBorderStyle::Outset:
break;
default:
return false;
@ -3751,7 +3751,7 @@ GetDashInfo(nscoord aBorderLength,
void
nsCSSRendering::DrawTableBorderSegment(DrawTarget& aDrawTarget,
uint8_t aBorderStyle,
StyleBorderStyle aBorderStyle,
nscolor aBorderColor,
const nsRect& aBorder,
int32_t aAppUnitsPerDevPixel,
@ -3765,28 +3765,28 @@ nsCSSRendering::DrawTableBorderSegment(DrawTarget& aDrawTarget,
nscoord oneDevPixel = NSIntPixelsToAppUnits(1, aAppUnitsPerDevPixel);
if ((oneDevPixel >= aBorder.width) || (oneDevPixel >= aBorder.height) ||
(NS_STYLE_BORDER_STYLE_DASHED == aBorderStyle) ||
(NS_STYLE_BORDER_STYLE_DOTTED == aBorderStyle)) {
(StyleBorderStyle::Dashed == aBorderStyle) ||
(StyleBorderStyle::Dotted == aBorderStyle)) {
// no beveling for 1 pixel border, dash or dot
aStartBevelOffset = 0;
aEndBevelOffset = 0;
}
switch (aBorderStyle) {
case NS_STYLE_BORDER_STYLE_NONE:
case NS_STYLE_BORDER_STYLE_HIDDEN:
case StyleBorderStyle::None:
case StyleBorderStyle::Hidden:
// NS_ASSERTION(false, "style of none or hidden");
break;
case NS_STYLE_BORDER_STYLE_DOTTED:
case NS_STYLE_BORDER_STYLE_DASHED: {
nscoord dashLength = (NS_STYLE_BORDER_STYLE_DASHED == aBorderStyle)
case StyleBorderStyle::Dotted:
case StyleBorderStyle::Dashed: {
nscoord dashLength = (StyleBorderStyle::Dashed == aBorderStyle)
? DASH_LENGTH
: DOT_LENGTH;
// make the dash length proportional to the border thickness
dashLength *= (horizontal) ? aBorder.height : aBorder.width;
// make the min dash length for the ends 1/2 the dash length
nscoord minDashLength =
(NS_STYLE_BORDER_STYLE_DASHED == aBorderStyle)
(StyleBorderStyle::Dashed == aBorderStyle)
? RoundFloatToPixel(((float)dashLength) / 2.0f, aAppUnitsPerDevPixel)
: dashLength;
minDashLength = std::max(minDashLength, oneDevPixel);
@ -3874,28 +3874,28 @@ nsCSSRendering::DrawTableBorderSegment(DrawTarget& aDrawTarget,
void
nsCSSRendering::GetTableBorderSolidSegments(
nsTArray<SolidBeveledBorderSegment>& aSegments,
uint8_t aBorderStyle,
nscolor aBorderColor,
const nsRect& aBorder,
int32_t aAppUnitsPerDevPixel,
mozilla::Side aStartBevelSide,
nscoord aStartBevelOffset,
mozilla::Side aEndBevelSide,
nscoord aEndBevelOffset)
StyleBorderStyle aBorderStyle,
nscolor aBorderColor,
const nsRect& aBorder,
int32_t aAppUnitsPerDevPixel,
mozilla::Side aStartBevelSide,
nscoord aStartBevelOffset,
mozilla::Side aEndBevelSide,
nscoord aEndBevelOffset)
{
const bool horizontal = eSideTop == aStartBevelSide || eSideBottom == aStartBevelSide;
const nscoord oneDevPixel = NSIntPixelsToAppUnits(1, aAppUnitsPerDevPixel);
switch (aBorderStyle) {
case NS_STYLE_BORDER_STYLE_NONE:
case NS_STYLE_BORDER_STYLE_HIDDEN:
case StyleBorderStyle::None:
case StyleBorderStyle::Hidden:
return;
case NS_STYLE_BORDER_STYLE_DOTTED:
case NS_STYLE_BORDER_STYLE_DASHED:
case StyleBorderStyle::Dotted:
case StyleBorderStyle::Dashed:
MOZ_ASSERT_UNREACHABLE("Caller should have checked");
return;
case NS_STYLE_BORDER_STYLE_GROOVE:
case NS_STYLE_BORDER_STYLE_RIDGE:
case StyleBorderStyle::Groove:
case StyleBorderStyle::Ridge:
if ((horizontal && (oneDevPixel >= aBorder.height)) ||
(!horizontal && (oneDevPixel >= aBorder.width))) {
aSegments.AppendElement(SolidBeveledBorderSegment {
@ -3995,7 +3995,7 @@ nsCSSRendering::GetTableBorderSolidSegments(
}
}
break;
case NS_STYLE_BORDER_STYLE_DOUBLE:
case StyleBorderStyle::Double:
// We can only do "double" borders if the thickness of the border
// is more than 2px. Otherwise, we fall through to painting a
// solid border.
@ -4086,7 +4086,7 @@ nsCSSRendering::GetTableBorderSolidSegments(
}
// else fall through to solid
MOZ_FALLTHROUGH;
case NS_STYLE_BORDER_STYLE_SOLID:
case StyleBorderStyle::Solid:
aSegments.AppendElement(SolidBeveledBorderSegment {
aBorder,
aBorderColor,
@ -4094,11 +4094,11 @@ nsCSSRendering::GetTableBorderSolidSegments(
{ aEndBevelSide, aEndBevelOffset }
});
break;
case NS_STYLE_BORDER_STYLE_OUTSET:
case NS_STYLE_BORDER_STYLE_INSET:
case StyleBorderStyle::Outset:
case StyleBorderStyle::Inset:
MOZ_ASSERT_UNREACHABLE("inset, outset should have been converted to groove, ridge");
break;
case NS_STYLE_BORDER_STYLE_AUTO:
case StyleBorderStyle::Auto:
MOZ_ASSERT_UNREACHABLE("Unexpected 'auto' table border");
break;
}

View File

@ -595,7 +595,7 @@ struct nsCSSRendering
// corners.
static void DrawTableBorderSegment(
DrawTarget& aDrawTarget,
uint8_t aBorderStyle,
mozilla::StyleBorderStyle aBorderStyle,
nscolor aBorderColor,
const nsRect& aBorderRect,
int32_t aAppUnitsPerDevPixel,
@ -624,7 +624,7 @@ struct nsCSSRendering
// dashed / dotted borders, since we don't support beveling those.
static void GetTableBorderSolidSegments(
nsTArray<SolidBeveledBorderSegment>& aSegments,
uint8_t aBorderStyle,
mozilla::StyleBorderStyle aBorderStyle,
nscolor aBorderColor,
const nsRect& aBorderRect,
int32_t aAppUnitsPerDevPixel,

View File

@ -174,7 +174,7 @@ nsCSSBorderRenderer::nsCSSBorderRenderer(nsPresContext* aPresContext,
DrawTarget* aDrawTarget,
const Rect& aDirtyRect,
Rect& aOuterRect,
const uint8_t* aBorderStyles,
const StyleBorderStyle* aBorderStyles,
const Float* aBorderWidths,
RectCornerRadii& aBorderRadii,
const nscolor* aBorderColors,
@ -194,10 +194,10 @@ nsCSSBorderRenderer::nsCSSBorderRenderer(nsPresContext* aPresContext,
PodCopy(mBorderColors, aBorderColors, 4);
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));
mBorderStyles[0] != StyleBorderStyle::None ? mBorderWidths[0] : 0,
mBorderStyles[1] != StyleBorderStyle::None ? mBorderWidths[1] : 0,
mBorderStyles[2] != StyleBorderStyle::None ? mBorderWidths[2] : 0,
mBorderStyles[3] != StyleBorderStyle::None ? mBorderWidths[3] : 0));
ComputeBorderCornerDimensions(
mBorderWidths, mBorderRadii, &mBorderCornerDimensions);
@ -338,34 +338,34 @@ nsCSSBorderRenderer::AreBorderSideFinalStylesSame(uint8_t aSides)
/* 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:
case NS_STYLE_BORDER_STYLE_RIDGE:
case NS_STYLE_BORDER_STYLE_INSET:
case NS_STYLE_BORDER_STYLE_OUTSET:
case StyleBorderStyle::Groove:
case StyleBorderStyle::Ridge:
case StyleBorderStyle::Inset:
case StyleBorderStyle::Outset:
return ((aSides & ~(eSideBitsTop | eSideBitsLeft)) == 0 ||
(aSides & ~(eSideBitsBottom | eSideBitsRight)) == 0);
default:
return true;
}
return true;
}
bool
nsCSSBorderRenderer::IsSolidCornerStyle(uint8_t aStyle, Corner aCorner)
nsCSSBorderRenderer::IsSolidCornerStyle(StyleBorderStyle aStyle, Corner aCorner)
{
switch (aStyle) {
case NS_STYLE_BORDER_STYLE_SOLID:
case StyleBorderStyle::Solid:
return true;
case NS_STYLE_BORDER_STYLE_INSET:
case NS_STYLE_BORDER_STYLE_OUTSET:
case StyleBorderStyle::Inset:
case StyleBorderStyle::Outset:
return (aCorner == eCornerTopLeft || aCorner == eCornerBottomRight);
case NS_STYLE_BORDER_STYLE_GROOVE:
case NS_STYLE_BORDER_STYLE_RIDGE:
case StyleBorderStyle::Groove:
case StyleBorderStyle::Ridge:
return mOneUnitBorder &&
(aCorner == eCornerTopLeft || aCorner == eCornerBottomRight);
case NS_STYLE_BORDER_STYLE_DOUBLE:
case StyleBorderStyle::Double:
return mOneUnitBorder;
default:
@ -406,9 +406,9 @@ nsCSSBorderRenderer::IsCornerMergeable(Corner aCorner)
// | |
mozilla::Side sideH(GetHorizontalSide(aCorner));
mozilla::Side sideV(GetVerticalSide(aCorner));
uint8_t styleH = mBorderStyles[sideH];
uint8_t styleV = mBorderStyles[sideV];
if (styleH != styleV || styleH != NS_STYLE_BORDER_STYLE_DOTTED) {
StyleBorderStyle styleH = mBorderStyles[sideH];
StyleBorderStyle styleV = mBorderStyles[sideV];
if (styleH != styleV || styleH != StyleBorderStyle::Dotted) {
return false;
}
@ -424,31 +424,33 @@ nsCSSBorderRenderer::IsCornerMergeable(Corner aCorner)
}
BorderColorStyle
nsCSSBorderRenderer::BorderColorStyleForSolidCorner(uint8_t aStyle,
nsCSSBorderRenderer::BorderColorStyleForSolidCorner(StyleBorderStyle aStyle,
Corner aCorner)
{
// note that this function assumes that the corner is already solid,
// as per the earlier function
switch (aStyle) {
case NS_STYLE_BORDER_STYLE_SOLID:
case NS_STYLE_BORDER_STYLE_DOUBLE:
case StyleBorderStyle::Solid:
case StyleBorderStyle::Double:
return BorderColorStyleSolid;
case NS_STYLE_BORDER_STYLE_INSET:
case NS_STYLE_BORDER_STYLE_GROOVE:
case StyleBorderStyle::Inset:
case StyleBorderStyle::Groove:
if (aCorner == eCornerTopLeft)
return BorderColorStyleDark;
else if (aCorner == eCornerBottomRight)
return BorderColorStyleLight;
break;
case NS_STYLE_BORDER_STYLE_OUTSET:
case NS_STYLE_BORDER_STYLE_RIDGE:
case StyleBorderStyle::Outset:
case StyleBorderStyle::Ridge:
if (aCorner == eCornerTopLeft)
return BorderColorStyleLight;
else if (aCorner == eCornerBottomRight)
return BorderColorStyleDark;
break;
default:
return BorderColorStyleNone;
}
return BorderColorStyleNone;
@ -616,7 +618,7 @@ nsCSSBorderRenderer::GetSideClipSubPath(mozilla::Side aSide)
Point start[2];
Point end[2];
#define IS_DOTTED(_s) ((_s) == NS_STYLE_BORDER_STYLE_DOTTED)
#define IS_DOTTED(_s) ((_s) == StyleBorderStyle::Dotted)
bool isDotted = IS_DOTTED(mBorderStyles[aSide]);
bool startIsDotted = IS_DOTTED(mBorderStyles[PREV_SIDE(aSide)]);
bool endIsDotted = IS_DOTTED(mBorderStyles[NEXT_SIDE(aSide)]);
@ -736,7 +738,7 @@ nsCSSBorderRenderer::GetStraightBorderPoint(mozilla::Side aSide,
*aIsUnfilled = false;
Point P = mOuterRect.AtCorner(aCorner);
uint8_t style = mBorderStyles[aSide];
StyleBorderStyle style = mBorderStyles[aSide];
Float borderWidth = mBorderWidths[aSide];
Size dim = mBorderCornerDimensions[aCorner];
bool isHorizontal = IsHorizontalSide(aSide);
@ -750,14 +752,14 @@ nsCSSBorderRenderer::GetStraightBorderPoint(mozilla::Side aSide,
// | |
mozilla::Side otherSide =
((uint8_t)aSide == (uint8_t)aCorner) ? PREV_SIDE(aSide) : NEXT_SIDE(aSide);
uint8_t otherStyle = mBorderStyles[otherSide];
StyleBorderStyle otherStyle = mBorderStyles[otherSide];
Float otherBorderWidth = mBorderWidths[otherSide];
Size radius = mBorderRadii[aCorner];
if (IsZeroSize(radius)) {
radius.width = 0.0f;
radius.height = 0.0f;
}
if (style == NS_STYLE_BORDER_STYLE_DOTTED) {
if (style == StyleBorderStyle::Dotted) {
// Offset the dot's location along the side toward the corner by a
// multiple of its width.
if (isHorizontal) {
@ -766,8 +768,8 @@ nsCSSBorderRenderer::GetStraightBorderPoint(mozilla::Side aSide,
P.y -= signs[1] * aDotOffset * borderWidth;
}
}
if (style == NS_STYLE_BORDER_STYLE_DOTTED &&
otherStyle == NS_STYLE_BORDER_STYLE_DOTTED) {
if (style == StyleBorderStyle::Dotted &&
otherStyle == StyleBorderStyle::Dotted) {
if (borderWidth == otherBorderWidth) {
if (radius.width < borderWidth / 2.0f &&
radius.height < borderWidth / 2.0f) {
@ -963,7 +965,7 @@ nsCSSBorderRenderer::GetStraightBorderPoint(mozilla::Side aSide,
return P;
}
if (style == NS_STYLE_BORDER_STYLE_DOTTED) {
if (style == StyleBorderStyle::Dotted) {
// If only this side is dotted, other side draws the corner.
//
// otherBorderWidth + borderWidth / 2.0
@ -1024,7 +1026,7 @@ nsCSSBorderRenderer::GetStraightBorderPoint(mozilla::Side aSide,
return P;
}
if (otherStyle == NS_STYLE_BORDER_STYLE_DOTTED && IsZeroSize(radius)) {
if (otherStyle == StyleBorderStyle::Dotted && IsZeroSize(radius)) {
// If other side is dotted and radius=0, draw side to the end of corner.
//
// +-------------------------------
@ -1290,7 +1292,7 @@ nsCSSBorderRenderer::DrawBorderSides(int aSides)
return;
}
uint8_t borderRenderStyle = NS_STYLE_BORDER_STYLE_NONE;
StyleBorderStyle borderRenderStyle = StyleBorderStyle::None;
nscolor borderRenderColor;
uint32_t borderColorStyleCount = 0;
@ -1306,12 +1308,12 @@ nsCSSBorderRenderer::DrawBorderSides(int aSides)
break;
}
if (borderRenderStyle == NS_STYLE_BORDER_STYLE_NONE ||
borderRenderStyle == NS_STYLE_BORDER_STYLE_HIDDEN)
if (borderRenderStyle == StyleBorderStyle::None ||
borderRenderStyle == StyleBorderStyle::Hidden)
return;
if (borderRenderStyle == NS_STYLE_BORDER_STYLE_DASHED ||
borderRenderStyle == NS_STYLE_BORDER_STYLE_DOTTED) {
if (borderRenderStyle == StyleBorderStyle::Dashed ||
borderRenderStyle == StyleBorderStyle::Dotted) {
// Draw each corner separately, with the given side's color.
if (aSides & eSideBitsTop) {
DrawDashedOrDottedCorner(eSideTop, C_TL);
@ -1344,13 +1346,13 @@ nsCSSBorderRenderer::DrawBorderSides(int aSides)
// 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))
borderRenderStyle = NS_STYLE_BORDER_STYLE_SOLID;
if (mOneUnitBorder && (borderRenderStyle == StyleBorderStyle::Ridge ||
borderRenderStyle == StyleBorderStyle::Groove ||
borderRenderStyle == StyleBorderStyle::Double))
borderRenderStyle = StyleBorderStyle::Solid;
switch (borderRenderStyle) {
case NS_STYLE_BORDER_STYLE_SOLID:
case StyleBorderStyle::Solid:
borderColorStyleTopLeft[0] = BorderColorStyleSolid;
borderColorStyleBottomRight[0] = BorderColorStyleSolid;
@ -1358,7 +1360,7 @@ nsCSSBorderRenderer::DrawBorderSides(int aSides)
borderColorStyleCount = 1;
break;
case NS_STYLE_BORDER_STYLE_GROOVE:
case StyleBorderStyle::Groove:
borderColorStyleTopLeft[0] = BorderColorStyleDark;
borderColorStyleTopLeft[1] = BorderColorStyleLight;
@ -1368,7 +1370,7 @@ nsCSSBorderRenderer::DrawBorderSides(int aSides)
borderColorStyleCount = 2;
break;
case NS_STYLE_BORDER_STYLE_RIDGE:
case StyleBorderStyle::Ridge:
borderColorStyleTopLeft[0] = BorderColorStyleLight;
borderColorStyleTopLeft[1] = BorderColorStyleDark;
@ -1378,7 +1380,7 @@ nsCSSBorderRenderer::DrawBorderSides(int aSides)
borderColorStyleCount = 2;
break;
case NS_STYLE_BORDER_STYLE_DOUBLE:
case StyleBorderStyle::Double:
borderColorStyleTopLeft[0] = BorderColorStyleSolid;
borderColorStyleTopLeft[1] = BorderColorStyleNone;
borderColorStyleTopLeft[2] = BorderColorStyleSolid;
@ -1390,14 +1392,14 @@ nsCSSBorderRenderer::DrawBorderSides(int aSides)
borderColorStyleCount = 3;
break;
case NS_STYLE_BORDER_STYLE_INSET:
case StyleBorderStyle::Inset:
borderColorStyleTopLeft[0] = BorderColorStyleDark;
borderColorStyleBottomRight[0] = BorderColorStyleLight;
borderColorStyleCount = 1;
break;
case NS_STYLE_BORDER_STYLE_OUTSET:
case StyleBorderStyle::Outset:
borderColorStyleTopLeft[0] = BorderColorStyleLight;
borderColorStyleBottomRight[0] = BorderColorStyleDark;
@ -1492,38 +1494,38 @@ nsCSSBorderRenderer::DrawBorderSides(int aSides)
// If there is at least one dotted side, every side is rendered separately.
if (IsSingleSide(aSides)) {
if (aSides == eSideBitsTop) {
if (mBorderStyles[eSideRight] == NS_STYLE_BORDER_STYLE_DOTTED &&
if (mBorderStyles[eSideRight] == StyleBorderStyle::Dotted &&
IsZeroSize(mBorderRadii[C_TR])) {
noMarginRight = true;
}
if (mBorderStyles[eSideLeft] == NS_STYLE_BORDER_STYLE_DOTTED &&
if (mBorderStyles[eSideLeft] == StyleBorderStyle::Dotted &&
IsZeroSize(mBorderRadii[C_TL])) {
noMarginLeft = true;
}
} else if (aSides == eSideBitsRight) {
if (mBorderStyles[eSideTop] == NS_STYLE_BORDER_STYLE_DOTTED &&
if (mBorderStyles[eSideTop] == StyleBorderStyle::Dotted &&
IsZeroSize(mBorderRadii[C_TR])) {
noMarginTop = true;
}
if (mBorderStyles[eSideBottom] == NS_STYLE_BORDER_STYLE_DOTTED &&
if (mBorderStyles[eSideBottom] == StyleBorderStyle::Dotted &&
IsZeroSize(mBorderRadii[C_BR])) {
noMarginBottom = true;
}
} else if (aSides == eSideBitsBottom) {
if (mBorderStyles[eSideRight] == NS_STYLE_BORDER_STYLE_DOTTED &&
if (mBorderStyles[eSideRight] == StyleBorderStyle::Dotted &&
IsZeroSize(mBorderRadii[C_BR])) {
noMarginRight = true;
}
if (mBorderStyles[eSideLeft] == NS_STYLE_BORDER_STYLE_DOTTED &&
if (mBorderStyles[eSideLeft] == StyleBorderStyle::Dotted &&
IsZeroSize(mBorderRadii[C_BL])) {
noMarginLeft = true;
}
} else {
if (mBorderStyles[eSideTop] == NS_STYLE_BORDER_STYLE_DOTTED &&
if (mBorderStyles[eSideTop] == StyleBorderStyle::Dotted &&
IsZeroSize(mBorderRadii[C_TL])) {
noMarginTop = true;
}
if (mBorderStyles[eSideBottom] == NS_STYLE_BORDER_STYLE_DOTTED &&
if (mBorderStyles[eSideBottom] == StyleBorderStyle::Dotted &&
IsZeroSize(mBorderRadii[C_BL])) {
noMarginBottom = true;
}
@ -1580,11 +1582,11 @@ nsCSSBorderRenderer::SetupDashedOptions(StrokeOptions* aStrokeOptions,
Float aBorderLength,
bool isCorner)
{
MOZ_ASSERT(mBorderStyles[aSide] == NS_STYLE_BORDER_STYLE_DASHED ||
mBorderStyles[aSide] == NS_STYLE_BORDER_STYLE_DOTTED,
MOZ_ASSERT(mBorderStyles[aSide] == StyleBorderStyle::Dashed ||
mBorderStyles[aSide] == StyleBorderStyle::Dotted,
"Style should be dashed or dotted.");
uint8_t style = mBorderStyles[aSide];
StyleBorderStyle style = mBorderStyles[aSide];
Float borderWidth = mBorderWidths[aSide];
// Dashed line starts and ends with half segment in most case.
@ -1614,7 +1616,7 @@ nsCSSBorderRenderer::SetupDashedOptions(StrokeOptions* aStrokeOptions,
// | | | |
bool fullStart = false, fullEnd = false;
Float halfDash;
if (style == NS_STYLE_BORDER_STYLE_DASHED) {
if (style == StyleBorderStyle::Dashed) {
// If either end of the side is not connecting onto a corner then we want a
// full dash at that end.
//
@ -1626,7 +1628,7 @@ nsCSSBorderRenderer::SetupDashedOptions(StrokeOptions* aStrokeOptions,
if (mBorderRadii[GetCCWCorner(aSide)].IsEmpty() &&
(mBorderCornerDimensions[GetCCWCorner(aSide)].IsEmpty() ||
mBorderStyles[PREV_SIDE(aSide)] == NS_STYLE_BORDER_STYLE_DOTTED ||
mBorderStyles[PREV_SIDE(aSide)] == StyleBorderStyle::Dotted ||
// XXX why this <=1 check?
borderWidth <= 1.0f)) {
fullStart = true;
@ -1634,7 +1636,7 @@ nsCSSBorderRenderer::SetupDashedOptions(StrokeOptions* aStrokeOptions,
if (mBorderRadii[GetCWCorner(aSide)].IsEmpty() &&
(mBorderCornerDimensions[GetCWCorner(aSide)].IsEmpty() ||
mBorderStyles[NEXT_SIDE(aSide)] == NS_STYLE_BORDER_STYLE_DOTTED)) {
mBorderStyles[NEXT_SIDE(aSide)] == StyleBorderStyle::Dotted)) {
fullEnd = true;
}
@ -1643,7 +1645,7 @@ nsCSSBorderRenderer::SetupDashedOptions(StrokeOptions* aStrokeOptions,
halfDash = borderWidth * DOT_LENGTH / 2.0f;
}
if (style == NS_STYLE_BORDER_STYLE_DASHED && aBorderLength > 0.0f) {
if (style == StyleBorderStyle::Dashed && aBorderLength > 0.0f) {
// The number of half segments, with maximum dash length.
int32_t count = floor(aBorderLength / halfDash);
Float minHalfDash = borderWidth * DOT_LENGTH / 2.0f;
@ -1735,12 +1737,12 @@ nsCSSBorderRenderer::SetupDashedOptions(StrokeOptions* aStrokeOptions,
aDash[0] = fullDash;
aDash[1] = fullDash;
if (style == NS_STYLE_BORDER_STYLE_DASHED && fullDash > 1.0f) {
if (style == StyleBorderStyle::Dashed && fullDash > 1.0f) {
if (!fullStart) {
// Draw half segments on both ends.
aStrokeOptions->mDashOffset = halfDash;
}
} else if (style != NS_STYLE_BORDER_STYLE_DOTTED && isCorner) {
} else if (style != StyleBorderStyle::Dotted && isCorner) {
// If side ends with filled full segment, corner should start with unfilled
// full segment. Not needed for dotted corners, as they overlap one dot with
// the side's end.
@ -1809,8 +1811,8 @@ nsCSSBorderRenderer::DrawDashedOrDottedSide(mozilla::Side aSide)
// the line ends with unfilled dot.
// (see comment for GetStraightBorderPoint for more detail)
NS_ASSERTION(mBorderStyles[aSide] == NS_STYLE_BORDER_STYLE_DASHED ||
mBorderStyles[aSide] == NS_STYLE_BORDER_STYLE_DOTTED,
NS_ASSERTION(mBorderStyles[aSide] == StyleBorderStyle::Dashed ||
mBorderStyles[aSide] == StyleBorderStyle::Dotted,
"Style should be dashed or dotted.");
Float borderWidth = mBorderWidths[aSide];
@ -1818,7 +1820,7 @@ nsCSSBorderRenderer::DrawDashedOrDottedSide(mozilla::Side aSide)
return;
}
if (mBorderStyles[aSide] == NS_STYLE_BORDER_STYLE_DOTTED &&
if (mBorderStyles[aSide] == StyleBorderStyle::Dotted &&
borderWidth > 2.0f) {
DrawDottedSideSlow(aSide);
return;
@ -1881,7 +1883,7 @@ nsCSSBorderRenderer::DrawDashedOrDottedSide(mozilla::Side aSide)
}
DrawOptions drawOptions;
if (mBorderStyles[aSide] == NS_STYLE_BORDER_STYLE_DOTTED) {
if (mBorderStyles[aSide] == StyleBorderStyle::Dotted) {
drawOptions.mAntialiasMode = AntialiasMode::NONE;
}
@ -1898,7 +1900,7 @@ nsCSSBorderRenderer::DrawDottedSideSlow(mozilla::Side aSide)
// Draw each circles separately for dotted with borderWidth > 2.0.
// Dashed line with CapStyle::ROUND doesn't render perfect circles.
NS_ASSERTION(mBorderStyles[aSide] == NS_STYLE_BORDER_STYLE_DOTTED,
NS_ASSERTION(mBorderStyles[aSide] == StyleBorderStyle::Dotted,
"Style should be dotted.");
Float borderWidth = mBorderWidths[aSide];
@ -2302,8 +2304,8 @@ nsCSSBorderRenderer::DrawDashedOrDottedCorner(mozilla::Side aSide,
// DrawDashedOrDottedSide. So this may draw no circles if there's no space
// between 2 dots at both ends.
NS_ASSERTION(mBorderStyles[aSide] == NS_STYLE_BORDER_STYLE_DASHED ||
mBorderStyles[aSide] == NS_STYLE_BORDER_STYLE_DOTTED,
NS_ASSERTION(mBorderStyles[aSide] == StyleBorderStyle::Dashed ||
mBorderStyles[aSide] == StyleBorderStyle::Dotted,
"Style should be dashed or dotted.");
if (IsCornerMergeable(aCorner)) {
@ -2319,13 +2321,13 @@ nsCSSBorderRenderer::DrawDashedOrDottedCorner(mozilla::Side aSide,
return;
}
Float styleH = mBorderStyles[sideH];
Float styleV = mBorderStyles[sideV];
StyleBorderStyle styleH = mBorderStyles[sideH];
StyleBorderStyle styleV = mBorderStyles[sideV];
// Corner between dotted and others with radius=0 is drawn by side.
if (IsZeroSize(mBorderRadii[aCorner]) &&
(styleV == NS_STYLE_BORDER_STYLE_DOTTED ||
styleH == NS_STYLE_BORDER_STYLE_DOTTED)) {
(styleV == StyleBorderStyle::Dotted ||
styleH == StyleBorderStyle::Dotted)) {
return;
}
@ -2337,8 +2339,8 @@ nsCSSBorderRenderer::DrawDashedOrDottedCorner(mozilla::Side aSide,
}
if (borderWidthH != borderWidthV || borderWidthH > 2.0f) {
uint8_t style = mBorderStyles[aSide];
if (style == NS_STYLE_BORDER_STYLE_DOTTED) {
StyleBorderStyle style = mBorderStyles[aSide];
if (style == StyleBorderStyle::Dotted) {
DrawDottedCornerSlow(aSide, aCorner);
} else {
DrawDashedCornerSlow(aSide, aCorner);
@ -2384,7 +2386,7 @@ nsCSSBorderRenderer::DrawDashedOrDottedCorner(mozilla::Side aSide,
void
nsCSSBorderRenderer::DrawDottedCornerSlow(mozilla::Side aSide, Corner aCorner)
{
NS_ASSERTION(mBorderStyles[aSide] == NS_STYLE_BORDER_STYLE_DOTTED,
NS_ASSERTION(mBorderStyles[aSide] == StyleBorderStyle::Dotted,
"Style should be dotted.");
mozilla::Side sideH(GetHorizontalSide(aCorner));
@ -2468,7 +2470,7 @@ DashedPathOverlapsRect(Rect& pathRect,
void
nsCSSBorderRenderer::DrawDashedCornerSlow(mozilla::Side aSide, Corner aCorner)
{
NS_ASSERTION(mBorderStyles[aSide] == NS_STYLE_BORDER_STYLE_DASHED,
NS_ASSERTION(mBorderStyles[aSide] == StyleBorderStyle::Dashed,
"Style should be dashed.");
mozilla::Side sideH(GetHorizontalSide(aCorner));
@ -2589,8 +2591,8 @@ nsCSSBorderRenderer::DrawFallbackSolidCorner(mozilla::Side aSide,
// Render too large dashed or dotted corner with solid style, to avoid hangup
// inside DashedCornerFinder and DottedCornerFinder.
NS_ASSERTION(mBorderStyles[aSide] == NS_STYLE_BORDER_STYLE_DASHED ||
mBorderStyles[aSide] == NS_STYLE_BORDER_STYLE_DOTTED,
NS_ASSERTION(mBorderStyles[aSide] == StyleBorderStyle::Dashed ||
mBorderStyles[aSide] == StyleBorderStyle::Dotted,
"Style should be dashed or dotted.");
nscolor borderColor = mBorderColors[aSide];
@ -2619,7 +2621,7 @@ nsCSSBorderRenderer::DrawFallbackSolidCorner(mozilla::Side aSide,
mDocument,
nsContentUtils::eCSS_PROPERTIES,
mBorderStyles[aSide] ==
NS_STYLE_BORDER_STYLE_DASHED
StyleBorderStyle::Dashed
? "TooLargeDashedRadius"
: "TooLargeDottedRadius");
}
@ -2643,9 +2645,9 @@ nsCSSBorderRenderer::AllBordersSolid()
{
NS_FOR_CSS_SIDES(i)
{
if (mBorderStyles[i] == NS_STYLE_BORDER_STYLE_SOLID ||
mBorderStyles[i] == NS_STYLE_BORDER_STYLE_NONE ||
mBorderStyles[i] == NS_STYLE_BORDER_STYLE_HIDDEN) {
if (mBorderStyles[i] == StyleBorderStyle::Solid ||
mBorderStyles[i] == StyleBorderStyle::None ||
mBorderStyles[i] == StyleBorderStyle::Hidden) {
continue;
}
return false;
@ -2655,10 +2657,10 @@ nsCSSBorderRenderer::AllBordersSolid()
}
static bool
IsVisible(int aStyle)
IsVisible(StyleBorderStyle aStyle)
{
if (aStyle != NS_STYLE_BORDER_STYLE_NONE &&
aStyle != NS_STYLE_BORDER_STYLE_HIDDEN) {
if (aStyle != StyleBorderStyle::None &&
aStyle != StyleBorderStyle::Hidden) {
return true;
}
return false;
@ -3157,8 +3159,8 @@ void
nsCSSBorderRenderer::DrawBorders()
{
if (mAllBordersSameStyle &&
(mBorderStyles[0] == NS_STYLE_BORDER_STYLE_NONE ||
mBorderStyles[0] == NS_STYLE_BORDER_STYLE_HIDDEN ||
(mBorderStyles[0] == StyleBorderStyle::None ||
mBorderStyles[0] == StyleBorderStyle::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.
@ -3206,7 +3208,7 @@ nsCSSBorderRenderer::DrawBorders()
// drawing paths, when none of these can be used we move on to the generalized
// border drawing code.
if (mAllBordersSameStyle && mAllBordersSameWidth &&
mBorderStyles[0] == NS_STYLE_BORDER_STYLE_SOLID && mNoBorderRadius &&
mBorderStyles[0] == StyleBorderStyle::Solid && mNoBorderRadius &&
!mAvoidStroke) {
// Very simple case.
Rect rect = mOuterRect;
@ -3215,7 +3217,7 @@ nsCSSBorderRenderer::DrawBorders()
return;
}
if (mAllBordersSameStyle && mBorderStyles[0] == NS_STYLE_BORDER_STYLE_SOLID &&
if (mAllBordersSameStyle && mBorderStyles[0] == StyleBorderStyle::Solid &&
!mAvoidStroke && !mNoBorderRadius) {
// Relatively simple case.
RoundedRect borderInnerRect(mOuterRect, mBorderRadii);
@ -3288,9 +3290,9 @@ nsCSSBorderRenderer::DrawBorders()
NS_FOR_CSS_SIDES(i)
{
uint8_t style = mBorderStyles[i];
if (style == NS_STYLE_BORDER_STYLE_DASHED ||
style == NS_STYLE_BORDER_STYLE_DOTTED) {
StyleBorderStyle style = mBorderStyles[i];
if (style == StyleBorderStyle::Dashed ||
style == StyleBorderStyle::Dotted) {
// we need to draw things separately for dashed/dotting
forceSeparateCorners = true;
dashedSides |= (1 << i);
@ -3430,13 +3432,13 @@ nsCSSBorderRenderer::DrawBorders()
for (int cornerSide = 0; cornerSide < 2; cornerSide++) {
mozilla::Side side = mozilla::Side(sides[cornerSide]);
uint8_t style = mBorderStyles[side];
StyleBorderStyle style = mBorderStyles[side];
PrintAsFormatString("corner: %d cornerSide: %d side: %d style: %d\n",
corner,
cornerSide,
side,
style);
static_cast<int>(style));
RefPtr<Path> path = GetSideClipSubPath(side);
mDrawTarget->PushClip(path);
@ -3488,8 +3490,8 @@ nsCSSBorderRenderer::DrawBorders()
// If there's no border on this side, skip it
if (mBorderWidths[side] == 0.0 ||
mBorderStyles[side] == NS_STYLE_BORDER_STYLE_HIDDEN ||
mBorderStyles[side] == NS_STYLE_BORDER_STYLE_NONE)
mBorderStyles[side] == StyleBorderStyle::Hidden ||
mBorderStyles[side] == StyleBorderStyle::None)
continue;
if (dashedSides & (1 << side)) {

View File

@ -92,7 +92,7 @@ public:
DrawTarget* aDrawTarget,
const Rect& aDirtyRect,
Rect& aOuterRect,
const uint8_t* aBorderStyles,
const mozilla::StyleBorderStyle* aBorderStyles,
const Float* aBorderWidths,
RectCornerRadii& aBorderRadii,
const nscolor* aBorderColors,
@ -139,7 +139,7 @@ private:
Rect mInnerRect;
// the style and size of the border
uint8_t mBorderStyles[4];
mozilla::StyleBorderStyle mBorderStyles[4];
Float mBorderWidths[4];
RectCornerRadii mBorderRadii;
@ -160,13 +160,13 @@ private:
bool AreBorderSideFinalStylesSame(uint8_t aSides);
// For the given style, is the given corner a solid color?
bool IsSolidCornerStyle(uint8_t aStyle, mozilla::Corner aCorner);
bool IsSolidCornerStyle(mozilla::StyleBorderStyle aStyle, mozilla::Corner aCorner);
// For the given corner, is the given corner mergeable into one dot?
bool IsCornerMergeable(mozilla::Corner aCorner);
// For the given solid corner, what color style should be used?
BorderColorStyle BorderColorStyleForSolidCorner(uint8_t aStyle,
BorderColorStyle BorderColorStyleForSolidCorner(mozilla::StyleBorderStyle aStyle,
mozilla::Corner aCorner);
//

View File

@ -5263,8 +5263,8 @@ nsDisplayOutline::CreateWebRenderCommands(
{
ContainerLayerParameters parameter;
uint8_t outlineStyle = mFrame->Style()->StyleOutline()->mOutlineStyle;
if (outlineStyle == NS_STYLE_BORDER_STYLE_AUTO &&
StyleBorderStyle outlineStyle = mFrame->Style()->StyleOutline()->mOutlineStyle;
if (outlineStyle == StyleBorderStyle::Auto &&
nsLayoutUtils::IsOutlineStyleAutoEnabled()) {
nsITheme* theme = mFrame->PresContext()->GetTheme();
if (theme && theme->ThemeSupportsWidget(mFrame->PresContext(),

View File

@ -133,6 +133,7 @@ rusty-enums = [
"mozilla::StyleImageLayerRepeat",
"mozilla::StyleImageLayerAttachment",
"mozilla::StyleBoxDecorationBreak",
"mozilla::StyleBorderStyle",
"mozilla::StyleRuleInclusion",
"mozilla::StyleGridTrackBreadth",
"mozilla::StyleOverscrollBehavior",

View File

@ -189,16 +189,16 @@ nsCSSProps::GetStringValue(nsCSSCounterDesc aCounterDesc)
/***************************************************************************/
const KTableEntry nsCSSProps::kBorderStyleKTable[] = {
{ eCSSKeyword_none, NS_STYLE_BORDER_STYLE_NONE },
{ eCSSKeyword_hidden, NS_STYLE_BORDER_STYLE_HIDDEN },
{ eCSSKeyword_dotted, NS_STYLE_BORDER_STYLE_DOTTED },
{ eCSSKeyword_dashed, NS_STYLE_BORDER_STYLE_DASHED },
{ eCSSKeyword_solid, NS_STYLE_BORDER_STYLE_SOLID },
{ eCSSKeyword_double, NS_STYLE_BORDER_STYLE_DOUBLE },
{ eCSSKeyword_groove, NS_STYLE_BORDER_STYLE_GROOVE },
{ eCSSKeyword_ridge, NS_STYLE_BORDER_STYLE_RIDGE },
{ eCSSKeyword_inset, NS_STYLE_BORDER_STYLE_INSET },
{ eCSSKeyword_outset, NS_STYLE_BORDER_STYLE_OUTSET },
{ eCSSKeyword_none, StyleBorderStyle::None },
{ eCSSKeyword_hidden, StyleBorderStyle::Hidden },
{ eCSSKeyword_dotted, StyleBorderStyle::Dotted },
{ eCSSKeyword_dashed, StyleBorderStyle::Dashed },
{ eCSSKeyword_solid, StyleBorderStyle::Solid },
{ eCSSKeyword_double, StyleBorderStyle::Double },
{ eCSSKeyword_groove, StyleBorderStyle::Groove },
{ eCSSKeyword_ridge, StyleBorderStyle::Ridge },
{ eCSSKeyword_inset, StyleBorderStyle::Inset },
{ eCSSKeyword_outset, StyleBorderStyle::Outset },
{ eCSSKeyword_UNKNOWN, -1 }
};
@ -498,16 +498,16 @@ const KTableEntry nsCSSProps::kContainKTable[] = {
// Same as kBorderStyleKTable except 'hidden'.
const KTableEntry nsCSSProps::kOutlineStyleKTable[] = {
{ eCSSKeyword_none, NS_STYLE_BORDER_STYLE_NONE },
{ eCSSKeyword_auto, NS_STYLE_BORDER_STYLE_AUTO },
{ eCSSKeyword_dotted, NS_STYLE_BORDER_STYLE_DOTTED },
{ eCSSKeyword_dashed, NS_STYLE_BORDER_STYLE_DASHED },
{ eCSSKeyword_solid, NS_STYLE_BORDER_STYLE_SOLID },
{ eCSSKeyword_double, NS_STYLE_BORDER_STYLE_DOUBLE },
{ eCSSKeyword_groove, NS_STYLE_BORDER_STYLE_GROOVE },
{ eCSSKeyword_ridge, NS_STYLE_BORDER_STYLE_RIDGE },
{ eCSSKeyword_inset, NS_STYLE_BORDER_STYLE_INSET },
{ eCSSKeyword_outset, NS_STYLE_BORDER_STYLE_OUTSET },
{ eCSSKeyword_none, StyleBorderStyle::None },
{ eCSSKeyword_auto, StyleBorderStyle::Auto },
{ eCSSKeyword_dotted, StyleBorderStyle::Dotted },
{ eCSSKeyword_dashed, StyleBorderStyle::Dashed },
{ eCSSKeyword_solid, StyleBorderStyle::Solid },
{ eCSSKeyword_double, StyleBorderStyle::Double },
{ eCSSKeyword_groove, StyleBorderStyle::Groove },
{ eCSSKeyword_ridge, StyleBorderStyle::Ridge },
{ eCSSKeyword_inset, StyleBorderStyle::Inset },
{ eCSSKeyword_outset, StyleBorderStyle::Outset },
{ eCSSKeyword_UNKNOWN, -1 }
};

View File

@ -2205,7 +2205,7 @@ nsComputedDOMStyle::DoGetOutlineWidth()
const nsStyleOutline* outline = StyleOutline();
nscoord width;
if (outline->mOutlineStyle == NS_STYLE_BORDER_STYLE_NONE) {
if (outline->mOutlineStyle == StyleBorderStyle::None) {
NS_ASSERTION(outline->GetOutlineWidth() == 0, "unexpected width");
width = 0;
} else {

View File

@ -306,18 +306,19 @@ enum class StyleImageLayerRepeat : uint8_t {
#define NS_STYLE_BORDER_WIDTH_THICK 2
// XXX chopping block #define NS_STYLE_BORDER_WIDTH_LENGTH_VALUE 3
// See nsStyleBorder mBorderStyle
#define NS_STYLE_BORDER_STYLE_NONE 0
#define NS_STYLE_BORDER_STYLE_GROOVE 1
#define NS_STYLE_BORDER_STYLE_RIDGE 2
#define NS_STYLE_BORDER_STYLE_DOTTED 3
#define NS_STYLE_BORDER_STYLE_DASHED 4
#define NS_STYLE_BORDER_STYLE_SOLID 5
#define NS_STYLE_BORDER_STYLE_DOUBLE 6
#define NS_STYLE_BORDER_STYLE_INSET 7
#define NS_STYLE_BORDER_STYLE_OUTSET 8
#define NS_STYLE_BORDER_STYLE_HIDDEN 9
#define NS_STYLE_BORDER_STYLE_AUTO 10 // for outline-style only
enum class StyleBorderStyle : uint8_t {
None,
Groove,
Ridge,
Dotted,
Dashed,
Solid,
Double,
Inset,
Outset,
Hidden,
Auto, // for outline-style only
};
// border-image-repeat
enum class StyleBorderImageRepeat : uint8_t {

View File

@ -291,7 +291,7 @@ nsStyleBorder::nsStyleBorder(const nsPresContext* aContext)
mBorderImageOutset.Set(side, nsStyleCoord(0.0f, eStyleUnit_Factor));
mBorder.Side(side) = medium;
mBorderStyle[side] = NS_STYLE_BORDER_STYLE_NONE;
mBorderStyle[side] = StyleBorderStyle::None;
}
mTwipsPerPixel = aContext->DevPixelsToAppUnits(1);
@ -449,7 +449,7 @@ nsStyleOutline::nsStyleOutline(const nsPresContext* aContext)
->GetBorderWidthTable())[NS_STYLE_BORDER_WIDTH_MEDIUM])
, mOutlineOffset(0)
, mOutlineColor(StyleComplexColor::CurrentColor())
, mOutlineStyle(NS_STYLE_BORDER_STYLE_NONE)
, mOutlineStyle(StyleBorderStyle::None)
, mActualOutlineWidth(0)
, mTwipsPerPixel(aContext->DevPixelsToAppUnits(1))
{
@ -476,7 +476,7 @@ nsStyleOutline::nsStyleOutline(const nsStyleOutline& aSrc)
void
nsStyleOutline::RecalcData()
{
if (NS_STYLE_BORDER_STYLE_NONE == mOutlineStyle) {
if (StyleBorderStyle::None == mOutlineStyle) {
mActualOutlineWidth = 0;
} else {
mActualOutlineWidth =
@ -667,7 +667,7 @@ nsStyleXUL::CalcDifference(const nsStyleXUL& aNewData) const
nsStyleColumn::nsStyleColumn(const nsPresContext* aContext)
: mColumnWidth(eStyleUnit_Auto)
, mColumnRuleColor(StyleComplexColor::CurrentColor())
, mColumnRuleStyle(NS_STYLE_BORDER_STYLE_NONE)
, mColumnRuleStyle(StyleBorderStyle::None)
, mColumnRuleWidth((StaticPresData::Get()
->GetBorderWidthTable())[NS_STYLE_BORDER_WIDTH_MEDIUM])
, mTwipsPerPixel(aContext->AppUnitsPerDevPixel())

View File

@ -965,10 +965,10 @@ private:
((l) == 0) ? 0 : std::max((tpp), (l) / (tpp) * (tpp))
// Returns if the given border style type is visible or not
static bool IsVisibleBorderStyle(uint8_t aStyle)
static bool IsVisibleBorderStyle(mozilla::StyleBorderStyle aStyle)
{
return (aStyle != NS_STYLE_BORDER_STYLE_NONE &&
aStyle != NS_STYLE_BORDER_STYLE_HIDDEN);
return (aStyle != mozilla::StyleBorderStyle::None &&
aStyle != mozilla::StyleBorderStyle::Hidden);
}
struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleBorder
@ -1028,13 +1028,13 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleBorder
return GetComputedBorder().Side(aSide);
}
uint8_t GetBorderStyle(mozilla::Side aSide) const
mozilla::StyleBorderStyle GetBorderStyle(mozilla::Side aSide) const
{
NS_ASSERTION(aSide <= mozilla::eSideLeft, "bad side");
return mBorderStyle[aSide];
}
void SetBorderStyle(mozilla::Side aSide, uint8_t aStyle)
void SetBorderStyle(mozilla::Side aSide, mozilla::StyleBorderStyle aStyle)
{
NS_ASSERTION(aSide <= mozilla::eSideLeft, "bad side");
mBorderStyle[aSide] = aStyle;
@ -1071,7 +1071,7 @@ public:
mozilla::StyleBoxDecorationBreak mBoxDecorationBreak;
protected:
uint8_t mBorderStyle[4]; // NS_STYLE_BORDER_STYLE_*
mozilla::StyleBorderStyle mBorderStyle[4]; // StyleBorderStyle::*
public:
// the colors to use for a simple border.
@ -1172,7 +1172,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleOutline
nscoord mOutlineWidth;
nscoord mOutlineOffset;
mozilla::StyleComplexColor mOutlineColor;
uint8_t mOutlineStyle; // NS_STYLE_BORDER_STYLE_*
mozilla::StyleBorderStyle mOutlineStyle; // StyleBorderStyle::*
nscoord GetOutlineWidth() const
{
@ -1181,9 +1181,9 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleOutline
bool ShouldPaintOutline() const
{
return mOutlineStyle == NS_STYLE_BORDER_STYLE_AUTO ||
return mOutlineStyle == mozilla::StyleBorderStyle::Auto ||
(GetOutlineWidth() > 0 &&
mOutlineStyle != NS_STYLE_BORDER_STYLE_NONE);
mOutlineStyle != mozilla::StyleBorderStyle::None);
}
protected:
@ -2781,7 +2781,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleColumn
nsStyleCoord mColumnWidth; // coord, auto
mozilla::StyleComplexColor mColumnRuleColor;
uint8_t mColumnRuleStyle; // NS_STYLE_BORDER_STYLE_*
mozilla::StyleBorderStyle mColumnRuleStyle; // StyleborderStyle::*
mozilla::StyleColumnFill mColumnFill = mozilla::StyleColumnFill::Balance;
mozilla::StyleColumnSpan mColumnSpan = mozilla::StyleColumnSpan::None;

View File

@ -4425,8 +4425,8 @@ struct BCCellBorder
void Reset(uint32_t aRowIndex, uint32_t aRowSpan);
nscolor color; // border segment color
BCPixelSize width; // border segment width in pixel coordinates !!
uint8_t style; // border segment style, possible values are defined
// in nsStyleConsts.h as NS_STYLE_BORDER_STYLE_*
StyleBorderStyle style; // border segment style, possible values are defined
// in nsStyleConsts.h as StyleBorderStyle::*
BCBorderOwner owner; // border segment owner, possible values are defined
// in celldata.h. In the cellmap for each border
// segment we store the owner and later when
@ -4442,7 +4442,7 @@ void
BCCellBorder::Reset(uint32_t aRowIndex,
uint32_t aRowSpan)
{
style = NS_STYLE_BORDER_STYLE_NONE;
style = StyleBorderStyle::None;
color = 0;
width = 0;
owner = eTableOwner;
@ -5002,18 +5002,18 @@ BCMapCellIterator::PeekBEnd(BCMapCellInfo& aRefInfo,
aAjaInfo.SetInfo(nextRow, aColIndex, cellData, this, cellMap);
}
// Assign priorities to border styles. For example, styleToPriority(NS_STYLE_BORDER_STYLE_SOLID)
// will return the priority of NS_STYLE_BORDER_STYLE_SOLID.
static uint8_t styleToPriority[13] = { 0, // NS_STYLE_BORDER_STYLE_NONE
2, // NS_STYLE_BORDER_STYLE_GROOVE
4, // NS_STYLE_BORDER_STYLE_RIDGE
5, // NS_STYLE_BORDER_STYLE_DOTTED
6, // NS_STYLE_BORDER_STYLE_DASHED
7, // NS_STYLE_BORDER_STYLE_SOLID
8, // NS_STYLE_BORDER_STYLE_DOUBLE
1, // NS_STYLE_BORDER_STYLE_INSET
3, // NS_STYLE_BORDER_STYLE_OUTSET
9 };// NS_STYLE_BORDER_STYLE_HIDDEN
// Assign priorities to border styles. For example, styleToPriority(StyleBorderStyle::Solid)
// will return the priority of StyleBorderStyle::Solid.
static uint8_t styleToPriority[13] = { 0, // StyleBorderStyle::None
2, // StyleBorderStyle::Groove
4, // StyleBorderStyle::Ridge
5, // StyleBorderStyle::Dotted
6, // StyleBorderStyle::Dashed
7, // StyleBorderStyle::Solid
8, // StyleBorderStyle::Double
1, // StyleBorderStyle::Inset
3, // StyleBorderStyle::Outset
9 };// StyleBorderStyle::Hidden
// priority rules follow CSS 2.1 spec
// 'hidden', 'double', 'solid', 'dashed', 'dotted', 'ridge', 'outset', 'groove',
// and the lowest: 'inset'. none is even weaker
@ -5032,7 +5032,7 @@ static void
GetColorAndStyle(const nsIFrame* aFrame,
WritingMode aTableWM,
LogicalSide aSide,
uint8_t* aStyle,
StyleBorderStyle* aStyle,
nscolor* aColor,
BCPixelSize* aWidth = nullptr)
{
@ -5049,8 +5049,8 @@ GetColorAndStyle(const nsIFrame* aFrame,
mozilla::Side physicalSide = aTableWM.PhysicalSide(aSide);
*aStyle = styleData->GetBorderStyle(physicalSide);
if ((NS_STYLE_BORDER_STYLE_NONE == *aStyle) ||
(NS_STYLE_BORDER_STYLE_HIDDEN == *aStyle)) {
if ((StyleBorderStyle::None == *aStyle) ||
(StyleBorderStyle::Hidden == *aStyle)) {
return;
}
*aColor = aFrame->Style()->
@ -5073,14 +5073,14 @@ static void
GetPaintStyleInfo(const nsIFrame* aFrame,
WritingMode aTableWM,
LogicalSide aSide,
uint8_t* aStyle,
StyleBorderStyle* aStyle,
nscolor* aColor)
{
GetColorAndStyle(aFrame, aTableWM, aSide, aStyle, aColor);
if (NS_STYLE_BORDER_STYLE_INSET == *aStyle) {
*aStyle = NS_STYLE_BORDER_STYLE_RIDGE;
} else if (NS_STYLE_BORDER_STYLE_OUTSET == *aStyle) {
*aStyle = NS_STYLE_BORDER_STYLE_GROOVE;
if (StyleBorderStyle::Inset == *aStyle) {
*aStyle = StyleBorderStyle::Ridge;
} else if (StyleBorderStyle::Outset == *aStyle) {
*aStyle = StyleBorderStyle::Groove;
}
}
@ -5151,20 +5151,22 @@ CompareBorders(bool aIsCorner, // Pass true for corner calculatio
{
bool firstDominates = true;
if (NS_STYLE_BORDER_STYLE_HIDDEN == aBorder1.style) {
if (StyleBorderStyle::Hidden == aBorder1.style) {
firstDominates = (aIsCorner) ? false : true;
}
else if (NS_STYLE_BORDER_STYLE_HIDDEN == aBorder2.style) {
else if (StyleBorderStyle::Hidden == aBorder2.style) {
firstDominates = (aIsCorner) ? true : false;
}
else if (aBorder1.width < aBorder2.width) {
firstDominates = false;
}
else if (aBorder1.width == aBorder2.width) {
if (styleToPriority[aBorder1.style] < styleToPriority[aBorder2.style]) {
if (styleToPriority[static_cast<uint8_t>(aBorder1.style)] <
styleToPriority[static_cast<uint8_t>(aBorder2.style)]) {
firstDominates = false;
}
else if (styleToPriority[aBorder1.style] == styleToPriority[aBorder2.style]) {
else if (styleToPriority[static_cast<uint8_t>(aBorder1.style)] ==
styleToPriority[static_cast<uint8_t>(aBorder2.style)]) {
if (aBorder1.owner == aBorder2.owner) {
firstDominates = !aSecondIsInlineDir;
}
@ -5220,7 +5222,7 @@ CompareBorders(const nsIFrame* aTableFrame,
GetColorAndStyle(aTableFrame, aTableWM, aSide,
&border.style, &border.color, &border.width);
border.owner = eTableOwner;
if (NS_STYLE_BORDER_STYLE_HIDDEN == border.style) {
if (StyleBorderStyle::Hidden == border.style) {
return border;
}
}
@ -5231,7 +5233,7 @@ CompareBorders(const nsIFrame* aTableFrame,
tempBorder.owner = aAja && !inlineAxis ? eAjaColGroupOwner : eColGroupOwner;
// pass here and below false for aSecondIsInlineDir as it is only used for corner calculations.
border = CompareBorders(!CELL_CORNER, border, tempBorder, false);
if (NS_STYLE_BORDER_STYLE_HIDDEN == border.style) {
if (StyleBorderStyle::Hidden == border.style) {
return border;
}
}
@ -5241,7 +5243,7 @@ CompareBorders(const nsIFrame* aTableFrame,
&tempBorder.style, &tempBorder.color, &tempBorder.width);
tempBorder.owner = aAja && !inlineAxis ? eAjaColOwner : eColOwner;
border = CompareBorders(!CELL_CORNER, border, tempBorder, false);
if (NS_STYLE_BORDER_STYLE_HIDDEN == border.style) {
if (StyleBorderStyle::Hidden == border.style) {
return border;
}
}
@ -5251,7 +5253,7 @@ CompareBorders(const nsIFrame* aTableFrame,
&tempBorder.style, &tempBorder.color, &tempBorder.width);
tempBorder.owner = aAja && inlineAxis ? eAjaRowGroupOwner : eRowGroupOwner;
border = CompareBorders(!CELL_CORNER, border, tempBorder, false);
if (NS_STYLE_BORDER_STYLE_HIDDEN == border.style) {
if (StyleBorderStyle::Hidden == border.style) {
return border;
}
}
@ -5261,7 +5263,7 @@ CompareBorders(const nsIFrame* aTableFrame,
&tempBorder.style, &tempBorder.color, &tempBorder.width);
tempBorder.owner = aAja && inlineAxis ? eAjaRowOwner : eRowOwner;
border = CompareBorders(!CELL_CORNER, border, tempBorder, false);
if (NS_STYLE_BORDER_STYLE_HIDDEN == border.style) {
if (StyleBorderStyle::Hidden == border.style) {
return border;
}
}
@ -5283,7 +5285,7 @@ Perpendicular(mozilla::LogicalSide aSide1,
}
// Initial value indicating that BCCornerInfo's ownerStyle hasn't been set yet.
#define BORDER_STYLE_UNSET 0xF
#define BORDER_STYLE_UNSET static_cast<StyleBorderStyle>(255)
// XXX allocate this as number-of-cols+1 instead of number-of-cols+1 * number-of-rows+1
struct BCCornerInfo
@ -5291,7 +5293,7 @@ struct BCCornerInfo
BCCornerInfo() { ownerColor = 0; ownerWidth = subWidth = ownerElem = subSide =
subElem = hasDashDot = numSegs = bevel = 0; ownerSide = eLogicalSideBStart;
ownerStyle = BORDER_STYLE_UNSET;
subStyle = NS_STYLE_BORDER_STYLE_SOLID; }
subStyle = StyleBorderStyle::Solid; }
void Set(mozilla::LogicalSide aSide,
BCCellBorder border);
@ -5299,20 +5301,20 @@ struct BCCornerInfo
void Update(mozilla::LogicalSide aSide,
BCCellBorder border);
nscolor ownerColor; // color of borderOwner
uint16_t ownerWidth; // pixel width of borderOwner
uint16_t subWidth; // pixel width of the largest border intersecting the border perpendicular
// to ownerSide
uint32_t ownerSide:2; // LogicalSide (e.g eLogicalSideBStart, etc) of the border
// owning the corner relative to the corner
uint32_t ownerElem:4; // elem type (e.g. eTable, eGroup, etc) owning the corner
uint32_t ownerStyle:4; // border style of ownerElem
uint32_t subSide:2; // side of border with subWidth relative to the corner
uint32_t subElem:4; // elem type (e.g. eTable, eGroup, etc) of sub owner
uint32_t subStyle:4; // border style of subElem
uint32_t hasDashDot:1; // does a dashed, dotted segment enter the corner, they cannot be beveled
uint32_t numSegs:3; // number of segments entering corner
uint32_t bevel:1; // is the corner beveled (uses the above two fields together with subWidth)
nscolor ownerColor; // color of borderOwner
uint16_t ownerWidth; // pixel width of borderOwner
uint16_t subWidth; // pixel width of the largest border intersecting the border perpendicular
// to ownerSide
StyleBorderStyle subStyle; // border style of subElem
StyleBorderStyle ownerStyle;// border style of ownerElem
uint16_t ownerSide:2; // LogicalSide (e.g eLogicalSideBStart, etc) of the border
// owning the corner relative to the corner
uint16_t ownerElem:4; // elem type (e.g. eTable, eGroup, etc) owning the corner
uint16_t subSide:2; // side of border with subWidth relative to the corner
uint16_t subElem:4; // elem type (e.g. eTable, eGroup, etc) of sub owner
uint16_t hasDashDot:1; // does a dashed, dotted segment enter the corner, they cannot be beveled
uint16_t numSegs:3; // number of segments entering corner
uint16_t bevel:1; // is the corner beveled (uses the above two fields together with subWidth)
// 7 bits are unused
};
@ -5332,15 +5334,15 @@ BCCornerInfo::Set(mozilla::LogicalSide aSide,
numSegs = 0;
if (aBorder.width > 0) {
numSegs++;
hasDashDot = (NS_STYLE_BORDER_STYLE_DASHED == aBorder.style) ||
(NS_STYLE_BORDER_STYLE_DOTTED == aBorder.style);
hasDashDot = (StyleBorderStyle::Dashed == aBorder.style) ||
(StyleBorderStyle::Dotted == aBorder.style);
}
bevel = 0;
subWidth = 0;
// the following will get set later
subSide = IsInline(aSide) ? eLogicalSideBStart : eLogicalSideIStart;
subElem = eTableOwner;
subStyle = NS_STYLE_BORDER_STYLE_SOLID;
subStyle = StyleBorderStyle::Solid;
}
void
@ -5398,8 +5400,8 @@ BCCornerInfo::Update(mozilla::LogicalSide aSide,
}
if (aBorder.width > 0) {
numSegs++;
if (!hasDashDot && ((NS_STYLE_BORDER_STYLE_DASHED == aBorder.style) ||
(NS_STYLE_BORDER_STYLE_DOTTED == aBorder.style))) {
if (!hasDashDot && ((StyleBorderStyle::Dashed == aBorder.style) ||
(StyleBorderStyle::Dotted == aBorder.style))) {
hasDashDot = 1;
}
}
@ -6503,7 +6505,7 @@ class BCPaintBorderIterator;
struct BCBorderParameters
{
uint8_t mBorderStyle;
StyleBorderStyle mBorderStyle;
nscolor mBorderColor;
nsRect mBorderRect;
int32_t mAppUnitsPerDevPixel;
@ -6519,8 +6521,8 @@ struct BCBorderParameters
return false;
}
if (mBorderStyle == NS_STYLE_BORDER_STYLE_DASHED ||
mBorderStyle == NS_STYLE_BORDER_STYLE_DOTTED) {
if (mBorderStyle == StyleBorderStyle::Dashed ||
mBorderStyle == StyleBorderStyle::Dotted) {
return false;
}
@ -7384,7 +7386,7 @@ BCBlockDirSeg::BuildBorderParameters(BCPaintBorderIterator& aIter,
nsTableColFrame* col = mCol; if (!col) ABORT1(Nothing());
nsTableCellFrame* cell = mFirstCell; // ???
nsIFrame* owner = nullptr;
result.mBorderStyle = NS_STYLE_BORDER_STYLE_SOLID;
result.mBorderStyle = StyleBorderStyle::Solid;
result.mBorderColor = 0xFFFFFFFF;
result.mBackfaceIsVisible = true;
@ -7534,7 +7536,7 @@ AdjustAndPushBevel(wr::DisplayListBuilder& aBuilder,
wr::LayoutRect bevelRect = aRect;
wr::BorderSide bevelBorder[4];
NS_FOR_CSS_SIDES(i) {
bevelBorder[i] = wr::ToBorderSide(ToDeviceColor(aColor), NS_STYLE_BORDER_STYLE_SOLID);
bevelBorder[i] = wr::ToBorderSide(ToDeviceColor(aColor), StyleBorderStyle::Solid);
}
// We're creating a half-transparent triangle using the border primitive.
@ -7669,7 +7671,7 @@ CreateWRCommandsForBorderSegment(const BCBorderParameters& aBorderParams,
wr::LayoutRect roundedRect = wr::ToRoundedLayoutRect(borderRect);
wr::BorderSide wrSide[4];
NS_FOR_CSS_SIDES(i) {
wrSide[i] = wr::ToBorderSide(ToDeviceColor(aBorderParams.mBorderColor), NS_STYLE_BORDER_STYLE_NONE);
wrSide[i] = wr::ToBorderSide(ToDeviceColor(aBorderParams.mBorderColor), StyleBorderStyle::None);
}
const bool horizontal = aBorderParams.mStartBevelSide == eSideTop ||
aBorderParams.mStartBevelSide == eSideBottom;
@ -7833,7 +7835,7 @@ BCInlineDirSeg::BuildBorderParameters(BCPaintBorderIterator& aIter)
nsPresContext* presContext = aIter.mTable->PresContext();
result.mAppUnitsPerDevPixel = presContext->AppUnitsPerDevPixel();
result.mBorderStyle = NS_STYLE_BORDER_STYLE_SOLID;
result.mBorderStyle = StyleBorderStyle::Solid;
result.mBorderColor = 0xFFFFFFFF;
switch (mOwner) {

View File

@ -3227,7 +3227,7 @@ nsTreeBodyFrame::PaintCell(int32_t aRowIndex,
nscolor color = borderStyle->mBorderLeftColor.CalcColor(lineContext);
ColorPattern colorPatt(ToDeviceColor(color));
uint8_t style = borderStyle->GetBorderStyle(eSideLeft);
StyleBorderStyle style = borderStyle->GetBorderStyle(eSideLeft);
StrokeOptions strokeOptions;
nsLayoutUtils::InitDashPattern(strokeOptions, style);

View File

@ -1516,7 +1516,9 @@ fn static_assert() {
<% border_style_keyword = Keyword("border-style",
"none solid double dotted dashed hidden groove ridge inset outset") %>
"none solid double dotted dashed hidden groove ridge inset outset",
gecko_enum_prefix="StyleBorderStyle",
gecko_inexhaustive=True) %>
<% skip_border_longhands = " ".join(["border-{0}-{1}".format(x.ident, y)
for x in SIDES

View File

@ -63,7 +63,9 @@
${helpers.gecko_keyword_conversion(
Keyword('border-style',
"none solid double dotted dashed hidden groove ridge inset outset"),
"none solid double dotted dashed hidden groove ridge inset outset",
gecko_enum_prefix="StyleBorderStyle",
gecko_inexhaustive=True),
type="crate::values::specified::BorderStyle",
)}

View File

@ -83,7 +83,8 @@ ${helpers.single_keyword(
"none hidden dotted dashed solid double groove ridge inset outset",
products="gecko",
extra_prefixes="moz",
gecko_constant_prefix="NS_STYLE_BORDER_STYLE",
gecko_enum_prefix="StyleBorderStyle",
gecko_inexhaustive=True,
animation_value_type="discrete",
spec="https://drafts.csswg.org/css-multicol/#propdef-column-rule-style",
)}

View File

@ -3925,10 +3925,10 @@ nsNativeThemeCocoa::CreateWebRenderCommandsForWidget(mozilla::wr::DisplayListBui
wr::ToColorF(Color(1.0, 1.0, 1.0, 1.0)));
wr::BorderSide side[4] = {
wr::ToBorderSide(kMultilineTextFieldTopBorderColor, NS_STYLE_BORDER_STYLE_SOLID),
wr::ToBorderSide(kMultilineTextFieldSidesAndBottomBorderColor, NS_STYLE_BORDER_STYLE_SOLID),
wr::ToBorderSide(kMultilineTextFieldSidesAndBottomBorderColor, NS_STYLE_BORDER_STYLE_SOLID),
wr::ToBorderSide(kMultilineTextFieldSidesAndBottomBorderColor, NS_STYLE_BORDER_STYLE_SOLID),
wr::ToBorderSide(kMultilineTextFieldTopBorderColor, StyleBorderStyle::Solid),
wr::ToBorderSide(kMultilineTextFieldSidesAndBottomBorderColor, StyleBorderStyle::Solid),
wr::ToBorderSide(kMultilineTextFieldSidesAndBottomBorderColor, StyleBorderStyle::Solid),
wr::ToBorderSide(kMultilineTextFieldSidesAndBottomBorderColor, StyleBorderStyle::Solid),
};
wr::BorderRadius borderRadius = wr::EmptyBorderRadius();
@ -3948,10 +3948,10 @@ nsNativeThemeCocoa::CreateWebRenderCommandsForWidget(mozilla::wr::DisplayListBui
wr::ToColorF(Color(1.0, 1.0, 1.0, 1.0)));
wr::BorderSide side[4] = {
wr::ToBorderSide(kListboxTopBorderColor, NS_STYLE_BORDER_STYLE_SOLID),
wr::ToBorderSide(kListBoxSidesAndBottomBorderColor, NS_STYLE_BORDER_STYLE_SOLID),
wr::ToBorderSide(kListBoxSidesAndBottomBorderColor, NS_STYLE_BORDER_STYLE_SOLID),
wr::ToBorderSide(kListBoxSidesAndBottomBorderColor, NS_STYLE_BORDER_STYLE_SOLID),
wr::ToBorderSide(kListboxTopBorderColor, StyleBorderStyle::Solid),
wr::ToBorderSide(kListBoxSidesAndBottomBorderColor, StyleBorderStyle::Solid),
wr::ToBorderSide(kListBoxSidesAndBottomBorderColor, StyleBorderStyle::Solid),
wr::ToBorderSide(kListBoxSidesAndBottomBorderColor, StyleBorderStyle::Solid),
};
wr::BorderRadius borderRadius = wr::EmptyBorderRadius();