Bug 1297982 - Replace NS_STYLE_BOX_DECORATION_BREAK_* with enum class; r=xidorn
MozReview-Commit-ID: 9Cli68UpKdz
This commit is contained in:
@@ -1553,7 +1553,7 @@ nsBidiPresUtils::RepositionFrame(nsIFrame* aFrame,
|
||||
// We don't need to do that for 'box-decoration-break:clone' because then all
|
||||
// continuations have border/padding/margin applied.
|
||||
if (aFrame->StyleBorder()->mBoxDecorationBreak ==
|
||||
NS_STYLE_BOX_DECORATION_BREAK_SLICE) {
|
||||
StyleBoxDecorationBreak::Slice) {
|
||||
// First remove the border/padding that was applied based on logical order.
|
||||
if (!aFrame->GetPrevContinuation()) {
|
||||
frameISize -= borderPadding.IStart(frameWM);
|
||||
|
||||
@@ -584,8 +584,7 @@ JoinBoxesForSlice(nsIFrame* aFrame, const nsRect& aBorderArea,
|
||||
static bool
|
||||
IsBoxDecorationSlice(const nsStyleBorder& aStyleBorder)
|
||||
{
|
||||
return aStyleBorder.mBoxDecorationBreak ==
|
||||
NS_STYLE_BOX_DECORATION_BREAK_SLICE;
|
||||
return aStyleBorder.mBoxDecorationBreak == StyleBoxDecorationBreak::Slice;
|
||||
}
|
||||
|
||||
static nsRect
|
||||
|
||||
@@ -2926,13 +2926,13 @@ nsDisplayBackgroundImage::GetOpaqueRegion(nsDisplayListBuilder* aBuilder,
|
||||
|
||||
*aSnap = true;
|
||||
|
||||
// For NS_STYLE_BOX_DECORATION_BREAK_SLICE, don't try to optimize here, since
|
||||
// For StyleBoxDecorationBreak::Slice, don't try to optimize here, since
|
||||
// this could easily lead to O(N^2) behavior inside InlineBackgroundData,
|
||||
// which expects frames to be sent to it in content order, not reverse
|
||||
// content order which we'll produce here.
|
||||
// Of course, if there's only one frame in the flow, it doesn't matter.
|
||||
if (mFrame->StyleBorder()->mBoxDecorationBreak ==
|
||||
NS_STYLE_BOX_DECORATION_BREAK_CLONE ||
|
||||
StyleBoxDecorationBreak::Clone ||
|
||||
(!mFrame->GetPrevContinuation() && !mFrame->GetNextContinuation())) {
|
||||
const nsStyleImageLayers::Layer& layer = mBackgroundStyle->mImage.mLayers[mLayer];
|
||||
if (layer.mImage.IsOpaque() && layer.mBlendMode == NS_STYLE_BLEND_NORMAL &&
|
||||
|
||||
@@ -207,7 +207,7 @@ GetBEndMarginClone(nsIFrame* aFrame,
|
||||
WritingMode aWritingMode)
|
||||
{
|
||||
if (aFrame->StyleBorder()->mBoxDecorationBreak ==
|
||||
NS_STYLE_BOX_DECORATION_BREAK_CLONE) {
|
||||
StyleBoxDecorationBreak::Clone) {
|
||||
SizeComputationInput os(aFrame, aRenderingContext, aWritingMode,
|
||||
aContentArea.ISize(aWritingMode));
|
||||
return os.ComputedLogicalMargin().
|
||||
|
||||
@@ -3083,7 +3083,7 @@ nsBlockFrame::ShouldApplyBStartMargin(BlockReflowInput& aState,
|
||||
|
||||
if (!aState.IsAdjacentWithTop() ||
|
||||
aChildFrame->StyleBorder()->mBoxDecorationBreak ==
|
||||
NS_STYLE_BOX_DECORATION_BREAK_CLONE) {
|
||||
StyleBoxDecorationBreak::Clone) {
|
||||
// If we aren't at the start block-coordinate then something of non-zero
|
||||
// height must have been placed. Therefore the childs block-start margin
|
||||
// applies.
|
||||
@@ -3149,7 +3149,7 @@ nsBlockFrame::ReflowBlockFrame(BlockReflowInput& aState,
|
||||
// apply its block-start margin because it's not significant unless it has
|
||||
// 'box-decoration-break:clone'. Otherwise, dig deeper.
|
||||
bool applyBStartMargin = (frame->StyleBorder()->mBoxDecorationBreak ==
|
||||
NS_STYLE_BOX_DECORATION_BREAK_CLONE ||
|
||||
StyleBoxDecorationBreak::Clone ||
|
||||
!frame->GetPrevInFlow()) &&
|
||||
ShouldApplyBStartMargin(aState, aLine, frame);
|
||||
if (applyBStartMargin) {
|
||||
|
||||
@@ -852,7 +852,7 @@ nsContainerFrame::DoInlineIntrinsicISize(nsRenderingContext *aRenderingContext,
|
||||
// add that to each line. For box-decoration-break:slice clonePBM is zero.
|
||||
nscoord clonePBM = 0; // PBM = PaddingBorderMargin
|
||||
const bool sliceBreak =
|
||||
styleBorder->mBoxDecorationBreak == NS_STYLE_BOX_DECORATION_BREAK_SLICE;
|
||||
styleBorder->mBoxDecorationBreak == StyleBoxDecorationBreak::Slice;
|
||||
if (!GetPrevContinuation()) {
|
||||
nscoord startPBM =
|
||||
// clamp negative calc() to 0
|
||||
|
||||
@@ -1049,7 +1049,7 @@ nsIFrame::Sides
|
||||
nsIFrame::GetSkipSides(const ReflowInput* aReflowInput) const
|
||||
{
|
||||
if (MOZ_UNLIKELY(StyleBorder()->mBoxDecorationBreak ==
|
||||
NS_STYLE_BOX_DECORATION_BREAK_CLONE) &&
|
||||
StyleBoxDecorationBreak::Clone) &&
|
||||
!(GetStateBits() & NS_FRAME_IS_OVERFLOW_CONTAINER)) {
|
||||
return Sides();
|
||||
}
|
||||
@@ -1950,7 +1950,7 @@ nsIFrame::GetClipPropClipRect(const nsStyleDisplay* aDisp,
|
||||
|
||||
*aRect = aEffects->mClip;
|
||||
if (MOZ_LIKELY(StyleBorder()->mBoxDecorationBreak ==
|
||||
NS_STYLE_BOX_DECORATION_BREAK_SLICE)) {
|
||||
StyleBoxDecorationBreak::Slice)) {
|
||||
// The clip applies to the joined boxes so it's relative the first
|
||||
// continuation.
|
||||
nscoord y = 0;
|
||||
|
||||
@@ -4809,7 +4809,7 @@ nsGridContainerFrame::ReflowInFragmentainer(GridReflowInput& aState,
|
||||
const uint32_t startRow = aState.mStartRow;
|
||||
const uint32_t numRows = aState.mRows.mSizes.Length();
|
||||
bool isBDBClone = aState.mReflowInput->mStyleBorder->mBoxDecorationBreak ==
|
||||
NS_STYLE_BOX_DECORATION_BREAK_CLONE;
|
||||
StyleBoxDecorationBreak::Clone;
|
||||
nscoord bpBEnd = aState.mBorderPadding.BEnd(aState.mWM);
|
||||
|
||||
// Set |endRow| to the first row that doesn't fit.
|
||||
@@ -4999,7 +4999,7 @@ nsGridContainerFrame::ReflowRowsInFragmentainer(
|
||||
FrameHashtable incompleteItems;
|
||||
FrameHashtable overflowIncompleteItems;
|
||||
bool isBDBClone = aState.mReflowInput->mStyleBorder->mBoxDecorationBreak ==
|
||||
NS_STYLE_BOX_DECORATION_BREAK_CLONE;
|
||||
StyleBoxDecorationBreak::Clone;
|
||||
bool didGrowRow = false;
|
||||
// As we walk across rows, we track whether the current row is at the top
|
||||
// of its grid-fragment, to help decide whether we can break before it. When
|
||||
@@ -5614,7 +5614,7 @@ nsGridContainerFrame::Reflow(nsPresContext* aPresContext,
|
||||
if (!NS_FRAME_IS_COMPLETE(aStatus) &&
|
||||
!gridReflowInput.mSkipSides.BEnd() &&
|
||||
StyleBorder()->mBoxDecorationBreak !=
|
||||
NS_STYLE_BOX_DECORATION_BREAK_CLONE) {
|
||||
StyleBoxDecorationBreak::Clone) {
|
||||
bp.BEnd(wm) = nscoord(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -2155,7 +2155,7 @@ nsIFrame::LogicalSides
|
||||
nsImageFrame::GetLogicalSkipSides(const ReflowInput* aReflowInput) const
|
||||
{
|
||||
if (MOZ_UNLIKELY(StyleBorder()->mBoxDecorationBreak ==
|
||||
NS_STYLE_BOX_DECORATION_BREAK_CLONE)) {
|
||||
StyleBoxDecorationBreak::Clone)) {
|
||||
return LogicalSides();
|
||||
}
|
||||
LogicalSides skip;
|
||||
|
||||
@@ -137,8 +137,7 @@ nsInlineFrame::IsSelfEmpty()
|
||||
// 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 ==
|
||||
NS_STYLE_BOX_DECORATION_BREAK_SLICE) {
|
||||
StyleBorder()->mBoxDecorationBreak == StyleBoxDecorationBreak::Slice) {
|
||||
// When direction=rtl, we need to consider logical rather than visual
|
||||
// start and end, so swap the flags.
|
||||
if (!wm.IsBidiLTR()) {
|
||||
@@ -585,7 +584,7 @@ nsInlineFrame::ReflowFrames(nsPresContext* aPresContext,
|
||||
nscoord startEdge = 0;
|
||||
const bool boxDecorationBreakClone =
|
||||
MOZ_UNLIKELY(StyleBorder()->mBoxDecorationBreak ==
|
||||
NS_STYLE_BOX_DECORATION_BREAK_CLONE);
|
||||
StyleBoxDecorationBreak::Clone);
|
||||
// Don't offset by our start borderpadding if we have a prev continuation or
|
||||
// if we're in a part of an {ib} split other than the first one. For
|
||||
// box-decoration-break:clone we always offset our start since all
|
||||
@@ -944,7 +943,7 @@ nsIFrame::LogicalSides
|
||||
nsInlineFrame::GetLogicalSkipSides(const ReflowInput* aReflowInput) const
|
||||
{
|
||||
if (MOZ_UNLIKELY(StyleBorder()->mBoxDecorationBreak ==
|
||||
NS_STYLE_BOX_DECORATION_BREAK_CLONE)) {
|
||||
StyleBoxDecorationBreak::Clone)) {
|
||||
return LogicalSides();
|
||||
}
|
||||
|
||||
|
||||
@@ -1188,7 +1188,7 @@ nsLineLayout::AllowForStartMargin(PerFrameData* pfd,
|
||||
if ((pfd->mFrame->GetPrevContinuation() ||
|
||||
pfd->mFrame->FrameIsNonFirstInIBSplit()) &&
|
||||
aReflowInput.mStyleBorder->mBoxDecorationBreak ==
|
||||
NS_STYLE_BOX_DECORATION_BREAK_SLICE) {
|
||||
StyleBoxDecorationBreak::Slice) {
|
||||
// Zero this out so that when we compute the max-element-width of
|
||||
// the frame we will properly avoid adding in the starting margin.
|
||||
pfd->mMargin.IStart(lineWM) = 0;
|
||||
@@ -1302,7 +1302,7 @@ nsLineLayout::CanPlaceFrame(PerFrameData* pfd,
|
||||
pfd->mFrame->FrameIsNonLastInIBSplit()) &&
|
||||
!pfd->mIsLetterFrame &&
|
||||
pfd->mFrame->StyleBorder()->mBoxDecorationBreak ==
|
||||
NS_STYLE_BOX_DECORATION_BREAK_SLICE) {
|
||||
StyleBoxDecorationBreak::Slice) {
|
||||
pfd->mMargin.IEnd(lineWM) = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -118,7 +118,7 @@ nsRubyFrame::Reflow(nsPresContext* aPresContext,
|
||||
LogicalMargin borderPadding = aReflowInput.ComputedLogicalBorderPadding();
|
||||
nscoord startEdge = 0;
|
||||
const bool boxDecorationBreakClone =
|
||||
StyleBorder()->mBoxDecorationBreak == NS_STYLE_BOX_DECORATION_BREAK_CLONE;
|
||||
StyleBorder()->mBoxDecorationBreak == StyleBoxDecorationBreak::Clone;
|
||||
if (boxDecorationBreakClone || !GetPrevContinuation()) {
|
||||
startEdge = borderPadding.IStart(frameWM);
|
||||
}
|
||||
|
||||
@@ -243,7 +243,7 @@ nsSplittableFrame::GetLogicalSkipSides(const ReflowInput* aReflowInput) const
|
||||
}
|
||||
|
||||
if (MOZ_UNLIKELY(StyleBorder()->mBoxDecorationBreak ==
|
||||
NS_STYLE_BOX_DECORATION_BREAK_CLONE)) {
|
||||
StyleBoxDecorationBreak::Clone)) {
|
||||
return LogicalSides();
|
||||
}
|
||||
|
||||
@@ -284,7 +284,7 @@ nsSplittableFrame::PreReflowBlockLevelLogicalSkipSides() const
|
||||
return LogicalSides(mozilla::eLogicalSideBitsBBoth);
|
||||
}
|
||||
if (MOZ_LIKELY(StyleBorder()->mBoxDecorationBreak !=
|
||||
NS_STYLE_BOX_DECORATION_BREAK_CLONE) &&
|
||||
StyleBoxDecorationBreak::Clone) &&
|
||||
GetPrevInFlow()) {
|
||||
return LogicalSides(mozilla::eLogicalSideBitsBStart);
|
||||
}
|
||||
|
||||
@@ -1031,8 +1031,8 @@ const KTableEntry nsCSSProps::kBorderWidthKTable[] = {
|
||||
};
|
||||
|
||||
const KTableEntry nsCSSProps::kBoxDecorationBreakKTable[] = {
|
||||
{ eCSSKeyword_slice, NS_STYLE_BOX_DECORATION_BREAK_SLICE },
|
||||
{ eCSSKeyword_clone, NS_STYLE_BOX_DECORATION_BREAK_CLONE },
|
||||
{ eCSSKeyword_slice, StyleBoxDecorationBreak::Slice },
|
||||
{ eCSSKeyword_clone, StyleBoxDecorationBreak::Clone },
|
||||
{ eCSSKeyword_UNKNOWN, -1 }
|
||||
};
|
||||
|
||||
|
||||
@@ -1335,6 +1335,7 @@ struct SetEnumValueHelper
|
||||
}
|
||||
|
||||
DEFINE_ENUM_CLASS_SETTER(StyleBoxAlign, Stretch, End)
|
||||
DEFINE_ENUM_CLASS_SETTER(StyleBoxDecorationBreak, Slice, Clone)
|
||||
DEFINE_ENUM_CLASS_SETTER(StyleBoxPack, Start, Justify)
|
||||
DEFINE_ENUM_CLASS_SETTER(StyleBoxSizing, Content, Border)
|
||||
DEFINE_ENUM_CLASS_SETTER(StyleFillRule, Nonzero, Evenodd)
|
||||
@@ -7466,7 +7467,7 @@ nsRuleNode::ComputeBorderData(void* aStartStruct,
|
||||
border->mBoxDecorationBreak, conditions,
|
||||
SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
|
||||
parentBorder->mBoxDecorationBreak,
|
||||
NS_STYLE_BOX_DECORATION_BREAK_SLICE);
|
||||
StyleBoxDecorationBreak::Slice);
|
||||
|
||||
// border-width, border-*-width: length, enum, inherit
|
||||
nsStyleCoord coord;
|
||||
|
||||
@@ -71,6 +71,12 @@ enum class StyleBoxAlign : uint8_t {
|
||||
End,
|
||||
};
|
||||
|
||||
// box-decoration-break
|
||||
enum class StyleBoxDecorationBreak : uint8_t {
|
||||
Slice,
|
||||
Clone,
|
||||
};
|
||||
|
||||
// box-pack
|
||||
enum class StyleBoxPack : uint8_t {
|
||||
Start,
|
||||
@@ -185,10 +191,6 @@ enum class StyleUserSelect : uint8_t {
|
||||
#define NS_STYLE_WINDOW_DRAGGING_DRAG 1
|
||||
#define NS_STYLE_WINDOW_DRAGGING_NO_DRAG 2
|
||||
|
||||
// box-decoration-break
|
||||
#define NS_STYLE_BOX_DECORATION_BREAK_SLICE 0
|
||||
#define NS_STYLE_BOX_DECORATION_BREAK_CLONE 1
|
||||
|
||||
// box-direction
|
||||
#define NS_STYLE_BOX_DIRECTION_NORMAL 0
|
||||
#define NS_STYLE_BOX_DIRECTION_REVERSE 1
|
||||
|
||||
@@ -440,7 +440,7 @@ nsStyleBorder::nsStyleBorder(StyleStructContext aContext)
|
||||
, mBorderImageRepeatH(NS_STYLE_BORDER_IMAGE_REPEAT_STRETCH)
|
||||
, mBorderImageRepeatV(NS_STYLE_BORDER_IMAGE_REPEAT_STRETCH)
|
||||
, mFloatEdge(StyleFloatEdge::ContentBox)
|
||||
, mBoxDecorationBreak(NS_STYLE_BOX_DECORATION_BREAK_SLICE)
|
||||
, mBoxDecorationBreak(StyleBoxDecorationBreak::Slice)
|
||||
, mComputedBorder(0, 0, 0, 0)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsStyleBorder);
|
||||
|
||||
@@ -1335,7 +1335,7 @@ public:
|
||||
uint8_t mBorderImageRepeatH; // [reset] see nsStyleConsts.h
|
||||
uint8_t mBorderImageRepeatV; // [reset]
|
||||
mozilla::StyleFloatEdge mFloatEdge; // [reset]
|
||||
uint8_t mBoxDecorationBreak; // [reset] see nsStyleConsts.h
|
||||
mozilla::StyleBoxDecorationBreak mBoxDecorationBreak; // [reset]
|
||||
|
||||
protected:
|
||||
// mComputedBorder holds the CSS2.1 computed border-width values.
|
||||
|
||||
@@ -564,7 +564,7 @@ nsIFrame::LogicalSides
|
||||
nsTableCellFrame::GetLogicalSkipSides(const ReflowInput* aReflowInput) const
|
||||
{
|
||||
if (MOZ_UNLIKELY(StyleBorder()->mBoxDecorationBreak ==
|
||||
NS_STYLE_BOX_DECORATION_BREAK_CLONE)) {
|
||||
StyleBoxDecorationBreak::Clone)) {
|
||||
return LogicalSides();
|
||||
}
|
||||
|
||||
|
||||
@@ -333,7 +333,7 @@ nsIFrame::LogicalSides
|
||||
nsTableColGroupFrame::GetLogicalSkipSides(const ReflowInput* aReflowInput) const
|
||||
{
|
||||
if (MOZ_UNLIKELY(StyleBorder()->mBoxDecorationBreak ==
|
||||
NS_STYLE_BOX_DECORATION_BREAK_CLONE)) {
|
||||
StyleBoxDecorationBreak::Clone)) {
|
||||
return LogicalSides();
|
||||
}
|
||||
|
||||
|
||||
@@ -1418,7 +1418,7 @@ nsIFrame::LogicalSides
|
||||
nsTableFrame::GetLogicalSkipSides(const ReflowInput* aReflowInput) const
|
||||
{
|
||||
if (MOZ_UNLIKELY(StyleBorder()->mBoxDecorationBreak ==
|
||||
NS_STYLE_BOX_DECORATION_BREAK_CLONE)) {
|
||||
StyleBoxDecorationBreak::Clone)) {
|
||||
return LogicalSides();
|
||||
}
|
||||
|
||||
|
||||
@@ -626,7 +626,7 @@ nsIFrame::LogicalSides
|
||||
nsTableRowFrame::GetLogicalSkipSides(const ReflowInput* aReflowInput) const
|
||||
{
|
||||
if (MOZ_UNLIKELY(StyleBorder()->mBoxDecorationBreak ==
|
||||
NS_STYLE_BOX_DECORATION_BREAK_CLONE)) {
|
||||
StyleBoxDecorationBreak::Clone)) {
|
||||
return LogicalSides();
|
||||
}
|
||||
|
||||
|
||||
@@ -268,7 +268,7 @@ nsIFrame::LogicalSides
|
||||
nsTableRowGroupFrame::GetLogicalSkipSides(const ReflowInput* aReflowInput) const
|
||||
{
|
||||
if (MOZ_UNLIKELY(StyleBorder()->mBoxDecorationBreak ==
|
||||
NS_STYLE_BOX_DECORATION_BREAK_CLONE)) {
|
||||
StyleBoxDecorationBreak::Clone)) {
|
||||
return LogicalSides();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user