Bug 1277131 : Part 2 - rename nsMathMLmtableOuterFrame to nsMathMLmtableWrapperFrame. r=heycam

MozReview-Commit-ID: EylH72aitOj
This commit is contained in:
Astley Chen
2016-06-16 13:14:50 +01:00
parent ca13d10ee9
commit cfbe3fb84d
3 changed files with 80 additions and 67 deletions

View File

@@ -91,7 +91,7 @@ FRAME_ID(nsMathMLmspaceFrame)
FRAME_ID(nsMathMLmsqrtFrame) FRAME_ID(nsMathMLmsqrtFrame)
FRAME_ID(nsMathMLmstyleFrame) FRAME_ID(nsMathMLmstyleFrame)
FRAME_ID(nsMathMLmtableFrame) FRAME_ID(nsMathMLmtableFrame)
FRAME_ID(nsMathMLmtableOuterFrame) FRAME_ID(nsMathMLmtableWrapperFrame)
FRAME_ID(nsMathMLmtdFrame) FRAME_ID(nsMathMLmtdFrame)
FRAME_ID(nsMathMLmtdInnerFrame) FRAME_ID(nsMathMLmtdInnerFrame)
FRAME_ID(nsMathMLmtrFrame) FRAME_ID(nsMathMLmtrFrame)

View File

@@ -65,7 +65,8 @@ ParseStyleValue(nsIAtom* aAttribute, const nsAString& aAttributeValue)
} }
static nsTArray<int8_t>* static nsTArray<int8_t>*
ExtractStyleValues(const nsAString& aString, nsIAtom* aAttribute, ExtractStyleValues(const nsAString& aString,
nsIAtom* aAttribute,
bool aAllowMultiValues) bool aAllowMultiValues)
{ {
nsTArray<int8_t>* styleArray = nullptr; nsTArray<int8_t>* styleArray = nullptr;
@@ -112,8 +113,10 @@ ExtractStyleValues(const nsAString& aString, nsIAtom* aAttribute,
return styleArray; return styleArray;
} }
static nsresult ReportParseError(nsIFrame* aFrame, const char16_t* aAttribute, static nsresult
const char16_t* aValue) ReportParseError(nsIFrame* aFrame,
const char16_t* aAttribute,
const char16_t* aValue)
{ {
nsIContent* content = aFrame->GetContent(); nsIContent* content = aFrame->GetContent();
@@ -152,7 +155,7 @@ AttributeToProperty(nsIAtom* aAttribute)
/* This method looks for a property that applies to a cell, but it looks /* This method looks for a property that applies to a cell, but it looks
* recursively because some cell properties can come from the cell, a row, * recursively because some cell properties can come from the cell, a row,
* a table, etc. This function searches through the heirarchy for a property * a table, etc. This function searches through the hierarchy for a property
* and returns its value. The function stops searching after checking a <mtable> * and returns its value. The function stops searching after checking a <mtable>
* frame. * frame.
*/ */
@@ -227,7 +230,8 @@ ApplyBorderToStyle(const nsMathMLmtdFrame* aFrame,
} }
static nsMargin static nsMargin
ComputeBorderOverflow(nsMathMLmtdFrame* aFrame, const nsStyleBorder& aStyleBorder) ComputeBorderOverflow(nsMathMLmtdFrame* aFrame,
const nsStyleBorder& aStyleBorder)
{ {
nsMargin overflow; nsMargin overflow;
int32_t rowIndex; int32_t rowIndex;
@@ -262,7 +266,8 @@ ComputeBorderOverflow(nsMathMLmtdFrame* aFrame, const nsStyleBorder& aStyleBorde
* around a nsMathMLmtdFrame based on the rowline and columnline properties * around a nsMathMLmtdFrame based on the rowline and columnline properties
* set on the cell frame. * set on the cell frame.
*/ */
class nsDisplaymtdBorder : public nsDisplayBorder { class nsDisplaymtdBorder : public nsDisplayBorder
{
public: public:
nsDisplaymtdBorder(nsDisplayListBuilder* aBuilder, nsMathMLmtdFrame* aFrame) nsDisplaymtdBorder(nsDisplayListBuilder* aBuilder, nsMathMLmtdFrame* aFrame)
: nsDisplayBorder(aBuilder, aFrame) : nsDisplayBorder(aBuilder, aFrame)
@@ -337,7 +342,8 @@ public:
#endif #endif
static void static void
ParseFrameAttribute(nsIFrame* aFrame, nsIAtom* aAttribute, ParseFrameAttribute(nsIFrame* aFrame,
nsIAtom* aAttribute,
bool aAllowMultiValues) bool aAllowMultiValues)
{ {
nsAutoString attrValue; nsAutoString attrValue;
@@ -560,7 +566,7 @@ static void ParseSpacingAttributes(nsMathMLmtableFrame* aTableFrame)
aTableFrame->SetUseCSSSpacing(); aTableFrame->SetUseCSSSpacing();
} }
// map all attribues within a table -- requires the indices of rows and cells. // map all attributes within a table -- requires the indices of rows and cells.
// so it can only happen after they are made ready by the table base class. // so it can only happen after they are made ready by the table base class.
static void static void
MapAllAttributesIntoCSS(nsMathMLmtableFrame* aTableFrame) MapAllAttributesIntoCSS(nsMathMLmtableFrame* aTableFrame)
@@ -681,28 +687,28 @@ ListMathMLTree(nsIFrame* atLeast)
#endif #endif
// -------- // --------
// implementation of nsMathMLmtableOuterFrame // implementation of nsMathMLmtableWrapperFrame
NS_QUERYFRAME_HEAD(nsMathMLmtableOuterFrame) NS_QUERYFRAME_HEAD(nsMathMLmtableWrapperFrame)
NS_QUERYFRAME_ENTRY(nsIMathMLFrame) NS_QUERYFRAME_ENTRY(nsIMathMLFrame)
NS_QUERYFRAME_TAIL_INHERITING(nsTableWrapperFrame) NS_QUERYFRAME_TAIL_INHERITING(nsTableWrapperFrame)
nsContainerFrame* nsContainerFrame*
NS_NewMathMLmtableOuterFrame (nsIPresShell* aPresShell, nsStyleContext* aContext) NS_NewMathMLmtableOuterFrame (nsIPresShell* aPresShell, nsStyleContext* aContext)
{ {
return new (aPresShell) nsMathMLmtableOuterFrame(aContext); return new (aPresShell) nsMathMLmtableWrapperFrame(aContext);
} }
NS_IMPL_FRAMEARENA_HELPERS(nsMathMLmtableOuterFrame) NS_IMPL_FRAMEARENA_HELPERS(nsMathMLmtableWrapperFrame)
nsMathMLmtableOuterFrame::~nsMathMLmtableOuterFrame() nsMathMLmtableWrapperFrame::~nsMathMLmtableWrapperFrame()
{ {
} }
nsresult nsresult
nsMathMLmtableOuterFrame::AttributeChanged(int32_t aNameSpaceID, nsMathMLmtableWrapperFrame::AttributeChanged(int32_t aNameSpaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
int32_t aModType) int32_t aModType)
{ {
// Attributes specific to <mtable>: // Attributes specific to <mtable>:
// frame : in mathml.css // frame : in mathml.css
@@ -779,7 +785,7 @@ nsMathMLmtableOuterFrame::AttributeChanged(int32_t aNameSpaceID,
} }
nsIFrame* nsIFrame*
nsMathMLmtableOuterFrame::GetRowFrameAt(int32_t aRowIndex) nsMathMLmtableWrapperFrame::GetRowFrameAt(int32_t aRowIndex)
{ {
int32_t rowCount = GetRowCount(); int32_t rowCount = GetRowCount();
@@ -814,10 +820,10 @@ nsMathMLmtableOuterFrame::GetRowFrameAt(int32_t aRowIndex)
} }
void void
nsMathMLmtableOuterFrame::Reflow(nsPresContext* aPresContext, nsMathMLmtableWrapperFrame::Reflow(nsPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize, nsHTMLReflowMetrics& aDesiredSize,
const nsHTMLReflowState& aReflowState, const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus) nsReflowStatus& aStatus)
{ {
nsAutoString value; nsAutoString value;
// we want to return a table that is anchored according to the align attribute // we want to return a table that is anchored according to the align attribute
@@ -971,7 +977,7 @@ nsMathMLmtableFrame::GetColSpacing(int32_t aColIndex)
nscoord nscoord
nsMathMLmtableFrame::GetColSpacing(int32_t aStartColIndex, nsMathMLmtableFrame::GetColSpacing(int32_t aStartColIndex,
int32_t aEndColIndex) int32_t aEndColIndex)
{ {
if (mUseCSSSpacing) { if (mUseCSSSpacing) {
return nsTableFrame::GetColSpacing(aStartColIndex, aEndColIndex); return nsTableFrame::GetColSpacing(aStartColIndex, aEndColIndex);
@@ -1031,7 +1037,7 @@ nsMathMLmtableFrame::GetRowSpacing(int32_t aRowIndex)
nscoord nscoord
nsMathMLmtableFrame::GetRowSpacing(int32_t aStartRowIndex, nsMathMLmtableFrame::GetRowSpacing(int32_t aStartRowIndex,
int32_t aEndRowIndex) int32_t aEndRowIndex)
{ {
if (mUseCSSSpacing) { if (mUseCSSSpacing) {
return nsTableFrame::GetRowSpacing(aStartRowIndex, aEndRowIndex); return nsTableFrame::GetRowSpacing(aStartRowIndex, aEndRowIndex);
@@ -1131,8 +1137,9 @@ nsMathMLmtrFrame::AttributeChanged(int32_t aNameSpaceID,
// implementation of nsMathMLmtdFrame // implementation of nsMathMLmtdFrame
nsContainerFrame* nsContainerFrame*
NS_NewMathMLmtdFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, NS_NewMathMLmtdFrame(nsIPresShell* aPresShell,
nsTableFrame* aTableFrame) nsStyleContext* aContext,
nsTableFrame* aTableFrame)
{ {
return new (aPresShell) nsMathMLmtdFrame(aContext, aTableFrame); return new (aPresShell) nsMathMLmtdFrame(aContext, aTableFrame);
} }
@@ -1298,7 +1305,7 @@ NS_IMPL_FRAMEARENA_HELPERS(nsMathMLmtdInnerFrame)
nsMathMLmtdInnerFrame::nsMathMLmtdInnerFrame(nsStyleContext* aContext) nsMathMLmtdInnerFrame::nsMathMLmtdInnerFrame(nsStyleContext* aContext)
: nsBlockFrame(aContext) : nsBlockFrame(aContext)
{ {
// Make a copy of the parent nsStyleText for later modificaiton. // Make a copy of the parent nsStyleText for later modification.
mUniqueStyleText = new (PresContext()) nsStyleText(*StyleText()); mUniqueStyleText = new (PresContext()) nsStyleText(*StyleText());
} }
@@ -1308,7 +1315,7 @@ nsMathMLmtdInnerFrame::~nsMathMLmtdInnerFrame()
} }
void void
nsMathMLmtdInnerFrame::Reflow(nsPresContext* aPresContext, nsMathMLmtdInnerFrame::Reflow(nsPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize, nsHTMLReflowMetrics& aDesiredSize,
const nsHTMLReflowState& aReflowState, const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus) nsReflowStatus& aStatus)

View File

@@ -17,12 +17,13 @@
// <mtable> -- table or matrix // <mtable> -- table or matrix
// //
class nsMathMLmtableOuterFrame : public nsTableWrapperFrame, class nsMathMLmtableWrapperFrame : public nsTableWrapperFrame,
public nsMathMLFrame public nsMathMLFrame
{ {
public: public:
friend nsContainerFrame* NS_NewMathMLmtableOuterFrame(nsIPresShell* aPresShell, friend nsContainerFrame*
nsStyleContext* aContext); NS_NewMathMLmtableOuterFrame(nsIPresShell* aPresShell,
nsStyleContext* aContext);
NS_DECL_QUERYFRAME NS_DECL_QUERYFRAME
NS_DECL_FRAMEARENA_HELPERS NS_DECL_FRAMEARENA_HELPERS
@@ -30,7 +31,7 @@ public:
// overloaded nsTableWrapperFrame methods // overloaded nsTableWrapperFrame methods
virtual void virtual void
Reflow(nsPresContext* aPresContext, Reflow(nsPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize, nsHTMLReflowMetrics& aDesiredSize,
const nsHTMLReflowState& aReflowState, const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus) override; nsReflowStatus& aStatus) override;
@@ -46,15 +47,16 @@ public:
} }
protected: protected:
explicit nsMathMLmtableOuterFrame(nsStyleContext* aContext) : nsTableWrapperFrame(aContext) {} explicit nsMathMLmtableWrapperFrame(nsStyleContext* aContext)
virtual ~nsMathMLmtableOuterFrame(); : nsTableWrapperFrame(aContext) {}
virtual ~nsMathMLmtableWrapperFrame();
// helper to find the row frame at a given index, positive or negative, e.g., // helper to find the row frame at a given index, positive or negative, e.g.,
// 1..n means the first row down to the last row, -1..-n means the last row // 1..n means the first row down to the last row, -1..-n means the last row
// up to the first row. Used for alignments that are relative to a given row // up to the first row. Used for alignments that are relative to a given row
nsIFrame* nsIFrame*
GetRowFrameAt(int32_t aRowIndex); GetRowFrameAt(int32_t aRowIndex);
}; // class nsMathMLmtableOuterFrame }; // class nsMathMLmtableWrapperFrame
// -------------- // --------------
@@ -65,8 +67,9 @@ public:
NS_DECL_QUERYFRAME NS_DECL_QUERYFRAME
NS_DECL_FRAMEARENA_HELPERS NS_DECL_FRAMEARENA_HELPERS
friend nsContainerFrame* NS_NewMathMLmtableFrame(nsIPresShell* aPresShell, friend nsContainerFrame*
nsStyleContext* aContext); NS_NewMathMLmtableFrame(nsIPresShell* aPresShell,
nsStyleContext* aContext);
// Overloaded nsTableFrame methods // Overloaded nsTableFrame methods
@@ -92,8 +95,7 @@ public:
} }
virtual void virtual void
RemoveFrame(ChildListID aListID, RemoveFrame(ChildListID aListID, nsIFrame* aOldFrame) override
nsIFrame* aOldFrame) override
{ {
nsTableFrame::RemoveFrame(aListID, aOldFrame); nsTableFrame::RemoveFrame(aListID, aOldFrame);
RestyleTable(); RestyleTable();
@@ -149,14 +151,11 @@ public:
* approach is used if the user specifies at least one of those attributes. * approach is used if the user specifies at least one of those attributes.
*/ */
void SetUseCSSSpacing(); void SetUseCSSSpacing();
bool GetUseCSSSpacing() { return mUseCSSSpacing; }
bool GetUseCSSSpacing()
{
return mUseCSSSpacing;
}
protected: protected:
explicit nsMathMLmtableFrame(nsStyleContext* aContext) : nsTableFrame(aContext) {} explicit nsMathMLmtableFrame(nsStyleContext* aContext)
: nsTableFrame(aContext) {}
virtual ~nsMathMLmtableFrame(); virtual ~nsMathMLmtableFrame();
private: private:
@@ -174,8 +173,9 @@ class nsMathMLmtrFrame : public nsTableRowFrame
public: public:
NS_DECL_FRAMEARENA_HELPERS NS_DECL_FRAMEARENA_HELPERS
friend nsContainerFrame* NS_NewMathMLmtrFrame(nsIPresShell* aPresShell, friend nsContainerFrame*
nsStyleContext* aContext); NS_NewMathMLmtrFrame(nsIPresShell* aPresShell,
nsStyleContext* aContext);
// overloaded nsTableRowFrame methods // overloaded nsTableRowFrame methods
@@ -193,8 +193,8 @@ public:
} }
virtual void virtual void
InsertFrames(ChildListID aListID, InsertFrames(ChildListID aListID,
nsIFrame* aPrevFrame, nsIFrame* aPrevFrame,
nsFrameList& aFrameList) override nsFrameList& aFrameList) override
{ {
nsTableRowFrame::InsertFrames(aListID, aPrevFrame, aFrameList); nsTableRowFrame::InsertFrames(aListID, aPrevFrame, aFrameList);
@@ -202,8 +202,7 @@ public:
} }
virtual void virtual void
RemoveFrame(ChildListID aListID, RemoveFrame(ChildListID aListID, nsIFrame* aOldFrame) override
nsIFrame* aOldFrame) override
{ {
nsTableRowFrame::RemoveFrame(aListID, aOldFrame); nsTableRowFrame::RemoveFrame(aListID, aOldFrame);
RestyleTable(); RestyleTable();
@@ -225,7 +224,8 @@ public:
} }
protected: protected:
explicit nsMathMLmtrFrame(nsStyleContext* aContext) : nsTableRowFrame(aContext) {} explicit nsMathMLmtrFrame(nsStyleContext* aContext)
: nsTableRowFrame(aContext) {}
virtual ~nsMathMLmtrFrame(); virtual ~nsMathMLmtrFrame();
}; // class nsMathMLmtrFrame }; // class nsMathMLmtrFrame
@@ -236,9 +236,10 @@ class nsMathMLmtdFrame : public nsTableCellFrame
public: public:
NS_DECL_FRAMEARENA_HELPERS NS_DECL_FRAMEARENA_HELPERS
friend nsContainerFrame* NS_NewMathMLmtdFrame(nsIPresShell* aPresShell, friend nsContainerFrame*
nsStyleContext* aContext, NS_NewMathMLmtdFrame(nsIPresShell* aPresShell,
nsTableFrame* aTableFrame); nsStyleContext* aContext,
nsTableFrame* aTableFrame);
// overloaded nsTableCellFrame methods // overloaded nsTableCellFrame methods
@@ -252,8 +253,8 @@ public:
int32_t aModType) override; int32_t aModType) override;
virtual uint8_t GetVerticalAlign() const override; virtual uint8_t GetVerticalAlign() const override;
virtual nsresult ProcessBorders(nsTableFrame* aFrame, virtual nsresult ProcessBorders(nsTableFrame* aFrame,
nsDisplayListBuilder* aBuilder, nsDisplayListBuilder* aBuilder,
const nsDisplayListSet& aLists) override; const nsDisplayListSet& aLists) override;
virtual int32_t GetRowSpan() override; virtual int32_t GetRowSpan() override;
@@ -276,9 +277,12 @@ protected:
// -------------- // --------------
class nsMathMLmtdInnerFrame : public nsBlockFrame, class nsMathMLmtdInnerFrame : public nsBlockFrame,
public nsMathMLFrame { public nsMathMLFrame
{
public: public:
friend nsContainerFrame* NS_NewMathMLmtdInnerFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); friend nsContainerFrame*
NS_NewMathMLmtdInnerFrame(nsIPresShell* aPresShell,
nsStyleContext* aContext);
NS_DECL_QUERYFRAME NS_DECL_QUERYFRAME
NS_DECL_FRAMEARENA_HELPERS NS_DECL_FRAMEARENA_HELPERS
@@ -286,10 +290,10 @@ public:
// Overloaded nsIMathMLFrame methods // Overloaded nsIMathMLFrame methods
NS_IMETHOD NS_IMETHOD
UpdatePresentationDataFromChildAt(int32_t aFirstIndex, UpdatePresentationDataFromChildAt(int32_t aFirstIndex,
int32_t aLastIndex, int32_t aLastIndex,
uint32_t aFlagsValues, uint32_t aFlagsValues,
uint32_t aFlagsToUpdate) override uint32_t aFlagsToUpdate) override
{ {
nsMathMLContainerFrame::PropagatePresentationDataFromChildAt(this, nsMathMLContainerFrame::PropagatePresentationDataFromChildAt(this,
aFirstIndex, aLastIndex, aFlagsValues, aFlagsToUpdate); aFirstIndex, aLastIndex, aFlagsValues, aFlagsToUpdate);
@@ -297,7 +301,7 @@ public:
} }
virtual void virtual void
Reflow(nsPresContext* aPresContext, Reflow(nsPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize, nsHTMLReflowMetrics& aDesiredSize,
const nsHTMLReflowState& aReflowState, const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus) override; nsReflowStatus& aStatus) override;
@@ -312,8 +316,10 @@ public:
virtual void DidSetStyleContext(nsStyleContext* aOldStyleContext) override; virtual void DidSetStyleContext(nsStyleContext* aOldStyleContext) override;
bool bool
IsMrowLike() override { IsMrowLike() override
return mFrames.FirstChild() != mFrames.LastChild() || {
return mFrames.FirstChild() !=
mFrames.LastChild() ||
!mFrames.FirstChild(); !mFrames.FirstChild();
} }