2017-10-27 20:33:53 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* 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/. */
|
2000-03-28 14:15:19 +04:00
|
|
|
|
|
|
|
#ifndef nsMathMLmtableFrame_h___
|
|
|
|
#define nsMathMLmtableFrame_h___
|
|
|
|
|
2012-09-14 20:10:08 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2018-03-28 19:45:18 +03:00
|
|
|
#include "mozilla/UniquePtr.h"
|
2000-03-28 14:15:19 +04:00
|
|
|
#include "nsMathMLContainerFrame.h"
|
2013-08-31 01:37:12 +04:00
|
|
|
#include "nsBlockFrame.h"
|
2016-06-16 15:14:08 +03:00
|
|
|
#include "nsTableWrapperFrame.h"
|
2013-08-31 01:37:12 +04:00
|
|
|
#include "nsTableRowFrame.h"
|
|
|
|
#include "nsTableCellFrame.h"
|
2000-03-28 14:15:19 +04:00
|
|
|
|
2019-04-16 10:24:49 +03:00
|
|
|
namespace mozilla {
|
|
|
|
class PresShell;
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2000-03-28 14:15:19 +04:00
|
|
|
//
|
|
|
|
// <mtable> -- table or matrix
|
|
|
|
//
|
|
|
|
|
2017-04-30 18:30:08 +03:00
|
|
|
class nsMathMLmtableWrapperFrame final : public nsTableWrapperFrame,
|
|
|
|
public nsMathMLFrame {
|
2000-03-28 14:15:19 +04:00
|
|
|
public:
|
2016-06-16 15:14:50 +03:00
|
|
|
friend nsContainerFrame* NS_NewMathMLmtableOuterFrame(
|
2019-04-16 10:24:49 +03:00
|
|
|
mozilla::PresShell* aPresShell, ComputedStyle* aStyle);
|
2000-03-28 14:15:19 +04:00
|
|
|
|
2009-01-12 22:20:59 +03:00
|
|
|
NS_DECL_QUERYFRAME
|
2017-05-26 13:11:11 +03:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS(nsMathMLmtableWrapperFrame)
|
2000-03-28 14:15:19 +04:00
|
|
|
|
2016-06-16 15:14:08 +03:00
|
|
|
// overloaded nsTableWrapperFrame methods
|
2000-05-12 03:03:19 +04:00
|
|
|
|
2016-06-16 15:14:50 +03:00
|
|
|
virtual void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
|
2016-07-21 13:36:39 +03:00
|
|
|
const ReflowInput& aReflowInput,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsReflowStatus& aStatus) override;
|
2000-03-28 14:15:19 +04:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
virtual nsresult AttributeChanged(int32_t aNameSpaceID, nsAtom* aAttribute,
|
2015-03-21 19:28:04 +03:00
|
|
|
int32_t aModType) override;
|
2006-09-19 08:43:14 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool IsFrameOfType(uint32_t aFlags) const override {
|
2016-06-16 15:14:08 +03:00
|
|
|
return nsTableWrapperFrame::IsFrameOfType(aFlags & ~(nsIFrame::eMathML));
|
2007-02-24 21:33:33 +03:00
|
|
|
}
|
2006-01-26 00:16:12 +03:00
|
|
|
|
2000-03-28 14:15:19 +04:00
|
|
|
protected:
|
2019-02-05 19:45:54 +03:00
|
|
|
explicit nsMathMLmtableWrapperFrame(ComputedStyle* aStyle,
|
|
|
|
nsPresContext* aPresContext)
|
|
|
|
: nsTableWrapperFrame(aStyle, aPresContext, kClassID) {}
|
2017-04-30 18:30:08 +03:00
|
|
|
|
2016-06-16 15:14:50 +03:00
|
|
|
virtual ~nsMathMLmtableWrapperFrame();
|
2002-01-25 10:03:43 +03:00
|
|
|
|
|
|
|
// 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
|
|
|
|
// up to the first row. Used for alignments that are relative to a given row
|
2015-12-07 04:15:53 +03:00
|
|
|
nsIFrame* GetRowFrameAt(int32_t aRowIndex);
|
2016-06-16 15:14:50 +03:00
|
|
|
}; // class nsMathMLmtableWrapperFrame
|
2000-03-28 14:15:19 +04:00
|
|
|
|
2002-01-25 10:03:43 +03:00
|
|
|
// --------------
|
|
|
|
|
2017-04-30 18:30:08 +03:00
|
|
|
class nsMathMLmtableFrame final : public nsTableFrame {
|
2006-09-07 07:45:45 +04:00
|
|
|
public:
|
2014-06-18 14:57:00 +04:00
|
|
|
NS_DECL_QUERYFRAME
|
2017-05-26 13:11:11 +03:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS(nsMathMLmtableFrame)
|
2009-09-12 20:49:24 +04:00
|
|
|
|
2019-04-16 10:24:49 +03:00
|
|
|
friend nsContainerFrame* NS_NewMathMLmtableFrame(
|
|
|
|
mozilla::PresShell* aPresShell, ComputedStyle* aStyle);
|
2006-09-07 07:45:45 +04:00
|
|
|
|
|
|
|
// Overloaded nsTableFrame methods
|
|
|
|
|
2011-08-25 00:54:30 +04:00
|
|
|
virtual void SetInitialChildList(ChildListID aListID,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsFrameList& aChildList) override;
|
2006-09-07 07:45:45 +04:00
|
|
|
|
2011-08-25 00:54:30 +04:00
|
|
|
virtual void AppendFrames(ChildListID aListID,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsFrameList& aFrameList) override {
|
2014-05-28 23:36:58 +04:00
|
|
|
nsTableFrame::AppendFrames(aListID, aFrameList);
|
2006-09-07 07:45:45 +04:00
|
|
|
RestyleTable();
|
|
|
|
}
|
|
|
|
|
2011-08-25 00:54:30 +04:00
|
|
|
virtual void InsertFrames(ChildListID aListID, nsIFrame* aPrevFrame,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsFrameList& aFrameList) override {
|
2014-05-28 23:36:58 +04:00
|
|
|
nsTableFrame::InsertFrames(aListID, aPrevFrame, aFrameList);
|
2006-09-07 07:45:45 +04:00
|
|
|
RestyleTable();
|
|
|
|
}
|
|
|
|
|
2016-06-16 15:14:50 +03:00
|
|
|
virtual void RemoveFrame(ChildListID aListID, nsIFrame* aOldFrame) override {
|
2014-05-28 23:36:58 +04:00
|
|
|
nsTableFrame::RemoveFrame(aListID, aOldFrame);
|
2006-09-07 07:45:45 +04:00
|
|
|
RestyleTable();
|
|
|
|
}
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool IsFrameOfType(uint32_t aFlags) const override {
|
2009-04-08 20:56:16 +04:00
|
|
|
return nsTableFrame::IsFrameOfType(aFlags & ~(nsIFrame::eMathML));
|
2007-02-24 21:33:33 +03:00
|
|
|
}
|
2006-09-07 07:45:45 +04:00
|
|
|
|
|
|
|
// helper to restyle and reflow the table when a row is changed -- since
|
|
|
|
// MathML attributes are inter-dependent and row/colspan can affect the table,
|
|
|
|
// it is safer (albeit grossly suboptimal) to just relayout the whole thing.
|
|
|
|
void RestyleTable();
|
|
|
|
|
2015-03-20 07:16:00 +03:00
|
|
|
/** helper to get the column spacing style value */
|
2015-03-21 19:28:04 +03:00
|
|
|
nscoord GetColSpacing(int32_t aColIndex) override;
|
2014-06-18 14:57:00 +04:00
|
|
|
|
|
|
|
/** Sums the combined cell spacing between the columns aStartColIndex to
|
|
|
|
* aEndColIndex.
|
|
|
|
*/
|
2015-03-20 07:16:00 +03:00
|
|
|
nscoord GetColSpacing(int32_t aStartColIndex, int32_t aEndColIndex) override;
|
2014-06-18 14:57:00 +04:00
|
|
|
|
2015-03-20 07:16:00 +03:00
|
|
|
/** helper to get the row spacing style value */
|
2015-03-21 19:28:04 +03:00
|
|
|
nscoord GetRowSpacing(int32_t aRowIndex) override;
|
2014-06-18 14:57:00 +04:00
|
|
|
|
|
|
|
/** Sums the combined cell spacing between the rows aStartRowIndex to
|
|
|
|
* aEndRowIndex.
|
|
|
|
*/
|
2015-03-20 07:16:00 +03:00
|
|
|
nscoord GetRowSpacing(int32_t aStartRowIndex, int32_t aEndRowIndex) override;
|
2014-06-18 14:57:00 +04:00
|
|
|
|
|
|
|
void SetColSpacingArray(const nsTArray<nscoord>& aColSpacing) {
|
|
|
|
mColSpacing = aColSpacing;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetRowSpacingArray(const nsTArray<nscoord>& aRowSpacing) {
|
|
|
|
mRowSpacing = aRowSpacing;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetFrameSpacing(nscoord aSpacingX, nscoord aSpacingY) {
|
|
|
|
mFrameSpacingX = aSpacingX;
|
|
|
|
mFrameSpacingY = aSpacingY;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Determines whether the placement of table cells is determined by CSS
|
|
|
|
* spacing based on padding and border-spacing, or one based upon the
|
|
|
|
* rowspacing, columnspacing and framespacing attributes. The second
|
|
|
|
* approach is used if the user specifies at least one of those attributes.
|
|
|
|
*/
|
|
|
|
void SetUseCSSSpacing();
|
2016-06-16 15:14:50 +03:00
|
|
|
bool GetUseCSSSpacing() { return mUseCSSSpacing; }
|
2014-06-18 14:57:00 +04:00
|
|
|
|
2006-09-07 07:45:45 +04:00
|
|
|
protected:
|
2019-02-05 19:45:54 +03:00
|
|
|
explicit nsMathMLmtableFrame(ComputedStyle* aStyle,
|
|
|
|
nsPresContext* aPresContext)
|
|
|
|
: nsTableFrame(aStyle, aPresContext, kClassID),
|
2017-05-06 06:46:00 +03:00
|
|
|
mFrameSpacingX(0),
|
|
|
|
mFrameSpacingY(0),
|
|
|
|
mUseCSSSpacing(false) {}
|
2017-04-30 18:30:08 +03:00
|
|
|
|
2006-09-07 07:45:45 +04:00
|
|
|
virtual ~nsMathMLmtableFrame();
|
2014-06-18 14:57:00 +04:00
|
|
|
|
|
|
|
private:
|
|
|
|
nsTArray<nscoord> mColSpacing;
|
|
|
|
nsTArray<nscoord> mRowSpacing;
|
|
|
|
nscoord mFrameSpacingX;
|
|
|
|
nscoord mFrameSpacingY;
|
|
|
|
bool mUseCSSSpacing;
|
2006-09-07 07:45:45 +04:00
|
|
|
}; // class nsMathMLmtableFrame
|
|
|
|
|
|
|
|
// --------------
|
|
|
|
|
2017-04-30 18:30:08 +03:00
|
|
|
class nsMathMLmtrFrame final : public nsTableRowFrame {
|
2006-09-07 07:45:45 +04:00
|
|
|
public:
|
2017-05-26 13:11:11 +03:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS(nsMathMLmtrFrame)
|
2009-09-12 20:49:24 +04:00
|
|
|
|
2019-04-16 10:24:49 +03:00
|
|
|
friend nsContainerFrame* NS_NewMathMLmtrFrame(mozilla::PresShell* aPresShell,
|
2018-03-22 21:20:41 +03:00
|
|
|
ComputedStyle* aStyle);
|
2006-09-07 07:45:45 +04:00
|
|
|
|
|
|
|
// overloaded nsTableRowFrame methods
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
virtual nsresult AttributeChanged(int32_t aNameSpaceID, nsAtom* aAttribute,
|
2015-03-21 19:28:04 +03:00
|
|
|
int32_t aModType) override;
|
2006-09-07 07:45:45 +04:00
|
|
|
|
2011-08-25 00:54:30 +04:00
|
|
|
virtual void AppendFrames(ChildListID aListID,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsFrameList& aFrameList) override {
|
2014-05-28 23:36:58 +04:00
|
|
|
nsTableRowFrame::AppendFrames(aListID, aFrameList);
|
2006-09-07 07:45:45 +04:00
|
|
|
RestyleTable();
|
|
|
|
}
|
|
|
|
|
2016-06-16 15:14:50 +03:00
|
|
|
virtual void InsertFrames(ChildListID aListID, nsIFrame* aPrevFrame,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsFrameList& aFrameList) override {
|
2014-05-28 23:36:58 +04:00
|
|
|
nsTableRowFrame::InsertFrames(aListID, aPrevFrame, aFrameList);
|
2006-09-07 07:45:45 +04:00
|
|
|
RestyleTable();
|
|
|
|
}
|
|
|
|
|
2016-06-16 15:14:50 +03:00
|
|
|
virtual void RemoveFrame(ChildListID aListID, nsIFrame* aOldFrame) override {
|
2014-05-28 23:36:58 +04:00
|
|
|
nsTableRowFrame::RemoveFrame(aListID, aOldFrame);
|
2006-09-07 07:45:45 +04:00
|
|
|
RestyleTable();
|
|
|
|
}
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool IsFrameOfType(uint32_t aFlags) const override {
|
2009-04-08 20:56:16 +04:00
|
|
|
return nsTableRowFrame::IsFrameOfType(aFlags & ~(nsIFrame::eMathML));
|
2007-02-24 21:33:33 +03:00
|
|
|
}
|
2006-09-07 07:45:45 +04:00
|
|
|
|
|
|
|
// helper to restyle and reflow the table -- @see nsMathMLmtableFrame.
|
|
|
|
void RestyleTable() {
|
2015-04-30 07:24:59 +03:00
|
|
|
nsTableFrame* tableFrame = GetTableFrame();
|
2006-09-07 07:45:45 +04:00
|
|
|
if (tableFrame && tableFrame->IsFrameOfType(nsIFrame::eMathML)) {
|
|
|
|
// relayout the table
|
|
|
|
((nsMathMLmtableFrame*)tableFrame)->RestyleTable();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
2019-02-05 19:45:54 +03:00
|
|
|
explicit nsMathMLmtrFrame(ComputedStyle* aStyle, nsPresContext* aPresContext)
|
|
|
|
: nsTableRowFrame(aStyle, aPresContext, kClassID) {}
|
2017-04-30 18:30:08 +03:00
|
|
|
|
2006-09-07 07:45:45 +04:00
|
|
|
virtual ~nsMathMLmtrFrame();
|
|
|
|
}; // class nsMathMLmtrFrame
|
|
|
|
|
|
|
|
// --------------
|
|
|
|
|
2018-09-06 04:23:14 +03:00
|
|
|
class nsMathMLmtdFrame final : public nsTableCellFrame {
|
2002-01-25 10:03:43 +03:00
|
|
|
public:
|
2017-05-26 13:11:11 +03:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS(nsMathMLmtdFrame)
|
2009-09-12 20:49:24 +04:00
|
|
|
|
2019-04-16 10:24:49 +03:00
|
|
|
friend nsContainerFrame* NS_NewMathMLmtdFrame(mozilla::PresShell* aPresShell,
|
2018-03-22 21:20:41 +03:00
|
|
|
ComputedStyle* aStyle,
|
2016-06-16 15:14:50 +03:00
|
|
|
nsTableFrame* aTableFrame);
|
2002-01-25 10:03:43 +03:00
|
|
|
|
|
|
|
// overloaded nsTableCellFrame methods
|
2006-09-07 07:45:45 +04:00
|
|
|
|
2014-11-06 16:01:00 +03:00
|
|
|
virtual void Init(nsIContent* aContent, nsContainerFrame* aParent,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsIFrame* aPrevInFlow) override;
|
2014-11-06 16:01:00 +03:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
virtual nsresult AttributeChanged(int32_t aNameSpaceID, nsAtom* aAttribute,
|
2015-03-21 19:28:04 +03:00
|
|
|
int32_t aModType) override;
|
2006-09-07 07:45:45 +04:00
|
|
|
|
2019-05-01 16:08:34 +03:00
|
|
|
virtual mozilla::StyleVerticalAlignKeyword GetVerticalAlign() const override;
|
2016-06-16 15:14:50 +03:00
|
|
|
virtual nsresult ProcessBorders(nsTableFrame* aFrame,
|
|
|
|
nsDisplayListBuilder* aBuilder,
|
2015-03-21 19:28:04 +03:00
|
|
|
const nsDisplayListSet& aLists) override;
|
2013-12-13 21:42:43 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool IsFrameOfType(uint32_t aFlags) const override {
|
2009-04-08 20:56:16 +04:00
|
|
|
return nsTableCellFrame::IsFrameOfType(aFlags & ~(nsIFrame::eMathML));
|
2007-02-24 21:33:33 +03:00
|
|
|
}
|
2002-01-25 10:03:43 +03:00
|
|
|
|
2015-05-04 10:09:25 +03:00
|
|
|
virtual LogicalMargin GetBorderWidth(WritingMode aWM) const override;
|
2014-03-03 19:37:08 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsMargin GetBorderOverflow() override;
|
2014-06-18 14:57:00 +04:00
|
|
|
|
2002-01-25 10:03:43 +03:00
|
|
|
protected:
|
2018-03-22 21:20:41 +03:00
|
|
|
nsMathMLmtdFrame(ComputedStyle* aStyle, nsTableFrame* aTableFrame)
|
|
|
|
: nsTableCellFrame(aStyle, aTableFrame, kClassID) {}
|
2017-04-30 18:30:08 +03:00
|
|
|
|
2002-01-25 10:03:43 +03:00
|
|
|
virtual ~nsMathMLmtdFrame();
|
|
|
|
}; // class nsMathMLmtdFrame
|
2000-03-28 14:15:19 +04:00
|
|
|
|
|
|
|
// --------------
|
|
|
|
|
2017-04-30 18:30:08 +03:00
|
|
|
class nsMathMLmtdInnerFrame final : public nsBlockFrame, public nsMathMLFrame {
|
2000-03-28 14:15:19 +04:00
|
|
|
public:
|
2019-04-16 10:24:49 +03:00
|
|
|
friend nsContainerFrame* NS_NewMathMLmtdInnerFrame(
|
|
|
|
mozilla::PresShell* aPresShell, ComputedStyle* aStyle);
|
2000-03-28 14:15:19 +04:00
|
|
|
|
2009-01-12 22:20:59 +03:00
|
|
|
NS_DECL_QUERYFRAME
|
2017-05-26 13:11:11 +03:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS(nsMathMLmtdInnerFrame)
|
2001-02-23 19:10:51 +03:00
|
|
|
|
2002-01-09 21:51:30 +03:00
|
|
|
// Overloaded nsIMathMLFrame methods
|
|
|
|
|
|
|
|
NS_IMETHOD
|
2016-06-16 15:14:50 +03:00
|
|
|
UpdatePresentationDataFromChildAt(int32_t aFirstIndex, int32_t aLastIndex,
|
|
|
|
uint32_t aFlagsValues,
|
|
|
|
uint32_t aFlagsToUpdate) override {
|
2005-02-07 04:57:50 +03:00
|
|
|
nsMathMLContainerFrame::PropagatePresentationDataFromChildAt(
|
2008-01-09 12:38:28 +03:00
|
|
|
this, aFirstIndex, aLastIndex, aFlagsValues, aFlagsToUpdate);
|
2002-01-09 21:51:30 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2016-06-16 15:14:50 +03:00
|
|
|
virtual void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
|
2016-07-21 13:36:39 +03:00
|
|
|
const ReflowInput& aReflowInput,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsReflowStatus& aStatus) override;
|
2007-02-24 21:33:33 +03:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool IsFrameOfType(uint32_t aFlags) const override {
|
2008-07-14 02:41:18 +04:00
|
|
|
return nsBlockFrame::IsFrameOfType(
|
|
|
|
aFlags & ~(nsIFrame::eMathML | nsIFrame::eExcludesIgnorableWhitespace));
|
2007-02-24 21:33:33 +03:00
|
|
|
}
|
2000-03-28 14:15:19 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual const nsStyleText* StyleTextForLineLayout() override;
|
2018-03-22 21:20:41 +03:00
|
|
|
virtual void DidSetComputedStyle(ComputedStyle* aOldComputedStyle) override;
|
2013-12-13 21:42:43 +04:00
|
|
|
|
2016-06-16 15:14:50 +03:00
|
|
|
bool IsMrowLike() override {
|
|
|
|
return mFrames.FirstChild() != mFrames.LastChild() || !mFrames.FirstChild();
|
2014-04-04 19:54:00 +04:00
|
|
|
}
|
|
|
|
|
2000-05-16 17:18:42 +04:00
|
|
|
protected:
|
2019-02-05 19:45:54 +03:00
|
|
|
explicit nsMathMLmtdInnerFrame(ComputedStyle* aStyle,
|
|
|
|
nsPresContext* aPresContext);
|
2018-03-28 19:45:18 +03:00
|
|
|
virtual ~nsMathMLmtdInnerFrame() {}
|
2013-12-13 21:42:43 +04:00
|
|
|
|
2018-03-28 19:45:18 +03:00
|
|
|
mozilla::UniquePtr<nsStyleText> mUniqueStyleText;
|
2013-12-13 21:42:43 +04:00
|
|
|
|
2001-05-19 14:00:01 +04:00
|
|
|
}; // class nsMathMLmtdInnerFrame
|
2000-03-28 14:15:19 +04:00
|
|
|
|
|
|
|
#endif /* nsMathMLmtableFrame_h___ */
|