--- a/dom/base/DOMIntersectionObserver.cpp
+++ b/dom/base/DOMIntersectionObserver.cpp
@@ -285,17 +285,17 @@ DOMIntersectionObserver::Update(nsIDocum
nsIScrollableFrame* scrollFrame = do_QueryFrame(rootFrame);
rootRect = scrollFrame->GetScrollPortRect();
}
}
}
nsMargin rootMargin;
NS_FOR_CSS_SIDES(side) {
- nscoord basis = side == NS_SIDE_TOP || side == NS_SIDE_BOTTOM ?
+ nscoord basis = side == eSideTop || side == eSideBottom ?
rootRect.height : rootRect.width;
nsCSSValue value = mRootMargin.*nsCSSRect::sides[side];
nsStyleCoord coord;
if (value.IsPixelLengthUnit()) {
coord.SetCoordValue(value.GetPixelLength());
} else if (value.IsPercentLengthUnit()) {
coord.SetPercentValue(value.GetPercentValue());
} else {
--- a/dom/html/nsGenericHTMLElement.cpp
+++ b/dom/html/nsGenericHTMLElement.cpp
@@ -337,18 +337,18 @@ nsGenericHTMLElement::GetOffsetRect(CSSI
}
}
}
// Subtract the parent border unless it uses border-box sizing.
if (parent &&
parent->StylePosition()->mBoxSizing != StyleBoxSizing::Border) {
const nsStyleBorder* border = parent->StyleBorder();
- origin.x -= border->GetComputedBorderWidth(NS_SIDE_LEFT);
- origin.y -= border->GetComputedBorderWidth(NS_SIDE_TOP);
+ origin.x -= border->GetComputedBorderWidth(eSideLeft);
+ origin.y -= border->GetComputedBorderWidth(eSideTop);
}
// XXX We should really consider subtracting out padding for
// content-box sizing, but we should see what IE does....
// Get the union of all rectangles in this and continuation frames.
// It doesn't really matter what we use as aRelativeTo here, since
// we only care about the size. We just have to use something non-null.
--- a/gfx/2d/BaseRect.h
+++ b/gfx/2d/BaseRect.h
@@ -325,29 +325,29 @@ struct BaseRect {
case RectCorner::TopRight: return TopRight();
case RectCorner::BottomRight: return BottomRight();
case RectCorner::BottomLeft: return BottomLeft();
}
MOZ_CRASH("GFX: Incomplete switch");
}
Point CCWCorner(mozilla::Side side) const {
switch (side) {
- case NS_SIDE_TOP: return TopLeft();
- case NS_SIDE_RIGHT: return TopRight();
- case NS_SIDE_BOTTOM: return BottomRight();
- case NS_SIDE_LEFT: return BottomLeft();
+ case eSideTop: return TopLeft();
+ case eSideRight: return TopRight();
+ case eSideBottom: return BottomRight();
+ case eSideLeft: return BottomLeft();
}
MOZ_CRASH("GFX: Incomplete switch");
}
Point CWCorner(mozilla::Side side) const {
switch (side) {
- case NS_SIDE_TOP: return TopRight();
- case NS_SIDE_RIGHT: return BottomRight();
- case NS_SIDE_BOTTOM: return BottomLeft();
- case NS_SIDE_LEFT: return TopLeft();
+ case eSideTop: return TopRight();
+ case eSideRight: return BottomRight();
+ case eSideBottom: return BottomLeft();
+ case eSideLeft: return TopLeft();
}
MOZ_CRASH("GFX: Incomplete switch");
}
Point Center() const { return Point(x, y) + Point(width, height)/2; }
SizeT Size() const { return SizeT(width, height); }
T Area() const { return width * height; }
@@ -358,20 +358,20 @@ struct BaseRect {
T Height() const { return height; }
T XMost() const { return x + width; }
T YMost() const { return y + height; }
// Get the coordinate of the edge on the given side.
T Edge(mozilla::Side aSide) const
{
switch (aSide) {
- case NS_SIDE_TOP: return Y();
- case NS_SIDE_RIGHT: return XMost();
- case NS_SIDE_BOTTOM: return YMost();
- case NS_SIDE_LEFT: return X();
+ case eSideTop: return Y();
+ case eSideRight: return XMost();
+ case eSideBottom: return YMost();
+ case eSideLeft: return X();
}
MOZ_CRASH("GFX: Incomplete switch");
}
// Moves one edge of the rect without moving the opposite edge.
void SetLeftEdge(T aX) {
MOZ_ASSERT(aX <= XMost());
width = XMost() - aX;
--- a/gfx/2d/Types.h
+++ b/gfx/2d/Types.h
@@ -3,17 +3,16 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef MOZILLA_GFX_TYPES_H_
#define MOZILLA_GFX_TYPES_H_
#include "mozilla/EndianUtils.h"
#include "mozilla/MacroArgs.h" // for MOZ_CONCAT
-#include "nsDebug.h"
#include <stddef.h>
#include <stdint.h>
namespace mozilla {
namespace gfx {
typedef float Float;
@@ -394,34 +393,29 @@ enum SideBits {
eSideBitsRight = 1 << eSideRight,
eSideBitsBottom = 1 << eSideBottom,
eSideBitsLeft = 1 << eSideLeft,
eSideBitsTopBottom = eSideBitsTop | eSideBitsBottom,
eSideBitsLeftRight = eSideBitsLeft | eSideBitsRight,
eSideBitsAll = eSideBitsTopBottom | eSideBitsLeftRight
};
-#define NS_SIDE_TOP mozilla::eSideTop
-#define NS_SIDE_RIGHT mozilla::eSideRight
-#define NS_SIDE_BOTTOM mozilla::eSideBottom
-#define NS_SIDE_LEFT mozilla::eSideLeft
-
// Creates a for loop that walks over the four mozilla::Side values.
// We use an int32_t helper variable (instead of a Side) for our loop counter,
// to avoid triggering undefined behavior just before we exit the loop (at
// which point the counter is incremented beyond the largest valid Side value).
#define NS_FOR_CSS_SIDES(var_) \
- int32_t MOZ_CONCAT(var_,__LINE__) = NS_SIDE_TOP; \
+ int32_t MOZ_CONCAT(var_,__LINE__) = mozilla::eSideTop; \
for (mozilla::Side var_; \
- MOZ_CONCAT(var_,__LINE__) <= NS_SIDE_LEFT && \
+ MOZ_CONCAT(var_,__LINE__) <= mozilla::eSideLeft && \
((var_ = mozilla::Side(MOZ_CONCAT(var_,__LINE__))), true); \
MOZ_CONCAT(var_,__LINE__)++)
static inline Side operator++(Side& side, int) {
- NS_PRECONDITION(side >= NS_SIDE_TOP &&
- side <= NS_SIDE_LEFT, "Out of range side");
- side = Side(side + 1);
- return side;
+ MOZ_ASSERT(side >= eSideTop && side <= eSideLeft,
+ "Out of range side");
+ side = Side(side + 1);
+ return side;
}
} // namespace mozilla
#endif /* MOZILLA_GFX_TYPES_H_ */
--- a/gfx/src/nsRect.cpp
+++ b/gfx/src/nsRect.cpp
@@ -1,24 +1,24 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsRect.h"
-#include "mozilla/gfx/Types.h" // for NS_SIDE_BOTTOM, etc
+#include "mozilla/gfx/Types.h" // for eSideBottom, etc
#include "mozilla/CheckedInt.h" // for CheckedInt
#include "nsDeviceContext.h" // for nsDeviceContext
#include "nsString.h" // for nsAutoString, etc
#include "nsMargin.h" // for nsMargin
-static_assert((int(NS_SIDE_TOP) == 0) &&
- (int(NS_SIDE_RIGHT) == 1) &&
- (int(NS_SIDE_BOTTOM) == 2) &&
- (int(NS_SIDE_LEFT) == 3),
+static_assert((int(eSideTop) == 0) &&
+ (int(eSideRight) == 1) &&
+ (int(eSideBottom) == 2) &&
+ (int(eSideLeft) == 3),
"The mozilla::Side sequence must match the nsMargin nscoord sequence");
const mozilla::gfx::IntRect& GetMaxSizedIntRect() {
static const mozilla::gfx::IntRect r(0, 0, INT32_MAX, INT32_MAX);
return r;
}
--- a/gfx/thebes/gfxRect.h
+++ b/gfx/thebes/gfxRect.h
@@ -85,30 +85,30 @@ struct gfxRect :
NS_ERROR("Invalid corner!");
break;
}
return gfxPoint(0.0, 0.0);
}
gfxPoint CCWCorner(mozilla::Side side) const {
switch (side) {
- case NS_SIDE_TOP: return TopLeft();
- case NS_SIDE_RIGHT: return TopRight();
- case NS_SIDE_BOTTOM: return BottomRight();
- case NS_SIDE_LEFT: return BottomLeft();
+ case mozilla::eSideTop: return TopLeft();
+ case mozilla::eSideRight: return TopRight();
+ case mozilla::eSideBottom: return BottomRight();
+ case mozilla::eSideLeft: return BottomLeft();
}
MOZ_CRASH("Incomplete switch");
}
gfxPoint CWCorner(mozilla::Side side) const {
switch (side) {
- case NS_SIDE_TOP: return TopRight();
- case NS_SIDE_RIGHT: return BottomRight();
- case NS_SIDE_BOTTOM: return BottomLeft();
- case NS_SIDE_LEFT: return TopLeft();
+ case mozilla::eSideTop: return TopRight();
+ case mozilla::eSideRight: return BottomRight();
+ case mozilla::eSideBottom: return BottomLeft();
+ case mozilla::eSideLeft: return TopLeft();
}
MOZ_CRASH("Incomplete switch");
}
/* Conditions this border to Cairo's max coordinate space.
* The caller can check IsEmpty() after Condition() -- if it's TRUE,
* the caller can possibly avoid doing any extra rendering.
*/
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -4620,19 +4620,19 @@ GetBSizeTakenByBoxSizing(StyleBoxSizing
const nsStyleBorder* styleBorder = aFrame->StyleBorder();
bSizeTakenByBoxSizing +=
aHorizontalAxis ? styleBorder->GetComputedBorder().TopBottom()
: styleBorder->GetComputedBorder().LeftRight();
if (!aIgnorePadding) {
const nsStyleSides& stylePadding =
aFrame->StylePadding()->mPadding;
const nsStyleCoord& paddingStart =
- stylePadding.Get(aHorizontalAxis ? NS_SIDE_TOP : NS_SIDE_LEFT);
+ stylePadding.Get(aHorizontalAxis ? eSideTop : eSideLeft);
const nsStyleCoord& paddingEnd =
- stylePadding.Get(aHorizontalAxis ? NS_SIDE_BOTTOM : NS_SIDE_RIGHT);
+ stylePadding.Get(aHorizontalAxis ? eSideBottom : eSideRight);
nscoord pad;
// XXXbz Calling GetPercentBSize on padding values looks bogus, since
// percent padding is always a percentage of the inline-size of the
// containing block. We should perhaps just treat non-absolute paddings
// here as 0 instead, except that in some cases the width may in fact be
// known. See bug 1231059.
if (GetAbsoluteCoord(paddingStart, pad) ||
GetPercentBSize(paddingStart, aFrame, aHorizontalAxis, pad)) {
@@ -6708,24 +6708,24 @@ nsLayoutUtils::HasNonZeroCorner(const ns
return true;
}
return false;
}
// aCorner is a "full corner" value, i.e. NS_CORNER_TOP_LEFT etc
static bool IsCornerAdjacentToSide(uint8_t aCorner, Side aSide)
{
- static_assert((int)NS_SIDE_TOP == NS_CORNER_TOP_LEFT, "Check for Full Corner");
- static_assert((int)NS_SIDE_RIGHT == NS_CORNER_TOP_RIGHT, "Check for Full Corner");
- static_assert((int)NS_SIDE_BOTTOM == NS_CORNER_BOTTOM_RIGHT, "Check for Full Corner");
- static_assert((int)NS_SIDE_LEFT == NS_CORNER_BOTTOM_LEFT, "Check for Full Corner");
- static_assert((int)NS_SIDE_TOP == ((NS_CORNER_TOP_RIGHT - 1)&3), "Check for Full Corner");
- static_assert((int)NS_SIDE_RIGHT == ((NS_CORNER_BOTTOM_RIGHT - 1)&3), "Check for Full Corner");
- static_assert((int)NS_SIDE_BOTTOM == ((NS_CORNER_BOTTOM_LEFT - 1)&3), "Check for Full Corner");
- static_assert((int)NS_SIDE_LEFT == ((NS_CORNER_TOP_LEFT - 1)&3), "Check for Full Corner");
+ static_assert((int)eSideTop == NS_CORNER_TOP_LEFT, "Check for Full Corner");
+ static_assert((int)eSideRight == NS_CORNER_TOP_RIGHT, "Check for Full Corner");
+ static_assert((int)eSideBottom == NS_CORNER_BOTTOM_RIGHT, "Check for Full Corner");
+ static_assert((int)eSideLeft == NS_CORNER_BOTTOM_LEFT, "Check for Full Corner");
+ static_assert((int)eSideTop == ((NS_CORNER_TOP_RIGHT - 1)&3), "Check for Full Corner");
+ static_assert((int)eSideRight == ((NS_CORNER_BOTTOM_RIGHT - 1)&3), "Check for Full Corner");
+ static_assert((int)eSideBottom == ((NS_CORNER_BOTTOM_LEFT - 1)&3), "Check for Full Corner");
+ static_assert((int)eSideLeft == ((NS_CORNER_TOP_LEFT - 1)&3), "Check for Full Corner");
return aSide == aCorner || aSide == ((aCorner - 1)&3);
}
/* static */ bool
nsLayoutUtils::HasNonZeroCornerOnSide(const nsStyleCorners& aCorners,
Side aSide)
{
--- a/layout/generic/WritingModes.h
+++ b/layout/generic/WritingModes.h
@@ -320,20 +320,20 @@ public:
static mozilla::Side PhysicalSideForBlockAxis(uint8_t aWritingModeValue,
LogicalEdge aEdge)
{
// indexes are NS_STYLE_WRITING_MODE_* values, which are the same as these
// two-bit values:
// bit 0 = the eOrientationMask value
// bit 1 = the eBlockFlowMask value
static const mozilla::Side kLogicalBlockSides[][2] = {
- { NS_SIDE_TOP, NS_SIDE_BOTTOM }, // horizontal-tb
- { NS_SIDE_RIGHT, NS_SIDE_LEFT }, // vertical-rl
- { NS_SIDE_BOTTOM, NS_SIDE_TOP }, // (horizontal-bt)
- { NS_SIDE_LEFT, NS_SIDE_RIGHT }, // vertical-lr
+ { eSideTop, eSideBottom }, // horizontal-tb
+ { eSideRight, eSideLeft }, // vertical-rl
+ { eSideBottom, eSideTop }, // (horizontal-bt)
+ { eSideLeft, eSideRight }, // vertical-lr
};
// Ignore the SIDEWAYS_MASK bit of the writing-mode value, as this has no
// effect on the side mappings.
aWritingModeValue &= ~NS_STYLE_WRITING_MODE_SIDEWAYS_MASK;
// What's left of the writing-mode should be in the range 0-3:
NS_ASSERTION(aWritingModeValue < 4, "invalid aWritingModeValue value");
@@ -348,32 +348,32 @@ public:
// bit 1 = the eInlineFlowMask value
// bit 2 = the eBlockFlowMask value
// bit 3 = the eLineOrientMask value
// Not all of these combinations can actually be specified via CSS: there
// is no horizontal-bt writing-mode, and no text-orientation value that
// produces "inverted" text. (The former 'sideways-left' value, no longer
// in the spec, would have produced this in vertical-rl mode.)
static const mozilla::Side kLogicalInlineSides[][2] = {
- { NS_SIDE_LEFT, NS_SIDE_RIGHT }, // horizontal-tb ltr
- { NS_SIDE_TOP, NS_SIDE_BOTTOM }, // vertical-rl ltr
- { NS_SIDE_RIGHT, NS_SIDE_LEFT }, // horizontal-tb rtl
- { NS_SIDE_BOTTOM, NS_SIDE_TOP }, // vertical-rl rtl
- { NS_SIDE_RIGHT, NS_SIDE_LEFT }, // (horizontal-bt) (inverted) ltr
- { NS_SIDE_TOP, NS_SIDE_BOTTOM }, // sideways-lr rtl
- { NS_SIDE_LEFT, NS_SIDE_RIGHT }, // (horizontal-bt) (inverted) rtl
- { NS_SIDE_BOTTOM, NS_SIDE_TOP }, // sideways-lr ltr
- { NS_SIDE_LEFT, NS_SIDE_RIGHT }, // horizontal-tb (inverted) rtl
- { NS_SIDE_TOP, NS_SIDE_BOTTOM }, // vertical-rl (inverted) rtl
- { NS_SIDE_RIGHT, NS_SIDE_LEFT }, // horizontal-tb (inverted) ltr
- { NS_SIDE_BOTTOM, NS_SIDE_TOP }, // vertical-rl (inverted) ltr
- { NS_SIDE_LEFT, NS_SIDE_RIGHT }, // (horizontal-bt) ltr
- { NS_SIDE_TOP, NS_SIDE_BOTTOM }, // vertical-lr ltr
- { NS_SIDE_RIGHT, NS_SIDE_LEFT }, // (horizontal-bt) rtl
- { NS_SIDE_BOTTOM, NS_SIDE_TOP }, // vertical-lr rtl
+ { eSideLeft, eSideRight }, // horizontal-tb ltr
+ { eSideTop, eSideBottom }, // vertical-rl ltr
+ { eSideRight, eSideLeft }, // horizontal-tb rtl
+ { eSideBottom, eSideTop }, // vertical-rl rtl
+ { eSideRight, eSideLeft }, // (horizontal-bt) (inverted) ltr
+ { eSideTop, eSideBottom }, // sideways-lr rtl
+ { eSideLeft, eSideRight }, // (horizontal-bt) (inverted) rtl
+ { eSideBottom, eSideTop }, // sideways-lr ltr
+ { eSideLeft, eSideRight }, // horizontal-tb (inverted) rtl
+ { eSideTop, eSideBottom }, // vertical-rl (inverted) rtl
+ { eSideRight, eSideLeft }, // horizontal-tb (inverted) ltr
+ { eSideBottom, eSideTop }, // vertical-rl (inverted) ltr
+ { eSideLeft, eSideRight }, // (horizontal-bt) ltr
+ { eSideTop, eSideBottom }, // vertical-lr ltr
+ { eSideRight, eSideLeft }, // (horizontal-bt) rtl
+ { eSideBottom, eSideTop }, // vertical-lr rtl
};
// Inline axis sides depend on all three of writing-mode, text-orientation
// and direction, which are encoded in the eOrientationMask,
// eInlineFlowMask, eBlockFlowMask and eLineOrientMask bits. Use these four
// bits to index into kLogicalInlineSides.
static_assert(eOrientationMask == 0x01 && eInlineFlowMask == 0x02 &&
eBlockFlowMask == 0x04 && eLineOrientMask == 0x08,
--- a/layout/generic/nsColumnSetFrame.cpp
+++ b/layout/generic/nsColumnSetFrame.cpp
@@ -88,24 +88,24 @@ nsColumnSetFrame::PaintColumnRule(nsRend
// In order to re-use a large amount of code, we treat the column rule as a border.
// We create a new border style object and fill in all the details of the column rule as
// the left border. PaintBorder() does all the rendering for us, so we not
// only save an enormous amount of code but we'll support all the line styles that
// we support on borders!
nsStyleBorder border(presContext);
Sides skipSides;
if (isVertical) {
- border.SetBorderWidth(NS_SIDE_TOP, ruleWidth);
- border.SetBorderStyle(NS_SIDE_TOP, ruleStyle);
+ border.SetBorderWidth(eSideTop, ruleWidth);
+ border.SetBorderStyle(eSideTop, ruleStyle);
border.mBorderTopColor = StyleComplexColor::FromColor(ruleColor);
skipSides |= mozilla::eSideBitsLeftRight;
skipSides |= mozilla::eSideBitsBottom;
} else {
- border.SetBorderWidth(NS_SIDE_LEFT, ruleWidth);
- border.SetBorderStyle(NS_SIDE_LEFT, ruleStyle);
+ border.SetBorderWidth(eSideLeft, ruleWidth);
+ border.SetBorderStyle(eSideLeft, ruleStyle);
border.mBorderLeftColor = StyleComplexColor::FromColor(ruleColor);
skipSides |= mozilla::eSideBitsTopBottom;
skipSides |= mozilla::eSideBitsRight;
}
// Get our content rect as an absolute coordinate, not relative to
// our parent (which is what the X and Y normally is)
nsRect contentRect = GetContentRect() - GetRect().TopLeft() + aPt;
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -4627,21 +4627,21 @@ IntrinsicSizeOffsets(nsIFrame* aFrame, b
true);
AddCoord(verticalAxis ? stylePadding->mPadding.GetBottom()
: stylePadding->mPadding.GetRight(),
aFrame, &result.hPadding, &result.hPctPadding,
true);
const nsStyleBorder* styleBorder = aFrame->StyleBorder();
if (verticalAxis) {
- result.hBorder += styleBorder->GetComputedBorderWidth(NS_SIDE_TOP);
- result.hBorder += styleBorder->GetComputedBorderWidth(NS_SIDE_BOTTOM);
+ result.hBorder += styleBorder->GetComputedBorderWidth(eSideTop);
+ result.hBorder += styleBorder->GetComputedBorderWidth(eSideBottom);
} else {
- result.hBorder += styleBorder->GetComputedBorderWidth(NS_SIDE_LEFT);
- result.hBorder += styleBorder->GetComputedBorderWidth(NS_SIDE_RIGHT);
+ result.hBorder += styleBorder->GetComputedBorderWidth(eSideLeft);
+ result.hBorder += styleBorder->GetComputedBorderWidth(eSideRight);
}
const nsStyleDisplay* disp = aFrame->StyleDisplay();
if (aFrame->IsThemed(disp)) {
nsPresContext* presContext = aFrame->PresContext();
nsIntMargin border;
presContext->GetTheme()->GetWidgetBorder(presContext->DeviceContext(),
--- a/layout/generic/nsInlineFrame.cpp
+++ b/layout/generic/nsInlineFrame.cpp
@@ -111,30 +111,30 @@ nsInlineFrame::IsSelfEmpty()
// ZeroEffectiveSpanBox, anymore, so what should this really be?
WritingMode wm = GetWritingMode();
bool haveStart, haveEnd;
// Initially set up haveStart and haveEnd in terms of visual (LTR/TTB)
// coordinates; we'll exchange them later if bidi-RTL is in effect to
// get logical start and end flags.
if (wm.IsVertical()) {
haveStart =
- border->GetComputedBorderWidth(NS_SIDE_TOP) != 0 ||
+ border->GetComputedBorderWidth(eSideTop) != 0 ||
!nsLayoutUtils::IsPaddingZero(padding->mPadding.GetTop()) ||
!IsMarginZero(margin->mMargin.GetTop());
haveEnd =
- border->GetComputedBorderWidth(NS_SIDE_BOTTOM) != 0 ||
+ border->GetComputedBorderWidth(eSideBottom) != 0 ||
!nsLayoutUtils::IsPaddingZero(padding->mPadding.GetBottom()) ||
!IsMarginZero(margin->mMargin.GetBottom());
} else {
haveStart =
- border->GetComputedBorderWidth(NS_SIDE_LEFT) != 0 ||
+ border->GetComputedBorderWidth(eSideLeft) != 0 ||
!nsLayoutUtils::IsPaddingZero(padding->mPadding.GetLeft()) ||
!IsMarginZero(margin->mMargin.GetLeft());
haveEnd =
- border->GetComputedBorderWidth(NS_SIDE_RIGHT) != 0 ||
+ border->GetComputedBorderWidth(eSideRight) != 0 ||
!nsLayoutUtils::IsPaddingZero(padding->mPadding.GetRight()) ||
!IsMarginZero(margin->mMargin.GetRight());
}
if (haveStart || haveEnd) {
// We skip this block and return false for box-decoration-break:clone since
// in that case all the continuations will have the border/padding/margin.
if ((GetStateBits() & NS_FRAME_PART_OF_IBSPLIT) &&
StyleBorder()->mBoxDecorationBreak == StyleBoxDecorationBreak::Slice) {
--- a/layout/generic/nsLineLayout.cpp
+++ b/layout/generic/nsLineLayout.cpp
@@ -753,18 +753,18 @@ IsPercentageAware(const nsIFrame* aFrame
// Note that borders can't be aware of percentages
const nsStylePosition* pos = aFrame->StylePosition();
if ((pos->WidthDependsOnContainer() &&
pos->mWidth.GetUnit() != eStyleUnit_Auto) ||
pos->MaxWidthDependsOnContainer() ||
pos->MinWidthDependsOnContainer() ||
- pos->OffsetHasPercent(NS_SIDE_RIGHT) ||
- pos->OffsetHasPercent(NS_SIDE_LEFT)) {
+ pos->OffsetHasPercent(eSideRight) ||
+ pos->OffsetHasPercent(eSideLeft)) {
return true;
}
if (eStyleUnit_Auto == pos->mWidth.GetUnit()) {
// We need to check for frames that shrink-wrap when they're auto
// width.
const nsStyleDisplay* disp = aFrame->StyleDisplay();
if (disp->mDisplay == StyleDisplay::InlineBlock ||
--- a/layout/generic/nsPageContentFrame.cpp
+++ b/layout/generic/nsPageContentFrame.cpp
@@ -74,17 +74,17 @@ nsPageContentFrame::Reflow(nsPresContext
// make the content that ought to be reachable (represented by the
// scrollable overflow) fit in the page.
if (frame->HasOverflowAreas()) {
// The background covers the content area and padding area, so check
// for children sticking outside the child frame's padding edge
nscoord xmost = aDesiredSize.ScrollableOverflow().XMost();
if (xmost > aDesiredSize.Width()) {
nscoord widthToFit = xmost + padding.right +
- kidReflowInput.mStyleBorder->GetComputedBorderWidth(NS_SIDE_RIGHT);
+ kidReflowInput.mStyleBorder->GetComputedBorderWidth(eSideRight);
float ratio = float(maxSize.width) / widthToFit;
NS_ASSERTION(ratio >= 0.0 && ratio < 1.0, "invalid shrink-to-fit ratio");
mPD->mShrinkToFitRatio = std::min(mPD->mShrinkToFitRatio, ratio);
}
}
// Place and size the child
FinishReflowChild(frame, aPresContext, aDesiredSize, &kidReflowInput, 0, 0, 0);
--- a/layout/mathml/nsMathMLmtableFrame.cpp
+++ b/layout/mathml/nsMathMLmtableFrame.cpp
@@ -199,38 +199,38 @@ ApplyBorderToStyle(const nsMathMLmtdFram
FindCellProperty(aFrame, ColumnLinesProperty());
// We don't place a row line on top of the first row
if (rowIndex > 0 && rowLinesList) {
// If the row number is greater than the number of provided rowline
// values, we simply repeat the last value.
int32_t listLength = rowLinesList->Length();
if (rowIndex < listLength) {
- aStyleBorder.SetBorderStyle(NS_SIDE_TOP,
+ aStyleBorder.SetBorderStyle(eSideTop,
rowLinesList->ElementAt(rowIndex - 1));
} else {
- aStyleBorder.SetBorderStyle(NS_SIDE_TOP,
+ aStyleBorder.SetBorderStyle(eSideTop,
rowLinesList->ElementAt(listLength - 1));
}
- aStyleBorder.SetBorderWidth(NS_SIDE_TOP, borderWidth);
+ aStyleBorder.SetBorderWidth(eSideTop, borderWidth);
}
// We don't place a column line on the left of the first column.
if (columnIndex > 0 && columnLinesList) {
// If the column number is greater than the number of provided columline
// values, we simply repeat the last value.
int32_t listLength = columnLinesList->Length();
if (columnIndex < listLength) {
- aStyleBorder.SetBorderStyle(NS_SIDE_LEFT,
+ aStyleBorder.SetBorderStyle(eSideLeft,
columnLinesList->ElementAt(columnIndex - 1));
} else {
- aStyleBorder.SetBorderStyle(NS_SIDE_LEFT,
+ aStyleBorder.SetBorderStyle(eSideLeft,
columnLinesList->ElementAt(listLength - 1));
}
- aStyleBorder.SetBorderWidth(NS_SIDE_LEFT, borderWidth);
+ aStyleBorder.SetBorderWidth(eSideLeft, borderWidth);
}
}
static nsMargin
ComputeBorderOverflow(nsMathMLmtdFrame* aFrame,
const nsStyleBorder& aStyleBorder)
{
nsMargin overflow;
--- a/layout/painting/BorderConsts.h
+++ b/layout/painting/BorderConsts.h
@@ -6,20 +6,20 @@
#ifndef mozilla_BorderConsts_h_
#define mozilla_BorderConsts_h_
// thickness of dashed line relative to dotted line
#define DOT_LENGTH 1 // square
#define DASH_LENGTH 3 // 3 times longer than dot
// some shorthand for side bits
-#define SIDE_BIT_TOP (1 << NS_SIDE_TOP)
-#define SIDE_BIT_RIGHT (1 << NS_SIDE_RIGHT)
-#define SIDE_BIT_BOTTOM (1 << NS_SIDE_BOTTOM)
-#define SIDE_BIT_LEFT (1 << NS_SIDE_LEFT)
+#define SIDE_BIT_TOP (1 << eSideTop)
+#define SIDE_BIT_RIGHT (1 << eSideRight)
+#define SIDE_BIT_BOTTOM (1 << eSideBottom)
+#define SIDE_BIT_LEFT (1 << eSideLeft)
#define SIDE_BITS_ALL (SIDE_BIT_TOP|SIDE_BIT_RIGHT|SIDE_BIT_BOTTOM|SIDE_BIT_LEFT)
#define C_TL NS_CORNER_TOP_LEFT
#define C_TR NS_CORNER_TOP_RIGHT
#define C_BR NS_CORNER_BOTTOM_RIGHT
#define C_BL NS_CORNER_BOTTOM_LEFT
#define BORDER_SEGMENT_COUNT_MAX 100
--- a/layout/painting/nsCSSRendering.cpp
+++ b/layout/painting/nsCSSRendering.cpp
@@ -471,34 +471,34 @@ MakeBevelColor(mozilla::Side whichSide,
// Given a background color and a border color
// calculate the color used for the shading
NS_GetSpecial3DColors(colors, aBackgroundColor, aBorderColor);
if ((style == NS_STYLE_BORDER_STYLE_OUTSET) ||
(style == NS_STYLE_BORDER_STYLE_RIDGE)) {
// Flip colors for these two border styles
switch (whichSide) {
- case NS_SIDE_BOTTOM: whichSide = NS_SIDE_TOP; break;
- case NS_SIDE_RIGHT: whichSide = NS_SIDE_LEFT; break;
- case NS_SIDE_TOP: whichSide = NS_SIDE_BOTTOM; break;
- case NS_SIDE_LEFT: whichSide = NS_SIDE_RIGHT; break;
+ case eSideBottom: whichSide = eSideTop; break;
+ case eSideRight: whichSide = eSideLeft; break;
+ case eSideTop: whichSide = eSideBottom; break;
+ case eSideLeft: whichSide = eSideRight; break;
}
}
switch (whichSide) {
- case NS_SIDE_BOTTOM:
+ case eSideBottom:
theColor = colors[1];
break;
- case NS_SIDE_RIGHT:
+ case eSideRight:
theColor = colors[1];
break;
- case NS_SIDE_TOP:
+ case eSideTop:
theColor = colors[0];
break;
- case NS_SIDE_LEFT:
+ case eSideLeft:
default:
theColor = colors[0];
break;
}
return theColor;
}
static bool
@@ -1479,20 +1479,20 @@ nsCSSRendering::PaintBoxShadowOuter(nsPr
aDrawTarget));
RectCornerRadii clipRectRadii;
if (hasBorderRadius) {
Float spreadDistance = shadowItem->mSpread / twipsPerPixel;
Float borderSizes[4];
- borderSizes[NS_SIDE_LEFT] = spreadDistance;
- borderSizes[NS_SIDE_TOP] = spreadDistance;
- borderSizes[NS_SIDE_RIGHT] = spreadDistance;
- borderSizes[NS_SIDE_BOTTOM] = spreadDistance;
+ borderSizes[eSideLeft] = spreadDistance;
+ borderSizes[eSideTop] = spreadDistance;
+ borderSizes[eSideRight] = spreadDistance;
+ borderSizes[eSideBottom] = spreadDistance;
nsCSSBorderRenderer::ComputeOuterRadii(borderRadii, borderSizes,
&clipRectRadii);
}
nsContextBoxBlur::BlurRectangle(renderContext,
shadowRect,
twipsPerPixel,
@@ -1591,29 +1591,29 @@ nsCSSRendering::PaintBoxShadowInner(nsPr
RectCornerRadii clipRectRadii;
if (hasBorderRadius) {
// Calculate the radii the inner clipping rect will have
Float borderSizes[4] = {0, 0, 0, 0};
// See PaintBoxShadowOuter and bug 514670
if (innerRadii[C_TL].width > 0 || innerRadii[C_BL].width > 0) {
- borderSizes[NS_SIDE_LEFT] = spreadDistance;
+ borderSizes[eSideLeft] = spreadDistance;
}
if (innerRadii[C_TL].height > 0 || innerRadii[C_TR].height > 0) {
- borderSizes[NS_SIDE_TOP] = spreadDistance;
+ borderSizes[eSideTop] = spreadDistance;
}
if (innerRadii[C_TR].width > 0 || innerRadii[C_BR].width > 0) {
- borderSizes[NS_SIDE_RIGHT] = spreadDistance;
+ borderSizes[eSideRight] = spreadDistance;
}
if (innerRadii[C_BL].height > 0 || innerRadii[C_BR].height > 0) {
- borderSizes[NS_SIDE_BOTTOM] = spreadDistance;
+ borderSizes[eSideBottom] = spreadDistance;
}
nsCSSBorderRenderer::ComputeInnerRadii(innerRadii, borderSizes,
&clipRectRadii);
}
// Set the "skip rect" to the area within the frame that we don't paint in,
// including after blurring.
@@ -4170,42 +4170,42 @@ DrawSolidBorderSegment(DrawTarget&
// polygon with beveling
Point poly[4];
SetPoly(NSRectToSnappedRect(aRect, aAppUnitsPerDevPixel, aDrawTarget),
poly);
Float startBevelOffset =
NSAppUnitsToFloatPixels(aStartBevelOffset, aAppUnitsPerDevPixel);
switch(aStartBevelSide) {
- case NS_SIDE_TOP:
+ case eSideTop:
poly[0].x += startBevelOffset;
break;
- case NS_SIDE_BOTTOM:
+ case eSideBottom:
poly[3].x += startBevelOffset;
break;
- case NS_SIDE_RIGHT:
+ case eSideRight:
poly[1].y += startBevelOffset;
break;
- case NS_SIDE_LEFT:
+ case eSideLeft:
poly[0].y += startBevelOffset;
}
Float endBevelOffset =
NSAppUnitsToFloatPixels(aEndBevelOffset, aAppUnitsPerDevPixel);
switch(aEndBevelSide) {
- case NS_SIDE_TOP:
+ case eSideTop:
poly[1].x -= endBevelOffset;
break;
- case NS_SIDE_BOTTOM:
+ case eSideBottom:
poly[2].x -= endBevelOffset;
break;
- case NS_SIDE_RIGHT:
+ case eSideRight:
poly[2].y -= endBevelOffset;
break;
- case NS_SIDE_LEFT:
+ case eSideLeft:
poly[3].y -= endBevelOffset;
}
RefPtr<PathBuilder> builder = aDrawTarget.CreatePathBuilder();
builder->MoveTo(poly[0]);
builder->LineTo(poly[1]);
builder->LineTo(poly[2]);
builder->LineTo(poly[3]);
@@ -4247,17 +4247,17 @@ nsCSSRendering::DrawTableBorderSegment(D
const nsRect& aBorder,
int32_t aAppUnitsPerDevPixel,
int32_t aAppUnitsPerCSSPixel,
uint8_t aStartBevelSide,
nscoord aStartBevelOffset,
uint8_t aEndBevelSide,
nscoord aEndBevelOffset)
{
- bool horizontal = ((NS_SIDE_TOP == aStartBevelSide) || (NS_SIDE_BOTTOM == aStartBevelSide));
+ bool horizontal = ((eSideTop == aStartBevelSide) || (eSideBottom == aStartBevelSide));
nscoord twipsPerPixel = NSIntPixelsToAppUnits(1, aAppUnitsPerCSSPixel);
uint8_t ridgeGroove = NS_STYLE_BORDER_STYLE_RIDGE;
if ((twipsPerPixel >= aBorder.width) || (twipsPerPixel >= aBorder.height) ||
(NS_STYLE_BORDER_STYLE_DASHED == aBorderStyle) || (NS_STYLE_BORDER_STYLE_DOTTED == aBorderStyle)) {
// no beveling for 1 pixel border, dash or dot
aStartBevelOffset = 0;
aEndBevelOffset = 0;
@@ -4331,84 +4331,84 @@ nsCSSRendering::DrawTableBorderSegment(D
aStartBevelSide, aStartBevelOffset,
aEndBevelSide, aEndBevelOffset);
}
else {
nscoord startBevel = (aStartBevelOffset > 0)
? RoundFloatToPixel(0.5f * (float)aStartBevelOffset, twipsPerPixel, true) : 0;
nscoord endBevel = (aEndBevelOffset > 0)
? RoundFloatToPixel(0.5f * (float)aEndBevelOffset, twipsPerPixel, true) : 0;
- mozilla::Side ridgeGrooveSide = (horizontal) ? NS_SIDE_TOP : NS_SIDE_LEFT;
+ mozilla::Side ridgeGrooveSide = (horizontal) ? eSideTop : eSideLeft;
// FIXME: In theory, this should use the visited-dependent
// background color, but I don't care.
nscolor bevelColor = MakeBevelColor(ridgeGrooveSide, ridgeGroove,
aBGColor->mBackgroundColor,
aBorderColor);
nsRect rect(aBorder);
nscoord half;
if (horizontal) { // top, bottom
half = RoundFloatToPixel(0.5f * (float)aBorder.height, twipsPerPixel);
rect.height = half;
- if (NS_SIDE_TOP == aStartBevelSide) {
+ if (eSideTop == aStartBevelSide) {
rect.x += startBevel;
rect.width -= startBevel;
}
- if (NS_SIDE_TOP == aEndBevelSide) {
+ if (eSideTop == aEndBevelSide) {
rect.width -= endBevel;
}
DrawSolidBorderSegment(aDrawTarget, rect, bevelColor,
aAppUnitsPerDevPixel, twipsPerPixel,
aStartBevelSide, startBevel, aEndBevelSide,
endBevel);
}
else { // left, right
half = RoundFloatToPixel(0.5f * (float)aBorder.width, twipsPerPixel);
rect.width = half;
- if (NS_SIDE_LEFT == aStartBevelSide) {
+ if (eSideLeft == aStartBevelSide) {
rect.y += startBevel;
rect.height -= startBevel;
}
- if (NS_SIDE_LEFT == aEndBevelSide) {
+ if (eSideLeft == aEndBevelSide) {
rect.height -= endBevel;
}
DrawSolidBorderSegment(aDrawTarget, rect, bevelColor,
aAppUnitsPerDevPixel, twipsPerPixel,
aStartBevelSide, startBevel, aEndBevelSide,
endBevel);
}
rect = aBorder;
- ridgeGrooveSide = (NS_SIDE_TOP == ridgeGrooveSide) ? NS_SIDE_BOTTOM : NS_SIDE_RIGHT;
+ ridgeGrooveSide = (eSideTop == ridgeGrooveSide) ? eSideBottom : eSideRight;
// FIXME: In theory, this should use the visited-dependent
// background color, but I don't care.
bevelColor = MakeBevelColor(ridgeGrooveSide, ridgeGroove,
aBGColor->mBackgroundColor, aBorderColor);
if (horizontal) {
rect.y = rect.y + half;
rect.height = aBorder.height - half;
- if (NS_SIDE_BOTTOM == aStartBevelSide) {
+ if (eSideBottom == aStartBevelSide) {
rect.x += startBevel;
rect.width -= startBevel;
}
- if (NS_SIDE_BOTTOM == aEndBevelSide) {
+ if (eSideBottom == aEndBevelSide) {
rect.width -= endBevel;
}
DrawSolidBorderSegment(aDrawTarget, rect, bevelColor,
aAppUnitsPerDevPixel, twipsPerPixel,
aStartBevelSide, startBevel, aEndBevelSide,
endBevel);
}
else {
rect.x = rect.x + half;
rect.width = aBorder.width - half;
- if (NS_SIDE_RIGHT == aStartBevelSide) {
+ if (eSideRight == aStartBevelSide) {
rect.y += aStartBevelOffset - startBevel;
rect.height -= startBevel;
}
- if (NS_SIDE_RIGHT == aEndBevelSide) {
+ if (eSideRight == aEndBevelSide) {
rect.height -= endBevel;
}
DrawSolidBorderSegment(aDrawTarget, rect, bevelColor,
aAppUnitsPerDevPixel, twipsPerPixel,
aStartBevelSide, startBevel, aEndBevelSide,
endBevel);
}
}
@@ -4423,66 +4423,66 @@ nsCSSRendering::DrawTableBorderSegment(D
? RoundFloatToPixel(0.333333f * (float)aStartBevelOffset, twipsPerPixel) : 0;
nscoord endBevel = (aEndBevelOffset > 0)
? RoundFloatToPixel(0.333333f * (float)aEndBevelOffset, twipsPerPixel) : 0;
if (horizontal) { // top, bottom
nscoord thirdHeight = RoundFloatToPixel(0.333333f * (float)aBorder.height, twipsPerPixel);
// draw the top line or rect
nsRect topRect(aBorder.x, aBorder.y, aBorder.width, thirdHeight);
- if (NS_SIDE_TOP == aStartBevelSide) {
+ if (eSideTop == aStartBevelSide) {
topRect.x += aStartBevelOffset - startBevel;
topRect.width -= aStartBevelOffset - startBevel;
}
- if (NS_SIDE_TOP == aEndBevelSide) {
+ if (eSideTop == aEndBevelSide) {
topRect.width -= aEndBevelOffset - endBevel;
}
DrawSolidBorderSegment(aDrawTarget, topRect, aBorderColor,
aAppUnitsPerDevPixel, twipsPerPixel,
aStartBevelSide, startBevel, aEndBevelSide,
endBevel);
// draw the botom line or rect
nscoord heightOffset = aBorder.height - thirdHeight;
nsRect bottomRect(aBorder.x, aBorder.y + heightOffset, aBorder.width, aBorder.height - heightOffset);
- if (NS_SIDE_BOTTOM == aStartBevelSide) {
+ if (eSideBottom == aStartBevelSide) {
bottomRect.x += aStartBevelOffset - startBevel;
bottomRect.width -= aStartBevelOffset - startBevel;
}
- if (NS_SIDE_BOTTOM == aEndBevelSide) {
+ if (eSideBottom == aEndBevelSide) {
bottomRect.width -= aEndBevelOffset - endBevel;
}
DrawSolidBorderSegment(aDrawTarget, bottomRect, aBorderColor,
aAppUnitsPerDevPixel, twipsPerPixel,
aStartBevelSide, startBevel, aEndBevelSide,
endBevel);
}
else { // left, right
nscoord thirdWidth = RoundFloatToPixel(0.333333f * (float)aBorder.width, twipsPerPixel);
nsRect leftRect(aBorder.x, aBorder.y, thirdWidth, aBorder.height);
- if (NS_SIDE_LEFT == aStartBevelSide) {
+ if (eSideLeft == aStartBevelSide) {
leftRect.y += aStartBevelOffset - startBevel;
leftRect.height -= aStartBevelOffset - startBevel;
}
- if (NS_SIDE_LEFT == aEndBevelSide) {
+ if (eSideLeft == aEndBevelSide) {
leftRect.height -= aEndBevelOffset - endBevel;
}
DrawSolidBorderSegment(aDrawTarget, leftRect, aBorderColor,
aAppUnitsPerDevPixel, twipsPerPixel,
aStartBevelSide, startBevel, aEndBevelSide,
endBevel);
nscoord widthOffset = aBorder.width - thirdWidth;
nsRect rightRect(aBorder.x + widthOffset, aBorder.y, aBorder.width - widthOffset, aBorder.height);
- if (NS_SIDE_RIGHT == aStartBevelSide) {
+ if (eSideRight == aStartBevelSide) {
rightRect.y += aStartBevelOffset - startBevel;
rightRect.height -= aStartBevelOffset - startBevel;
}
- if (NS_SIDE_RIGHT == aEndBevelSide) {
+ if (eSideRight == aEndBevelSide) {
rightRect.height -= aEndBevelOffset - endBevel;
}
DrawSolidBorderSegment(aDrawTarget, rightRect, aBorderColor,
aAppUnitsPerDevPixel, twipsPerPixel,
aStartBevelSide, startBevel, aEndBevelSide,
endBevel);
}
break;
--- a/layout/painting/nsCSSRenderingBorders.cpp
+++ b/layout/painting/nsCSSRenderingBorders.cpp
@@ -112,23 +112,23 @@ AllCornersZeroSize(const RectCornerRadii
IsZeroSize(corners[NS_CORNER_TOP_RIGHT]) &&
IsZeroSize(corners[NS_CORNER_BOTTOM_RIGHT]) &&
IsZeroSize(corners[NS_CORNER_BOTTOM_LEFT]);
}
static mozilla::Side
GetHorizontalSide(mozilla::css::Corner aCorner)
{
- return (aCorner == C_TL || aCorner == C_TR) ? NS_SIDE_TOP : NS_SIDE_BOTTOM;
+ return (aCorner == C_TL || aCorner == C_TR) ? eSideTop : eSideBottom;
}
static mozilla::Side
GetVerticalSide(mozilla::css::Corner aCorner)
{
- return (aCorner == C_TL || aCorner == C_BL) ? NS_SIDE_LEFT : NS_SIDE_RIGHT;
+ return (aCorner == C_TL || aCorner == C_BL) ? eSideLeft : eSideRight;
}
static mozilla::css::Corner
GetCWCorner(mozilla::Side aSide)
{
return mozilla::css::Corner(NEXT_SIDE(aSide));
}
@@ -143,17 +143,17 @@ IsSingleSide(int aSides)
{
return aSides == SIDE_BIT_TOP || aSides == SIDE_BIT_RIGHT ||
aSides == SIDE_BIT_BOTTOM || aSides == SIDE_BIT_LEFT;
}
static bool
IsHorizontalSide(mozilla::Side aSide)
{
- return aSide == NS_SIDE_TOP || aSide == NS_SIDE_BOTTOM;
+ return aSide == eSideTop || aSide == eSideBottom;
}
typedef enum {
// Normal solid square corner. Will be rectangular, the size of the
// adjacent sides. If the corner has a border radius, the corner
// will always be solid, since we don't do dotted/dashed etc.
CORNER_NORMAL,
@@ -211,70 +211,70 @@ nsCSSBorderRenderer::nsCSSBorderRenderer
/* static */ void
nsCSSBorderRenderer::ComputeInnerRadii(const RectCornerRadii& aRadii,
const Float* aBorderSizes,
RectCornerRadii* aInnerRadiiRet)
{
RectCornerRadii& iRadii = *aInnerRadiiRet;
- iRadii[C_TL].width = std::max(0.f, aRadii[C_TL].width - aBorderSizes[NS_SIDE_LEFT]);
- iRadii[C_TL].height = std::max(0.f, aRadii[C_TL].height - aBorderSizes[NS_SIDE_TOP]);
-
- iRadii[C_TR].width = std::max(0.f, aRadii[C_TR].width - aBorderSizes[NS_SIDE_RIGHT]);
- iRadii[C_TR].height = std::max(0.f, aRadii[C_TR].height - aBorderSizes[NS_SIDE_TOP]);
-
- iRadii[C_BR].width = std::max(0.f, aRadii[C_BR].width - aBorderSizes[NS_SIDE_RIGHT]);
- iRadii[C_BR].height = std::max(0.f, aRadii[C_BR].height - aBorderSizes[NS_SIDE_BOTTOM]);
-
- iRadii[C_BL].width = std::max(0.f, aRadii[C_BL].width - aBorderSizes[NS_SIDE_LEFT]);
- iRadii[C_BL].height = std::max(0.f, aRadii[C_BL].height - aBorderSizes[NS_SIDE_BOTTOM]);
+ iRadii[C_TL].width = std::max(0.f, aRadii[C_TL].width - aBorderSizes[eSideLeft]);
+ iRadii[C_TL].height = std::max(0.f, aRadii[C_TL].height - aBorderSizes[eSideTop]);
+
+ iRadii[C_TR].width = std::max(0.f, aRadii[C_TR].width - aBorderSizes[eSideRight]);
+ iRadii[C_TR].height = std::max(0.f, aRadii[C_TR].height - aBorderSizes[eSideTop]);
+
+ iRadii[C_BR].width = std::max(0.f, aRadii[C_BR].width - aBorderSizes[eSideRight]);
+ iRadii[C_BR].height = std::max(0.f, aRadii[C_BR].height - aBorderSizes[eSideBottom]);
+
+ iRadii[C_BL].width = std::max(0.f, aRadii[C_BL].width - aBorderSizes[eSideLeft]);
+ iRadii[C_BL].height = std::max(0.f, aRadii[C_BL].height - aBorderSizes[eSideBottom]);
}
/* static */ void
nsCSSBorderRenderer::ComputeOuterRadii(const RectCornerRadii& aRadii,
const Float* aBorderSizes,
RectCornerRadii* aOuterRadiiRet)
{
RectCornerRadii& oRadii = *aOuterRadiiRet;
// default all corners to sharp corners
oRadii = RectCornerRadii(0.f);
// round the edges that have radii > 0.0 to start with
if (aRadii[C_TL].width > 0.f && aRadii[C_TL].height > 0.f) {
- oRadii[C_TL].width = std::max(0.f, aRadii[C_TL].width + aBorderSizes[NS_SIDE_LEFT]);
- oRadii[C_TL].height = std::max(0.f, aRadii[C_TL].height + aBorderSizes[NS_SIDE_TOP]);
+ oRadii[C_TL].width = std::max(0.f, aRadii[C_TL].width + aBorderSizes[eSideLeft]);
+ oRadii[C_TL].height = std::max(0.f, aRadii[C_TL].height + aBorderSizes[eSideTop]);
}
if (aRadii[C_TR].width > 0.f && aRadii[C_TR].height > 0.f) {
- oRadii[C_TR].width = std::max(0.f, aRadii[C_TR].width + aBorderSizes[NS_SIDE_RIGHT]);
- oRadii[C_TR].height = std::max(0.f, aRadii[C_TR].height + aBorderSizes[NS_SIDE_TOP]);
+ oRadii[C_TR].width = std::max(0.f, aRadii[C_TR].width + aBorderSizes[eSideRight]);
+ oRadii[C_TR].height = std::max(0.f, aRadii[C_TR].height + aBorderSizes[eSideTop]);
}
if (aRadii[C_BR].width > 0.f && aRadii[C_BR].height > 0.f) {
- oRadii[C_BR].width = std::max(0.f, aRadii[C_BR].width + aBorderSizes[NS_SIDE_RIGHT]);
- oRadii[C_BR].height = std::max(0.f, aRadii[C_BR].height + aBorderSizes[NS_SIDE_BOTTOM]);
+ oRadii[C_BR].width = std::max(0.f, aRadii[C_BR].width + aBorderSizes[eSideRight]);
+ oRadii[C_BR].height = std::max(0.f, aRadii[C_BR].height + aBorderSizes[eSideBottom]);
}
if (aRadii[C_BL].width > 0.f && aRadii[C_BL].height > 0.f) {
- oRadii[C_BL].width = std::max(0.f, aRadii[C_BL].width + aBorderSizes[NS_SIDE_LEFT]);
- oRadii[C_BL].height = std::max(0.f, aRadii[C_BL].height + aBorderSizes[NS_SIDE_BOTTOM]);
+ oRadii[C_BL].width = std::max(0.f, aRadii[C_BL].width + aBorderSizes[eSideLeft]);
+ oRadii[C_BL].height = std::max(0.f, aRadii[C_BL].height + aBorderSizes[eSideBottom]);
}
}
/*static*/ void
ComputeBorderCornerDimensions(const Float* aBorderWidths,
const RectCornerRadii& aRadii,
RectCornerRadii* aDimsRet)
{
- Float leftWidth = aBorderWidths[NS_SIDE_LEFT];
- Float topWidth = aBorderWidths[NS_SIDE_TOP];
- Float rightWidth = aBorderWidths[NS_SIDE_RIGHT];
- Float bottomWidth = aBorderWidths[NS_SIDE_BOTTOM];
+ Float leftWidth = aBorderWidths[eSideLeft];
+ Float topWidth = aBorderWidths[eSideTop];
+ Float rightWidth = aBorderWidths[eSideRight];
+ Float bottomWidth = aBorderWidths[eSideBottom];
if (AllCornersZeroSize(aRadii)) {
// These will always be in pixel units from CSS
(*aDimsRet)[C_TL] = Size(leftWidth, topWidth);
(*aDimsRet)[C_TR] = Size(rightWidth, topWidth);
(*aDimsRet)[C_BR] = Size(rightWidth, bottomWidth);
(*aDimsRet)[C_BL] = Size(leftWidth, bottomWidth);
} else {
@@ -454,25 +454,25 @@ nsCSSBorderRenderer::GetSideClipWithoutC
{
Point offset(0.f, 0.f);
// The offset from the outside rect to the start of this side's
// box. For the top and bottom sides, the height of the box
// must be the border height; the x start must take into account
// the corner size (which may be bigger than the right or left
// side's width). The same applies to the right and left sides.
- if (aSide == NS_SIDE_TOP) {
+ if (aSide == eSideTop) {
offset.x = mBorderCornerDimensions[C_TL].width;
- } else if (aSide == NS_SIDE_RIGHT) {
- offset.x = mOuterRect.Width() - mBorderWidths[NS_SIDE_RIGHT];
+ } else if (aSide == eSideRight) {
+ offset.x = mOuterRect.Width() - mBorderWidths[eSideRight];
offset.y = mBorderCornerDimensions[C_TR].height;
- } else if (aSide == NS_SIDE_BOTTOM) {
+ } else if (aSide == eSideBottom) {
offset.x = mBorderCornerDimensions[C_BL].width;
- offset.y = mOuterRect.Height() - mBorderWidths[NS_SIDE_BOTTOM];
- } else if (aSide == NS_SIDE_LEFT) {
+ offset.y = mOuterRect.Height() - mBorderWidths[eSideBottom];
+ } else if (aSide == eSideLeft) {
offset.y = mBorderCornerDimensions[C_TL].height;
}
// The sum of the width & height of the corners adjacent to the
// side. This relies on the relationship between side indexing and
// corner indexing; that is, 0 == SIDE_TOP and 0 == CORNER_TOP_LEFT,
// with both proceeding clockwise.
Size sideCornerSum = mBorderCornerDimensions[GetCCWCorner(aSide)]
@@ -675,17 +675,17 @@ nsCSSBorderRenderer::GetSideClipSubPath(
Point
nsCSSBorderRenderer::GetStraightBorderPoint(mozilla::Side aSide,
mozilla::css::Corner aCorner,
bool* aIsUnfilled)
{
// Calculate the end point of the side for dashed/dotted border, that is also
// the end point of the corner curve. The point is specified by aSide and
- // aCorner. (e.g. NS_SIDE_TOP and C_TL means the left end of border-top)
+ // aCorner. (e.g. eSideTop and C_TL means the left end of border-top)
//
//
// aCorner aSide
// +--------------------
// |
// |
// | +----------
// | the end point
@@ -1148,64 +1148,64 @@ nsCSSBorderRenderer::FillSolidBorder(con
// Otherwise, we have unequal sized borders or we're only
// drawing some sides; create rectangles for each side
// and fill them.
Rect r[4];
// compute base rects for each side
if (aSides & SIDE_BIT_TOP) {
- r[NS_SIDE_TOP] =
+ r[eSideTop] =
Rect(aOuterRect.X(), aOuterRect.Y(),
- aOuterRect.Width(), aBorderSizes[NS_SIDE_TOP]);
+ aOuterRect.Width(), aBorderSizes[eSideTop]);
}
if (aSides & SIDE_BIT_BOTTOM) {
- r[NS_SIDE_BOTTOM] =
- Rect(aOuterRect.X(), aOuterRect.YMost() - aBorderSizes[NS_SIDE_BOTTOM],
- aOuterRect.Width(), aBorderSizes[NS_SIDE_BOTTOM]);
+ r[eSideBottom] =
+ Rect(aOuterRect.X(), aOuterRect.YMost() - aBorderSizes[eSideBottom],
+ aOuterRect.Width(), aBorderSizes[eSideBottom]);
}
if (aSides & SIDE_BIT_LEFT) {
- r[NS_SIDE_LEFT] =
+ r[eSideLeft] =
Rect(aOuterRect.X(), aOuterRect.Y(),
- aBorderSizes[NS_SIDE_LEFT], aOuterRect.Height());
+ aBorderSizes[eSideLeft], aOuterRect.Height());
}
if (aSides & SIDE_BIT_RIGHT) {
- r[NS_SIDE_RIGHT] =
- Rect(aOuterRect.XMost() - aBorderSizes[NS_SIDE_RIGHT], aOuterRect.Y(),
- aBorderSizes[NS_SIDE_RIGHT], aOuterRect.Height());
+ r[eSideRight] =
+ Rect(aOuterRect.XMost() - aBorderSizes[eSideRight], aOuterRect.Y(),
+ aBorderSizes[eSideRight], aOuterRect.Height());
}
// If two sides meet at a corner that we're rendering, then
// make sure that we adjust one of the sides to avoid overlap.
// This is especially important in the case of colors with
// an alpha channel.
if ((aSides & (SIDE_BIT_TOP | SIDE_BIT_LEFT)) == (SIDE_BIT_TOP | SIDE_BIT_LEFT)) {
// adjust the left's top down a bit
- r[NS_SIDE_LEFT].y += aBorderSizes[NS_SIDE_TOP];
- r[NS_SIDE_LEFT].height -= aBorderSizes[NS_SIDE_TOP];
+ r[eSideLeft].y += aBorderSizes[eSideTop];
+ r[eSideLeft].height -= aBorderSizes[eSideTop];
}
if ((aSides & (SIDE_BIT_TOP | SIDE_BIT_RIGHT)) == (SIDE_BIT_TOP | SIDE_BIT_RIGHT)) {
// adjust the top's left a bit
- r[NS_SIDE_TOP].width -= aBorderSizes[NS_SIDE_RIGHT];
+ r[eSideTop].width -= aBorderSizes[eSideRight];
}
if ((aSides & (SIDE_BIT_BOTTOM | SIDE_BIT_RIGHT)) == (SIDE_BIT_BOTTOM | SIDE_BIT_RIGHT)) {
// adjust the right's bottom a bit
- r[NS_SIDE_RIGHT].height -= aBorderSizes[NS_SIDE_BOTTOM];
+ r[eSideRight].height -= aBorderSizes[eSideBottom];
}
if ((aSides & (SIDE_BIT_BOTTOM | SIDE_BIT_LEFT)) == (SIDE_BIT_BOTTOM | SIDE_BIT_LEFT)) {
// adjust the bottom's left a bit
- r[NS_SIDE_BOTTOM].x += aBorderSizes[NS_SIDE_LEFT];
- r[NS_SIDE_BOTTOM].width -= aBorderSizes[NS_SIDE_LEFT];
+ r[eSideBottom].x += aBorderSizes[eSideLeft];
+ r[eSideBottom].width -= aBorderSizes[eSideLeft];
}
// Filling these one by one is faster than filling them all at once.
for (uint32_t i = 0; i < 4; i++) {
if (aSides & (1 << i)) {
MaybeSnapToDevicePixels(r[i], *mDrawTarget, true);
mDrawTarget->FillRect(r[i], aColor);
}
@@ -1290,20 +1290,20 @@ nsCSSBorderRenderer::DrawBorderSidesComp
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[NS_SIDE_TOP] = siRect.TopLeft().y - soRect.TopLeft().y;
- fakeBorderSizes[NS_SIDE_RIGHT] = soRect.TopRight().x - siRect.TopRight().x;
- fakeBorderSizes[NS_SIDE_BOTTOM] = soRect.BottomRight().y - siRect.BottomRight().y;
- fakeBorderSizes[NS_SIDE_LEFT] = siRect.BottomLeft().x - soRect.BottomLeft().x;
+ 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);
}
}
@@ -1336,37 +1336,37 @@ nsCSSBorderRenderer::DrawBorderSides(int
if (borderRenderStyle == NS_STYLE_BORDER_STYLE_NONE ||
borderRenderStyle == NS_STYLE_BORDER_STYLE_HIDDEN)
return;
if (borderRenderStyle == NS_STYLE_BORDER_STYLE_DASHED ||
borderRenderStyle == NS_STYLE_BORDER_STYLE_DOTTED) {
// Draw each corner separately, with the given side's color.
if (aSides & SIDE_BIT_TOP) {
- DrawDashedOrDottedCorner(NS_SIDE_TOP, C_TL);
+ DrawDashedOrDottedCorner(eSideTop, C_TL);
} else if (aSides & SIDE_BIT_LEFT) {
- DrawDashedOrDottedCorner(NS_SIDE_LEFT, C_TL);
+ DrawDashedOrDottedCorner(eSideLeft, C_TL);
}
if (aSides & SIDE_BIT_TOP) {
- DrawDashedOrDottedCorner(NS_SIDE_TOP, C_TR);
+ DrawDashedOrDottedCorner(eSideTop, C_TR);
} else if (aSides & SIDE_BIT_RIGHT) {
- DrawDashedOrDottedCorner(NS_SIDE_RIGHT, C_TR);
+ DrawDashedOrDottedCorner(eSideRight, C_TR);
}
if (aSides & SIDE_BIT_BOTTOM) {
- DrawDashedOrDottedCorner(NS_SIDE_BOTTOM, C_BL);
+ DrawDashedOrDottedCorner(eSideBottom, C_BL);
} else if (aSides & SIDE_BIT_LEFT) {
- DrawDashedOrDottedCorner(NS_SIDE_LEFT, C_BL);
+ DrawDashedOrDottedCorner(eSideLeft, C_BL);
}
if (aSides & SIDE_BIT_BOTTOM) {
- DrawDashedOrDottedCorner(NS_SIDE_BOTTOM, C_BR);
+ DrawDashedOrDottedCorner(eSideBottom, C_BR);
} else if (aSides & SIDE_BIT_RIGHT) {
- DrawDashedOrDottedCorner(NS_SIDE_RIGHT, C_BR);
+ 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.
@@ -1530,48 +1530,48 @@ nsCSSBorderRenderer::DrawBorderSides(int
bool noMarginTop = false;
bool noMarginRight = false;
bool noMarginBottom = false;
bool noMarginLeft = false;
// If there is at least one dotted side, every side is rendered separately.
if (IsSingleSide(aSides)) {
if (aSides == SIDE_BIT_TOP) {
- if (mBorderStyles[NS_SIDE_RIGHT] == NS_STYLE_BORDER_STYLE_DOTTED &&
+ if (mBorderStyles[eSideRight] == NS_STYLE_BORDER_STYLE_DOTTED &&
IsZeroSize(mBorderRadii[C_TR])) {
noMarginRight = true;
}
- if (mBorderStyles[NS_SIDE_LEFT] == NS_STYLE_BORDER_STYLE_DOTTED &&
+ if (mBorderStyles[eSideLeft] == NS_STYLE_BORDER_STYLE_DOTTED &&
IsZeroSize(mBorderRadii[C_TL])) {
noMarginLeft = true;
}
} else if (aSides == SIDE_BIT_RIGHT) {
- if (mBorderStyles[NS_SIDE_TOP] == NS_STYLE_BORDER_STYLE_DOTTED &&
+ if (mBorderStyles[eSideTop] == NS_STYLE_BORDER_STYLE_DOTTED &&
IsZeroSize(mBorderRadii[C_TR])) {
noMarginTop = true;
}
- if (mBorderStyles[NS_SIDE_BOTTOM] == NS_STYLE_BORDER_STYLE_DOTTED &&
+ if (mBorderStyles[eSideBottom] == NS_STYLE_BORDER_STYLE_DOTTED &&
IsZeroSize(mBorderRadii[C_BR])) {
noMarginBottom = true;
}
} else if (aSides == SIDE_BIT_BOTTOM) {
- if (mBorderStyles[NS_SIDE_RIGHT] == NS_STYLE_BORDER_STYLE_DOTTED &&
+ if (mBorderStyles[eSideRight] == NS_STYLE_BORDER_STYLE_DOTTED &&
IsZeroSize(mBorderRadii[C_BR])) {
noMarginRight = true;
}
- if (mBorderStyles[NS_SIDE_LEFT] == NS_STYLE_BORDER_STYLE_DOTTED &&
+ if (mBorderStyles[eSideLeft] == NS_STYLE_BORDER_STYLE_DOTTED &&
IsZeroSize(mBorderRadii[C_BL])) {
noMarginLeft = true;
}
} else {
- if (mBorderStyles[NS_SIDE_TOP] == NS_STYLE_BORDER_STYLE_DOTTED &&
+ if (mBorderStyles[eSideTop] == NS_STYLE_BORDER_STYLE_DOTTED &&
IsZeroSize(mBorderRadii[C_TL])) {
noMarginTop = true;
}
- if (mBorderStyles[NS_SIDE_BOTTOM] == NS_STYLE_BORDER_STYLE_DOTTED &&
+ if (mBorderStyles[eSideBottom] == NS_STYLE_BORDER_STYLE_DOTTED &&
IsZeroSize(mBorderRadii[C_BL])) {
noMarginBottom = true;
}
}
}
for (unsigned int i = 0; i < borderColorStyleCount; i++) {
// walk siRect inwards at the start of the loop to get the
@@ -1790,23 +1790,23 @@ nsCSSBorderRenderer::SetupDashedOptions(
PrintAsFormatString("dash: %f %f\n", aDash[0], aDash[1]);
}
static Float
GetBorderLength(mozilla::Side aSide,
const Point& aStart, const Point& aEnd)
{
- if (aSide == NS_SIDE_TOP) {
+ if (aSide == eSideTop) {
return aEnd.x - aStart.x;
}
- if (aSide == NS_SIDE_RIGHT) {
+ if (aSide == eSideRight) {
return aEnd.y - aStart.y;
}
- if (aSide == NS_SIDE_BOTTOM) {
+ if (aSide == eSideBottom) {
return aStart.x - aEnd.x;
}
return aStart.y - aEnd.y;
}
void
nsCSSBorderRenderer::DrawDashedOrDottedSide(mozilla::Side aSide)
{
@@ -2027,26 +2027,26 @@ nsCSSBorderRenderer::DrawDottedSideSlow(
// ####+####|
// ## end ##|
// ####### |
// ##### |
// ------------+
// Ei
Point I(0.0f, 0.0f), J(0.0f, 0.0f);
- if (aSide == NS_SIDE_TOP) {
+ if (aSide == eSideTop) {
I.x = 1.0f;
J.y = 1.0f;
- } else if (aSide == NS_SIDE_RIGHT) {
+ } else if (aSide == eSideRight) {
I.y = 1.0f;
J.x = -1.0f;
- } else if (aSide == NS_SIDE_BOTTOM) {
+ } else if (aSide == eSideBottom) {
I.x = -1.0f;
J.y = -1.0f;
- } else if (aSide == NS_SIDE_LEFT) {
+ } else if (aSide == eSideLeft) {
I.y = -1.0f;
J.x = 1.0f;
}
Point So, Si, Eo, Ei;
So = (start + (-I + -J) * borderWidth / 2.0f);
Si = (mergeStart == MERGE_HALF)
@@ -2113,17 +2113,17 @@ nsCSSBorderRenderer::DrawDottedSideSlow(
}
}
Point fromP = (start * (count - from) + end * from) / count;
Point toP = (start * (count - to) + end * to) / count;
// Extend dirty rect to avoid clipping pixel for anti-aliasing.
const Float AA_MARGIN = 2.0f;
- if (aSide == NS_SIDE_TOP) {
+ if (aSide == eSideTop) {
// Tweak |from| and |to| to fit into |mDirtyRect + radius margin|,
// to render only paths that may overlap mDirtyRect.
//
// mDirtyRect + radius margin
// +--+---------------------+--+
// | |
// | mDirtyRect |
// + +---------------------+ +
@@ -2158,17 +2158,17 @@ nsCSSBorderRenderer::DrawDottedSideSlow(
if (tmp < to) {
if ((tmp & 1) != (to & 1)) {
to = tmp + 1;
} else {
to = tmp;
}
}
}
- } else if (aSide == NS_SIDE_RIGHT) {
+ } else if (aSide == eSideRight) {
Float top = mDirtyRect.y - radius - AA_MARGIN;
if (fromP.y < top) {
size_t tmp = ceil(count * (top - start.y) / (end.y - start.y));
if (tmp > from) {
if ((tmp & 1) != (from & 1)) {
from = tmp - 1;
} else {
from = tmp;
@@ -2181,17 +2181,17 @@ nsCSSBorderRenderer::DrawDottedSideSlow(
if (tmp < to) {
if ((tmp & 1) != (to & 1)) {
to = tmp + 1;
} else {
to = tmp;
}
}
}
- } else if (aSide == NS_SIDE_BOTTOM) {
+ } else if (aSide == eSideBottom) {
Float right = mDirtyRect.x + mDirtyRect.width + radius + AA_MARGIN;
if (fromP.x > right) {
size_t tmp = ceil(count * (right - start.x) / (end.x - start.x));
if (tmp > from) {
if ((tmp & 1) != (from & 1)) {
from = tmp - 1;
} else {
from = tmp;
@@ -2204,17 +2204,17 @@ nsCSSBorderRenderer::DrawDottedSideSlow(
if (tmp < to) {
if ((tmp & 1) != (to & 1)) {
to = tmp + 1;
} else {
to = tmp;
}
}
}
- } else if (aSide == NS_SIDE_LEFT) {
+ } else if (aSide == eSideLeft) {
Float bottom = mDirtyRect.y + mDirtyRect.height + radius + AA_MARGIN;
if (fromP.y > bottom) {
size_t tmp = ceil(count * (bottom - start.y) / (end.y - start.y));
if (tmp > from) {
if ((tmp & 1) != (from & 1)) {
from = tmp - 1;
} else {
from = tmp;
@@ -3183,18 +3183,18 @@ nsCSSBorderRenderer::DrawBorders()
if (allBordersSameWidth && mBorderWidths[0] == 0.0) {
// Some of the allBordersSameWidth codepaths depend on the border
// width being greater than zero.
return;
}
// Initial values only used when the border colors/widths are all the same:
- ColorPattern color(ToDeviceColor(mBorderColors[NS_SIDE_TOP]));
- StrokeOptions strokeOptions(mBorderWidths[NS_SIDE_TOP]); // stroke width
+ ColorPattern color(ToDeviceColor(mBorderColors[eSideTop]));
+ StrokeOptions strokeOptions(mBorderWidths[eSideTop]); // stroke width
bool allBordersSolid;
// 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 (allBordersSame &&
mCompositeColors[0] == nullptr &&
@@ -3237,20 +3237,20 @@ nsCSSBorderRenderer::DrawBorders()
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[NS_SIDE_TOP],
- mBorderWidths[NS_SIDE_BOTTOM],
- mBorderWidths[NS_SIDE_LEFT],
- mBorderWidths[NS_SIDE_RIGHT]);
+ borderInnerRect.Deflate(mBorderWidths[eSideTop],
+ mBorderWidths[eSideBottom],
+ mBorderWidths[eSideLeft],
+ mBorderWidths[eSideRight]);
// Instead of stroking we just use two paths: an inner and an outer.
// This allows us to draw borders that we couldn't when stroking. For example,
// borders with a border width >= the border radius. (i.e. when there are
// square corners on the inside)
//
// Further, this approach can be more efficient because the backend
// doesn't need to compute an offset curve to stroke the path. We know that
--- a/layout/style/StyleAnimationValue.cpp
+++ b/layout/style/StyleAnimationValue.cpp
@@ -4518,20 +4518,20 @@ StyleAnimationValue::ExtractComputedValu
}
return StyleCoordToValue(coord, aComputedValue);
}
case eStyleAnimType_Sides_Top:
case eStyleAnimType_Sides_Right:
case eStyleAnimType_Sides_Bottom:
case eStyleAnimType_Sides_Left: {
static_assert(
- NS_SIDE_TOP == eStyleAnimType_Sides_Top -eStyleAnimType_Sides_Top &&
- NS_SIDE_RIGHT == eStyleAnimType_Sides_Right -eStyleAnimType_Sides_Top &&
- NS_SIDE_BOTTOM == eStyleAnimType_Sides_Bottom-eStyleAnimType_Sides_Top &&
- NS_SIDE_LEFT == eStyleAnimType_Sides_Left -eStyleAnimType_Sides_Top,
+ eSideTop == eStyleAnimType_Sides_Top -eStyleAnimType_Sides_Top &&
+ eSideRight == eStyleAnimType_Sides_Right -eStyleAnimType_Sides_Top &&
+ eSideBottom == eStyleAnimType_Sides_Bottom-eStyleAnimType_Sides_Top &&
+ eSideLeft == eStyleAnimType_Sides_Left -eStyleAnimType_Sides_Top,
"box side constants out of sync with animation side constants");
const nsStyleCoord &coord =
StyleDataAtOffset<nsStyleSides>(styleStruct, ssOffset).
Get(mozilla::Side(animType - eStyleAnimType_Sides_Top));
return StyleCoordToValue(coord, aComputedValue);
}
case eStyleAnimType_Corner_TopLeft:
--- a/layout/style/nsCSSDataBlock.cpp
+++ b/layout/style/nsCSSDataBlock.cpp
@@ -247,18 +247,18 @@ EnsurePhysicalProperty(nsCSSPropertyID&
side = WritingMode::PhysicalSideForBlockAxis(wm, edge);
} else {
WritingMode wm(aRuleData->mStyleContext);
side = wm.PhysicalSideForInlineAxis(edge);
}
// We rely on the physical side constant values matching the order of
// the physical properties in the logical group array.
- static_assert(NS_SIDE_TOP == 0 && NS_SIDE_RIGHT == 1 &&
- NS_SIDE_BOTTOM == 2 && NS_SIDE_LEFT == 3,
+ static_assert(eSideTop == 0 && eSideRight == 1 &&
+ eSideBottom == 2 && eSideLeft == 3,
"unexpected side constant values");
index = side;
}
const nsCSSPropertyID* props = nsCSSProps::LogicalGroup(aProperty);
size_t len = isAxisProperty ? 2 : 4;
#ifdef DEBUG
for (size_t i = 0; i < len; i++) {
--- a/layout/style/nsCSSProps.cpp
+++ b/layout/style/nsCSSProps.cpp
@@ -2736,18 +2736,18 @@ static const nsCSSPropertyID gBorderBott
// Declaration.cpp outputs the subproperties in this order.
// It also depends on the color being third.
eCSSProperty_border_bottom_width,
eCSSProperty_border_bottom_style,
eCSSProperty_border_bottom_color,
eCSSProperty_UNKNOWN
};
-static_assert(NS_SIDE_TOP == 0 && NS_SIDE_RIGHT == 1 &&
- NS_SIDE_BOTTOM == 2 && NS_SIDE_LEFT == 3,
+static_assert(eSideTop == 0 && eSideRight == 1 &&
+ eSideBottom == 2 && eSideLeft == 3,
"box side constants not top/right/bottom/left == 0/1/2/3");
static const nsCSSPropertyID gBorderColorSubpropTable[] = {
// Code relies on these being in top-right-bottom-left order.
// Code relies on these matching the NS_SIDE_* constants.
eCSSProperty_border_top_color,
eCSSProperty_border_right_color,
eCSSProperty_border_bottom_color,
eCSSProperty_border_left_color,
--- a/layout/style/nsCSSValue.cpp
+++ b/layout/style/nsCSSValue.cpp
@@ -2515,18 +2515,18 @@ nsCSSRect_heap::SizeOfIncludingThis(mozi
n += mTop .SizeOfExcludingThis(aMallocSizeOf);
n += mRight .SizeOfExcludingThis(aMallocSizeOf);
n += mBottom.SizeOfExcludingThis(aMallocSizeOf);
n += mLeft .SizeOfExcludingThis(aMallocSizeOf);
}
return n;
}
-static_assert(NS_SIDE_TOP == 0 && NS_SIDE_RIGHT == 1 &&
- NS_SIDE_BOTTOM == 2 && NS_SIDE_LEFT == 3,
+static_assert(eSideTop == 0 && eSideRight == 1 &&
+ eSideBottom == 2 && eSideLeft == 3,
"box side constants not top/right/bottom/left == 0/1/2/3");
/* static */ const nsCSSRect::side_type nsCSSRect::sides[4] = {
&nsCSSRect::mTop,
&nsCSSRect::mRight,
&nsCSSRect::mBottom,
&nsCSSRect::mLeft,
};
--- a/layout/style/nsComputedDOMStyle.cpp
+++ b/layout/style/nsComputedDOMStyle.cpp
@@ -914,17 +914,17 @@ nsComputedDOMStyle::DoGetFloat()
val->SetIdent(nsCSSProps::ValueToKeywordEnum(StyleDisplay()->mFloat,
nsCSSProps::kFloatKTable));
return val.forget();
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetBottom()
{
- return GetOffsetWidthFor(NS_SIDE_BOTTOM);
+ return GetOffsetWidthFor(eSideBottom);
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetStackSizing()
{
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
val->SetIdent(StyleXUL()->mStretchStack ? eCSSKeyword_stretch_to_fit :
eCSSKeyword_ignore);
@@ -2958,35 +2958,35 @@ nsComputedDOMStyle::DoGetGridRowGap()
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
SetValueToCoord(val, StylePosition()->mGridRowGap, true);
return val.forget();
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetPaddingTop()
{
- return GetPaddingWidthFor(NS_SIDE_TOP);
+ return GetPaddingWidthFor(eSideTop);
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetPaddingBottom()
{
- return GetPaddingWidthFor(NS_SIDE_BOTTOM);
+ return GetPaddingWidthFor(eSideBottom);
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetPaddingLeft()
{
- return GetPaddingWidthFor(NS_SIDE_LEFT);
+ return GetPaddingWidthFor(eSideLeft);
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetPaddingRight()
{
- return GetPaddingWidthFor(NS_SIDE_RIGHT);
+ return GetPaddingWidthFor(eSideRight);
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetBorderCollapse()
{
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
val->SetIdent(
nsCSSProps::ValueToKeywordEnum(StyleTableBorder()->mBorderCollapse,
@@ -3040,60 +3040,60 @@ nsComputedDOMStyle::DoGetTableLayout()
nsCSSProps::ValueToKeywordEnum(StyleTable()->mLayoutStrategy,
nsCSSProps::kTableLayoutKTable));
return val.forget();
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetBorderTopStyle()
{
- return GetBorderStyleFor(NS_SIDE_TOP);
+ return GetBorderStyleFor(eSideTop);
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetBorderBottomStyle()
{
- return GetBorderStyleFor(NS_SIDE_BOTTOM);
+ return GetBorderStyleFor(eSideBottom);
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetBorderLeftStyle()
{
- return GetBorderStyleFor(NS_SIDE_LEFT);
+ return GetBorderStyleFor(eSideLeft);
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetBorderRightStyle()
{
- return GetBorderStyleFor(NS_SIDE_RIGHT);
+ return GetBorderStyleFor(eSideRight);
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetBorderBottomColors()
{
- return GetBorderColorsFor(NS_SIDE_BOTTOM);
+ return GetBorderColorsFor(eSideBottom);
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetBorderLeftColors()
{
- return GetBorderColorsFor(NS_SIDE_LEFT);
+ return GetBorderColorsFor(eSideLeft);
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetBorderRightColors()
{
- return GetBorderColorsFor(NS_SIDE_RIGHT);
+ return GetBorderColorsFor(eSideRight);
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetBorderTopColors()
{
- return GetBorderColorsFor(NS_SIDE_TOP);
+ return GetBorderColorsFor(eSideTop);
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetBorderBottomLeftRadius()
{
return GetEllipseRadii(StyleBorder()->mBorderRadius,
NS_CORNER_BOTTOM_LEFT);
}
@@ -3117,83 +3117,83 @@ nsComputedDOMStyle::DoGetBorderTopRightR
{
return GetEllipseRadii(StyleBorder()->mBorderRadius,
NS_CORNER_TOP_RIGHT);
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetBorderTopWidth()
{
- return GetBorderWidthFor(NS_SIDE_TOP);
+ return GetBorderWidthFor(eSideTop);
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetBorderBottomWidth()
{
- return GetBorderWidthFor(NS_SIDE_BOTTOM);
+ return GetBorderWidthFor(eSideBottom);
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetBorderLeftWidth()
{
- return GetBorderWidthFor(NS_SIDE_LEFT);
+ return GetBorderWidthFor(eSideLeft);
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetBorderRightWidth()
{
- return GetBorderWidthFor(NS_SIDE_RIGHT);
+ return GetBorderWidthFor(eSideRight);
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetBorderTopColor()
{
- return GetBorderColorFor(NS_SIDE_TOP);
+ return GetBorderColorFor(eSideTop);
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetBorderBottomColor()
{
- return GetBorderColorFor(NS_SIDE_BOTTOM);
+ return GetBorderColorFor(eSideBottom);
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetBorderLeftColor()
{
- return GetBorderColorFor(NS_SIDE_LEFT);
+ return GetBorderColorFor(eSideLeft);
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetBorderRightColor()
{
- return GetBorderColorFor(NS_SIDE_RIGHT);
+ return GetBorderColorFor(eSideRight);
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetMarginTopWidth()
{
- return GetMarginWidthFor(NS_SIDE_TOP);
+ return GetMarginWidthFor(eSideTop);
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetMarginBottomWidth()
{
- return GetMarginWidthFor(NS_SIDE_BOTTOM);
+ return GetMarginWidthFor(eSideBottom);
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetMarginLeftWidth()
{
- return GetMarginWidthFor(NS_SIDE_LEFT);
+ return GetMarginWidthFor(eSideLeft);
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetMarginRightWidth()
{
- return GetMarginWidthFor(NS_SIDE_RIGHT);
+ return GetMarginWidthFor(eSideRight);
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetOrient()
{
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
val->SetIdent(
nsCSSProps::ValueToKeywordEnum(StyleDisplay()->mOrient,
@@ -4983,29 +4983,29 @@ nsComputedDOMStyle::DoGetObjectPosition(
RefPtr<nsDOMCSSValueList> valueList = GetROCSSValueList(false);
SetValueToPosition(StylePosition()->mObjectPosition, valueList);
return valueList.forget();
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetLeft()
{
- return GetOffsetWidthFor(NS_SIDE_LEFT);
+ return GetOffsetWidthFor(eSideLeft);
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetRight()
{
- return GetOffsetWidthFor(NS_SIDE_RIGHT);
+ return GetOffsetWidthFor(eSideRight);
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetTop()
{
- return GetOffsetWidthFor(NS_SIDE_TOP);
+ return GetOffsetWidthFor(eSideTop);
}
nsDOMCSSValueList*
nsComputedDOMStyle::GetROCSSValueList(bool aCommaDelimited)
{
return new nsDOMCSSValueList(aCommaDelimited, true);
}
@@ -5063,46 +5063,46 @@ nsComputedDOMStyle::GetAbsoluteOffset(mo
nsIScrollableFrame *scrollFrame = do_QueryFrame(scrollingChild);
if (scrollFrame) {
scrollbarSizes = scrollFrame->GetActualScrollbarSizes();
}
}
nscoord offset = 0;
switch (aSide) {
- case NS_SIDE_TOP:
+ case eSideTop:
offset = rect.y - margin.top - border.top - scrollbarSizes.top;
break;
- case NS_SIDE_RIGHT:
+ case eSideRight:
offset = containerRect.width - rect.width -
rect.x - margin.right - border.right - scrollbarSizes.right;
break;
- case NS_SIDE_BOTTOM:
+ case eSideBottom:
offset = containerRect.height - rect.height -
rect.y - margin.bottom - border.bottom - scrollbarSizes.bottom;
break;
- case NS_SIDE_LEFT:
+ case eSideLeft:
offset = rect.x - margin.left - border.left - scrollbarSizes.left;
break;
default:
NS_ERROR("Invalid side");
break;
}
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
val->SetAppUnits(offset);
return val.forget();
}
-static_assert(NS_SIDE_TOP == 0 && NS_SIDE_RIGHT == 1 &&
- NS_SIDE_BOTTOM == 2 && NS_SIDE_LEFT == 3,
+static_assert(eSideTop == 0 && eSideRight == 1 &&
+ eSideBottom == 2 && eSideLeft == 3,
"box side constants not as expected for NS_OPPOSITE_SIDE");
#define NS_OPPOSITE_SIDE(s_) mozilla::Side(((s_) + 2) & 3)
already_AddRefed<CSSValue>
nsComputedDOMStyle::GetRelativeOffset(mozilla::Side aSide)
{
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
@@ -5116,17 +5116,17 @@ nsComputedDOMStyle::GetRelativeOffset(mo
coord.IsCalcUnit(),
"Unexpected unit");
if (coord.GetUnit() == eStyleUnit_Auto) {
coord = positionData->mOffset.Get(NS_OPPOSITE_SIDE(aSide));
sign = -1;
}
PercentageBaseGetter baseGetter;
- if (aSide == NS_SIDE_LEFT || aSide == NS_SIDE_RIGHT) {
+ if (aSide == eSideLeft || aSide == eSideRight) {
baseGetter = &nsComputedDOMStyle::GetCBContentWidth;
} else {
baseGetter = &nsComputedDOMStyle::GetCBContentHeight;
}
val->SetAppUnits(sign * StyleCoordToNSCoord(coord, baseGetter, 0, false));
return val.forget();
}
@@ -5145,17 +5145,17 @@ nsComputedDOMStyle::GetStickyOffset(mozi
coord.IsCalcUnit(),
"Unexpected unit");
if (coord.GetUnit() == eStyleUnit_Auto) {
val->SetIdent(eCSSKeyword_auto);
return val.forget();
}
PercentageBaseGetter baseGetter;
- if (aSide == NS_SIDE_LEFT || aSide == NS_SIDE_RIGHT) {
+ if (aSide == eSideLeft || aSide == eSideRight) {
baseGetter = &nsComputedDOMStyle::GetScrollFrameContentWidth;
} else {
baseGetter = &nsComputedDOMStyle::GetScrollFrameContentHeight;
}
val->SetAppUnits(StyleCoordToNSCoord(coord, baseGetter, 0, false));
return val.forget();
}
--- a/layout/style/nsStyleCoord.cpp
+++ b/layout/style/nsStyleCoord.cpp
@@ -327,20 +327,20 @@ void nsStyleCorners::Reset()
nsStyleCoord::Reset(mUnits[i], mValues[i]);
}
}
// Validation of NS_SIDE_IS_VERTICAL and NS_HALF_CORNER_IS_X.
#define CASE(side, result) \
static_assert(NS_SIDE_IS_VERTICAL(side) == result, \
"NS_SIDE_IS_VERTICAL is wrong")
-CASE(NS_SIDE_TOP, false);
-CASE(NS_SIDE_RIGHT, true);
-CASE(NS_SIDE_BOTTOM, false);
-CASE(NS_SIDE_LEFT, true);
+CASE(eSideTop, false);
+CASE(eSideRight, true);
+CASE(eSideBottom, false);
+CASE(eSideLeft, true);
#undef CASE
#define CASE(corner, result) \
static_assert(NS_HALF_CORNER_IS_X(corner) == result, \
"NS_HALF_CORNER_IS_X is wrong")
CASE(NS_CORNER_TOP_LEFT_X, true);
CASE(NS_CORNER_TOP_LEFT_Y, false);
CASE(NS_CORNER_TOP_RIGHT_X, true);
@@ -378,44 +378,44 @@ CASE(NS_CORNER_BOTTOM_RIGHT, true, NS_C
CASE(NS_CORNER_BOTTOM_LEFT, false, NS_CORNER_BOTTOM_LEFT_X);
CASE(NS_CORNER_BOTTOM_LEFT, true, NS_CORNER_BOTTOM_LEFT_Y);
#undef CASE
// Validation of NS_SIDE_TO_{FULL,HALF}_CORNER.
#define CASE(side, second, result) \
static_assert(NS_SIDE_TO_FULL_CORNER(side, second) == result, \
"NS_SIDE_TO_FULL_CORNER is wrong")
-CASE(NS_SIDE_TOP, false, NS_CORNER_TOP_LEFT);
-CASE(NS_SIDE_TOP, true, NS_CORNER_TOP_RIGHT);
+CASE(eSideTop, false, NS_CORNER_TOP_LEFT);
+CASE(eSideTop, true, NS_CORNER_TOP_RIGHT);
-CASE(NS_SIDE_RIGHT, false, NS_CORNER_TOP_RIGHT);
-CASE(NS_SIDE_RIGHT, true, NS_CORNER_BOTTOM_RIGHT);
+CASE(eSideRight, false, NS_CORNER_TOP_RIGHT);
+CASE(eSideRight, true, NS_CORNER_BOTTOM_RIGHT);
-CASE(NS_SIDE_BOTTOM, false, NS_CORNER_BOTTOM_RIGHT);
-CASE(NS_SIDE_BOTTOM, true, NS_CORNER_BOTTOM_LEFT);
+CASE(eSideBottom, false, NS_CORNER_BOTTOM_RIGHT);
+CASE(eSideBottom, true, NS_CORNER_BOTTOM_LEFT);
-CASE(NS_SIDE_LEFT, false, NS_CORNER_BOTTOM_LEFT);
-CASE(NS_SIDE_LEFT, true, NS_CORNER_TOP_LEFT);
+CASE(eSideLeft, false, NS_CORNER_BOTTOM_LEFT);
+CASE(eSideLeft, true, NS_CORNER_TOP_LEFT);
#undef CASE
#define CASE(side, second, parallel, result) \
static_assert(NS_SIDE_TO_HALF_CORNER(side, second, parallel) == result, \
"NS_SIDE_TO_HALF_CORNER is wrong")
-CASE(NS_SIDE_TOP, false, true, NS_CORNER_TOP_LEFT_X);
-CASE(NS_SIDE_TOP, false, false, NS_CORNER_TOP_LEFT_Y);
-CASE(NS_SIDE_TOP, true, true, NS_CORNER_TOP_RIGHT_X);
-CASE(NS_SIDE_TOP, true, false, NS_CORNER_TOP_RIGHT_Y);
+CASE(eSideTop, false, true, NS_CORNER_TOP_LEFT_X);
+CASE(eSideTop, false, false, NS_CORNER_TOP_LEFT_Y);
+CASE(eSideTop, true, true, NS_CORNER_TOP_RIGHT_X);
+CASE(eSideTop, true, false, NS_CORNER_TOP_RIGHT_Y);
-CASE(NS_SIDE_RIGHT, false, false, NS_CORNER_TOP_RIGHT_X);
-CASE(NS_SIDE_RIGHT, false, true, NS_CORNER_TOP_RIGHT_Y);
-CASE(NS_SIDE_RIGHT, true, false, NS_CORNER_BOTTOM_RIGHT_X);
-CASE(NS_SIDE_RIGHT, true, true, NS_CORNER_BOTTOM_RIGHT_Y);
+CASE(eSideRight, false, false, NS_CORNER_TOP_RIGHT_X);
+CASE(eSideRight, false, true, NS_CORNER_TOP_RIGHT_Y);
+CASE(eSideRight, true, false, NS_CORNER_BOTTOM_RIGHT_X);
+CASE(eSideRight, true, true, NS_CORNER_BOTTOM_RIGHT_Y);
-CASE(NS_SIDE_BOTTOM, false, true, NS_CORNER_BOTTOM_RIGHT_X);
-CASE(NS_SIDE_BOTTOM, false, false, NS_CORNER_BOTTOM_RIGHT_Y);
-CASE(NS_SIDE_BOTTOM, true, true, NS_CORNER_BOTTOM_LEFT_X);
-CASE(NS_SIDE_BOTTOM, true, false, NS_CORNER_BOTTOM_LEFT_Y);
+CASE(eSideBottom, false, true, NS_CORNER_BOTTOM_RIGHT_X);
+CASE(eSideBottom, false, false, NS_CORNER_BOTTOM_RIGHT_Y);
+CASE(eSideBottom, true, true, NS_CORNER_BOTTOM_LEFT_X);
+CASE(eSideBottom, true, false, NS_CORNER_BOTTOM_LEFT_Y);
-CASE(NS_SIDE_LEFT, false, false, NS_CORNER_BOTTOM_LEFT_X);
-CASE(NS_SIDE_LEFT, false, true, NS_CORNER_BOTTOM_LEFT_Y);
-CASE(NS_SIDE_LEFT, true, false, NS_CORNER_TOP_LEFT_X);
-CASE(NS_SIDE_LEFT, true, true, NS_CORNER_TOP_LEFT_Y);
+CASE(eSideLeft, false, false, NS_CORNER_BOTTOM_LEFT_X);
+CASE(eSideLeft, false, true, NS_CORNER_BOTTOM_LEFT_Y);
+CASE(eSideLeft, true, false, NS_CORNER_TOP_LEFT_X);
+CASE(eSideLeft, true, true, NS_CORNER_TOP_LEFT_Y);
#undef CASE
--- a/layout/style/nsStyleCoord.h
+++ b/layout/style/nsStyleCoord.h
@@ -550,82 +550,82 @@ inline bool nsStyleSides::operator!=(con
inline nsStyleUnit nsStyleSides::GetUnit(mozilla::Side aSide) const
{
return (nsStyleUnit)mUnits[aSide];
}
inline nsStyleUnit nsStyleSides::GetLeftUnit() const
{
- return GetUnit(NS_SIDE_LEFT);
+ return GetUnit(mozilla::eSideLeft);
}
inline nsStyleUnit nsStyleSides::GetTopUnit() const
{
- return GetUnit(NS_SIDE_TOP);
+ return GetUnit(mozilla::eSideTop);
}
inline nsStyleUnit nsStyleSides::GetRightUnit() const
{
- return GetUnit(NS_SIDE_RIGHT);
+ return GetUnit(mozilla::eSideRight);
}
inline nsStyleUnit nsStyleSides::GetBottomUnit() const
{
- return GetUnit(NS_SIDE_BOTTOM);
+ return GetUnit(mozilla::eSideBottom);
}
inline nsStyleCoord nsStyleSides::Get(mozilla::Side aSide) const
{
return nsStyleCoord(mValues[aSide], nsStyleUnit(mUnits[aSide]));
}
inline nsStyleCoord nsStyleSides::GetLeft() const
{
- return Get(NS_SIDE_LEFT);
+ return Get(mozilla::eSideLeft);
}
inline nsStyleCoord nsStyleSides::GetTop() const
{
- return Get(NS_SIDE_TOP);
+ return Get(mozilla::eSideTop);
}
inline nsStyleCoord nsStyleSides::GetRight() const
{
- return Get(NS_SIDE_RIGHT);
+ return Get(mozilla::eSideRight);
}
inline nsStyleCoord nsStyleSides::GetBottom() const
{
- return Get(NS_SIDE_BOTTOM);
+ return Get(mozilla::eSideBottom);
}
inline void nsStyleSides::Set(mozilla::Side aSide, const nsStyleCoord& aCoord)
{
nsStyleCoord::SetValue(mUnits[aSide], mValues[aSide], aCoord);
}
inline void nsStyleSides::SetLeft(const nsStyleCoord& aCoord)
{
- Set(NS_SIDE_LEFT, aCoord);
+ Set(mozilla::eSideLeft, aCoord);
}
inline void nsStyleSides::SetTop(const nsStyleCoord& aCoord)
{
- Set(NS_SIDE_TOP, aCoord);
+ Set(mozilla::eSideTop, aCoord);
}
inline void nsStyleSides::SetRight(const nsStyleCoord& aCoord)
{
- Set(NS_SIDE_RIGHT, aCoord);
+ Set(mozilla::eSideRight, aCoord);
}
inline void nsStyleSides::SetBottom(const nsStyleCoord& aCoord)
{
- Set(NS_SIDE_BOTTOM, aCoord);
+ Set(mozilla::eSideBottom, aCoord);
}
// -------------------------
// nsStyleCorners inlines
//
inline bool nsStyleCorners::operator!=(const nsStyleCorners& aOther) const
{
return !((*this) == aOther);
--- a/layout/style/nsStyleStruct.h
+++ b/layout/style/nsStyleStruct.h
@@ -1310,23 +1310,23 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
// value is rounded to the nearest device pixel by NS_ROUND_BORDER_TO_PIXELS.
nscoord GetComputedBorderWidth(mozilla::Side aSide) const
{
return GetComputedBorder().Side(aSide);
}
uint8_t GetBorderStyle(mozilla::Side aSide) const
{
- NS_ASSERTION(aSide <= NS_SIDE_LEFT, "bad side");
+ NS_ASSERTION(aSide <= mozilla::eSideLeft, "bad side");
return mBorderStyle[aSide];
}
void SetBorderStyle(mozilla::Side aSide, uint8_t aStyle)
{
- NS_ASSERTION(aSide <= NS_SIDE_LEFT, "bad side");
+ NS_ASSERTION(aSide <= mozilla::eSideLeft, "bad side");
mBorderStyle[aSide] = aStyle;
mComputedBorder.Side(aSide) =
(HasVisibleStyle(aSide) ? mBorder.Side(aSide) : 0);
}
inline bool IsBorderImageLoaded() const
{
return mBorderImageSource.IsLoaded();
--- a/layout/xul/BoxObject.cpp
+++ b/layout/xul/BoxObject.cpp
@@ -180,23 +180,23 @@ BoxObject::GetOffsetRect(nsIntRect& aRec
// Add the parent's origin to our own to get to the
// right coordinate system
origin += next->GetPositionOfChildIgnoringScrolling(parent);
parent = next;
}
// For the origin, add in the border for the frame
const nsStyleBorder* border = frame->StyleBorder();
- origin.x += border->GetComputedBorderWidth(NS_SIDE_LEFT);
- origin.y += border->GetComputedBorderWidth(NS_SIDE_TOP);
+ origin.x += border->GetComputedBorderWidth(eSideLeft);
+ origin.y += border->GetComputedBorderWidth(eSideTop);
// And subtract out the border for the parent
const nsStyleBorder* parentBorder = parent->StyleBorder();
- origin.x -= parentBorder->GetComputedBorderWidth(NS_SIDE_LEFT);
- origin.y -= parentBorder->GetComputedBorderWidth(NS_SIDE_TOP);
+ origin.x -= parentBorder->GetComputedBorderWidth(eSideLeft);
+ origin.y -= parentBorder->GetComputedBorderWidth(eSideTop);
aRect.x = nsPresContext::AppUnitsToIntCSSPixels(origin.x);
aRect.y = nsPresContext::AppUnitsToIntCSSPixels(origin.y);
// Get the union of all rectangles in this and continuation frames.
// It doesn't really matter what we use as aRelativeTo here, since
// we only care about the size. Using 'parent' might make things
// a bit faster by speeding up the internal GetOffsetTo operations.
--- a/layout/xul/nsMenuPopupFrame.cpp
+++ b/layout/xul/nsMenuPopupFrame.cpp
@@ -1701,33 +1701,33 @@ void nsMenuPopupFrame::CanAdjustEdges(in
int8_t aVerticalSide,
LayoutDeviceIntPoint& aChange)
{
int8_t popupAlign(mPopupAlignment);
if (IsDirectionRTL()) {
popupAlign = -popupAlign;
}
- if (aHorizontalSide == (mHFlip ? NS_SIDE_RIGHT : NS_SIDE_LEFT)) {
+ if (aHorizontalSide == (mHFlip ? eSideRight : eSideLeft)) {
if (popupAlign == POPUPALIGNMENT_TOPLEFT || popupAlign == POPUPALIGNMENT_BOTTOMLEFT) {
aChange.x = 0;
}
}
- else if (aHorizontalSide == (mHFlip ? NS_SIDE_LEFT : NS_SIDE_RIGHT)) {
+ else if (aHorizontalSide == (mHFlip ? eSideLeft : eSideRight)) {
if (popupAlign == POPUPALIGNMENT_TOPRIGHT || popupAlign == POPUPALIGNMENT_BOTTOMRIGHT) {
aChange.x = 0;
}
}
- if (aVerticalSide == (mVFlip ? NS_SIDE_BOTTOM : NS_SIDE_TOP)) {
+ if (aVerticalSide == (mVFlip ? eSideBottom : eSideTop)) {
if (popupAlign == POPUPALIGNMENT_TOPLEFT || popupAlign == POPUPALIGNMENT_TOPRIGHT) {
aChange.y = 0;
}
}
- else if (aVerticalSide == (mVFlip ? NS_SIDE_TOP : NS_SIDE_BOTTOM)) {
+ else if (aVerticalSide == (mVFlip ? eSideTop : eSideBottom)) {
if (popupAlign == POPUPALIGNMENT_BOTTOMLEFT || popupAlign == POPUPALIGNMENT_BOTTOMRIGHT) {
aChange.y = 0;
}
}
}
ConsumeOutsideClicksResult nsMenuPopupFrame::ConsumeOutsideClicks()
{
--- a/layout/xul/nsResizerFrame.cpp
+++ b/layout/xul/nsResizerFrame.cpp
@@ -168,18 +168,18 @@ nsResizerFrame::HandleEvent(nsPresContex
LayoutDeviceIntPoint mouseMove(screenPoint - mMouseDownPoint);
// Determine which direction to resize by checking the dir attribute.
// For windows and menus, ensure that it can be resized in that direction.
Direction direction = GetDirection();
if (window || menuPopupFrame) {
if (menuPopupFrame) {
menuPopupFrame->CanAdjustEdges(
- (direction.mHorizontal == -1) ? NS_SIDE_LEFT : NS_SIDE_RIGHT,
- (direction.mVertical == -1) ? NS_SIDE_TOP : NS_SIDE_BOTTOM, mouseMove);
+ (direction.mHorizontal == -1) ? eSideLeft : eSideRight,
+ (direction.mVertical == -1) ? eSideTop : eSideBottom, mouseMove);
}
}
else if (!contentToResize) {
break; // don't do anything if there's nothing to resize
}
LayoutDeviceIntRect rect = mMouseDownRect;
--- a/layout/xul/nsStackLayout.cpp
+++ b/layout/xul/nsStackLayout.cpp
@@ -18,20 +18,20 @@
#include "nsGkAtoms.h"
#include "nsIContent.h"
#include "nsNameSpaceManager.h"
using namespace mozilla;
nsBoxLayout* nsStackLayout::gInstance = nullptr;
-#define SPECIFIED_LEFT (1 << NS_SIDE_LEFT)
-#define SPECIFIED_RIGHT (1 << NS_SIDE_RIGHT)
-#define SPECIFIED_TOP (1 << NS_SIDE_TOP)
-#define SPECIFIED_BOTTOM (1 << NS_SIDE_BOTTOM)
+#define SPECIFIED_LEFT (1 << eSideLeft)
+#define SPECIFIED_RIGHT (1 << eSideRight)
+#define SPECIFIED_TOP (1 << eSideTop)
+#define SPECIFIED_BOTTOM (1 << eSideBottom)
nsresult
NS_NewStackLayout(nsCOMPtr<nsBoxLayout>& aNewLayout)
{
if (!nsStackLayout::gInstance) {
nsStackLayout::gInstance = new nsStackLayout();
NS_IF_ADDREF(nsStackLayout::gInstance);
}
--- a/layout/xul/tree/nsTreeBodyFrame.cpp
+++ b/layout/xul/tree/nsTreeBodyFrame.cpp
@@ -3314,17 +3314,17 @@ nsTreeBodyFrame::PaintCell(int32_t
aRenderingContext.ThebesContext()->Save();
const nsStyleBorder* borderStyle = lineContext->StyleBorder();
// Resolve currentcolor values against the treeline context
nscolor color = lineContext->StyleColor()->
CalcComplexColor(borderStyle->mBorderLeftColor);
ColorPattern colorPatt(ToDeviceColor(color));
- uint8_t style = borderStyle->GetBorderStyle(NS_SIDE_LEFT);
+ uint8_t style = borderStyle->GetBorderStyle(eSideLeft);
StrokeOptions strokeOptions;
nsLayoutUtils::InitDashPattern(strokeOptions, style);
nscoord srcX = currX + twistyRect.width - mIndentation / 2;
nscoord lineY = (aRowIndex - mTopRowIndex) * mRowHeight + aPt.y;
DrawTarget* drawTarget = aRenderingContext.GetDrawTarget();
nsPresContext* pc = PresContext();