Bug 1301630 - Remove nsBlockFrame::SetFlags(). r=bz

Per bug 1299753 comment 20, SetFlags() is designed for flag propagation
to continuations during block reflow. To avoid misuse, I expand
SetFlags() directly in the only reasonable caller nsBlackFrame::Init(),
and replace other usages by AddStateBits().

MozReview-Commit-ID: GsbE2Z0Rps1

--HG--
extra : rebase_source : 72a64e9218870d638f67d1b586f533cd7d16c491
This commit is contained in:
Ting-Yu Lin 2016-09-09 15:26:57 +08:00
Родитель 21f8f5eff5
Коммит 2884834832
8 изменённых файлов: 15 добавлений и 25 удалений

Просмотреть файл

@ -5061,8 +5061,8 @@ nsCSSFrameConstructor::FlushAccumulatedBlock(nsFrameConstructorState& aState,
// MathML frame so that Get(Absolute/Float)ContainingBlockFor know that this
// is not a suitable block.
nsContainerFrame* blockFrame =
NS_NewMathMLmathBlockFrame(mPresShell, blockContext,
NS_BLOCK_FLOAT_MGR | NS_BLOCK_MARGIN_ROOT);
NS_NewMathMLmathBlockFrame(mPresShell, blockContext);
blockFrame->AddStateBits(NS_BLOCK_FLOAT_MGR | NS_BLOCK_MARGIN_ROOT);
InitAndRestoreFrame(aState, aContent, aParentFrame, blockFrame);
ReparentFrames(this, blockFrame, aBlockItems);
@ -5102,7 +5102,7 @@ nsCSSFrameConstructor::FindMathMLData(Element* aElement,
static const FrameConstructionData sBlockMathData =
FCDATA_DECL(FCDATA_FORCE_NULL_ABSPOS_CONTAINER |
FCDATA_WRAP_KIDS_IN_BLOCKS,
NS_CreateNewMathMLmathBlockFrame);
NS_NewMathMLmathBlockFrame);
return &sBlockMathData;
}

Просмотреть файл

@ -17,7 +17,7 @@ NS_NewSelectsAreaFrame(nsIPresShell* aShell, nsStyleContext* aContext, nsFrameSt
// We need NS_BLOCK_FLOAT_MGR to ensure that the options inside the select
// aren't expanded by right floats outside the select.
it->SetFlags(aFlags | NS_BLOCK_FLOAT_MGR);
it->AddStateBits(aFlags | NS_BLOCK_FLOAT_MGR);
return it;
}

Просмотреть файл

@ -6799,8 +6799,9 @@ nsBlockFrame::Init(nsIContent* aContent,
{
if (aPrevInFlow) {
// Copy over the inherited block frame bits from the prev-in-flow.
SetFlags(aPrevInFlow->GetStateBits() &
(NS_BLOCK_FLAGS_MASK & ~NS_BLOCK_FLAGS_NON_INHERITED_MASK));
RemoveStateBits(NS_BLOCK_FLAGS_MASK);
AddStateBits(aPrevInFlow->GetStateBits() &
(NS_BLOCK_FLAGS_MASK & ~NS_BLOCK_FLAGS_NON_INHERITED_MASK));
}
nsContainerFrame::Init(aContent, aParent, aPrevInFlow);

Просмотреть файл

@ -396,11 +396,6 @@ protected:
bool* aInOverflowLines,
FrameLines** aOverflowLines);
void SetFlags(nsFrameState aFlags) {
mState &= ~NS_BLOCK_FLAGS_MASK;
mState |= aFlags;
}
/** move the frames contained by aLine by aDeltaBCoord
* if aLine is a block, its child floats are added to the state manager
*/

Просмотреть файл

@ -1583,12 +1583,9 @@ nsMathMLContainerFrame::ReportInvalidChildError(nsIAtom* aChildTag)
//==========================
nsContainerFrame*
NS_NewMathMLmathBlockFrame(nsIPresShell* aPresShell, nsStyleContext* aContext,
nsFrameState aFlags)
NS_NewMathMLmathBlockFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
{
nsMathMLmathBlockFrame* it = new (aPresShell) nsMathMLmathBlockFrame(aContext);
it->SetFlags(aFlags);
return it;
return new (aPresShell) nsMathMLmathBlockFrame(aContext);
}
NS_IMPL_FRAMEARENA_HELPERS(nsMathMLmathBlockFrame)

Просмотреть файл

@ -418,7 +418,7 @@ public:
NS_DECL_FRAMEARENA_HELPERS
friend nsContainerFrame* NS_NewMathMLmathBlockFrame(nsIPresShell* aPresShell,
nsStyleContext* aContext, nsFrameState aFlags);
nsStyleContext* aContext);
// beware, mFrames is not set by nsBlockFrame
// cannot use mFrames{.FirstChild()|.etc} since the block code doesn't set mFrames
@ -481,7 +481,8 @@ protected:
explicit nsMathMLmathBlockFrame(nsStyleContext* aContext) : nsBlockFrame(aContext) {
// We should always have a float manager. Not that things can really try
// to float out of us anyway, but we need one for line layout.
AddStateBits(NS_BLOCK_FLOAT_MGR);
// Bug 1301881: Do we still need to set NS_BLOCK_FLOAT_MGR?
// AddStateBits(NS_BLOCK_FLOAT_MGR);
}
virtual ~nsMathMLmathBlockFrame() {}
};

Просмотреть файл

@ -36,10 +36,6 @@ nsIFrame* NS_NewMathMLmactionFrame(nsIPresShell* aPresShell, nsStyleContext* aCo
nsIFrame* NS_NewMathMLmencloseFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
nsIFrame* NS_NewMathMLsemanticsFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
nsContainerFrame* NS_NewMathMLmathBlockFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, nsFrameState aFlags);
nsContainerFrame* NS_NewMathMLmathBlockFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
nsContainerFrame* NS_NewMathMLmathInlineFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
inline nsContainerFrame* NS_CreateNewMathMLmathBlockFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
{
return NS_NewMathMLmathBlockFrame(aPresShell, aContext, nsFrameState(0));
}
#endif /* nsMathMLParts_h___ */

Просмотреть файл

@ -16,8 +16,8 @@ nsIFrame*
NS_NewXULLabelFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
{
nsXULLabelFrame* it = new (aPresShell) nsXULLabelFrame(aContext);
it->SetFlags(NS_BLOCK_FLOAT_MGR | NS_BLOCK_MARGIN_ROOT);
it->AddStateBits(NS_BLOCK_FLOAT_MGR | NS_BLOCK_MARGIN_ROOT);
return it;
}