Bug 1537708 - Clean up NS_STATE_IS_OUTER_SVG flag in favor of IsSVGOuterSVGFrame r=longsonr

NS_STATE_IS_OUTER_SVG is redundant, we clean it up and use
nsIFrame::IsSVGOuterSVGFrame() instead.

Differential Revision: https://phabricator.services.mozilla.com/D24330

--HG--
extra : moz-landing-system : lando
This commit is contained in:
violet 2019-03-22 02:23:35 +00:00
parent 90e63da7c3
commit 0a0bd52597
8 changed files with 17 additions and 25 deletions

View File

@ -1038,7 +1038,7 @@ static void DoApplyRenderingChangeToTree(nsIFrame* aFrame,
aFrame->InvalidateFrameSubtree();
if ((aChange & nsChangeHint_UpdateEffects) &&
aFrame->IsFrameOfType(nsIFrame::eSVG) &&
!(aFrame->GetStateBits() & NS_STATE_IS_OUTER_SVG)) {
!aFrame->IsSVGOuterSVGFrame()) {
// Need to update our overflow rects:
nsSVGUtils::ScheduleReflowSVG(aFrame);
}
@ -1666,7 +1666,7 @@ void RestyleManager::ProcessRestyledFrames(nsStyleChangeList& aChangeList) {
if ((hint & nsChangeHint_InvalidateRenderingObservers) ||
((hint & nsChangeHint_UpdateOpacityLayer) &&
frame->IsFrameOfType(nsIFrame::eSVG) &&
!(frame->GetStateBits() & NS_STATE_IS_OUTER_SVG))) {
!frame->IsSVGOuterSVGFrame())) {
SVGObserverUtils::InvalidateRenderingObservers(frame);
frame->SchedulePaint();
}

View File

@ -393,10 +393,8 @@ FRAME_STATE_GROUP_NAME(SVG)
FRAME_STATE_GROUP_CLASS(SVG, nsSVGDisplayableFrame)
FRAME_STATE_GROUP_CLASS(SVG, nsSVGContainerFrame)
FRAME_STATE_BIT(SVG, 20, NS_STATE_IS_OUTER_SVG)
// If this bit is set, we are a <clipPath> element or descendant.
FRAME_STATE_BIT(SVG, 21, NS_STATE_SVG_CLIPPATH_CHILD)
FRAME_STATE_BIT(SVG, 20, NS_STATE_SVG_CLIPPATH_CHILD)
// For SVG text, the NS_FRAME_IS_DIRTY and NS_FRAME_HAS_DIRTY_CHILDREN bits
// indicate that our anonymous block child needs to be reflowed, and that
@ -406,7 +404,7 @@ FRAME_STATE_BIT(SVG, 21, NS_STATE_SVG_CLIPPATH_CHILD)
// mPositioningDirty is used to indicate this latter "things are dirty" case
// to allow us to avoid reflowing the anonymous block when it is not
// necessary.
FRAME_STATE_BIT(SVG, 22, NS_STATE_SVG_POSITIONING_DIRTY)
FRAME_STATE_BIT(SVG, 21, NS_STATE_SVG_POSITIONING_DIRTY)
// For text, whether the values from x/y/dx/dy attributes have any percentage
// values that are used in determining the positions of glyphs. The value will
@ -429,14 +427,14 @@ FRAME_STATE_BIT(SVG, 22, NS_STATE_SVG_POSITIONING_DIRTY)
// determining a completley accurate value for
// NS_STATE_SVG_POSITIONING_MAY_USE_PERCENTAGES would require extra work that is
// probably not worth it.
FRAME_STATE_BIT(SVG, 23, NS_STATE_SVG_POSITIONING_MAY_USE_PERCENTAGES)
FRAME_STATE_BIT(SVG, 22, NS_STATE_SVG_POSITIONING_MAY_USE_PERCENTAGES)
FRAME_STATE_BIT(SVG, 24, NS_STATE_SVG_TEXT_IN_REFLOW)
FRAME_STATE_BIT(SVG, 23, NS_STATE_SVG_TEXT_IN_REFLOW)
// Set on SVGTextFrame frames when they need a
// TextNodeCorrespondenceRecorder::RecordCorrespondence call
// to update the cached nsTextNode indexes that they correspond to.
FRAME_STATE_BIT(SVG, 25, NS_STATE_SVG_TEXT_CORRESPONDENCE_DIRTY)
FRAME_STATE_BIT(SVG, 24, NS_STATE_SVG_TEXT_CORRESPONDENCE_DIRTY)
// == Frame state bits that apply to text frames ==============================

View File

@ -4015,12 +4015,8 @@ class nsIFrame : public nsQueryFrame {
* areas, because they're never painted.)
*/
bool FrameMaintainsOverflow() const {
// The IsSVGElement() check below is necessary, because the
// NS_STATE_IS_OUTER_SVG bit has conflict in other frames due to lack
// of bits.
return !HasAllStateBits(NS_FRAME_SVG_LAYOUT | NS_FRAME_IS_NONDISPLAY) &&
!(HasAllStateBits(NS_STATE_IS_OUTER_SVG | NS_FRAME_IS_NONDISPLAY) &&
GetContent()->IsSVGElement(nsGkAtoms::svg));
!(IsSVGOuterSVGFrame() && HasAnyStateBits(NS_FRAME_IS_NONDISPLAY));
}
/*

View File

@ -101,9 +101,8 @@ static void ScheduleReflow(nsIPresShell* aShell, nsIFrame* aFrame) {
// FrameNeedsReflow again, then.
return;
}
if (f->GetStateBits() & NS_STATE_IS_OUTER_SVG ||
!(f->IsFrameOfType(nsIFrame::eSVG) ||
nsSVGUtils::IsInSVGTextSubtree(f))) {
if (f->IsSVGOuterSVGFrame() || !(f->IsFrameOfType(nsIFrame::eSVG) ||
nsSVGUtils::IsInSVGTextSubtree(f))) {
break;
}
f->AddStateBits(NS_FRAME_HAS_DIRTY_CHILDREN);

View File

@ -3051,8 +3051,7 @@ void SVGTextFrame::ScheduleReflowSVGNonDisplayText(
// reflowed soon anyway. No need to call FrameNeedsReflow again, then.
return;
}
if (!f->IsFrameOfType(eSVG) ||
(f->GetStateBits() & NS_STATE_IS_OUTER_SVG)) {
if (!f->IsFrameOfType(eSVG) || f->IsSVGOuterSVGFrame()) {
break;
}
f->AddStateBits(NS_FRAME_HAS_DIRTY_CHILDREN);

View File

@ -123,7 +123,7 @@ void nsSVGContainerFrame::ReflowSVGNonDisplayText(nsIFrame* aContainer) {
void nsSVGDisplayContainerFrame::Init(nsIContent* aContent,
nsContainerFrame* aParent,
nsIFrame* aPrevInFlow) {
if (!(GetStateBits() & NS_STATE_IS_OUTER_SVG)) {
if (!IsSVGOuterSVGFrame()) {
AddStateBits(aParent->GetStateBits() & NS_STATE_SVG_CLIPPATH_CHILD);
}
nsSVGContainerFrame::Init(aContent, aParent, aPrevInFlow);

View File

@ -93,7 +93,7 @@ void nsSVGOuterSVGFrame::Init(nsIContent* aContent, nsContainerFrame* aParent,
NS_ASSERTION(aContent->IsSVGElement(nsGkAtoms::svg),
"Content is not an SVG 'svg' element!");
AddStateBits(NS_STATE_IS_OUTER_SVG | NS_FRAME_FONT_INFLATION_CONTAINER |
AddStateBits(NS_FRAME_FONT_INFLATION_CONTAINER |
NS_FRAME_FONT_INFLATION_FLOW_ROOT);
// Check for conditional processing attributes here rather than in

View File

@ -189,13 +189,13 @@ void nsSVGUtils::ScheduleReflowSVG(nsIFrame* aFrame) {
// We must not add dirty bits to the nsSVGOuterSVGFrame or else
// PresShell::FrameNeedsReflow won't work when we pass it in below.
if (aFrame->GetStateBits() & NS_STATE_IS_OUTER_SVG) {
if (aFrame->IsSVGOuterSVGFrame()) {
outerSVGFrame = static_cast<nsSVGOuterSVGFrame*>(aFrame);
} else {
aFrame->AddStateBits(NS_FRAME_IS_DIRTY);
nsIFrame* f = aFrame->GetParent();
while (f && !(f->GetStateBits() & NS_STATE_IS_OUTER_SVG)) {
while (f && !f->IsSVGOuterSVGFrame()) {
if (f->GetStateBits() &
(NS_FRAME_IS_DIRTY | NS_FRAME_HAS_DIRTY_CHILDREN)) {
return;
@ -203,7 +203,7 @@ void nsSVGUtils::ScheduleReflowSVG(nsIFrame* aFrame) {
f->AddStateBits(NS_FRAME_HAS_DIRTY_CHILDREN);
f = f->GetParent();
MOZ_ASSERT(f->IsFrameOfType(nsIFrame::eSVG),
"NS_STATE_IS_OUTER_SVG check above not valid!");
"IsSVGOuterSVGFrame check above not valid!");
}
outerSVGFrame = static_cast<nsSVGOuterSVGFrame*>(f);
@ -295,7 +295,7 @@ float nsSVGUtils::UserSpace(const UserSpaceMetrics& aMetrics,
nsSVGOuterSVGFrame* nsSVGUtils::GetOuterSVGFrame(nsIFrame* aFrame) {
while (aFrame) {
if (aFrame->GetStateBits() & NS_STATE_IS_OUTER_SVG) {
if (aFrame->IsSVGOuterSVGFrame()) {
return static_cast<nsSVGOuterSVGFrame*>(aFrame);
}
aFrame = aFrame->GetParent();