зеркало из https://github.com/mozilla/gecko-dev.git
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
This commit is contained in:
Родитель
43fda17309
Коммит
139bce88f8
|
@ -4630,7 +4630,7 @@ nsCSSFrameConstructor::FindMathMLData(const Element& aElement,
|
|||
SIMPLE_MATHML_CREATE(mfenced_, NS_NewMathMLmrowFrame),
|
||||
SIMPLE_MATHML_CREATE(mmultiscripts_, NS_NewMathMLmmultiscriptsFrame),
|
||||
SIMPLE_MATHML_CREATE(mstyle_, NS_NewMathMLmrowFrame),
|
||||
SIMPLE_MATHML_CREATE(msqrt_, NS_NewMathMLmsqrtFrame),
|
||||
SIMPLE_MATHML_CREATE(msqrt_, NS_NewMathMLmrootFrame),
|
||||
SIMPLE_MATHML_CREATE(mroot_, NS_NewMathMLmrootFrame),
|
||||
SIMPLE_MATHML_CREATE(maction_, NS_NewMathMLmrowFrame),
|
||||
SIMPLE_MATHML_CREATE(mrow_, NS_NewMathMLmrowFrame),
|
||||
|
|
|
@ -88,7 +88,6 @@ FRAME_CLASSES = [
|
|||
Frame("nsMathMLmrootFrame", "None", MATHML_CONTAINER),
|
||||
Frame("nsMathMLmrowFrame", "None", MATHML_CONTAINER),
|
||||
Frame("nsMathMLmspaceFrame", "None", MATHML_CONTAINER | LEAF),
|
||||
Frame("nsMathMLmsqrtFrame", "None", MATHML_CONTAINER),
|
||||
Frame("nsMathMLmtableFrame", "Table", TABLE | MATHML),
|
||||
Frame("nsMathMLmtableWrapperFrame", "TableWrapper", BLOCK | MATHML),
|
||||
Frame("nsMathMLmtdFrame", "TableCell", TABLE_CELL | MATHML),
|
||||
|
|
|
@ -24,7 +24,6 @@ UNIFIED_SOURCES += [
|
|||
"nsMathMLmrootFrame.cpp",
|
||||
"nsMathMLmrowFrame.cpp",
|
||||
"nsMathMLmspaceFrame.cpp",
|
||||
"nsMathMLmsqrtFrame.cpp",
|
||||
"nsMathMLmtableFrame.cpp",
|
||||
"nsMathMLmunderoverFrame.cpp",
|
||||
"nsMathMLOperators.cpp",
|
||||
|
|
|
@ -52,8 +52,6 @@ nsContainerFrame* NS_NewMathMLmtdFrame(mozilla::PresShell* aPresShell,
|
|||
nsTableFrame* aTableFrame);
|
||||
nsContainerFrame* NS_NewMathMLmtdInnerFrame(mozilla::PresShell* aPresShell,
|
||||
mozilla::ComputedStyle* aStyle);
|
||||
nsIFrame* NS_NewMathMLmsqrtFrame(mozilla::PresShell* aPresShell,
|
||||
mozilla::ComputedStyle* aStyle);
|
||||
nsIFrame* NS_NewMathMLmrootFrame(mozilla::PresShell* aPresShell,
|
||||
mozilla::ComputedStyle* aStyle);
|
||||
nsIFrame* NS_NewMathMLmencloseFrame(mozilla::PresShell* aPresShell,
|
||||
|
|
|
@ -29,8 +29,8 @@ nsIFrame* NS_NewMathMLmrootFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
|
|||
NS_IMPL_FRAMEARENA_HELPERS(nsMathMLmrootFrame)
|
||||
|
||||
nsMathMLmrootFrame::nsMathMLmrootFrame(ComputedStyle* aStyle,
|
||||
nsPresContext* aPresContext, ClassID aID)
|
||||
: nsMathMLContainerFrame(aStyle, aPresContext, aID) {}
|
||||
nsPresContext* aPresContext)
|
||||
: nsMathMLContainerFrame(aStyle, aPresContext, kClassID) {}
|
||||
|
||||
nsMathMLmrootFrame::~nsMathMLmrootFrame() = default;
|
||||
|
||||
|
@ -58,6 +58,26 @@ bool nsMathMLmrootFrame::ShouldUseRowFallback() {
|
|||
return !indexFrame || indexFrame->GetNextSibling();
|
||||
}
|
||||
|
||||
bool nsMathMLmrootFrame::IsMrowLike() {
|
||||
bool isRootWithIndex = GetContent()->IsMathMLElement(nsGkAtoms::mroot_);
|
||||
if (isRootWithIndex) {
|
||||
return false;
|
||||
}
|
||||
return mFrames.FirstChild() != mFrames.LastChild() || !mFrames.FirstChild();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMathMLmrootFrame::InheritAutomaticData(nsIFrame* aParent) {
|
||||
nsMathMLContainerFrame::InheritAutomaticData(aParent);
|
||||
|
||||
bool isRootWithIndex = GetContent()->IsMathMLElement(nsGkAtoms::mroot_);
|
||||
if (!isRootWithIndex) {
|
||||
mPresentationData.flags |= NS_MATHML_STRETCH_ALL_CHILDREN_VERTICALLY;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMathMLmrootFrame::TransmitAutomaticData() {
|
||||
bool isRootWithIndex = GetContent()->IsMathMLElement(nsGkAtoms::mroot_);
|
||||
|
|
|
@ -31,6 +31,9 @@ class nsMathMLmrootFrame : public nsMathMLContainerFrame {
|
|||
virtual void Init(nsIContent* aContent, nsContainerFrame* aParent,
|
||||
nsIFrame* aPrevInFlow) override;
|
||||
|
||||
NS_IMETHOD
|
||||
InheritAutomaticData(nsIFrame* aParent) final;
|
||||
|
||||
NS_IMETHOD
|
||||
TransmitAutomaticData() override;
|
||||
|
||||
|
@ -47,8 +50,7 @@ class nsMathMLmrootFrame : public nsMathMLContainerFrame {
|
|||
|
||||
protected:
|
||||
explicit nsMathMLmrootFrame(ComputedStyle* aStyle,
|
||||
nsPresContext* aPresContext,
|
||||
ClassID aID = kClassID);
|
||||
nsPresContext* aPresContext);
|
||||
virtual ~nsMathMLmrootFrame();
|
||||
|
||||
nsMathMLChar mSqrChar;
|
||||
|
@ -56,6 +58,7 @@ class nsMathMLmrootFrame : public nsMathMLContainerFrame {
|
|||
|
||||
private:
|
||||
bool ShouldUseRowFallback();
|
||||
bool IsMrowLike() final;
|
||||
nsresult Place(DrawTarget* aDrawTarget, const PlaceFlags& aFlags,
|
||||
ReflowOutput& aDesiredSize) final;
|
||||
};
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsMathMLmsqrtFrame.h"
|
||||
|
||||
#include "mozilla/PresShell.h"
|
||||
#include "mozilla/gfx/2D.h"
|
||||
|
||||
//
|
||||
// <msqrt> -- form a radical - implementation
|
||||
//
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
nsIFrame* NS_NewMathMLmsqrtFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
|
||||
return new (aPresShell)
|
||||
nsMathMLmsqrtFrame(aStyle, aPresShell->GetPresContext());
|
||||
}
|
||||
|
||||
NS_IMPL_FRAMEARENA_HELPERS(nsMathMLmsqrtFrame)
|
||||
|
||||
nsMathMLmsqrtFrame::nsMathMLmsqrtFrame(ComputedStyle* aStyle,
|
||||
nsPresContext* aPresContext)
|
||||
: nsMathMLmrootFrame(aStyle, aPresContext, kClassID) {}
|
||||
|
||||
nsMathMLmsqrtFrame::~nsMathMLmsqrtFrame() = default;
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMathMLmsqrtFrame::InheritAutomaticData(nsIFrame* aParent) {
|
||||
nsMathMLContainerFrame::InheritAutomaticData(aParent);
|
||||
|
||||
mPresentationData.flags |= NS_MATHML_STRETCH_ALL_CHILDREN_VERTICALLY;
|
||||
|
||||
return NS_OK;
|
||||
}
|
|
@ -1,60 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef nsMathMLmsqrtFrame_h___
|
||||
#define nsMathMLmsqrtFrame_h___
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "nsMathMLmrootFrame.h"
|
||||
|
||||
namespace mozilla {
|
||||
class PresShell;
|
||||
} // namespace mozilla
|
||||
|
||||
//
|
||||
// <msqrt> -- form a radical
|
||||
//
|
||||
|
||||
/*
|
||||
The MathML REC describes:
|
||||
|
||||
The <msqrt> element is used to display square roots.
|
||||
The syntax for <msqrt> is:
|
||||
<msqrt> base </msqrt>
|
||||
|
||||
Attributes of <msqrt> and <mroot>:
|
||||
|
||||
None (except the attributes allowed for all MathML elements, listed in Section
|
||||
2.3.4).
|
||||
|
||||
The <mroot> element increments scriptlevel by 2, and sets displaystyle to
|
||||
"false", within index, but leaves both attributes unchanged within base. The
|
||||
<msqrt> element leaves both attributes unchanged within all its arguments.
|
||||
These attributes are inherited by every element from its rendering environment,
|
||||
but can be set explicitly only on <mstyle>. (See Section 3.3.4.)
|
||||
*/
|
||||
|
||||
class nsMathMLmsqrtFrame final : public nsMathMLmrootFrame {
|
||||
public:
|
||||
NS_DECL_FRAMEARENA_HELPERS(nsMathMLmsqrtFrame)
|
||||
|
||||
friend nsIFrame* NS_NewMathMLmsqrtFrame(mozilla::PresShell* aPresShell,
|
||||
ComputedStyle* aStyle);
|
||||
|
||||
NS_IMETHOD
|
||||
InheritAutomaticData(nsIFrame* aParent) override;
|
||||
|
||||
virtual bool IsMrowLike() override {
|
||||
return mFrames.FirstChild() != mFrames.LastChild() || !mFrames.FirstChild();
|
||||
}
|
||||
|
||||
protected:
|
||||
explicit nsMathMLmsqrtFrame(ComputedStyle* aStyle,
|
||||
nsPresContext* aPresContext);
|
||||
virtual ~nsMathMLmsqrtFrame();
|
||||
};
|
||||
|
||||
#endif /* nsMathMLmsqrtFrame_h___ */
|
Загрузка…
Ссылка в новой задаче