Bug 1647525 - Use HasAnyStateBits() in nsCSSFrameConstructor r=emilio

Differential Revision: https://phabricator.services.mozilla.com/D81093
This commit is contained in:
Kagami Sascha Rosylight 2020-06-25 14:23:35 +00:00
Родитель 8c5c27b442
Коммит 1793f22207
1 изменённых файлов: 17 добавлений и 17 удалений

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

@ -451,7 +451,7 @@ static void ReparentFrames(nsCSSFrameConstructor* aFrameConstructor,
// more easily.
static inline bool IsFramePartOfIBSplit(nsIFrame* aFrame) {
bool result = (aFrame->GetStateBits() & NS_FRAME_PART_OF_IBSPLIT) != 0;
bool result = aFrame->HasAnyStateBits(NS_FRAME_PART_OF_IBSPLIT);
MOZ_ASSERT(!result || static_cast<nsBlockFrame*>(do_QueryFrame(aFrame)) ||
static_cast<nsInlineFrame*>(do_QueryFrame(aFrame)),
"only block/inline frames can have NS_FRAME_PART_OF_IBSPLIT");
@ -1195,7 +1195,7 @@ MOZ_NEVER_INLINE void nsFrameConstructorState::ProcessFrameInsertions(
// is set) and doesn't have any frames in the aChildListID child list yet.
const nsFrameList& childList = containingBlock->GetChildList(aChildListID);
if (childList.IsEmpty() &&
(containingBlock->GetStateBits() & NS_FRAME_FIRST_REFLOW)) {
containingBlock->HasAnyStateBits(NS_FRAME_FIRST_REFLOW)) {
// If we're injecting absolutely positioned frames, inject them on the
// absolute containing block
if (aChildListID == containingBlock->GetAbsoluteListID()) {
@ -1356,7 +1356,7 @@ static void MoveChildrenTo(nsIFrame* aOldParent, nsContainerFrame* aNewParent,
}
if (aNewParent->PrincipalChildList().IsEmpty() &&
(aNewParent->GetStateBits() & NS_FRAME_FIRST_REFLOW)) {
aNewParent->HasAnyStateBits(NS_FRAME_FIRST_REFLOW)) {
aNewParent->SetInitialChildList(kPrincipalList, aFrameList);
} else {
aNewParent->AppendFrames(kPrincipalList, aFrameList);
@ -1446,7 +1446,7 @@ nsCSSFrameConstructor::nsCSSFrameConstructor(Document* aDocument,
}
void nsCSSFrameConstructor::NotifyDestroyingFrame(nsIFrame* aFrame) {
if (aFrame->GetStateBits() & NS_FRAME_GENERATED_CONTENT) {
if (aFrame->HasAnyStateBits(NS_FRAME_GENERATED_CONTENT)) {
if (mQuoteList.DestroyNodesFor(aFrame)) QuotesDirty();
}
@ -2643,7 +2643,7 @@ void nsCSSFrameConstructor::SetUpDocElementContainingBlock(
mHasRootAbsPosContainingBlock = true;
}
if (viewportFrame->GetStateBits() & NS_FRAME_FIRST_REFLOW) {
if (viewportFrame->HasAnyStateBits(NS_FRAME_FIRST_REFLOW)) {
SetInitialSingleChild(viewportFrame, newFrame);
} else {
nsFrameList newFrameList(newFrame, newFrame);
@ -6092,7 +6092,7 @@ nsIFrame* nsCSSFrameConstructor::AdjustSiblingFrame(
return nullptr;
}
if (aSibling->GetStateBits() & NS_FRAME_OUT_OF_FLOW) {
if (aSibling->HasAnyStateBits(NS_FRAME_OUT_OF_FLOW)) {
aSibling = aSibling->GetPlaceholderFrame();
MOZ_ASSERT(aSibling);
}
@ -7064,7 +7064,7 @@ void nsCSSFrameConstructor::ContentRangeInserted(nsIContent* aStartChild,
if (insertion.mParentFrame->IsLetterFrame()) {
// If insertion.mParentFrame is out of flow, then we actually want the
// parent of the placeholder frame.
if (insertion.mParentFrame->GetStateBits() & NS_FRAME_OUT_OF_FLOW) {
if (insertion.mParentFrame->HasAnyStateBits(NS_FRAME_OUT_OF_FLOW)) {
nsPlaceholderFrame* placeholderFrame =
insertion.mParentFrame->GetPlaceholderFrame();
NS_ASSERTION(placeholderFrame, "No placeholder for out-of-flow?");
@ -7462,7 +7462,7 @@ bool nsCSSFrameConstructor::ContentRemoved(nsIContent* aChild,
// wrapper frame.)
nsIFrame* grandparentFrame = parentFrame->GetParent();
if (grandparentFrame && grandparentFrame->IsXULBoxFrame() &&
(grandparentFrame->GetStateBits() & NS_STATE_BOX_WRAPS_KIDS_IN_BLOCK) &&
(grandparentFrame->HasAnyStateBits(NS_STATE_BOX_WRAPS_KIDS_IN_BLOCK)) &&
// check if this frame is the only one needing wrapping
aChild == AnyKidsNeedBlockParent(
parentFrame->PrincipalChildList().FirstChild()) &&
@ -7486,7 +7486,7 @@ bool nsCSSFrameConstructor::ContentRemoved(nsIContent* aChild,
// Examine the containing-block for the removed content and see if
// :first-letter style applies.
nsIFrame* inflowChild = childFrame;
if (childFrame->GetStateBits() & NS_FRAME_OUT_OF_FLOW) {
if (childFrame->HasAnyStateBits(NS_FRAME_OUT_OF_FLOW)) {
inflowChild = childFrame->GetPlaceholderFrame();
NS_ASSERTION(inflowChild, "No placeholder for out-of-flow?");
}
@ -7540,7 +7540,7 @@ bool nsCSSFrameConstructor::ContentRemoved(nsIContent* aChild,
#endif
// Notify the parent frame that it should delete the frame
if (childFrame->GetStateBits() & NS_FRAME_OUT_OF_FLOW) {
if (childFrame->HasAnyStateBits(NS_FRAME_OUT_OF_FLOW)) {
childFrame = childFrame->GetPlaceholderFrame();
NS_ASSERTION(childFrame, "Missing placeholder frame for out of flow.");
parentFrame = childFrame->GetParent();
@ -7940,14 +7940,14 @@ nsIFrame* nsCSSFrameConstructor::CreateContinuingFrame(
} else if (LayoutFrameType::TableRowGroup == frameType) {
newFrame = NS_NewTableRowGroupFrame(mPresShell, computedStyle);
newFrame->Init(content, aParentFrame, aFrame);
if (newFrame->GetStateBits() & NS_FRAME_CAN_HAVE_ABSPOS_CHILDREN) {
if (newFrame->HasAnyStateBits(NS_FRAME_CAN_HAVE_ABSPOS_CHILDREN)) {
nsTableFrame::RegisterPositionedTablePart(newFrame);
}
} else if (LayoutFrameType::TableRow == frameType) {
nsTableRowFrame* rowFrame = NS_NewTableRowFrame(mPresShell, computedStyle);
rowFrame->Init(content, aParentFrame, aFrame);
if (rowFrame->GetStateBits() & NS_FRAME_CAN_HAVE_ABSPOS_CHILDREN) {
if (rowFrame->HasAnyStateBits(NS_FRAME_CAN_HAVE_ABSPOS_CHILDREN)) {
nsTableFrame::RegisterPositionedTablePart(rowFrame);
}
@ -7977,7 +7977,7 @@ nsIFrame* nsCSSFrameConstructor::CreateContinuingFrame(
NS_NewTableCellFrame(mPresShell, computedStyle, tableFrame);
cellFrame->Init(content, aParentFrame, aFrame);
if (cellFrame->GetStateBits() & NS_FRAME_CAN_HAVE_ABSPOS_CHILDREN) {
if (cellFrame->HasAnyStateBits(NS_FRAME_CAN_HAVE_ABSPOS_CHILDREN)) {
nsTableFrame::RegisterPositionedTablePart(cellFrame);
}
@ -8198,7 +8198,7 @@ bool nsCSSFrameConstructor::MaybeRecreateContainerForFrameRemoval(
MOZ_ASSERT(aFrame == aFrame->FirstContinuation(),
"aFrame not the result of GetPrimaryFrame()?");
nsIFrame* inFlowFrame = (aFrame->GetStateBits() & NS_FRAME_OUT_OF_FLOW)
nsIFrame* inFlowFrame = aFrame->HasAnyStateBits(NS_FRAME_OUT_OF_FLOW)
? aFrame->GetPlaceholderFrame()
: aFrame;
MOZ_ASSERT(inFlowFrame, "How did that happen?");
@ -8596,7 +8596,7 @@ bool nsCSSFrameConstructor::HasFirstLetterStyle(nsIFrame* aBlockFrame) {
MOZ_ASSERT(aBlockFrame, "Need a frame");
NS_ASSERTION(aBlockFrame->IsBlockFrameOrSubclass(), "Not a block frame?");
return (aBlockFrame->GetStateBits() & NS_BLOCK_HAS_FIRST_LETTER_STYLE) != 0;
return aBlockFrame->HasAnyStateBits(NS_BLOCK_HAS_FIRST_LETTER_STYLE);
}
bool nsCSSFrameConstructor::ShouldHaveFirstLineStyle(
@ -9695,7 +9695,7 @@ void nsCSSFrameConstructor::WrapFramesInFirstLineFrame(
// Give the inline frames to the lineFrame <b>after</b> reparenting them
ReparentFrames(this, aLineFrame, firstLineChildren, true);
if (aLineFrame->PrincipalChildList().IsEmpty() &&
(aLineFrame->GetStateBits() & NS_FRAME_FIRST_REFLOW)) {
aLineFrame->HasAnyStateBits(NS_FRAME_FIRST_REFLOW)) {
aLineFrame->SetInitialChildList(kPrincipalList, firstLineChildren);
} else {
AppendFrames(aLineFrame, kPrincipalList, firstLineChildren);
@ -11141,7 +11141,7 @@ bool nsCSSFrameConstructor::WipeContainingBlock(
// Situation #1 is a XUL frame that contains frames that are required
// to be wrapped in blocks.
if (aFrame->IsXULBoxFrame() &&
!(aFrame->GetStateBits() & NS_STATE_BOX_WRAPS_KIDS_IN_BLOCK) &&
!aFrame->HasAnyStateBits(NS_STATE_BOX_WRAPS_KIDS_IN_BLOCK) &&
aItems.AnyItemsNeedBlockParent()) {
TRACE("XUL with block-wrapped kids");
RecreateFramesForContent(aFrame->GetContent(), InsertionKind::Async);