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

Differential Revision: https://phabricator.services.mozilla.com/D81218
This commit is contained in:
Kagami Sascha Rosylight 2020-06-27 14:15:47 +00:00
Родитель 73697d6a65
Коммит 01781c983c
1 изменённых файлов: 10 добавлений и 10 удалений

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

@ -191,7 +191,7 @@ bool nsSVGIntegrationUtils::UsingSimpleClipPathForFrame(
} }
nsPoint nsSVGIntegrationUtils::GetOffsetToBoundingBox(nsIFrame* aFrame) { nsPoint nsSVGIntegrationUtils::GetOffsetToBoundingBox(nsIFrame* aFrame) {
if ((aFrame->GetStateBits() & NS_FRAME_SVG_LAYOUT)) { if (aFrame->HasAnyStateBits(NS_FRAME_SVG_LAYOUT)) {
// Do NOT call GetAllInFlowRectsUnion for SVG - it will get the // Do NOT call GetAllInFlowRectsUnion for SVG - it will get the
// covered region relative to the nsSVGOuterSVGFrame, which is absolutely // covered region relative to the nsSVGOuterSVGFrame, which is absolutely
// not what we want. SVG frames are always in user space, so they have // not what we want. SVG frames are always in user space, so they have
@ -230,7 +230,7 @@ gfxRect nsSVGIntegrationUtils::GetSVGBBoxForNonSVGFrame(
// Except for nsSVGOuterSVGFrame, we shouldn't be getting here with SVG // Except for nsSVGOuterSVGFrame, we shouldn't be getting here with SVG
// frames at all. This function is for elements that are laid out using the // frames at all. This function is for elements that are laid out using the
// CSS box model rules. // CSS box model rules.
NS_ASSERTION(!(aNonSVGFrame->GetStateBits() & NS_FRAME_SVG_LAYOUT), NS_ASSERTION(!aNonSVGFrame->HasAnyStateBits(NS_FRAME_SVG_LAYOUT),
"Frames with SVG layout should not get here"); "Frames with SVG layout should not get here");
MOZ_ASSERT(!aNonSVGFrame->IsFrameOfType(nsIFrame::eSVG) || MOZ_ASSERT(!aNonSVGFrame->IsFrameOfType(nsIFrame::eSVG) ||
aNonSVGFrame->IsSVGOuterSVGFrame()); aNonSVGFrame->IsSVGOuterSVGFrame());
@ -283,7 +283,7 @@ gfxRect nsSVGIntegrationUtils::GetSVGBBoxForNonSVGFrame(
// //
nsRect nsSVGIntegrationUtils::ComputePostEffectsVisualOverflowRect( nsRect nsSVGIntegrationUtils::ComputePostEffectsVisualOverflowRect(
nsIFrame* aFrame, const nsRect& aPreEffectsOverflowRect) { nsIFrame* aFrame, const nsRect& aPreEffectsOverflowRect) {
MOZ_ASSERT(!(aFrame->GetStateBits() & NS_FRAME_SVG_LAYOUT), MOZ_ASSERT(!aFrame->HasAnyStateBits(NS_FRAME_SVG_LAYOUT),
"Don't call this on SVG child frames"); "Don't call this on SVG child frames");
MOZ_ASSERT(aFrame->StyleEffects()->HasFilters(), MOZ_ASSERT(aFrame->StyleEffects()->HasFilters(),
@ -396,7 +396,7 @@ bool nsSVGIntegrationUtils::HitTestFrameForEffects(nsIFrame* aFrame,
nsLayoutUtils::FirstContinuationOrIBSplitSibling(aFrame); nsLayoutUtils::FirstContinuationOrIBSplitSibling(aFrame);
// Convert aPt to user space: // Convert aPt to user space:
nsPoint toUserSpace; nsPoint toUserSpace;
if (aFrame->GetStateBits() & NS_FRAME_SVG_LAYOUT) { if (aFrame->HasAnyStateBits(NS_FRAME_SVG_LAYOUT)) {
// XXXmstange Isn't this wrong for svg:use and innerSVG frames? // XXXmstange Isn't this wrong for svg:use and innerSVG frames?
toUserSpace = aFrame->GetPosition(); toUserSpace = aFrame->GetPosition();
} else { } else {
@ -599,7 +599,7 @@ static MaskPaintResult CreateAndPaintMaskSurface(
// Left paintResult.maskSurface empty, the caller should paint all // Left paintResult.maskSurface empty, the caller should paint all
// masked content as if this mask is an opaque white one(no mask). // masked content as if this mask is an opaque white one(no mask).
paintResult.transparentBlackMask = paintResult.transparentBlackMask =
!(aParams.frame->GetStateBits() & NS_FRAME_SVG_LAYOUT); !aParams.frame->HasAnyStateBits(NS_FRAME_SVG_LAYOUT);
MOZ_ASSERT(!paintResult.maskSurface); MOZ_ASSERT(!paintResult.maskSurface);
return paintResult; return paintResult;
@ -616,13 +616,13 @@ static MaskPaintResult CreateAndPaintMaskSurface(
static bool ValidateSVGFrame(nsIFrame* aFrame) { static bool ValidateSVGFrame(nsIFrame* aFrame) {
#ifdef DEBUG #ifdef DEBUG
NS_ASSERTION(!(aFrame->GetStateBits() & NS_FRAME_SVG_LAYOUT) || NS_ASSERTION(!aFrame->HasAnyStateBits(NS_FRAME_SVG_LAYOUT) ||
(NS_SVGDisplayListPaintingEnabled() && (NS_SVGDisplayListPaintingEnabled() &&
!(aFrame->GetStateBits() & NS_FRAME_IS_NONDISPLAY)), !aFrame->HasAnyStateBits(NS_FRAME_IS_NONDISPLAY)),
"Should not use nsSVGIntegrationUtils on this SVG frame"); "Should not use nsSVGIntegrationUtils on this SVG frame");
#endif #endif
bool hasSVGLayout = (aFrame->GetStateBits() & NS_FRAME_SVG_LAYOUT); bool hasSVGLayout = aFrame->HasAnyStateBits(NS_FRAME_SVG_LAYOUT);
if (hasSVGLayout) { if (hasSVGLayout) {
#ifdef DEBUG #ifdef DEBUG
nsSVGDisplayableFrame* svgFrame = do_QueryFrame(aFrame); nsSVGDisplayableFrame* svgFrame = do_QueryFrame(aFrame);
@ -689,7 +689,7 @@ static EffectOffsets ComputeEffectOffset(nsIFrame* aFrame,
result.offsetToUserSpace = result.offsetToBoundingBox - toUserSpace; result.offsetToUserSpace = result.offsetToBoundingBox - toUserSpace;
#ifdef DEBUG #ifdef DEBUG
bool hasSVGLayout = (aFrame->GetStateBits() & NS_FRAME_SVG_LAYOUT); bool hasSVGLayout = aFrame->HasAnyStateBits(NS_FRAME_SVG_LAYOUT);
NS_ASSERTION( NS_ASSERTION(
hasSVGLayout || result.offsetToBoundingBox == result.offsetToUserSpace, hasSVGLayout || result.offsetToBoundingBox == result.offsetToUserSpace,
"For non-SVG frames there shouldn't be any additional offset"); "For non-SVG frames there shouldn't be any additional offset");
@ -1252,7 +1252,7 @@ bool PaintFrameCallback::operator()(gfxContext* aContext,
const gfxRect& aFillRect, const gfxRect& aFillRect,
const SamplingFilter aSamplingFilter, const SamplingFilter aSamplingFilter,
const gfxMatrix& aTransform) { const gfxMatrix& aTransform) {
if (mFrame->GetStateBits() & NS_FRAME_DRAWING_AS_PAINTSERVER) { if (mFrame->HasAnyStateBits(NS_FRAME_DRAWING_AS_PAINTSERVER)) {
return false; return false;
} }