--- a/dom/html/HTMLBRElement.cpp
+++ b/dom/html/HTMLBRElement.cpp
@@ -25,20 +25,20 @@ HTMLBRElement::HTMLBRElement(already_Add
HTMLBRElement::~HTMLBRElement()
{
}
NS_IMPL_ELEMENT_CLONE(HTMLBRElement)
static const nsAttrValue::EnumTable kClearTable[] = {
- { "left", NS_STYLE_CLEAR_LEFT },
- { "right", NS_STYLE_CLEAR_RIGHT },
- { "all", NS_STYLE_CLEAR_BOTH },
- { "both", NS_STYLE_CLEAR_BOTH },
+ { "left", StyleClear::Left },
+ { "right", StyleClear::Right },
+ { "all", StyleClear::Both },
+ { "both", StyleClear::Both },
{ nullptr, 0 }
};
bool
HTMLBRElement::ParseAttribute(int32_t aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult)
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -3045,41 +3045,44 @@ nsLayoutUtils::TranslateViewToWidget(nsP
nsPoint pt = (aPt +
viewOffset).ApplyResolution(GetCurrentAPZResolutionScale(aPresContext->PresShell()));
LayoutDeviceIntPoint relativeToViewWidget(aPresContext->AppUnitsToDevPixels(pt.x),
aPresContext->AppUnitsToDevPixels(pt.y));
return relativeToViewWidget + WidgetToWidgetOffset(viewWidget, aWidget);
}
// Combine aNewBreakType with aOrigBreakType, but limit the break types
-// to NS_STYLE_CLEAR_LEFT, RIGHT, BOTH.
-uint8_t
-nsLayoutUtils::CombineBreakType(uint8_t aOrigBreakType,
- uint8_t aNewBreakType)
-{
- uint8_t breakType = aOrigBreakType;
+// to StyleClear::Left, Right, Both.
+StyleClear
+nsLayoutUtils::CombineBreakType(StyleClear aOrigBreakType,
+ StyleClear aNewBreakType)
+{
+ StyleClear breakType = aOrigBreakType;
switch(breakType) {
- case NS_STYLE_CLEAR_LEFT:
- if (NS_STYLE_CLEAR_RIGHT == aNewBreakType ||
- NS_STYLE_CLEAR_BOTH == aNewBreakType) {
- breakType = NS_STYLE_CLEAR_BOTH;
- }
- break;
- case NS_STYLE_CLEAR_RIGHT:
- if (NS_STYLE_CLEAR_LEFT == aNewBreakType ||
- NS_STYLE_CLEAR_BOTH == aNewBreakType) {
- breakType = NS_STYLE_CLEAR_BOTH;
- }
- break;
- case NS_STYLE_CLEAR_NONE:
- if (NS_STYLE_CLEAR_LEFT == aNewBreakType ||
- NS_STYLE_CLEAR_RIGHT == aNewBreakType ||
- NS_STYLE_CLEAR_BOTH == aNewBreakType) {
- breakType = aNewBreakType;
- }
+ case StyleClear::Left:
+ if (StyleClear::Right == aNewBreakType ||
+ StyleClear::Both == aNewBreakType) {
+ breakType = StyleClear::Both;
+ }
+ break;
+ case StyleClear::Right:
+ if (StyleClear::Left == aNewBreakType ||
+ StyleClear::Both == aNewBreakType) {
+ breakType = StyleClear::Both;
+ }
+ break;
+ case StyleClear::None_:
+ if (StyleClear::Left == aNewBreakType ||
+ StyleClear::Right == aNewBreakType ||
+ StyleClear::Both == aNewBreakType) {
+ breakType = aNewBreakType;
+ }
+ break;
+ default:
+ break;
}
return breakType;
}
#ifdef MOZ_DUMP_PAINTING
#include <stdio.h>
static bool gDumpEventList = false;
--- a/layout/base/nsLayoutUtils.h
+++ b/layout/base/nsLayoutUtils.h
@@ -689,18 +689,19 @@ public:
/**
* If this frame is a placeholder for a float, then return the float,
* otherwise return nullptr. aPlaceholder must be a placeholder frame.
*/
static nsIFrame* GetFloatFromPlaceholder(nsIFrame* aPlaceholder);
// Combine aNewBreakType with aOrigBreakType, but limit the break types
- // to NS_STYLE_CLEAR_LEFT, RIGHT, LEFT_AND_RIGHT.
- static uint8_t CombineBreakType(uint8_t aOrigBreakType, uint8_t aNewBreakType);
+ // to StyleClear::Left, Right, Both.
+ static mozilla::StyleClear CombineBreakType(mozilla::StyleClear aOrigBreakType,
+ mozilla::StyleClear aNewBreakType);
/**
* Get the coordinates of a given DOM mouse event, relative to a given
* frame. Works only for DOM events generated by WidgetGUIEvents.
* @param aDOMEvent the event
* @param aFrame the frame to make coordinates relative to
* @return the point, or (NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE) if
* for some reason the coordinates for the mouse are not known (e.g.,
--- a/layout/generic/BlockReflowInput.cpp
+++ b/layout/generic/BlockReflowInput.cpp
@@ -39,17 +39,17 @@ BlockReflowInput::BlockReflowInput(const
mPresContext(aPresContext),
mReflowInput(aReflowInput),
mContentArea(aReflowInput.GetWritingMode()),
mPushedFloats(nullptr),
mOverflowTracker(nullptr),
mBorderPadding(mReflowInput.ComputedLogicalBorderPadding()),
mPrevBEndMargin(),
mLineNumber(0),
- mFloatBreakType(NS_STYLE_CLEAR_NONE),
+ mFloatBreakType(StyleClear::None_),
mConsumedBSize(aConsumedBSize)
{
if (!sFloatFragmentsInsideColumnPrefCached) {
sFloatFragmentsInsideColumnPrefCached = true;
Preferences::AddBoolVarCache(&sFloatFragmentsInsideColumnEnabled,
"layout.float-fragments-inside-column.enabled");
}
mFlags.mFloatFragmentsInsideColumnEnabled = sFloatFragmentsInsideColumnEnabled;
@@ -727,17 +727,17 @@ BlockReflowInput::FlowAndPlaceFloat(nsIF
// Enforce CSS2 9.5.1 rule [2], i.e., make sure that a float isn't
// ``above'' another float that preceded it in the flow.
mBCoord = std::max(mFloatManager->GetLowestFloatTop(), mBCoord);
// See if the float should clear any preceding floats...
// XXX We need to mark this float somehow so that it gets reflowed
// when floats are inserted before it.
- if (NS_STYLE_CLEAR_NONE != floatDisplay->mBreakType) {
+ if (StyleClear::None_ != floatDisplay->mBreakType) {
// XXXldb Does this handle vertical margins correctly?
mBCoord = ClearFloats(mBCoord, floatDisplay->PhysicalBreakType(wm));
}
// Get the band of available space
nsFlowAreaRect floatAvailableSpace = GetFloatAvailableSpace(mBCoord);
LogicalRect adjustedAvailableSpace =
mBlock->AdjustFloatAvailableSpace(*this, floatAvailableSpace.mRect, aFloat);
@@ -1075,40 +1075,40 @@ BlockReflowInput::PlaceBelowCurrentLineF
delete fc;
aLine->SetHadFloatPushed();
}
fc = next;
}
}
nscoord
-BlockReflowInput::ClearFloats(nscoord aBCoord, uint8_t aBreakType,
+BlockReflowInput::ClearFloats(nscoord aBCoord, StyleClear aBreakType,
nsIFrame *aReplacedBlock,
uint32_t aFlags)
{
#ifdef DEBUG
if (nsBlockFrame::gNoisyReflow) {
nsFrame::IndentBy(stdout, nsBlockFrame::gNoiseIndent);
printf("clear floats: in: aBCoord=%d\n", aBCoord);
}
#endif
#ifdef NOISY_FLOAT_CLEARING
- printf("BlockReflowInput::ClearFloats: aBCoord=%d breakType=%d\n",
- aBCoord, aBreakType);
+ printf("BlockReflowInput::ClearFloats: aBCoord=%d breakType=%s\n",
+ aBCoord, nsLineBox::BreakTypeToString(aBreakType));
mFloatManager->List(stdout);
#endif
if (!mFloatManager->HasAnyFloats()) {
return aBCoord;
}
nscoord newBCoord = aBCoord;
- if (aBreakType != NS_STYLE_CLEAR_NONE) {
+ if (aBreakType != StyleClear::None_) {
newBCoord = mFloatManager->ClearFloats(newBCoord, aBreakType, aFlags);
}
if (aReplacedBlock) {
for (;;) {
nsFlowAreaRect floatAvailableSpace = GetFloatAvailableSpace(newBCoord);
if (ReplacedBlockFitsInAvailSpace(aReplacedBlock, floatAvailableSpace)) {
break;
--- a/layout/generic/BlockReflowInput.h
+++ b/layout/generic/BlockReflowInput.h
@@ -144,17 +144,17 @@ public:
bool FlowAndPlaceFloat(nsIFrame* aFloat);
void PlaceBelowCurrentLineFloats(nsFloatCacheFreeList& aFloats,
nsLineBox* aLine);
// Returns the first coordinate >= aBCoord that clears the
// floats indicated by aBreakType and has enough inline size between floats
// (or no floats remaining) to accomodate aReplacedBlock.
- nscoord ClearFloats(nscoord aBCoord, uint8_t aBreakType,
+ nscoord ClearFloats(nscoord aBCoord, mozilla::StyleClear aBreakType,
nsIFrame *aReplacedBlock = nullptr,
uint32_t aFlags = 0);
// Advances to the next band, i.e., the next horizontal stripe in
// which there is a different set of floats.
// Return false if it did not advance, which only happens for
// constrained heights (and means that we should get pushed to the
// next column/page).
@@ -366,17 +366,17 @@ public:
nsFloatCacheFreeList mBelowCurrentLineFloats;
nscoord mMinLineHeight;
int32_t mLineNumber;
Flags mFlags;
- uint8_t mFloatBreakType;
+ StyleClear mFloatBreakType;
// The amount of computed block-direction size "consumed" by previous-in-flows.
nscoord mConsumedBSize;
private:
bool CanPlaceFloat(nscoord aFloatISize,
const nsFlowAreaRect& aFloatAvailableSpace);
--- a/layout/generic/WritingModes.h
+++ b/layout/generic/WritingModes.h
@@ -2009,24 +2009,25 @@ nsStyleDisplay::PhysicalFloats(mozilla::
return aWM.IsBidiLTR() ? StyleFloat::Left : StyleFloat::Right;
}
if (mFloat == StyleFloat::InlineEnd) {
return aWM.IsBidiLTR() ? StyleFloat::Right : StyleFloat::Left;
}
return mFloat;
}
-inline uint8_t
+inline mozilla::StyleClear
nsStyleDisplay::PhysicalBreakType(mozilla::WritingMode aWM) const
{
- if (mBreakType == NS_STYLE_CLEAR_INLINE_START) {
- return aWM.IsBidiLTR() ? NS_STYLE_CLEAR_LEFT : NS_STYLE_CLEAR_RIGHT;
+ using StyleClear = mozilla::StyleClear;
+ if (mBreakType == StyleClear::InlineStart) {
+ return aWM.IsBidiLTR() ? StyleClear::Left : StyleClear::Right;
}
- if (mBreakType == NS_STYLE_CLEAR_INLINE_END) {
- return aWM.IsBidiLTR() ? NS_STYLE_CLEAR_RIGHT : NS_STYLE_CLEAR_LEFT;
+ if (mBreakType == StyleClear::InlineEnd) {
+ return aWM.IsBidiLTR() ? StyleClear::Right : StyleClear::Left;
}
return mBreakType;
}
inline bool
nsStyleMargin::HasBlockAxisAuto(mozilla::WritingMode aWM) const
{
return mMargin.HasBlockAxisAuto(aWM);
--- a/layout/generic/nsBRFrame.cpp
+++ b/layout/generic/nsBRFrame.cpp
@@ -139,19 +139,19 @@ BRFrame::Reflow(nsPresContext* aPresCont
// XXX This also fixes bug 10036!
// Warning: nsTextControlFrame::CalculateSizeStandard depends on
// the following line, see bug 228752.
// The code below in AddInlinePrefISize also adds 1 appunit to width
finalSize.ISize(wm) = 1;
}
// Return our reflow status
- uint32_t breakType = aReflowInput.mStyleDisplay->PhysicalBreakType(wm);
- if (NS_STYLE_CLEAR_NONE == breakType) {
- breakType = NS_STYLE_CLEAR_LINE;
+ StyleClear breakType = aReflowInput.mStyleDisplay->PhysicalBreakType(wm);
+ if (StyleClear::None_ == breakType) {
+ breakType = StyleClear::Line;
}
aStatus = NS_INLINE_BREAK | NS_INLINE_BREAK_AFTER |
NS_INLINE_MAKE_BREAK_TYPE(breakType);
ll->SetLineEndsInBR(true);
}
else {
aStatus = NS_FRAME_COMPLETE;
--- a/layout/generic/nsBlockFrame.cpp
+++ b/layout/generic/nsBlockFrame.cpp
@@ -1544,17 +1544,17 @@ nsBlockFrame::ComputeFinalSize(const Ref
std::min(blockEndEdgeOfChildren + aState.mPrevBEndMargin.get(),
aState.mReflowInput.AvailableBSize());
}
}
if (aState.mFlags.mBlockNeedsFloatManager) {
// Include the float manager's state to properly account for the
// block-end margin of any floated elements; e.g., inside a table cell.
nscoord floatHeight =
- aState.ClearFloats(blockEndEdgeOfChildren, NS_STYLE_CLEAR_BOTH,
+ aState.ClearFloats(blockEndEdgeOfChildren, StyleClear::Both,
nullptr, nsFloatManager::DONT_CLEAR_PUSHED_FLOATS);
blockEndEdgeOfChildren = std::max(blockEndEdgeOfChildren, floatHeight);
}
if (NS_UNCONSTRAINEDSIZE != aReflowInput.ComputedBSize()
&& (GetParent()->GetType() != nsGkAtoms::columnSetFrame ||
aReflowInput.mParentReflowInput->AvailableBSize() == NS_UNCONSTRAINEDSIZE)) {
ComputeFinalBSize(aReflowInput, &aState.mReflowStatus,
@@ -1914,24 +1914,25 @@ nsBlockFrame::PrepareResizeReflow(BlockR
if (!line->IsBlock()) {
printf("PrepareResizeReflow thinks line %p is %simpacted by floats\n",
line.get(), line->IsImpactedByFloat() ? "" : "not ");
}
#endif
#ifdef DEBUG
if (gNoisyReflow && !line->IsDirty()) {
IndentBy(stdout, gNoiseIndent + 1);
- printf("skipped: line=%p next=%p %s %s%s%s breakTypeBefore/After=%d/%d xmost=%d\n",
+ printf("skipped: line=%p next=%p %s %s%s%s breakTypeBefore/After=%s/%s xmost=%d\n",
static_cast<void*>(line.get()),
static_cast<void*>((line.next() != end_lines() ? line.next().get() : nullptr)),
line->IsBlock() ? "block" : "inline",
line->HasBreakAfter() ? "has-break-after " : "",
line->HasFloats() ? "has-floats " : "",
line->IsImpactedByFloat() ? "impacted " : "",
- line->GetBreakTypeBefore(), line->GetBreakTypeAfter(),
+ line->BreakTypeToString(line->GetBreakTypeBefore()),
+ line->BreakTypeToString(line->GetBreakTypeAfter()),
line->IEnd());
}
#endif
}
}
else {
// Mark everything dirty
for (line_iterator line = begin_lines(), line_end = end_lines();
@@ -2024,17 +2025,17 @@ nsBlockFrame::PropagateFloatDamage(Block
aLine->MarkDirty();
}
}
}
}
static bool LineHasClear(nsLineBox* aLine) {
return aLine->IsBlock()
- ? (aLine->GetBreakTypeBefore() ||
+ ? (aLine->GetBreakTypeBefore() != StyleClear::None_ ||
(aLine->mFirstChild->GetStateBits() & NS_BLOCK_HAS_CLEAR_CHILDREN) ||
!nsBlockFrame::BlockCanIntersectFloats(aLine->mFirstChild))
: aLine->HasFloatBreakAfter();
}
/**
* Reparent a whole list of floats from aOldParent to this block. The
@@ -2075,17 +2076,17 @@ static void DumpLine(const BlockReflowIn
#endif
}
void
nsBlockFrame::ReflowDirtyLines(BlockReflowInput& aState)
{
bool keepGoing = true;
bool repositionViews = false; // should we really need this?
- bool foundAnyClears = aState.mFloatBreakType != NS_STYLE_CLEAR_NONE;
+ bool foundAnyClears = aState.mFloatBreakType != StyleClear::None_;
bool willReflowAgain = false;
#ifdef DEBUG
if (gNoisyReflow) {
IndentBy(stdout, gNoiseIndent);
ListTag(stdout);
printf(": reflowing dirty lines");
printf(" computedISize=%d\n", aState.mReflowInput.ComputedISize());
@@ -2116,17 +2117,17 @@ nsBlockFrame::ReflowDirtyLines(BlockRefl
// recompute the carried out margin before the line if we want to
// reflow it or if its previous margin is dirty
bool needToRecoverState = false;
// Float continuations were reflowed in ReflowPushedFloats
bool reflowedFloat = mFloats.NotEmpty() &&
(mFloats.FirstChild()->GetStateBits() & NS_FRAME_IS_PUSHED_FLOAT);
bool lastLineMovedUp = false;
// We save up information about BR-clearance here
- uint8_t inlineFloatBreakType = aState.mFloatBreakType;
+ StyleClear inlineFloatBreakType = aState.mFloatBreakType;
line_iterator line = begin_lines(), line_end = end_lines();
// Reflow the lines that are already ours
for ( ; line != line_end; ++line, aState.AdvanceToNextLine()) {
DumpLine(aState, line, deltaBCoord, 0);
#ifdef DEBUG
AutoNoisyIndenter indent2(gNoisyReflow);
@@ -2147,22 +2148,22 @@ nsBlockFrame::ReflowDirtyLines(BlockRefl
if (line->IsBlock() &&
!nsBlockFrame::BlockCanIntersectFloats(line->mFirstChild)) {
replacedBlock = line->mFirstChild;
}
// We have to reflow the line if it's a block whose clearance
// might have changed, so detect that.
if (!line->IsDirty() &&
- (line->GetBreakTypeBefore() != NS_STYLE_CLEAR_NONE ||
+ (line->GetBreakTypeBefore() != StyleClear::None_ ||
replacedBlock)) {
nscoord curBCoord = aState.mBCoord;
// See where we would be after applying any clearance due to
// BRs.
- if (inlineFloatBreakType != NS_STYLE_CLEAR_NONE) {
+ if (inlineFloatBreakType != StyleClear::None_) {
curBCoord = aState.ClearFloats(curBCoord, inlineFloatBreakType);
}
nscoord newBCoord =
aState.ClearFloats(curBCoord, line->GetBreakTypeBefore(), replacedBlock);
if (line->HasClearance()) {
// Reflow the line if it might not have clearance anymore.
@@ -2178,24 +2179,24 @@ nsBlockFrame::ReflowDirtyLines(BlockRefl
// Reflow the line if the line might have clearance now.
if (curBCoord != newBCoord) {
line->MarkDirty();
}
}
}
// We might have to reflow a line that is after a clearing BR.
- if (inlineFloatBreakType != NS_STYLE_CLEAR_NONE) {
+ if (inlineFloatBreakType != StyleClear::None_) {
aState.mBCoord = aState.ClearFloats(aState.mBCoord, inlineFloatBreakType);
if (aState.mBCoord != line->BStart() + deltaBCoord) {
// SlideLine is not going to put the line where the clearance
// put it. Reflow the line to be sure.
line->MarkDirty();
}
- inlineFloatBreakType = NS_STYLE_CLEAR_NONE;
+ inlineFloatBreakType = StyleClear::None_;
}
bool previousMarginWasDirty = line->IsPreviousMarginDirty();
if (previousMarginWasDirty) {
// If the previous margin is dirty, reflow the current line
line->MarkDirty();
line->ClearPreviousMarginDirty();
} else if (line->BEnd() + deltaBCoord > aState.mBEndEdge) {
@@ -2438,17 +2439,17 @@ nsBlockFrame::ReflowDirtyLines(BlockRefl
// sure whether we really want to mark all lines dirty after an
// interrupt, but until we get better at propagating float damage we
// really do need to do it this way; see comments inside MarkLineDirty.
MarkLineDirtyForInterrupt(line);
}
}
// Handle BR-clearance from the last line of the block
- if (inlineFloatBreakType != NS_STYLE_CLEAR_NONE) {
+ if (inlineFloatBreakType != StyleClear::None_) {
aState.mBCoord = aState.ClearFloats(aState.mBCoord, inlineFloatBreakType);
}
if (needToRecoverState) {
// Is this expensive?
aState.ReconstructMarginBefore(line);
// Update aState.mPrevChild as if we had reflowed all of the frames in
@@ -3121,22 +3122,22 @@ nsBlockFrame::ReflowBlockFrame(BlockRefl
if (!frame) {
NS_ASSERTION(false, "program error - unexpected empty line");
return;
}
// Prepare the block reflow engine
nsBlockReflowContext brc(aState.mPresContext, aState.mReflowInput);
- uint8_t breakType = frame->StyleDisplay()->
+ StyleClear breakType = frame->StyleDisplay()->
PhysicalBreakType(aState.mReflowInput.GetWritingMode());
- if (NS_STYLE_CLEAR_NONE != aState.mFloatBreakType) {
+ if (StyleClear::None_ != aState.mFloatBreakType) {
breakType = nsLayoutUtils::CombineBreakType(breakType,
aState.mFloatBreakType);
- aState.mFloatBreakType = NS_STYLE_CLEAR_NONE;
+ aState.mFloatBreakType = StyleClear::None_;
}
// Clear past floats before the block if the clear style is not none
aLine->SetBreakTypeBefore(breakType);
// See if we should apply the block-start margin. If the block frame being
// reflowed is a continuation (non-null prev-in-flow) then we don't
// apply its block-start margin because it's not significant unless it has
@@ -3149,17 +3150,17 @@ nsBlockFrame::ReflowBlockFrame(BlockRefl
// The HasClearance setting is only valid if ShouldApplyBStartMargin
// returned false (in which case the block-start margin-root set our
// clearance flag). Otherwise clear it now. We'll set it later on
// ourselves if necessary.
aLine->ClearHasClearance();
}
bool treatWithClearance = aLine->HasClearance();
- bool mightClearFloats = breakType != NS_STYLE_CLEAR_NONE;
+ bool mightClearFloats = breakType != StyleClear::None_;
nsIFrame *replacedBlock = nullptr;
if (!nsBlockFrame::BlockCanIntersectFloats(frame)) {
mightClearFloats = true;
replacedBlock = frame;
}
// If our block-start margin was counted as part of some parent's block-start
// margin collapse, and we are being speculatively reflowed assuming this
@@ -3428,17 +3429,17 @@ nsBlockFrame::ReflowBlockFrame(BlockRefl
floatAvailableSpace)) {
// Advance to the next band.
nscoord newBCoord = aState.mBCoord;
if (aState.AdvanceToNextBand(floatAvailableSpace.mRect, &newBCoord)) {
advanced = true;
}
// ClearFloats might be able to advance us further once we're there.
aState.mBCoord =
- aState.ClearFloats(newBCoord, NS_STYLE_CLEAR_NONE, replacedBlock);
+ aState.ClearFloats(newBCoord, StyleClear::None_, replacedBlock);
// Start over with a new available space rect at the new height.
floatAvailableSpace =
aState.GetFloatAvailableSpaceWithState(aState.mBCoord,
&floatManagerState);
}
LogicalRect oldAvailSpace(availSpace);
aState.ComputeBlockAvailSpace(frame, floatAvailableSpace,
@@ -4049,17 +4050,17 @@ nsBlockFrame::DoReflowInlineFrames(Block
}
/**
* Reflow an inline frame. The reflow status is mapped from the frames
* reflow status to the lines reflow status (not to our reflow status).
* The line reflow status is simple: true means keep placing frames
* on the line; false means don't (the line is done). If the line
* has some sort of breaking affect then aLine's break-type will be set
- * to something other than NS_STYLE_CLEAR_NONE.
+ * to something other than StyleClear::None_.
*/
void
nsBlockFrame::ReflowInlineFrame(BlockReflowInput& aState,
nsLineLayout& aLineLayout,
line_iterator aLine,
nsIFrame* aFrame,
LineReflowStatus* aLineReflowStatus)
{
@@ -4106,28 +4107,27 @@ nsBlockFrame::ReflowInlineFrame(BlockRef
see bug 22496
*/
// Process the child frames reflow status. There are 5 cases:
// complete, not-complete, break-before, break-after-complete,
// break-after-not-complete. There are two situations: we are a
// block or we are an inline. This makes a total of 10 cases
// (fortunately, there is some overlap).
- aLine->SetBreakTypeAfter(NS_STYLE_CLEAR_NONE);
- if (NS_INLINE_IS_BREAK(frameReflowStatus) ||
- (NS_STYLE_CLEAR_NONE != aState.mFloatBreakType)) {
+ aLine->SetBreakTypeAfter(StyleClear::None_);
+ if (NS_INLINE_IS_BREAK(frameReflowStatus) ||
+ StyleClear::None_ != aState.mFloatBreakType) {
// Always abort the line reflow (because a line break is the
// minimal amount of break we do).
*aLineReflowStatus = LINE_REFLOW_STOP;
// XXX what should aLine's break-type be set to in all these cases?
- uint8_t breakType = NS_INLINE_GET_BREAK_TYPE(frameReflowStatus);
- NS_ASSERTION((NS_STYLE_CLEAR_NONE != breakType) ||
- (NS_STYLE_CLEAR_NONE != aState.mFloatBreakType), "bad break type");
- NS_ASSERTION(NS_STYLE_CLEAR_MAX >= breakType, "invalid break type");
+ StyleClear breakType = NS_INLINE_GET_BREAK_TYPE(frameReflowStatus);
+ NS_ASSERTION(StyleClear::None_ != breakType ||
+ StyleClear::None_ != aState.mFloatBreakType, "bad break type");
if (NS_INLINE_IS_BREAK_BEFORE(frameReflowStatus)) {
// Break-before cases.
if (aFrame == aLine->mFirstChild) {
// If we break before the first frame on the line then we must
// be trying to place content where there's no room (e.g. on a
// line with wide floats). Inform the caller to reflow the
// line after skipping past a float.
@@ -4142,28 +4142,28 @@ nsBlockFrame::ReflowInlineFrame(BlockRef
// was pushed, then mark the line as having word wrapped. We need to
// know that if we're shrink wrapping our width
if (pushedFrame) {
aLine->SetLineWrapped(true);
}
}
}
else {
- // If a float split and its prev-in-flow was followed by a <BR>, then combine
- // the <BR>'s break type with the inline's break type (the inline will be the very
+ // If a float split and its prev-in-flow was followed by a <BR>, then combine
+ // the <BR>'s break type with the inline's break type (the inline will be the very
// next frame after the split float).
- if (NS_STYLE_CLEAR_NONE != aState.mFloatBreakType) {
+ if (StyleClear::None_ != aState.mFloatBreakType) {
breakType = nsLayoutUtils::CombineBreakType(breakType,
aState.mFloatBreakType);
- aState.mFloatBreakType = NS_STYLE_CLEAR_NONE;
+ aState.mFloatBreakType = StyleClear::None_;
}
// Break-after cases
- if (breakType == NS_STYLE_CLEAR_LINE) {
+ if (breakType == StyleClear::Line) {
if (!aLineLayout.GetLineEndsInBR()) {
- breakType = NS_STYLE_CLEAR_NONE;
+ breakType = StyleClear::None_;
}
}
aLine->SetBreakTypeAfter(breakType);
if (NS_FRAME_IS_COMPLETE(frameReflowStatus)) {
// Split line, but after the frame just reflowed
SplitLine(aState, aLineLayout, aLine, aFrame->GetNextSibling(), aLineReflowStatus);
if (NS_INLINE_IS_BREAK_AFTER(frameReflowStatus) &&
@@ -6221,29 +6221,29 @@ nsBlockFrame::ReflowFloat(BlockReflowInp
nsDidReflowStatus::FINISHED);
#ifdef NOISY_FLOAT
printf("end ReflowFloat %p, sized to %d,%d\n",
aFloat, metrics.Width(), metrics.Height());
#endif
}
-uint8_t
+StyleClear
nsBlockFrame::FindTrailingClear()
{
// find the break type of the last line
for (nsIFrame* b = this; b; b = b->GetPrevInFlow()) {
nsBlockFrame* block = static_cast<nsBlockFrame*>(b);
line_iterator endLine = block->end_lines();
if (endLine != block->begin_lines()) {
--endLine;
return endLine->GetBreakTypeAfter();
}
}
- return NS_STYLE_CLEAR_NONE;
+ return StyleClear::None_;
}
void
nsBlockFrame::ReflowPushedFloats(BlockReflowInput& aState,
nsOverflowAreas& aOverflowAreas,
nsReflowStatus& aStatus)
{
// Pushed floats live at the start of our float list; see comment
@@ -6302,17 +6302,17 @@ nsBlockFrame::ReflowPushedFloats(BlockRe
// We didn't push |f| so its next-sibling is next.
next = f->GetNextSibling();
prev = f;
} // else: we did push |f| so |prev|'s new next-sibling is next.
f = next;
}
// If there are continued floats, then we may need to continue BR clearance
- if (0 != aState.ClearFloats(0, NS_STYLE_CLEAR_BOTH)) {
+ if (0 != aState.ClearFloats(0, StyleClear::Both)) {
nsBlockFrame* prevBlock = static_cast<nsBlockFrame*>(GetPrevInFlow());
if (prevBlock) {
aState.mFloatBreakType = prevBlock->FindTrailingClear();
}
}
}
void
--- a/layout/generic/nsBlockFrame.h
+++ b/layout/generic/nsBlockFrame.h
@@ -571,17 +571,17 @@ protected:
/** Reflow pushed floats
*/
void ReflowPushedFloats(BlockReflowInput& aState,
nsOverflowAreas& aOverflowAreas,
nsReflowStatus& aStatus);
/** Find any trailing BR clear from the last line of the block (or its PIFs)
*/
- uint8_t FindTrailingClear();
+ mozilla::StyleClear FindTrailingClear();
/**
* Remove a float from our float list.
*/
void RemoveFloat(nsIFrame* aFloat);
/**
* Remove a float from the float cache for the line its placeholder is on.
*/
--- a/layout/generic/nsBlockReflowContext.cpp
+++ b/layout/generic/nsBlockReflowContext.cpp
@@ -163,17 +163,17 @@ nsBlockReflowContext::ComputeCollapsedBS
{
LogicalSize availSpace =
outerReflowInput->ComputedSize(kid->GetWritingMode());
ReflowInput innerReflowInput(prescontext,
*outerReflowInput, kid,
availSpace);
// Record that we're being optimistic by assuming the kid
// has no clearance
- if (kid->StyleDisplay()->mBreakType != NS_STYLE_CLEAR_NONE ||
+ if (kid->StyleDisplay()->mBreakType != StyleClear::None_ ||
!nsBlockFrame::BlockCanIntersectFloats(kid)) {
*aMayNeedRetry = true;
}
if (ComputeCollapsedBStartMargin(innerReflowInput, aMargin,
aClearanceFrame, aMayNeedRetry,
&isEmpty)) {
line->MarkDirty();
dirtiedLine = true;
--- a/layout/generic/nsFloatManager.cpp
+++ b/layout/generic/nsFloatManager.cpp
@@ -473,59 +473,59 @@ nsFloatManager::List(FILE* out) const
fi.LineLeft(), fi.BStart(), fi.ISize(), fi.BSize(),
fi.mLeftBEnd, fi.mRightBEnd);
}
return NS_OK;
}
#endif
nscoord
-nsFloatManager::ClearFloats(nscoord aBCoord, uint8_t aBreakType,
+nsFloatManager::ClearFloats(nscoord aBCoord, StyleClear aBreakType,
uint32_t aFlags) const
{
if (!(aFlags & DONT_CLEAR_PUSHED_FLOATS) && ClearContinues(aBreakType)) {
return nscoord_MAX;
}
if (!HasAnyFloats()) {
return aBCoord;
}
nscoord blockEnd = aBCoord + mBlockStart;
const FloatInfo &tail = mFloats[mFloats.Length() - 1];
switch (aBreakType) {
- case NS_STYLE_CLEAR_BOTH:
+ case StyleClear::Both:
blockEnd = std::max(blockEnd, tail.mLeftBEnd);
blockEnd = std::max(blockEnd, tail.mRightBEnd);
break;
- case NS_STYLE_CLEAR_LEFT:
+ case StyleClear::Left:
blockEnd = std::max(blockEnd, tail.mLeftBEnd);
break;
- case NS_STYLE_CLEAR_RIGHT:
+ case StyleClear::Right:
blockEnd = std::max(blockEnd, tail.mRightBEnd);
break;
default:
// Do nothing
break;
}
blockEnd -= mBlockStart;
return blockEnd;
}
bool
-nsFloatManager::ClearContinues(uint8_t aBreakType) const
+nsFloatManager::ClearContinues(StyleClear aBreakType) const
{
return ((mPushedLeftFloatPastBreak || mSplitLeftFloatAcrossBreak) &&
- (aBreakType == NS_STYLE_CLEAR_BOTH ||
- aBreakType == NS_STYLE_CLEAR_LEFT)) ||
+ (aBreakType == StyleClear::Both ||
+ aBreakType == StyleClear::Left)) ||
((mPushedRightFloatPastBreak || mSplitRightFloatAcrossBreak) &&
- (aBreakType == NS_STYLE_CLEAR_BOTH ||
- aBreakType == NS_STYLE_CLEAR_RIGHT));
+ (aBreakType == StyleClear::Both ||
+ aBreakType == StyleClear::Right));
}
/////////////////////////////////////////////////////////////////////////////
// FloatInfo
nsFloatManager::FloatInfo::FloatInfo(nsIFrame* aFrame,
nscoord aLineLeft, nscoord aBStart,
nscoord aISize, nscoord aBSize)
--- a/layout/generic/nsFloatManager.h
+++ b/layout/generic/nsFloatManager.h
@@ -266,24 +266,24 @@ public:
*
* Both aBCoord and the result are relative to the current translation.
*/
enum {
// Tell ClearFloats not to push to nscoord_MAX when floats have been
// pushed to the next page/column.
DONT_CLEAR_PUSHED_FLOATS = (1<<0)
};
- nscoord ClearFloats(nscoord aBCoord, uint8_t aBreakType,
+ nscoord ClearFloats(nscoord aBCoord, mozilla::StyleClear aBreakType,
uint32_t aFlags = 0) const;
/**
* Checks if clear would pass into the floats' BFC's next-in-flow,
* i.e. whether floats affecting this clear have continuations.
*/
- bool ClearContinues(uint8_t aBreakType) const;
+ bool ClearContinues(mozilla::StyleClear aBreakType) const;
void AssertStateMatches(SavedState *aState) const
{
NS_ASSERTION(aState->mLineLeft == mLineLeft &&
aState->mBlockStart == mBlockStart &&
aState->mPushedLeftFloatPastBreak ==
mPushedLeftFloatPastBreak &&
aState->mPushedRightFloatPastBreak ==
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -4486,29 +4486,29 @@ nsIFrame::InlinePrefISizeData::ForceBrea
// preferred widths accumulated for floats that have not yet
// been cleared past
floats_cur_left = 0,
floats_cur_right = 0;
for (uint32_t i = 0, i_end = mFloats.Length(); i != i_end; ++i) {
const FloatInfo& floatInfo = mFloats[i];
const nsStyleDisplay* floatDisp = floatInfo.Frame()->StyleDisplay();
- uint8_t breakType = floatDisp->PhysicalBreakType(mLineContainerWM);
- if (breakType == NS_STYLE_CLEAR_LEFT ||
- breakType == NS_STYLE_CLEAR_RIGHT ||
- breakType == NS_STYLE_CLEAR_BOTH) {
+ StyleClear breakType = floatDisp->PhysicalBreakType(mLineContainerWM);
+ if (breakType == StyleClear::Left ||
+ breakType == StyleClear::Right ||
+ breakType == StyleClear::Both) {
nscoord floats_cur = NSCoordSaturatingAdd(floats_cur_left,
floats_cur_right);
if (floats_cur > floats_done) {
floats_done = floats_cur;
}
- if (breakType != NS_STYLE_CLEAR_RIGHT) {
+ if (breakType != StyleClear::Right) {
floats_cur_left = 0;
}
- if (breakType != NS_STYLE_CLEAR_LEFT) {
+ if (breakType != StyleClear::Left) {
floats_cur_right = 0;
}
}
StyleFloat floatStyle = floatDisp->PhysicalFloats(mLineContainerWM);
nscoord& floats_cur =
floatStyle == StyleFloat::Left ? floats_cur_left : floats_cur_right;
nscoord floatWidth = floatInfo.Width();
--- a/layout/generic/nsIFrame.h
+++ b/layout/generic/nsIFrame.h
@@ -280,35 +280,36 @@ typedef uint32_t nsReflowStatus;
(0 != ((_status) & NS_INLINE_BREAK))
#define NS_INLINE_IS_BREAK_AFTER(_status) \
(0 != ((_status) & NS_INLINE_BREAK_AFTER))
#define NS_INLINE_IS_BREAK_BEFORE(_status) \
(NS_INLINE_BREAK == ((_status) & (NS_INLINE_BREAK|NS_INLINE_BREAK_AFTER)))
-#define NS_INLINE_GET_BREAK_TYPE(_status) (((_status) >> 12) & 0xF)
-
-#define NS_INLINE_MAKE_BREAK_TYPE(_type) ((_type) << 12)
+#define NS_INLINE_GET_BREAK_TYPE(_status) \
+ (static_cast<StyleClear>(((_status) >> 12) & 0xF))
+
+#define NS_INLINE_MAKE_BREAK_TYPE(_type) (static_cast<int>(_type) << 12)
// Construct a line-break-before status. Note that there is no
// completion status for a line-break before because we *know* that
// the frame will be reflowed later and hence its current completion
// status doesn't matter.
#define NS_INLINE_LINE_BREAK_BEFORE() \
(NS_INLINE_BREAK | NS_INLINE_BREAK_BEFORE | \
- NS_INLINE_MAKE_BREAK_TYPE(NS_STYLE_CLEAR_LINE))
+ NS_INLINE_MAKE_BREAK_TYPE(StyleClear::Line))
// Take a completion status and add to it the desire to have a
// line-break after. For this macro we do need the completion status
// because the user of the status will need to know whether to
// continue the frame or not.
#define NS_INLINE_LINE_BREAK_AFTER(_completionStatus) \
((_completionStatus) | NS_INLINE_BREAK | NS_INLINE_BREAK_AFTER | \
- NS_INLINE_MAKE_BREAK_TYPE(NS_STYLE_CLEAR_LINE))
+ NS_INLINE_MAKE_BREAK_TYPE(StyleClear::Line))
// A frame is "truncated" if the part of the frame before the first
// possible break point was unable to fit in the available vertical
// space. Therefore, the entire frame should be moved to the next page.
// A frame that begins at the top of the page must never be "truncated".
// Doing so would likely cause an infinite loop.
#define NS_FRAME_TRUNCATED 0x0010
#define NS_FRAME_IS_TRUNCATED(status) \
--- a/layout/generic/nsLineBox.cpp
+++ b/layout/generic/nsLineBox.cpp
@@ -43,18 +43,17 @@ nsLineBox::nsLineBox(nsIFrame* aFrame, i
++ctorCount;
NS_ASSERTION(!aIsBlock || aCount == 1, "Blocks must have exactly one child");
nsIFrame* f = aFrame;
for (int32_t n = aCount; n > 0; f = f->GetNextSibling(), --n) {
NS_ASSERTION(aIsBlock == f->IsBlockOutside(),
"wrong kind of child frame");
}
#endif
-
- static_assert(NS_STYLE_CLEAR_MAX <= 15,
+ static_assert(static_cast<int>(StyleClear::Max) <= 15,
"FlagBits needs more bits to store the full range of "
"break type ('clear') values");
mChildCount = aCount;
MarkDirty();
mFlags.mBlock = aIsBlock;
}
nsLineBox::~nsLineBox()
@@ -188,26 +187,26 @@ ListFloats(FILE* out, const char* aPrefi
str += "\n###!!! NULL out-of-flow frame";
}
fprintf_stderr(out, "%s\n", str.get());
fc = fc->Next();
}
}
const char*
-nsLineBox::BreakTypeToString(uint8_t aBreakType) const
+nsLineBox::BreakTypeToString(StyleClear aBreakType) const
{
switch (aBreakType) {
- case NS_STYLE_CLEAR_NONE: return "nobr";
- case NS_STYLE_CLEAR_LEFT: return "leftbr";
- case NS_STYLE_CLEAR_RIGHT: return "rightbr";
- case NS_STYLE_CLEAR_INLINE_START: return "inlinestartbr";
- case NS_STYLE_CLEAR_INLINE_END: return "inlineendbr";
- case NS_STYLE_CLEAR_BOTH: return "leftbr+rightbr";
- case NS_STYLE_CLEAR_LINE: return "linebr";
+ case StyleClear::None_: return "nobr";
+ case StyleClear::Left: return "leftbr";
+ case StyleClear::Right: return "rightbr";
+ case StyleClear::InlineStart: return "inlinestartbr";
+ case StyleClear::InlineEnd: return "inlineendbr";
+ case StyleClear::Both: return "leftbr+rightbr";
+ case StyleClear::Line: return "linebr";
default:
break;
}
return "unknown";
}
char*
nsLineBox::StateToString(char* aBuf, int32_t aBufSize) const
--- a/layout/generic/nsLineBox.h
+++ b/layout/generic/nsLineBox.h
@@ -138,17 +138,16 @@ public:
protected:
nsFloatCache* mTail;
friend class nsFloatCacheList;
};
//----------------------------------------------------------------------
-#define LINE_MAX_BREAK_TYPE ((1 << 4) - 1)
#define LINE_MAX_CHILD_COUNT INT32_MAX
/**
* Function to create a line box and initialize it with a single frame.
* The allocation is infallible.
* If the frame was moved from another line then you're responsible
* for notifying that line using NoteFrameRemoved(). Alternatively,
* it's better to use the next function that does that for you in an
@@ -389,47 +388,48 @@ public:
--mChildCount;
}
}
// mBreakType value
// Break information is applied *before* the line if the line is a block,
// or *after* the line if the line is an inline. Confusing, I know, but
// using different names should help.
+ using StyleClear = mozilla::StyleClear;
bool HasBreakBefore() const {
- return IsBlock() && NS_STYLE_CLEAR_NONE != mFlags.mBreakType;
+ return IsBlock() && StyleClear::None_ != BreakType();
}
- void SetBreakTypeBefore(uint8_t aBreakType) {
+ void SetBreakTypeBefore(StyleClear aBreakType) {
NS_ASSERTION(IsBlock(), "Only blocks have break-before");
- NS_ASSERTION(aBreakType == NS_STYLE_CLEAR_NONE ||
- aBreakType == NS_STYLE_CLEAR_LEFT ||
- aBreakType == NS_STYLE_CLEAR_RIGHT ||
- aBreakType == NS_STYLE_CLEAR_BOTH,
+ NS_ASSERTION(aBreakType == StyleClear::None_ ||
+ aBreakType == StyleClear::Left ||
+ aBreakType == StyleClear::Right ||
+ aBreakType == StyleClear::Both,
"Only float break types are allowed before a line");
- mFlags.mBreakType = aBreakType;
+ mFlags.mBreakType = static_cast<int>(aBreakType);
}
- uint8_t GetBreakTypeBefore() const {
- return IsBlock() ? mFlags.mBreakType : NS_STYLE_CLEAR_NONE;
+ StyleClear GetBreakTypeBefore() const {
+ return IsBlock() ? BreakType() : StyleClear::None_;
}
bool HasBreakAfter() const {
- return !IsBlock() && NS_STYLE_CLEAR_NONE != mFlags.mBreakType;
+ return !IsBlock() && StyleClear::None_ != BreakType();
}
- void SetBreakTypeAfter(uint8_t aBreakType) {
+ void SetBreakTypeAfter(StyleClear aBreakType) {
NS_ASSERTION(!IsBlock(), "Only inlines have break-after");
- NS_ASSERTION(aBreakType <= LINE_MAX_BREAK_TYPE, "bad break type");
- mFlags.mBreakType = aBreakType;
+ mFlags.mBreakType = static_cast<int>(aBreakType);
}
bool HasFloatBreakAfter() const {
- return !IsBlock() && (NS_STYLE_CLEAR_LEFT == mFlags.mBreakType ||
- NS_STYLE_CLEAR_RIGHT == mFlags.mBreakType ||
- NS_STYLE_CLEAR_BOTH == mFlags.mBreakType);
+ return !IsBlock() &&
+ (StyleClear::Left == BreakType() ||
+ StyleClear::Right == BreakType() ||
+ StyleClear::Both == BreakType());
}
- uint8_t GetBreakTypeAfter() const {
- return !IsBlock() ? mFlags.mBreakType : NS_STYLE_CLEAR_NONE;
+ StyleClear GetBreakTypeAfter() const {
+ return !IsBlock() ? BreakType() : StyleClear::None_;
}
// mCarriedOutBEndMargin value
nsCollapsingMargin GetCarriedOutBEndMargin() const;
// Returns true if the margin changed
bool SetCarriedOutBEndMargin(nsCollapsingMargin aValue);
// mFloats
@@ -567,17 +567,17 @@ public:
// list).
static bool RFindLineContaining(nsIFrame* aFrame,
const nsLineList_iterator& aBegin,
nsLineList_iterator& aEnd,
nsIFrame* aLastFrameBeforeEnd,
int32_t* aFrameIndexInLine);
#ifdef DEBUG_FRAME_DUMP
- const char* BreakTypeToString(uint8_t aBreakType) const;
+ const char* BreakTypeToString(StyleClear aBreakType) const;
char* StateToString(char* aBuf, int32_t aBufSize) const;
void List(FILE* out, int32_t aIndent, uint32_t aFlags = 0) const;
void List(FILE* out = stderr, const char* aPrefix = "", uint32_t aFlags = 0) const;
nsIFrame* LastChild() const;
#endif
private:
@@ -659,17 +659,19 @@ public:
struct FlagBits {
uint32_t mDirty : 1;
uint32_t mPreviousMarginDirty : 1;
uint32_t mHasClearance : 1;
uint32_t mBlock : 1;
uint32_t mImpactedByFloat : 1;
uint32_t mLineWrapped: 1;
uint32_t mInvalidateTextRuns : 1;
- uint32_t mResizeReflowOptimizationDisabled: 1; // default 0 = means that the opt potentially applies to this line. 1 = never skip reflowing this line for a resize reflow
+ // default 0 = means that the opt potentially applies to this line.
+ // 1 = never skip reflowing this line for a resize reflow
+ uint32_t mResizeReflowOptimizationDisabled: 1;
uint32_t mEmptyCacheValid: 1;
uint32_t mEmptyCacheState: 1;
// mHasBullet indicates that this is an inline line whose block's
// bullet is adjacent to this line and non-empty.
uint32_t mHasBullet : 1;
// Indicates that this line *may* have a placeholder for a float
// that was pushed to a later column or page.
uint32_t mHadFloatPushed : 1;
@@ -695,21 +697,27 @@ public:
struct ExtraInlineData : public ExtraData {
explicit ExtraInlineData(const nsRect& aBounds) : ExtraData(aBounds) {
}
nsFloatCacheList mFloats;
};
protected:
nscoord mAscent; // see |SetAscent| / |GetAscent|
+ static_assert(sizeof(FlagBits) <= sizeof(uint32_t),
+ "size of FlagBits should not be larger than size of uint32_t");
union {
uint32_t mAllFlags;
FlagBits mFlags;
};
+ StyleClear BreakType() const {
+ return static_cast<StyleClear>(mFlags.mBreakType);
+ };
+
union {
ExtraData* mData;
ExtraBlockData* mBlockData;
ExtraInlineData* mInlineData;
};
void Cleanup();
void MaybeFreeData();
--- a/layout/style/nsCSSProps.cpp
+++ b/layout/style/nsCSSProps.cpp
@@ -1053,23 +1053,23 @@ const KTableEntry nsCSSProps::kCaptionSi
{ eCSSKeyword_bottom, NS_STYLE_CAPTION_SIDE_BOTTOM },
{ eCSSKeyword_left, NS_STYLE_CAPTION_SIDE_LEFT },
{ eCSSKeyword_top_outside, NS_STYLE_CAPTION_SIDE_TOP_OUTSIDE },
{ eCSSKeyword_bottom_outside, NS_STYLE_CAPTION_SIDE_BOTTOM_OUTSIDE },
{ eCSSKeyword_UNKNOWN, -1 }
};
KTableEntry nsCSSProps::kClearKTable[] = {
- { eCSSKeyword_none, NS_STYLE_CLEAR_NONE },
- { eCSSKeyword_left, NS_STYLE_CLEAR_LEFT },
- { eCSSKeyword_right, NS_STYLE_CLEAR_RIGHT },
- { eCSSKeyword_inline_start, NS_STYLE_CLEAR_INLINE_START },
- { eCSSKeyword_inline_end, NS_STYLE_CLEAR_INLINE_END },
- { eCSSKeyword_both, NS_STYLE_CLEAR_BOTH },
- { eCSSKeyword_UNKNOWN, -1 }
+ { eCSSKeyword_none, StyleClear::None_ },
+ { eCSSKeyword_left, StyleClear::Left },
+ { eCSSKeyword_right, StyleClear::Right },
+ { eCSSKeyword_inline_start, StyleClear::InlineStart },
+ { eCSSKeyword_inline_end, StyleClear::InlineEnd },
+ { eCSSKeyword_both, StyleClear::Both },
+ { eCSSKeyword_UNKNOWN, -1 }
};
// See also kContextPatternKTable for SVG paint-specific values
const KTableEntry nsCSSProps::kColorKTable[] = {
{ eCSSKeyword_activeborder, LookAndFeel::eColorID_activeborder },
{ eCSSKeyword_activecaption, LookAndFeel::eColorID_activecaption },
{ eCSSKeyword_appworkspace, LookAndFeel::eColorID_appworkspace },
{ eCSSKeyword_background, LookAndFeel::eColorID_background },
--- a/layout/style/nsRuleNode.cpp
+++ b/layout/style/nsRuleNode.cpp
@@ -1337,16 +1337,17 @@ struct SetEnumValueHelper
}
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(StyleClear, None_, Both)
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)
#ifdef MOZ_XUL
DEFINE_ENUM_CLASS_SETTER(StyleDisplay, None_, Popup)
#else
@@ -6039,17 +6040,17 @@ nsRuleNode::ComputeDisplayData(void* aSt
// an aStartStruct for some other elements.
conditions.SetUncacheable();
}
// clear: enum, inherit, initial
SetValue(*aRuleData->ValueForClear(), display->mBreakType, conditions,
SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
parentDisplay->mBreakType,
- NS_STYLE_CLEAR_NONE);
+ StyleClear::None_);
// temp fix for bug 24000
// Map 'auto' and 'avoid' to false, and 'always', 'left', and
// 'right' to true.
// "A conforming user agent may interpret the values 'left' and
// 'right' as 'always'." - CSS2.1, section 13.3.1
const nsCSSValue* breakBeforeValue = aRuleData->ValueForPageBreakBefore();
if (eCSSUnit_Enumerated == breakBeforeValue->GetUnit()) {
--- a/layout/style/nsStyleConsts.h
+++ b/layout/style/nsStyleConsts.h
@@ -103,16 +103,30 @@ enum class StyleBoxSizing : uint8_t {
Border
};
// box-shadow
enum class StyleBoxShadowType : uint8_t {
Inset,
};
+// clear
+enum class StyleClear : uint8_t {
+ None_ = 0,
+ Left,
+ Right,
+ InlineStart,
+ InlineEnd,
+ Both,
+ // StyleClear::Line can be added to one of the other values in layout
+ // so it needs to use a bit value that none of the other values can have.
+ Line = 8,
+ Max = 13 // Max = (Both | Line)
+};
+
// clip-path geometry box
enum class StyleClipPathGeometryBox : uint8_t {
NoBox,
Content,
Padding,
Border,
Margin,
Fill,
@@ -398,28 +412,16 @@ enum class FillMode : uint32_t;
#define NS_STYLE_BORDER_IMAGE_REPEAT_STRETCH 0
#define NS_STYLE_BORDER_IMAGE_REPEAT_REPEAT 1
#define NS_STYLE_BORDER_IMAGE_REPEAT_ROUND 2
#define NS_STYLE_BORDER_IMAGE_REPEAT_SPACE 3
#define NS_STYLE_BORDER_IMAGE_SLICE_NOFILL 0
#define NS_STYLE_BORDER_IMAGE_SLICE_FILL 1
-// See nsStyleDisplay
-#define NS_STYLE_CLEAR_NONE 0
-#define NS_STYLE_CLEAR_LEFT 1
-#define NS_STYLE_CLEAR_RIGHT 2
-#define NS_STYLE_CLEAR_INLINE_START 3
-#define NS_STYLE_CLEAR_INLINE_END 4
-#define NS_STYLE_CLEAR_BOTH 5
-#define NS_STYLE_CLEAR_LINE 8
-// @note NS_STYLE_CLEAR_LINE can be added to one of the other values in layout
-// so it needs to use a bit value that none of the other values can have.
-#define NS_STYLE_CLEAR_MAX (NS_STYLE_CLEAR_LINE | NS_STYLE_CLEAR_BOTH)
-
// See nsStyleContent
#define NS_STYLE_CONTENT_OPEN_QUOTE 0
#define NS_STYLE_CONTENT_CLOSE_QUOTE 1
#define NS_STYLE_CONTENT_NO_OPEN_QUOTE 2
#define NS_STYLE_CONTENT_NO_CLOSE_QUOTE 3
#define NS_STYLE_CONTENT_ALT_CONTENT 4
// See nsStyleColor
--- a/layout/style/nsStyleStruct.cpp
+++ b/layout/style/nsStyleStruct.cpp
@@ -2983,17 +2983,17 @@ StyleAnimation::operator==(const StyleAn
nsStyleDisplay::nsStyleDisplay(StyleStructContext aContext)
: mDisplay(StyleDisplay::Inline)
, mOriginalDisplay(StyleDisplay::Inline)
, mContain(NS_STYLE_CONTAIN_NONE)
, mAppearance(NS_THEME_NONE)
, mPosition(NS_STYLE_POSITION_STATIC)
, mFloat(StyleFloat::None_)
, mOriginalFloat(StyleFloat::None_)
- , mBreakType(NS_STYLE_CLEAR_NONE)
+ , mBreakType(StyleClear::None_)
, mBreakInside(NS_STYLE_PAGE_BREAK_AUTO)
, mBreakBefore(false)
, mBreakAfter(false)
, mOverflowX(NS_STYLE_OVERFLOW_VISIBLE)
, mOverflowY(NS_STYLE_OVERFLOW_VISIBLE)
, mOverflowClipBox(NS_STYLE_OVERFLOW_CLIP_BOX_PADDING_BOX)
, mResize(NS_STYLE_RESIZE_NONE)
, mOrient(NS_STYLE_ORIENT_INLINE)
--- a/layout/style/nsStyleStruct.h
+++ b/layout/style/nsStyleStruct.h
@@ -2835,17 +2835,17 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
uint8_t mAppearance; // [reset]
uint8_t mPosition; // [reset] see nsStyleConsts.h
// [reset] See StyleFloat in nsStyleConsts.h.
mozilla::StyleFloat mFloat;
// [reset] Save mFloat for position:absolute/fixed; otherwise equal to mFloat.
mozilla::StyleFloat mOriginalFloat;
- uint8_t mBreakType; // [reset] see nsStyleConsts.h NS_STYLE_CLEAR_*
+ mozilla::StyleClear mBreakType; // [reset]
uint8_t mBreakInside; // [reset] NS_STYLE_PAGE_BREAK_AUTO/AVOID
bool mBreakBefore; // [reset]
bool mBreakAfter; // [reset]
uint8_t mOverflowX; // [reset] see nsStyleConsts.h
uint8_t mOverflowY; // [reset] see nsStyleConsts.h
uint8_t mOverflowClipBox; // [reset] see nsStyleConsts.h
uint8_t mResize; // [reset] see nsStyleConsts.h
uint8_t mOrient; // [reset] see nsStyleConsts.h
@@ -3089,17 +3089,17 @@ private:
inline bool HasFixedPosContainingBlockStyleInternal(
StyleContextLike* aStyleContext) const;
public:
// Return the 'float' and 'clear' properties, with inline-{start,end} values
// resolved to {left,right} according to the given writing mode. These are
// defined in WritingModes.h.
inline mozilla::StyleFloat PhysicalFloats(mozilla::WritingMode aWM) const;
- inline uint8_t PhysicalBreakType(mozilla::WritingMode aWM) const;
+ inline mozilla::StyleClear PhysicalBreakType(mozilla::WritingMode aWM) const;
};
struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleTable
{
explicit nsStyleTable(StyleStructContext aContext);
nsStyleTable(const nsStyleTable& aOther);
~nsStyleTable();