Bug 1297982 - Replace NS_STYLE_BOX_ORIENT_* with enum class; r?xidorn
MozReview-Commit-ID: GC0VRyHUM4V
--- a/accessible/generic/Accessible.cpp
+++ b/accessible/generic/Accessible.cpp
@@ -423,17 +423,17 @@ Accessible::NativeState()
state |= states::FLOATING;
// XXX we should look at layout for non XUL box frames, but need to decide
// how that interacts with ARIA.
if (HasOwnContent() && mContent->IsXULElement() && frame->IsXULBoxFrame()) {
const nsStyleXUL* xulStyle = frame->StyleXUL();
if (xulStyle && frame->IsXULBoxFrame()) {
// In XUL all boxes are either vertical or horizontal
- if (xulStyle->mBoxOrient == NS_STYLE_BOX_ORIENT_VERTICAL)
+ if (xulStyle->mBoxOrient == StyleBoxOrient::Vertical)
state |= states::VERTICAL;
else
state |= states::HORIZONTAL;
}
}
}
// Check if a XUL element has the popup attribute (an attached popup menu).
--- a/layout/generic/nsFlexContainerFrame.cpp
+++ b/layout/generic/nsFlexContainerFrame.cpp
@@ -3243,17 +3243,17 @@ FlexboxAxisTracker::FlexboxAxisTracker(
void
FlexboxAxisTracker::InitAxesFromLegacyProps(
const nsFlexContainerFrame* aFlexContainer)
{
const nsStyleXUL* styleXUL = aFlexContainer->StyleXUL();
const bool boxOrientIsVertical = (styleXUL->mBoxOrient ==
- NS_STYLE_BOX_ORIENT_VERTICAL);
+ StyleBoxOrient::Vertical);
const bool wmIsVertical = mWM.IsVertical();
// If box-orient agrees with our writing-mode, then we're "row-oriented"
// (i.e. the flexbox main axis is the same as our writing mode's inline
// direction). Otherwise, we're column-oriented (i.e. the flexbox's main
// axis is perpendicular to the writing-mode's inline direction).
mIsRowOriented = (boxOrientIsVertical == wmIsVertical);
--- a/layout/style/nsCSSProps.cpp
+++ b/layout/style/nsCSSProps.cpp
@@ -2252,20 +2252,20 @@ const KTableEntry nsCSSProps::kBoxAlignK
const KTableEntry nsCSSProps::kBoxDirectionKTable[] = {
{ eCSSKeyword_normal, StyleBoxDirection::Normal },
{ eCSSKeyword_reverse, StyleBoxDirection::Reverse },
{ eCSSKeyword_UNKNOWN, -1 }
};
const KTableEntry nsCSSProps::kBoxOrientKTable[] = {
- { eCSSKeyword_horizontal, NS_STYLE_BOX_ORIENT_HORIZONTAL },
- { eCSSKeyword_vertical, NS_STYLE_BOX_ORIENT_VERTICAL },
- { eCSSKeyword_inline_axis, NS_STYLE_BOX_ORIENT_HORIZONTAL },
- { eCSSKeyword_block_axis, NS_STYLE_BOX_ORIENT_VERTICAL },
+ { eCSSKeyword_horizontal, StyleBoxOrient::Horizontal },
+ { eCSSKeyword_vertical, StyleBoxOrient::Vertical },
+ { eCSSKeyword_inline_axis, StyleBoxOrient::Horizontal },
+ { eCSSKeyword_block_axis, StyleBoxOrient::Vertical },
{ eCSSKeyword_UNKNOWN, -1 }
};
const KTableEntry nsCSSProps::kBoxPackKTable[] = {
{ eCSSKeyword_start, StyleBoxPack::Start },
{ eCSSKeyword_center, StyleBoxPack::Center },
{ eCSSKeyword_end, StyleBoxPack::End },
{ eCSSKeyword_justify, StyleBoxPack::Justify },
--- a/layout/style/nsRuleNode.cpp
+++ b/layout/style/nsRuleNode.cpp
@@ -1332,16 +1332,17 @@ struct SetEnumValueHelper
value <= static_cast<decltype(value)>(type_::max_), \
"inappropriate value"); \
aField = static_cast<type_>(value); \
}
DEFINE_ENUM_CLASS_SETTER(StyleBoxAlign, Stretch, End)
DEFINE_ENUM_CLASS_SETTER(StyleBoxDecorationBreak, Slice, Clone)
DEFINE_ENUM_CLASS_SETTER(StyleBoxDirection, Normal, Reverse)
+ DEFINE_ENUM_CLASS_SETTER(StyleBoxOrient, Horizontal, Vertical)
DEFINE_ENUM_CLASS_SETTER(StyleBoxPack, Start, Justify)
DEFINE_ENUM_CLASS_SETTER(StyleBoxSizing, Content, Border)
DEFINE_ENUM_CLASS_SETTER(StyleFillRule, Nonzero, Evenodd)
DEFINE_ENUM_CLASS_SETTER(StyleFloat, None_, InlineEnd)
DEFINE_ENUM_CLASS_SETTER(StyleFloatEdge, ContentBox, MarginBox)
DEFINE_ENUM_CLASS_SETTER(StyleUserFocus, None_, SelectMenu)
DEFINE_ENUM_CLASS_SETTER(StyleUserSelect, None_, MozText)
@@ -9112,17 +9113,17 @@ nsRuleNode::ComputeXULData(void* aStartS
parentXUL->mBoxFlex, 0.0f,
SETFCT_UNSET_INITIAL);
// box-orient: enum, inherit, initial
SetValue(*aRuleData->ValueForBoxOrient(),
xul->mBoxOrient, conditions,
SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
parentXUL->mBoxOrient,
- NS_STYLE_BOX_ORIENT_HORIZONTAL);
+ StyleBoxOrient::Horizontal);
// box-pack: enum, inherit, initial
SetValue(*aRuleData->ValueForBoxPack(),
xul->mBoxPack, conditions,
SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
parentXUL->mBoxPack,
StyleBoxPack::Start);
--- a/layout/style/nsStyleConsts.h
+++ b/layout/style/nsStyleConsts.h
@@ -78,16 +78,22 @@ enum class StyleBoxDecorationBreak : uin
};
// box-direction
enum class StyleBoxDirection : uint8_t {
Normal,
Reverse,
};
+// box-orient
+enum class StyleBoxOrient : uint8_t {
+ Horizontal,
+ Vertical,
+};
+
// box-pack
enum class StyleBoxPack : uint8_t {
Start,
Center,
End,
Justify,
};
@@ -192,20 +198,16 @@ enum class StyleUserSelect : uint8_t {
#define NS_STYLE_USER_MODIFY_READ_WRITE 1
#define NS_STYLE_USER_MODIFY_WRITE_ONLY 2
// -moz-window-dragging
#define NS_STYLE_WINDOW_DRAGGING_DEFAULT 0
#define NS_STYLE_WINDOW_DRAGGING_DRAG 1
#define NS_STYLE_WINDOW_DRAGGING_NO_DRAG 2
-// box-orient
-#define NS_STYLE_BOX_ORIENT_HORIZONTAL 0
-#define NS_STYLE_BOX_ORIENT_VERTICAL 1
-
// orient
#define NS_STYLE_ORIENT_INLINE 0
#define NS_STYLE_ORIENT_BLOCK 1
#define NS_STYLE_ORIENT_HORIZONTAL 2
#define NS_STYLE_ORIENT_VERTICAL 3
#define NS_RADIUS_FARTHEST_SIDE 0
#define NS_RADIUS_CLOSEST_SIDE 1
--- a/layout/style/nsStyleStruct.cpp
+++ b/layout/style/nsStyleStruct.cpp
@@ -825,17 +825,17 @@ nsStyleList::sNoneQuotes;
// --------------------
// nsStyleXUL
//
nsStyleXUL::nsStyleXUL(StyleStructContext aContext)
: mBoxFlex(0.0f)
, mBoxOrdinal(1)
, mBoxAlign(StyleBoxAlign::Stretch)
, mBoxDirection(StyleBoxDirection::Normal)
- , mBoxOrient(NS_STYLE_BOX_ORIENT_HORIZONTAL)
+ , mBoxOrient(StyleBoxOrient::Horizontal)
, mBoxPack(StyleBoxPack::Start)
, mStretchStack(true)
{
MOZ_COUNT_CTOR(nsStyleXUL);
}
nsStyleXUL::~nsStyleXUL()
{
--- a/layout/style/nsStyleStruct.h
+++ b/layout/style/nsStyleStruct.h
@@ -3433,17 +3433,17 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
nsChangeHint_ReflowChangesSizeOrPosition |
nsChangeHint_ClearAncestorIntrinsics;
}
float mBoxFlex; // [reset] see nsStyleConsts.h
uint32_t mBoxOrdinal; // [reset] see nsStyleConsts.h
mozilla::StyleBoxAlign mBoxAlign; // [reset]
mozilla::StyleBoxDirection mBoxDirection; // [reset]
- uint8_t mBoxOrient; // [reset] see nsStyleConsts.h
+ mozilla::StyleBoxOrient mBoxOrient; // [reset]
mozilla::StyleBoxPack mBoxPack; // [reset]
bool mStretchStack; // [reset] see nsStyleConsts.h
};
struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleColumn
{
explicit nsStyleColumn(StyleStructContext aContext);
nsStyleColumn(const nsStyleColumn& aSource);
--- a/layout/xul/nsBoxFrame.cpp
+++ b/layout/xul/nsBoxFrame.cpp
@@ -452,20 +452,21 @@ void
nsBoxFrame::GetInitialOrientation(bool& aIsHorizontal)
{
// see if we are a vertical or horizontal box.
if (!GetContent())
return;
// Check the style system first.
const nsStyleXUL* boxInfo = StyleXUL();
- if (boxInfo->mBoxOrient == NS_STYLE_BOX_ORIENT_HORIZONTAL)
+ if (boxInfo->mBoxOrient == StyleBoxOrient::Horizontal) {
aIsHorizontal = true;
- else
+ } else {
aIsHorizontal = false;
+ }
// Now see if we have an attribute. The attribute overrides
// the style system value.
static nsIContent::AttrValuesArray strings[] =
{&nsGkAtoms::vertical, &nsGkAtoms::horizontal, nullptr};
int32_t index = GetContent()->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::orient,
strings, eCaseMatters);
if (index >= 0) {