Skip to content

Commit 139bce8

Browse files
committed
Bug 1918310 - Remove class nsMathMLmsqrtFrame. r=emilio
This class is currently only used to override InheritAutomaticData() and IsMrowLike(). This patch moves that directly in nsMathMLrootFrame. Probably we should have the same behavior when ShouldUseRowFallback() returns true, but this patch does not try and change anything. Differential Revision: https://phabricator.services.mozilla.com/D222258
1 parent 43fda17 commit 139bce8

File tree

8 files changed

+28
-107
lines changed

8 files changed

+28
-107
lines changed

layout/base/nsCSSFrameConstructor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4630,7 +4630,7 @@ nsCSSFrameConstructor::FindMathMLData(const Element& aElement,
46304630
SIMPLE_MATHML_CREATE(mfenced_, NS_NewMathMLmrowFrame),
46314631
SIMPLE_MATHML_CREATE(mmultiscripts_, NS_NewMathMLmmultiscriptsFrame),
46324632
SIMPLE_MATHML_CREATE(mstyle_, NS_NewMathMLmrowFrame),
4633-
SIMPLE_MATHML_CREATE(msqrt_, NS_NewMathMLmsqrtFrame),
4633+
SIMPLE_MATHML_CREATE(msqrt_, NS_NewMathMLmrootFrame),
46344634
SIMPLE_MATHML_CREATE(mroot_, NS_NewMathMLmrootFrame),
46354635
SIMPLE_MATHML_CREATE(maction_, NS_NewMathMLmrowFrame),
46364636
SIMPLE_MATHML_CREATE(mrow_, NS_NewMathMLmrowFrame),

layout/generic/FrameClasses.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@
8888
Frame("nsMathMLmrootFrame", "None", MATHML_CONTAINER),
8989
Frame("nsMathMLmrowFrame", "None", MATHML_CONTAINER),
9090
Frame("nsMathMLmspaceFrame", "None", MATHML_CONTAINER | LEAF),
91-
Frame("nsMathMLmsqrtFrame", "None", MATHML_CONTAINER),
9291
Frame("nsMathMLmtableFrame", "Table", TABLE | MATHML),
9392
Frame("nsMathMLmtableWrapperFrame", "TableWrapper", BLOCK | MATHML),
9493
Frame("nsMathMLmtdFrame", "TableCell", TABLE_CELL | MATHML),

layout/mathml/moz.build

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ UNIFIED_SOURCES += [
2424
"nsMathMLmrootFrame.cpp",
2525
"nsMathMLmrowFrame.cpp",
2626
"nsMathMLmspaceFrame.cpp",
27-
"nsMathMLmsqrtFrame.cpp",
2827
"nsMathMLmtableFrame.cpp",
2928
"nsMathMLmunderoverFrame.cpp",
3029
"nsMathMLOperators.cpp",

layout/mathml/nsMathMLParts.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@ nsContainerFrame* NS_NewMathMLmtdFrame(mozilla::PresShell* aPresShell,
5252
nsTableFrame* aTableFrame);
5353
nsContainerFrame* NS_NewMathMLmtdInnerFrame(mozilla::PresShell* aPresShell,
5454
mozilla::ComputedStyle* aStyle);
55-
nsIFrame* NS_NewMathMLmsqrtFrame(mozilla::PresShell* aPresShell,
56-
mozilla::ComputedStyle* aStyle);
5755
nsIFrame* NS_NewMathMLmrootFrame(mozilla::PresShell* aPresShell,
5856
mozilla::ComputedStyle* aStyle);
5957
nsIFrame* NS_NewMathMLmencloseFrame(mozilla::PresShell* aPresShell,

layout/mathml/nsMathMLmrootFrame.cpp

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ nsIFrame* NS_NewMathMLmrootFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
2929
NS_IMPL_FRAMEARENA_HELPERS(nsMathMLmrootFrame)
3030

3131
nsMathMLmrootFrame::nsMathMLmrootFrame(ComputedStyle* aStyle,
32-
nsPresContext* aPresContext, ClassID aID)
33-
: nsMathMLContainerFrame(aStyle, aPresContext, aID) {}
32+
nsPresContext* aPresContext)
33+
: nsMathMLContainerFrame(aStyle, aPresContext, kClassID) {}
3434

3535
nsMathMLmrootFrame::~nsMathMLmrootFrame() = default;
3636

@@ -58,6 +58,26 @@ bool nsMathMLmrootFrame::ShouldUseRowFallback() {
5858
return !indexFrame || indexFrame->GetNextSibling();
5959
}
6060

61+
bool nsMathMLmrootFrame::IsMrowLike() {
62+
bool isRootWithIndex = GetContent()->IsMathMLElement(nsGkAtoms::mroot_);
63+
if (isRootWithIndex) {
64+
return false;
65+
}
66+
return mFrames.FirstChild() != mFrames.LastChild() || !mFrames.FirstChild();
67+
}
68+
69+
NS_IMETHODIMP
70+
nsMathMLmrootFrame::InheritAutomaticData(nsIFrame* aParent) {
71+
nsMathMLContainerFrame::InheritAutomaticData(aParent);
72+
73+
bool isRootWithIndex = GetContent()->IsMathMLElement(nsGkAtoms::mroot_);
74+
if (!isRootWithIndex) {
75+
mPresentationData.flags |= NS_MATHML_STRETCH_ALL_CHILDREN_VERTICALLY;
76+
}
77+
78+
return NS_OK;
79+
}
80+
6181
NS_IMETHODIMP
6282
nsMathMLmrootFrame::TransmitAutomaticData() {
6383
bool isRootWithIndex = GetContent()->IsMathMLElement(nsGkAtoms::mroot_);

layout/mathml/nsMathMLmrootFrame.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ class nsMathMLmrootFrame : public nsMathMLContainerFrame {
3131
virtual void Init(nsIContent* aContent, nsContainerFrame* aParent,
3232
nsIFrame* aPrevInFlow) override;
3333

34+
NS_IMETHOD
35+
InheritAutomaticData(nsIFrame* aParent) final;
36+
3437
NS_IMETHOD
3538
TransmitAutomaticData() override;
3639

@@ -47,15 +50,15 @@ class nsMathMLmrootFrame : public nsMathMLContainerFrame {
4750

4851
protected:
4952
explicit nsMathMLmrootFrame(ComputedStyle* aStyle,
50-
nsPresContext* aPresContext,
51-
ClassID aID = kClassID);
53+
nsPresContext* aPresContext);
5254
virtual ~nsMathMLmrootFrame();
5355

5456
nsMathMLChar mSqrChar;
5557
nsRect mBarRect;
5658

5759
private:
5860
bool ShouldUseRowFallback();
61+
bool IsMrowLike() final;
5962
nsresult Place(DrawTarget* aDrawTarget, const PlaceFlags& aFlags,
6063
ReflowOutput& aDesiredSize) final;
6164
};

layout/mathml/nsMathMLmsqrtFrame.cpp

Lines changed: 0 additions & 38 deletions
This file was deleted.

layout/mathml/nsMathMLmsqrtFrame.h

Lines changed: 0 additions & 60 deletions
This file was deleted.

0 commit comments

Comments
 (0)