Bug 1647525 - Use HasAnyStateBits() in remaining layout files r=emilio

Differential Revision: https://phabricator.services.mozilla.com/D81230
This commit is contained in:
Kagami Sascha Rosylight 2020-06-28 01:00:19 +00:00
parent 3979f83c6e
commit 21f2b48e01
25 changed files with 28 additions and 29 deletions

View File

@ -7462,7 +7462,7 @@ bool nsCSSFrameConstructor::ContentRemoved(nsIContent* aChild,
// wrapper frame.)
nsIFrame* grandparentFrame = parentFrame->GetParent();
if (grandparentFrame && grandparentFrame->IsXULBoxFrame() &&
(grandparentFrame->HasAnyStateBits(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()) &&

View File

@ -5007,7 +5007,7 @@ bool nsLayoutUtils::IsFirstContinuationOrIBSplitSibling(
if (aFrame->GetPrevContinuation()) {
return false;
}
if ((aFrame->HasAnyStateBits(NS_FRAME_PART_OF_IBSPLIT)) &&
if (aFrame->HasAnyStateBits(NS_FRAME_PART_OF_IBSPLIT) &&
aFrame->GetProperty(nsIFrame::IBSplitPrevSibling())) {
return false;
}

View File

@ -7548,7 +7548,7 @@ bool nsBlockFrame::BlockNeedsFloatManager(nsIFrame* aBlock) {
NS_ASSERTION(aBlock->IsBlockFrameOrSubclass(), "aBlock must be a block");
nsIFrame* parent = aBlock->GetParent();
return (aBlock->HasAnyStateBits(NS_BLOCK_FLOAT_MGR)) ||
return aBlock->HasAnyStateBits(NS_BLOCK_FLOAT_MGR) ||
(parent && !parent->IsFloatContainingBlock());
}

View File

@ -279,9 +279,10 @@ void nsBlockReflowContext::ReflowBlock(
tI = space.LineLeft(mWritingMode, mContainerSize);
tB = mBCoord;
if ((mFrame->GetStateBits() & NS_BLOCK_FLOAT_MGR) == 0)
if (!mFrame->HasAnyStateBits(NS_BLOCK_FLOAT_MGR)) {
aFrameRI.mBlockDelta =
mOuterReflowInput.mBlockDelta + mBCoord - aLine->BStart();
}
}
#ifdef DEBUG

View File

@ -32,7 +32,7 @@ class nsFirstLetterFrame final : public nsContainerFrame {
virtual nsresult GetFrameName(nsAString& aResult) const override;
#endif
bool IsFloating() const { return GetStateBits() & NS_FRAME_OUT_OF_FLOW; }
bool IsFloating() const { return HasAnyStateBits(NS_FRAME_OUT_OF_FLOW); }
virtual bool IsFrameOfType(uint32_t aFlags) const override {
if (!IsFloating()) aFlags = aFlags & ~(nsIFrame::eLineParticipant);

View File

@ -1086,7 +1086,7 @@ void nsImageFrame::Reflow(nsPresContext* aPresContext, ReflowOutput& aMetrics,
}
FinishAndStoreOverflow(&aMetrics, aReflowInput.mStyleDisplay);
if ((GetStateBits() & NS_FRAME_FIRST_REFLOW) && !mReflowCallbackPosted) {
if (HasAnyStateBits(NS_FRAME_FIRST_REFLOW) && !mReflowCallbackPosted) {
mReflowCallbackPosted = true;
PresShell()->PostReflowCallback(this);
}

View File

@ -876,7 +876,7 @@ void nsFloatCacheFreeList::DeleteAll() {
}
nsFloatCache* nsFloatCacheFreeList::Alloc(nsIFrame* aFloat) {
MOZ_ASSERT(aFloat->GetStateBits() & NS_FRAME_OUT_OF_FLOW,
MOZ_ASSERT(aFloat->HasAnyStateBits(NS_FRAME_OUT_OF_FLOW),
"This is a float cache, why isn't the frame out-of-flow?");
nsFloatCache* fc = mHead;

View File

@ -31,7 +31,7 @@ void nsPageContentFrame::Reflow(nsPresContext* aPresContext,
DISPLAY_REFLOW(aPresContext, this, aReflowInput, aDesiredSize, aStatus);
MOZ_ASSERT(aStatus.IsEmpty(), "Caller should pass a fresh reflow status!");
if (GetPrevInFlow() && (GetStateBits() & NS_FRAME_FIRST_REFLOW)) {
if (GetPrevInFlow() && HasAnyStateBits(NS_FRAME_FIRST_REFLOW)) {
nsresult rv =
aPresContext->PresShell()->FrameConstructor()->ReplicateFixedFrames(
this);

View File

@ -153,7 +153,7 @@ void nsPageSequenceFrame::Reflow(nsPresContext* aPresContext,
// Don't do incremental reflow until we've taught tables how to do
// it right in paginated mode.
if (!(GetStateBits() & NS_FRAME_FIRST_REFLOW)) {
if (!HasAnyStateBits(NS_FRAME_FIRST_REFLOW)) {
// Return our desired size
SetDesiredSize(aDesiredSize, aReflowInput, mSize.width, mSize.height);
aDesiredSize.SetOverflowAreasToDesiredBounds();

View File

@ -784,7 +784,7 @@ void nsPluginFrame::DidReflow(nsPresContext* aPresContext,
const ReflowInput* aReflowInput) {
// Do this check before calling the superclass, as that clears
// NS_FRAME_FIRST_REFLOW
if (GetStateBits() & NS_FRAME_FIRST_REFLOW) {
if (HasAnyStateBits(NS_FRAME_FIRST_REFLOW)) {
nsCOMPtr<nsIObjectLoadingContent> objContent(do_QueryInterface(mContent));
NS_ASSERTION(objContent, "Why not an object loading content?");
objContent->HasNewFrame(this);

View File

@ -48,7 +48,7 @@ class nsRubyTextContainerFrame final : public nsContainerFrame {
virtual void RemoveFrame(ChildListID aListID, nsIFrame* aOldFrame) override;
bool IsSpanContainer() const {
return GetStateBits() & NS_RUBY_TEXT_CONTAINER_IS_SPAN;
return HasAnyStateBits(NS_RUBY_TEXT_CONTAINER_IS_SPAN);
}
protected:

View File

@ -42,7 +42,7 @@ class nsRubyTextFrame final : public nsRubyContentFrame {
nsReflowStatus& aStatus) override;
bool IsAutoHidden() const {
return GetStateBits() & NS_RUBY_TEXT_FRAME_AUTOHIDE;
return HasAnyStateBits(NS_RUBY_TEXT_FRAME_AUTOHIDE);
}
protected:

View File

@ -4030,7 +4030,7 @@ void PaintedLayerData::AccumulateHitTestItem(ContainerState* aState,
}
}
if (hasRoundedCorners || (frame->GetStateBits() & NS_FRAME_SVG_LAYOUT)) {
if (hasRoundedCorners || frame->HasAnyStateBits(NS_FRAME_SVG_LAYOUT)) {
mMaybeHitRegion.OrWith(area);
} else {
mHitRegion.OrWith(area);

View File

@ -253,8 +253,7 @@ bool RetainedDisplayListBuilder::PreProcessDisplayList(
bool keepLinked = aKeepLinked;
nsIFrame* invalid = item->FrameForInvalidation();
if (!invalid->ForceDescendIntoIfVisible() &&
!(invalid->GetStateBits() &
NS_FRAME_FORCE_DISPLAY_LIST_DESCEND_INTO)) {
!invalid->HasAnyStateBits(NS_FRAME_FORCE_DISPLAY_LIST_DESCEND_INTO)) {
keepLinked = true;
}

View File

@ -2096,7 +2096,7 @@ nscoord nsComputedDOMStyle::GetUsedAbsoluteOffset(mozilla::Side aSide) {
containerRect.SizeTo(
viewportFrame->AdjustViewportSizeForFixedPosition(containerRect));
} else if (container->IsGridContainerFrame() &&
(mOuterFrame->HasAnyStateBits(NS_FRAME_OUT_OF_FLOW))) {
mOuterFrame->HasAnyStateBits(NS_FRAME_OUT_OF_FLOW)) {
containerRect = nsGridContainerFrame::GridItemCB(mOuterFrame);
rect.MoveBy(-containerRect.x, -containerRect.y);
}

View File

@ -48,7 +48,7 @@ void TransformReferenceBox::EnsureDimensionsAreCached() {
mIsCached = true;
if (mFrame->GetStateBits() & NS_FRAME_SVG_LAYOUT) {
if (mFrame->HasAnyStateBits(NS_FRAME_SVG_LAYOUT)) {
if (!StaticPrefs::svg_transform_box_enabled()) {
mX = -mFrame->GetPosition().x;
mY = -mFrame->GetPosition().y;

View File

@ -163,7 +163,7 @@ nsresult SVGViewportFrame::AttributeChanged(int32_t aNameSpaceID,
nsAtom* aAttribute,
int32_t aModType) {
if (aNameSpaceID == kNameSpaceID_None &&
!(GetStateBits() & NS_FRAME_IS_NONDISPLAY)) {
!HasAnyStateBits(NS_FRAME_IS_NONDISPLAY)) {
SVGViewportElement* content =
static_cast<SVGViewportElement*>(GetContent());

View File

@ -407,8 +407,8 @@ nsRegion nsFilterInstance::GetPreFilterNeededArea(
nsRect nsFilterInstance::GetPostFilterBounds(nsIFrame* aFilteredFrame,
const gfxRect* aOverrideBBox,
const nsRect* aPreFilterBounds) {
MOZ_ASSERT(!(aFilteredFrame->GetStateBits() & NS_FRAME_SVG_LAYOUT) ||
!(aFilteredFrame->GetStateBits() & NS_FRAME_IS_NONDISPLAY),
MOZ_ASSERT(!aFilteredFrame->HasAnyStateBits(NS_FRAME_SVG_LAYOUT) ||
!aFilteredFrame->HasAnyStateBits(NS_FRAME_IS_NONDISPLAY),
"Non-display SVG do not maintain visual overflow rects");
nsRegion preFilterRegion;

View File

@ -352,8 +352,7 @@ already_AddRefed<SourceSurface> nsSVGPatternFrame::PaintPattern(
// Delay checking NS_FRAME_DRAWING_AS_PAINTSERVER bit until here so we can
// give back a clear surface if there's a loop
if (!(patternWithChildren->GetStateBits() &
NS_FRAME_DRAWING_AS_PAINTSERVER)) {
if (!patternWithChildren->HasAnyStateBits(NS_FRAME_DRAWING_AS_PAINTSERVER)) {
AutoSetRestorePaintServerState paintServer(patternWithChildren);
for (nsIFrame* kid = firstKid; kid; kid = kid->GetNextSibling()) {
gfxMatrix tm = *(patternWithChildren->mCTM);

View File

@ -803,7 +803,7 @@ void nsImageBoxFrame::OnSizeAvailable(imgIRequest* aRequest,
mIntrinsicSize.SizeTo(nsPresContext::CSSPixelsToAppUnits(w),
nsPresContext::CSSPixelsToAppUnits(h));
if (!(GetStateBits() & NS_FRAME_FIRST_REFLOW)) {
if (!HasAnyStateBits(NS_FRAME_FIRST_REFLOW)) {
PresShell()->FrameNeedsReflow(this, IntrinsicDirty::StyleChange,
NS_FRAME_IS_DIRTY);
}

View File

@ -47,7 +47,7 @@ void nsLeafBoxFrame::Init(nsIContent* aContent, nsContainerFrame* aParent,
nsIFrame* aPrevInFlow) {
nsLeafFrame::Init(aContent, aParent, aPrevInFlow);
if (GetStateBits() & NS_FRAME_FONT_INFLATION_CONTAINER) {
if (HasAnyStateBits(NS_FRAME_FONT_INFLATION_CONTAINER)) {
AddStateBits(NS_FRAME_FONT_INFLATION_FLOW_ROOT);
}
}

View File

@ -151,7 +151,7 @@ class nsMenuFrame final : public nsBoxFrame, public nsIReflowCallback {
* @return true if this frame has a popup child frame.
*/
bool HasPopup() const {
return (GetStateBits() & NS_STATE_MENU_HAS_POPUP_LIST) != 0;
return HasAnyStateBits(NS_STATE_MENU_HAS_POPUP_LIST);
}
// nsMenuFrame methods

View File

@ -1372,8 +1372,7 @@ nsSize nsSliderFrame::GetXULMaxSize(nsBoxLayoutState& aState) {
void nsSliderFrame::EnsureOrient() {
nsIFrame* scrollbarBox = GetScrollbar();
bool isHorizontal =
(scrollbarBox->GetStateBits() & NS_STATE_IS_HORIZONTAL) != 0;
bool isHorizontal = scrollbarBox->HasAnyStateBits(NS_STATE_IS_HORIZONTAL);
if (isHorizontal)
AddStateBits(NS_STATE_IS_HORIZONTAL);
else

View File

@ -42,7 +42,7 @@ void nsSprocketLayout::Shutdown() { NS_IF_RELEASE(gInstance); }
nsSprocketLayout::nsSprocketLayout() = default;
bool nsSprocketLayout::IsXULHorizontal(nsIFrame* aBox) {
return (aBox->GetStateBits() & NS_STATE_IS_HORIZONTAL) != 0;
return aBox->HasAnyStateBits(NS_STATE_IS_HORIZONTAL);
}
void nsSprocketLayout::GetFrameState(nsIFrame* aBox, nsFrameState& aState) {

View File

@ -160,8 +160,9 @@ uint8_t nsStackLayout::GetOffset(nsIFrame* aChild, nsMargin& aOffset) {
// As an optimization, we cache the fact that we are not positioned to avoid
// wasting time fetching attributes.
if (aChild->IsXULBoxFrame() &&
(aChild->GetStateBits() & NS_STATE_STACK_NOT_POSITIONED))
aChild->HasAnyStateBits(NS_STATE_STACK_NOT_POSITIONED)) {
return 0;
}
uint8_t offsetSpecified = 0;
nsIContent* content = aChild->GetContent();