Bug 1651129 - Convert uses of mState to various StateBits methods and make mState private r=emilio

Differential Revision: https://phabricator.services.mozilla.com/D169943
This commit is contained in:
Robert Longson 2023-02-15 21:35:46 +00:00
Родитель 27dd98b647
Коммит 2ec308723b
11 изменённых файлов: 39 добавлений и 37 удалений

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

@ -4490,14 +4490,14 @@ void nsBlockFrame::DoReflowInlineFrames(
// XXX Unfortunately we need to know this before reflowing the first
// inline frame in the line. FIX ME.
if ((0 == aLineLayout.GetLineNumber()) &&
(NS_BLOCK_HAS_FIRST_LETTER_CHILD & mState) &&
(NS_BLOCK_HAS_FIRST_LETTER_STYLE & mState)) {
if (0 == aLineLayout.GetLineNumber() &&
HasAllStateBits(NS_BLOCK_HAS_FIRST_LETTER_CHILD |
NS_BLOCK_HAS_FIRST_LETTER_STYLE)) {
aLineLayout.SetFirstLetterStyleOK(true);
}
NS_ASSERTION(
!((NS_BLOCK_HAS_FIRST_LETTER_CHILD & mState) && GetPrevContinuation()),
"first letter child bit should only be on first continuation");
NS_ASSERTION(!(HasAnyStateBits(NS_BLOCK_HAS_FIRST_LETTER_CHILD) &&
GetPrevContinuation()),
"first letter child bit should only be on first continuation");
// Reflow the frames that are already on the line first
LineReflowStatus lineReflowStatus = LineReflowStatus::OK;
@ -7517,7 +7517,7 @@ void nsBlockFrame::SetInitialChildList(ChildListID aListID,
!IsColumnSetWrapperFrame() &&
RefPtr<ComputedStyle>(GetFirstLetterStyle(PresContext())) != nullptr;
NS_ASSERTION(haveFirstLetterStyle ==
((mState & NS_BLOCK_HAS_FIRST_LETTER_STYLE) != 0),
HasAnyStateBits(NS_BLOCK_HAS_FIRST_LETTER_STYLE),
"NS_BLOCK_HAS_FIRST_LETTER_STYLE state out of sync");
#endif

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

@ -251,14 +251,14 @@ class nsBlockFrame : public nsContainerFrame {
* @return true if this frame has an inside ::marker frame.
*/
bool HasInsideMarker() const {
return 0 != (mState & NS_BLOCK_FRAME_HAS_INSIDE_MARKER);
return HasAnyStateBits(NS_BLOCK_FRAME_HAS_INSIDE_MARKER);
}
/**
* @return true if this frame has an outside ::marker frame.
*/
bool HasOutsideMarker() const {
return 0 != (mState & NS_BLOCK_FRAME_HAS_OUTSIDE_MARKER);
return HasAnyStateBits(NS_BLOCK_FRAME_HAS_OUTSIDE_MARKER);
}
/**

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

@ -444,7 +444,7 @@ void nsHTMLCanvasFrame::Reflow(nsPresContext* aPresContext,
("enter nsHTMLCanvasFrame::Reflow: availSize=%d,%d",
aReflowInput.AvailableWidth(), aReflowInput.AvailableHeight()));
MOZ_ASSERT(mState & NS_FRAME_IN_REFLOW, "frame is not in reflow");
MOZ_ASSERT(HasAnyStateBits(NS_FRAME_IN_REFLOW), "frame is not in reflow");
WritingMode wm = aReflowInput.GetWritingMode();
const LogicalSize finalSize = aReflowInput.ComputedSizeWithBorderPadding(wm);

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

@ -841,7 +841,7 @@ void nsIFrame::DestroyFrom(nsIFrame* aDestructRoot,
nsPresContext* presContext = PresContext();
mozilla::PresShell* presShell = presContext->GetPresShell();
if (mState & NS_FRAME_OUT_OF_FLOW) {
if (HasAnyStateBits(NS_FRAME_OUT_OF_FLOW)) {
nsPlaceholderFrame* placeholder = GetPlaceholderFrame();
NS_ASSERTION(
!placeholder || (aDestructRoot != this),
@ -899,7 +899,7 @@ void nsIFrame::DestroyFrom(nsIFrame* aDestructRoot,
presShell->NotifyDestroyingFrame(this);
if (mState & NS_FRAME_EXTERNAL_REFERENCE) {
if (HasAnyStateBits(NS_FRAME_EXTERNAL_REFERENCE)) {
presShell->ClearFrameRefs(this);
}
@ -1829,7 +1829,7 @@ bool nsIFrame::IsSVGTransformed(gfx::Matrix* aOwnTransforms,
bool nsIFrame::Extend3DContext(const nsStyleDisplay* aStyleDisplay,
const nsStyleEffects* aStyleEffects,
mozilla::EffectSet* aEffectSetForOpacity) const {
if (!(mState & NS_FRAME_MAY_BE_TRANSFORMED)) {
if (!HasAnyStateBits(NS_FRAME_MAY_BE_TRANSFORMED)) {
return false;
}
const nsStyleDisplay* disp = StyleDisplayWithOptionalParam(aStyleDisplay);
@ -9973,7 +9973,7 @@ bool nsIFrame::FinishAndStoreOverflow(OverflowAreas& aOverflowAreas,
DebugOnly<nsRect*> r = &aOverflowAreas.Overflow(otype);
NS_ASSERTION(aNewSize.width == 0 || aNewSize.height == 0 ||
r->width == nscoord_MAX || r->height == nscoord_MAX ||
(mState & NS_FRAME_SVG_LAYOUT) ||
HasAnyStateBits(NS_FRAME_SVG_LAYOUT) ||
r->Contains(nsRect(nsPoint(0, 0), aNewSize)),
"Computed overflow area must contain frame bounds");
}
@ -10431,13 +10431,13 @@ ComputedStyle* nsIFrame::DoGetParentComputedStyle(
}
}
if (!(mState & NS_FRAME_OUT_OF_FLOW)) {
if (!HasAnyStateBits(NS_FRAME_OUT_OF_FLOW)) {
/*
* If this frame is an anonymous block created when an inline with a block
* inside it got split, then the parent style is on its preceding inline. We
* can get to it using GetIBSplitSiblingForAnonymousBlock.
*/
if (mState & NS_FRAME_PART_OF_IBSPLIT) {
if (HasAnyStateBits(NS_FRAME_PART_OF_IBSPLIT)) {
nsIFrame* ibSplitSibling = GetIBSplitSiblingForAnonymousBlock(this);
if (ibSplitSibling) {
return (*aProviderFrame = ibSplitSibling)->Style();

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

@ -5066,8 +5066,10 @@ class nsIFrame : public nsQueryFrame {
AddStateBits(NS_FRAME_IN_REFLOW);
}
private:
nsFrameState mState;
protected:
/**
* List of properties attached to the frame.
*/

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

@ -1332,7 +1332,7 @@ void nsImageFrame::Reflow(nsPresContext* aPresContext, ReflowOutput& aMetrics,
("enter nsImageFrame::Reflow: availSize=%d,%d",
aReflowInput.AvailableWidth(), aReflowInput.AvailableHeight()));
MOZ_ASSERT(mState & NS_FRAME_IN_REFLOW, "frame is not in reflow");
MOZ_ASSERT(HasAnyStateBits(NS_FRAME_IN_REFLOW), "frame is not in reflow");
// see if we have a frozen size (i.e. a fixed width and height)
if (!SizeDependsOnIntrinsicSize(aReflowInput)) {
@ -1368,7 +1368,7 @@ void nsImageFrame::Reflow(nsPresContext* aPresContext, ReflowOutput& aMetrics,
if (aPresContext->IsPaginated() &&
((loadStatus & imgIRequest::STATUS_SIZE_AVAILABLE) ||
(mState & IMAGE_SIZECONSTRAINED)) &&
HasAnyStateBits(IMAGE_SIZECONSTRAINED)) &&
NS_UNCONSTRAINEDSIZE != aReflowInput.AvailableHeight() &&
aMetrics.Height() > aReflowInput.AvailableHeight()) {
// our desired height was greater than 0, so to avoid infinite

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

@ -791,7 +791,7 @@ struct FlowLengthProperty {
};
int32_t nsTextFrame::GetInFlowContentLength() {
if (!(mState & NS_FRAME_IS_BIDI)) {
if (!HasAnyStateBits(NS_FRAME_IS_BIDI)) {
return mContent->TextLength() - mContentOffset;
}
@ -7827,7 +7827,7 @@ void nsTextFrame::SelectionStateChanged(uint32_t aStart, uint32_t aEnd,
SelectionType aSelectionType) {
NS_ASSERTION(!GetPrevContinuation(),
"Should only be called for primary frame");
DEBUG_VERIFY_NOT_DIRTY(mState);
DEBUG_VERIFY_NOT_DIRTY(GetStateBits());
InvalidateSelectionState();
@ -7919,8 +7919,8 @@ nsresult nsTextFrame::GetPointFromOffset(int32_t inOffset, nsPoint* outPoint) {
return NS_ERROR_NULL_POINTER;
}
DEBUG_VERIFY_NOT_DIRTY(mState);
if (mState & NS_FRAME_IS_DIRTY) {
DEBUG_VERIFY_NOT_DIRTY(GetStateBits());
if (HasAnyStateBits(NS_FRAME_IS_DIRTY)) {
return NS_ERROR_UNEXPECTED;
}
@ -7950,8 +7950,8 @@ nsresult nsTextFrame::GetPointFromOffset(int32_t inOffset, nsPoint* outPoint) {
nsresult nsTextFrame::GetCharacterRectsInRange(int32_t aInOffset,
int32_t aLength,
nsTArray<nsRect>& aRects) {
DEBUG_VERIFY_NOT_DIRTY(mState);
if (mState & NS_FRAME_IS_DIRTY) {
DEBUG_VERIFY_NOT_DIRTY(GetStateBits());
if (HasAnyStateBits(NS_FRAME_IS_DIRTY)) {
return NS_ERROR_UNEXPECTED;
}
@ -8041,9 +8041,9 @@ nsresult nsTextFrame::GetChildFrameContainingOffset(int32_t aContentOffset,
bool aHint,
int32_t* aOutOffset,
nsIFrame** aOutFrame) {
DEBUG_VERIFY_NOT_DIRTY(mState);
DEBUG_VERIFY_NOT_DIRTY(GetStateBits());
#if 0 // XXXrbs disable due to bug 310227
if (mState & NS_FRAME_IS_DIRTY)
if (HasAnyStateBits(NS_FRAME_IS_DIRTY))
return NS_ERROR_UNEXPECTED;
#endif
@ -10531,9 +10531,9 @@ nsIFrame::RenderedText nsTextFrame::GetRenderedText(
/* virtual */
bool nsTextFrame::IsEmpty() {
NS_ASSERTION(!(mState & TEXT_IS_ONLY_WHITESPACE) ||
!(mState & TEXT_ISNOT_ONLY_WHITESPACE),
"Invalid state");
NS_ASSERTION(
!HasAllStateBits(TEXT_IS_ONLY_WHITESPACE | TEXT_ISNOT_ONLY_WHITESPACE),
"Invalid state");
// XXXldb Should this check compatibility mode as well???
const nsStyleText* textStyle = StyleText();
@ -10547,11 +10547,11 @@ bool nsTextFrame::IsEmpty() {
!GetContent()->GetParent()->IsHTMLElement(nsGkAtoms::input);
}
if (mState & TEXT_ISNOT_ONLY_WHITESPACE) {
if (HasAnyStateBits(TEXT_ISNOT_ONLY_WHITESPACE)) {
return false;
}
if (mState & TEXT_IS_ONLY_WHITESPACE) {
if (HasAnyStateBits(TEXT_IS_ONLY_WHITESPACE)) {
return true;
}

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

@ -233,7 +233,7 @@ void nsVideoFrame::Reflow(nsPresContext* aPresContext, ReflowOutput& aMetrics,
("enter nsVideoFrame::Reflow: availSize=%d,%d",
aReflowInput.AvailableWidth(), aReflowInput.AvailableHeight()));
MOZ_ASSERT(mState & NS_FRAME_IN_REFLOW, "frame is not in reflow");
MOZ_ASSERT(HasAnyStateBits(NS_FRAME_IN_REFLOW), "frame is not in reflow");
const WritingMode myWM = aReflowInput.GetWritingMode();
nscoord contentBoxBSize = aReflowInput.ComputedBSize();

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

@ -50,7 +50,7 @@ nsTableColFrame::nsTableColFrame(ComputedStyle* aStyle,
nsTableColFrame::~nsTableColFrame() = default;
nsTableColType nsTableColFrame::GetColType() const {
return (nsTableColType)((mState & COL_TYPE_BITS) >> COL_TYPE_OFFSET);
return (nsTableColType)((GetStateBits() & COL_TYPE_BITS) >> COL_TYPE_OFFSET);
}
void nsTableColFrame::SetColType(nsTableColType aType) {

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

@ -203,7 +203,7 @@ void nsBoxFrame::CacheAttributes() {
GetInitialVAlignment(mValign);
GetInitialHAlignment(mHalign);
bool autostretch = !!(mState & NS_STATE_AUTO_STRETCH);
bool autostretch = HasAnyStateBits(NS_STATE_AUTO_STRETCH);
GetInitialAutoStretch(autostretch);
if (autostretch)
AddStateBits(NS_STATE_AUTO_STRETCH);
@ -349,7 +349,7 @@ bool nsBoxFrame::GetInitialAutoStretch(bool& aStretch) {
void nsBoxFrame::DidReflow(nsPresContext* aPresContext,
const ReflowInput* aReflowInput) {
nsFrameState preserveBits =
mState & (NS_FRAME_IS_DIRTY | NS_FRAME_HAS_DIRTY_CHILDREN);
GetStateBits() & (NS_FRAME_IS_DIRTY | NS_FRAME_HAS_DIRTY_CHILDREN);
nsIFrame::DidReflow(aPresContext, aReflowInput);
AddStateBits(preserveBits);
if (preserveBits & NS_FRAME_IS_DIRTY) {
@ -815,7 +815,7 @@ nsresult nsBoxFrame::AttributeChanged(int32_t aNameSpaceID, nsAtom* aAttribute,
GetInitialVAlignment(mValign);
GetInitialHAlignment(mHalign);
bool autostretch = !!(mState & NS_STATE_AUTO_STRETCH);
bool autostretch = HasAnyStateBits(NS_STATE_AUTO_STRETCH);
GetInitialAutoStretch(autostretch);
if (autostretch)
AddStateBits(NS_STATE_AUTO_STRETCH);

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

@ -482,7 +482,7 @@ void nsTextBoxFrame::DrawText(gfxContext& aRenderingContext,
nsresult rv = NS_ERROR_FAILURE;
if (mState & NS_FRAME_IS_BIDI) {
if (HasAnyStateBits(NS_FRAME_IS_BIDI)) {
presContext->SetBidiEnabled();
mozilla::intl::BidiEmbeddingLevel level =
nsBidiPresUtils::BidiLevelFromStyle(Style());