Files
palemoon27/layout/mathml/nsMathMLmtableFrame.h
roytam1 bb3c92a4bb import changes from `dev' branch of rmottola/Arctic-Fox:
- Bug 1229623 - Remove compilation/database.py from mach_bootstrap.py. r=mshal (16de324bd5)
- Bug 1228208 - Make sure ICU flags are prepended before system flags. r=glandium (77a099bb4a)
- Bug 1176968 part 2: Add "requirement flags" field to media query features, and logic for ignoring the feature if requirements aren't met. r=heycam (f2fb438cc7)
- Bug 1176968 part 3: Add support for "-webkit-device-pixel-ratio" media query, along with its min/max variants (behind a pref). r=heycam (d9cf15f3f3)
- Bug 1176968 part 4: Add tests for -webkit-device-pixel-ratio, based on existing -moz tests. r=heycam (7a143f1310)
- Bug 1230863 - Remove unused nsPresContext args from many functions. r=roc. (8f3ca74bb8)
- Add APZ support for mousewheel.acceleration prefs. (bug 1214170 part 1, r=kats) (f9ead80db9)
- Add APZ support for mousewheel delta multiplier prefs. (bug 1214170 part 2, r=kats) (111d111124)
- Bug 1143618 - Follow-up to fix static analysis build bustage. r=me on a CLOSED TREE (57c395593f)
- Bug 1021845 - Before compositing, clip the visible region of a layer to the layer's clip rect. r=mattwoodrow (493ad91934)
- Bug 1152046 - move ClosingService::Start/Shutdown to nsIOService. r=mayhemer (4d078b7611)
- Bug 1226909 part 1: Do security checks in a redirect handler rather than when opening the redirected channel. r=ckerschb (30d23ad2ee)
- Bug 1226909 part 2: Let CORS preflight logic grab information from nsILoadInfo rather than duplicate it. r=ckerschb (04ece9d251)
- Bug 1214361 Test final response types after redirect. r=sicking a=abillings (3f288cae02)
- Bug 1210302 - Part 4: Add automated tests; r=sicking (b43a9a02c4)
- Bug 1226909 part 3: Move logic of when to initiate CORS preflight into channels. Allow CORS preflight to happen when doing a same-origin to cross-origin redirect. r=ckerschb (816498fdb5)
- Bug 1216793 - check against tracking protection list in fetch(). r=gcp (1ddeb07832)
- Bug 1228342 - initialize mTainting by all constructors. r=bkelly (60e63d22bd)
- Bug 1226909 part 4: Make AsyncOpen2 set taining information on channels. Use this information in XHR and fetch(). r=bkelly (3b0bc77efc)
- Bug 1214819. Add support for @crossorigin to <link rel=prefetch> so resources can be prefetched via anonymous CORS, for example. r=hurley (de8b0aef94)
- Bug 1216687: Add nsILoadInfo flags for cookie policies. r=ckerschb (f2634fd5b0)
- Bug 1213443 - Parallelism for <link rel=prefetch> r=bz (f5ee458126)
2023-05-12 10:38:28 +08:00

329 lines
9.7 KiB
C++

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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 nsMathMLmtableFrame_h___
#define nsMathMLmtableFrame_h___
#include "mozilla/Attributes.h"
#include "nsMathMLContainerFrame.h"
#include "nsBlockFrame.h"
#include "nsTableOuterFrame.h"
#include "nsTableRowFrame.h"
#include "nsTableCellFrame.h"
//
// <mtable> -- table or matrix
//
class nsMathMLmtableOuterFrame : public nsTableOuterFrame,
public nsMathMLFrame
{
public:
friend nsContainerFrame* NS_NewMathMLmtableOuterFrame(nsIPresShell* aPresShell,
nsStyleContext* aContext);
NS_DECL_QUERYFRAME
NS_DECL_FRAMEARENA_HELPERS
// overloaded nsTableOuterFrame methods
virtual void
Reflow(nsPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus) override;
virtual nsresult
AttributeChanged(int32_t aNameSpaceID,
nsIAtom* aAttribute,
int32_t aModType) override;
virtual bool IsFrameOfType(uint32_t aFlags) const override
{
return nsTableOuterFrame::IsFrameOfType(aFlags & ~(nsIFrame::eMathML));
}
protected:
explicit nsMathMLmtableOuterFrame(nsStyleContext* aContext) : nsTableOuterFrame(aContext) {}
virtual ~nsMathMLmtableOuterFrame();
// 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
nsIFrame*
GetRowFrameAt(int32_t aRowIndex);
}; // class nsMathMLmtableOuterFrame
// --------------
class nsMathMLmtableFrame : public nsTableFrame
{
public:
NS_DECL_QUERYFRAME_TARGET(nsMathMLmtableFrame)
NS_DECL_QUERYFRAME
NS_DECL_FRAMEARENA_HELPERS
friend nsContainerFrame* NS_NewMathMLmtableFrame(nsIPresShell* aPresShell,
nsStyleContext* aContext);
// Overloaded nsTableFrame methods
virtual void
SetInitialChildList(ChildListID aListID,
nsFrameList& aChildList) override;
virtual void
AppendFrames(ChildListID aListID,
nsFrameList& aFrameList) override
{
nsTableFrame::AppendFrames(aListID, aFrameList);
RestyleTable();
}
virtual void
InsertFrames(ChildListID aListID,
nsIFrame* aPrevFrame,
nsFrameList& aFrameList) override
{
nsTableFrame::InsertFrames(aListID, aPrevFrame, aFrameList);
RestyleTable();
}
virtual void
RemoveFrame(ChildListID aListID,
nsIFrame* aOldFrame) override
{
nsTableFrame::RemoveFrame(aListID, aOldFrame);
RestyleTable();
}
virtual bool IsFrameOfType(uint32_t aFlags) const override
{
return nsTableFrame::IsFrameOfType(aFlags & ~(nsIFrame::eMathML));
}
// 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();
/** helper to get the column spacing style value */
nscoord GetColSpacing(int32_t aColIndex) override;
/** Sums the combined cell spacing between the columns aStartColIndex to
* aEndColIndex.
*/
nscoord GetColSpacing(int32_t aStartColIndex,
int32_t aEndColIndex) override;
/** helper to get the row spacing style value */
nscoord GetRowSpacing(int32_t aRowIndex) override;
/** Sums the combined cell spacing between the rows aStartRowIndex to
* aEndRowIndex.
*/
nscoord GetRowSpacing(int32_t aStartRowIndex,
int32_t aEndRowIndex) override;
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();
bool GetUseCSSSpacing()
{
return mUseCSSSpacing;
}
protected:
explicit nsMathMLmtableFrame(nsStyleContext* aContext) : nsTableFrame(aContext) {}
virtual ~nsMathMLmtableFrame();
private:
nsTArray<nscoord> mColSpacing;
nsTArray<nscoord> mRowSpacing;
nscoord mFrameSpacingX;
nscoord mFrameSpacingY;
bool mUseCSSSpacing;
}; // class nsMathMLmtableFrame
// --------------
class nsMathMLmtrFrame : public nsTableRowFrame
{
public:
NS_DECL_FRAMEARENA_HELPERS
friend nsContainerFrame* NS_NewMathMLmtrFrame(nsIPresShell* aPresShell,
nsStyleContext* aContext);
// overloaded nsTableRowFrame methods
virtual nsresult
AttributeChanged(int32_t aNameSpaceID,
nsIAtom* aAttribute,
int32_t aModType) override;
virtual void
AppendFrames(ChildListID aListID,
nsFrameList& aFrameList) override
{
nsTableRowFrame::AppendFrames(aListID, aFrameList);
RestyleTable();
}
virtual void
InsertFrames(ChildListID aListID,
nsIFrame* aPrevFrame,
nsFrameList& aFrameList) override
{
nsTableRowFrame::InsertFrames(aListID, aPrevFrame, aFrameList);
RestyleTable();
}
virtual void
RemoveFrame(ChildListID aListID,
nsIFrame* aOldFrame) override
{
nsTableRowFrame::RemoveFrame(aListID, aOldFrame);
RestyleTable();
}
virtual bool IsFrameOfType(uint32_t aFlags) const override
{
return nsTableRowFrame::IsFrameOfType(aFlags & ~(nsIFrame::eMathML));
}
// helper to restyle and reflow the table -- @see nsMathMLmtableFrame.
void RestyleTable()
{
nsTableFrame* tableFrame = GetTableFrame();
if (tableFrame && tableFrame->IsFrameOfType(nsIFrame::eMathML)) {
// relayout the table
((nsMathMLmtableFrame*)tableFrame)->RestyleTable();
}
}
protected:
explicit nsMathMLmtrFrame(nsStyleContext* aContext) : nsTableRowFrame(aContext) {}
virtual ~nsMathMLmtrFrame();
}; // class nsMathMLmtrFrame
// --------------
class nsMathMLmtdFrame : public nsTableCellFrame
{
public:
NS_DECL_FRAMEARENA_HELPERS
friend nsContainerFrame* NS_NewMathMLmtdFrame(nsIPresShell* aPresShell,
nsStyleContext* aContext,
nsTableFrame* aTableFrame);
// overloaded nsTableCellFrame methods
virtual void Init(nsIContent* aContent,
nsContainerFrame* aParent,
nsIFrame* aPrevInFlow) override;
virtual nsresult
AttributeChanged(int32_t aNameSpaceID,
nsIAtom* aAttribute,
int32_t aModType) override;
virtual uint8_t GetVerticalAlign() const override;
virtual nsresult ProcessBorders(nsTableFrame* aFrame,
nsDisplayListBuilder* aBuilder,
const nsDisplayListSet& aLists) override;
virtual int32_t GetRowSpan() override;
virtual int32_t GetColSpan() override;
virtual bool IsFrameOfType(uint32_t aFlags) const override
{
return nsTableCellFrame::IsFrameOfType(aFlags & ~(nsIFrame::eMathML));
}
virtual LogicalMargin GetBorderWidth(WritingMode aWM) const override;
virtual nsMargin GetBorderOverflow() override;
protected:
nsMathMLmtdFrame(nsStyleContext* aContext, nsTableFrame* aTableFrame)
: nsTableCellFrame(aContext, aTableFrame) {}
virtual ~nsMathMLmtdFrame();
}; // class nsMathMLmtdFrame
// --------------
class nsMathMLmtdInnerFrame : public nsBlockFrame,
public nsMathMLFrame {
public:
friend nsContainerFrame* NS_NewMathMLmtdInnerFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
NS_DECL_QUERYFRAME
NS_DECL_FRAMEARENA_HELPERS
// Overloaded nsIMathMLFrame methods
NS_IMETHOD
UpdatePresentationDataFromChildAt(int32_t aFirstIndex,
int32_t aLastIndex,
uint32_t aFlagsValues,
uint32_t aFlagsToUpdate) override
{
nsMathMLContainerFrame::PropagatePresentationDataFromChildAt(this,
aFirstIndex, aLastIndex, aFlagsValues, aFlagsToUpdate);
return NS_OK;
}
virtual void
Reflow(nsPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus) override;
virtual bool IsFrameOfType(uint32_t aFlags) const override
{
return nsBlockFrame::IsFrameOfType(aFlags &
~(nsIFrame::eMathML | nsIFrame::eExcludesIgnorableWhitespace));
}
virtual const nsStyleText* StyleTextForLineLayout() override;
virtual void DidSetStyleContext(nsStyleContext* aOldStyleContext) override;
bool
IsMrowLike() override {
return mFrames.FirstChild() != mFrames.LastChild() ||
!mFrames.FirstChild();
}
protected:
explicit nsMathMLmtdInnerFrame(nsStyleContext* aContext);
virtual ~nsMathMLmtdInnerFrame();
nsStyleText* mUniqueStyleText;
}; // class nsMathMLmtdInnerFrame
#endif /* nsMathMLmtableFrame_h___ */