2001-09-29 00:14:13 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
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/. */
|
1998-04-14 00:24:54 +04:00
|
|
|
#ifndef nsTableCellFrame_h__
|
|
|
|
#define nsTableCellFrame_h__
|
|
|
|
|
2012-09-14 20:10:08 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2012-08-08 17:05:17 +04:00
|
|
|
#include "celldata.h"
|
2015-02-06 07:45:56 +03:00
|
|
|
#include "imgIContainer.h"
|
1999-02-11 04:16:28 +03:00
|
|
|
#include "nsITableCellLayout.h"
|
1998-04-14 00:24:54 +04:00
|
|
|
#include "nscore.h"
|
2011-12-28 00:18:48 +04:00
|
|
|
#include "nsContainerFrame.h"
|
2003-02-22 03:32:13 +03:00
|
|
|
#include "nsStyleContext.h"
|
2015-06-22 12:33:34 +03:00
|
|
|
#include "nsIPercentBSizeObserver.h"
|
2007-01-30 03:06:41 +03:00
|
|
|
#include "nsGkAtoms.h"
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
#include "nsLayoutUtils.h"
|
2009-02-05 12:09:50 +03:00
|
|
|
#include "nsTArray.h"
|
2015-04-30 07:24:59 +03:00
|
|
|
#include "nsTableRowFrame.h"
|
2015-05-04 10:09:25 +03:00
|
|
|
#include "mozilla/WritingModes.h"
|
1998-06-24 03:23:21 +04:00
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
/**
|
|
|
|
* nsTableCellFrame
|
|
|
|
* data structure to maintain information about a single table cell's frame
|
|
|
|
*
|
1999-02-11 04:16:28 +03:00
|
|
|
* NOTE: frames are not ref counted. We expose addref and release here
|
|
|
|
* so we can change that decsion in the future. Users of nsITableCellLayout
|
|
|
|
* should refcount correctly as if this object is being ref counted, though
|
|
|
|
* no actual support is under the hood.
|
|
|
|
*
|
1998-04-14 00:24:54 +04:00
|
|
|
* @author sclark
|
|
|
|
*/
|
2011-12-28 00:18:48 +04:00
|
|
|
class nsTableCellFrame : public nsContainerFrame,
|
2010-04-27 20:15:01 +04:00
|
|
|
public nsITableCellLayout,
|
2015-06-22 12:33:34 +03:00
|
|
|
public nsIPercentBSizeObserver
|
1998-04-14 00:24:54 +04:00
|
|
|
{
|
2015-12-04 06:16:59 +03:00
|
|
|
typedef mozilla::gfx::DrawTarget DrawTarget;
|
2015-02-06 07:45:56 +03:00
|
|
|
typedef mozilla::image::DrawResult DrawResult;
|
|
|
|
|
2017-05-26 13:11:11 +03:00
|
|
|
friend nsTableCellFrame* NS_NewTableCellFrame(nsIPresShell* aPresShell,
|
|
|
|
nsStyleContext* aContext,
|
|
|
|
nsTableFrame* aTableFrame);
|
|
|
|
|
|
|
|
nsTableCellFrame(nsStyleContext* aContext, nsTableFrame* aTableFrame)
|
|
|
|
: nsTableCellFrame(aContext, aTableFrame, kClassID) {}
|
|
|
|
|
2015-05-04 10:09:25 +03:00
|
|
|
protected:
|
|
|
|
typedef mozilla::WritingMode WritingMode;
|
|
|
|
typedef mozilla::LogicalSide LogicalSide;
|
|
|
|
typedef mozilla::LogicalMargin LogicalMargin;
|
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
public:
|
2009-01-12 22:20:59 +03:00
|
|
|
NS_DECL_QUERYFRAME
|
2017-05-26 13:11:11 +03:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS(nsTableCellFrame)
|
1999-02-11 04:16:28 +03:00
|
|
|
|
2015-04-30 07:24:59 +03:00
|
|
|
nsTableRowFrame* GetTableRowFrame() const
|
|
|
|
{
|
|
|
|
nsIFrame* parent = GetParent();
|
2017-04-30 18:30:08 +03:00
|
|
|
MOZ_ASSERT(parent && parent->IsTableRowFrame());
|
2015-04-30 07:24:59 +03:00
|
|
|
return static_cast<nsTableRowFrame*>(parent);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsTableFrame* GetTableFrame() const
|
|
|
|
{
|
|
|
|
return GetTableRowFrame()->GetTableFrame();
|
|
|
|
}
|
|
|
|
|
2014-05-25 02:20:40 +04:00
|
|
|
virtual void Init(nsIContent* aContent,
|
|
|
|
nsContainerFrame* aParent,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsIFrame* aPrevInFlow) override;
|
1999-02-25 08:31:15 +03:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void DestroyFrom(nsIFrame* aDestructRoot) override;
|
2014-03-11 02:41:17 +04:00
|
|
|
|
2001-08-17 07:13:07 +04:00
|
|
|
#ifdef ACCESSIBILITY
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual mozilla::a11y::AccType AccessibleType() override;
|
2001-08-17 07:13:07 +04:00
|
|
|
#endif
|
2001-05-18 03:52:32 +04:00
|
|
|
|
2014-02-18 11:47:48 +04:00
|
|
|
virtual nsresult AttributeChanged(int32_t aNameSpaceID,
|
2017-10-03 01:05:19 +03:00
|
|
|
nsAtom* aAttribute,
|
2015-03-21 19:28:04 +03:00
|
|
|
int32_t aModType) override;
|
2000-01-04 08:31:56 +03:00
|
|
|
|
2008-10-26 13:11:34 +03:00
|
|
|
/** @see nsIFrame::DidSetStyleContext */
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void DidSetStyleContext(nsStyleContext* aOldStyleContext) override;
|
2010-04-27 20:15:01 +04:00
|
|
|
|
2014-05-28 23:36:59 +04:00
|
|
|
#ifdef DEBUG
|
|
|
|
// Our anonymous block frame is the content insertion frame so these
|
|
|
|
// methods should never be called:
|
2014-05-28 23:36:58 +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
|
|
|
virtual void InsertFrames(ChildListID aListID,
|
2014-05-28 23:36:58 +04:00
|
|
|
nsIFrame* aPrevFrame,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsFrameList& aFrameList) override;
|
2014-05-28 23:36:58 +04:00
|
|
|
virtual void RemoveFrame(ChildListID aListID,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsIFrame* aOldFrame) override;
|
2014-05-28 23:36:59 +04:00
|
|
|
#endif
|
1999-08-02 02:21:03 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsContainerFrame* GetContentInsertionFrame() override {
|
2016-01-29 17:42:14 +03:00
|
|
|
return PrincipalChildList().FirstChild()->GetContentInsertionFrame();
|
2004-07-18 16:02:53 +04:00
|
|
|
}
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsMargin GetUsedMargin() const override;
|
2006-12-14 02:04:57 +03:00
|
|
|
|
2016-07-21 13:36:39 +03:00
|
|
|
virtual void NotifyPercentBSize(const ReflowInput& aReflowInput) override;
|
2001-12-07 17:51:12 +03:00
|
|
|
|
2016-07-21 13:36:39 +03:00
|
|
|
virtual bool NeedsToObserve(const ReflowInput& aReflowInput) override;
|
1998-12-21 09:38:18 +03:00
|
|
|
|
2013-02-14 15:12:27 +04:00
|
|
|
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
2015-03-21 19:28:04 +03:00
|
|
|
const nsDisplayListSet& aLists) override;
|
2010-04-27 20:15:01 +04:00
|
|
|
|
2013-12-13 21:42:43 +04:00
|
|
|
virtual nsresult ProcessBorders(nsTableFrame* aFrame,
|
|
|
|
nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsDisplayListSet& aLists);
|
|
|
|
|
2017-06-09 22:14:53 +03:00
|
|
|
virtual nscoord GetMinISize(gfxContext *aRenderingContext) override;
|
|
|
|
virtual nscoord GetPrefISize(gfxContext *aRenderingContext) override;
|
2015-06-16 14:21:04 +03:00
|
|
|
virtual IntrinsicISizeOffsetData IntrinsicISizeOffsets() override;
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
|
2014-05-13 04:47:52 +04:00
|
|
|
virtual void Reflow(nsPresContext* aPresContext,
|
2016-07-21 13:36:38 +03:00
|
|
|
ReflowOutput& aDesiredSize,
|
2016-07-21 13:36:39 +03:00
|
|
|
const ReflowInput& aReflowInput,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsReflowStatus& aStatus) override;
|
1998-04-14 00:24:54 +04:00
|
|
|
|
2014-01-06 03:31:14 +04:00
|
|
|
#ifdef DEBUG_FRAME_DUMP
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsresult GetFrameName(nsAString& aResult) const override;
|
1999-09-01 05:02:16 +04:00
|
|
|
#endif
|
1999-08-31 07:09:40 +04:00
|
|
|
|
2015-06-18 12:11:40 +03:00
|
|
|
void BlockDirAlignChild(mozilla::WritingMode aWM, nscoord aMaxAscent);
|
2000-06-05 12:25:11 +04:00
|
|
|
|
2010-08-31 20:05:12 +04:00
|
|
|
/*
|
|
|
|
* Get the value of vertical-align adjusted for CSS 2's rules for a
|
|
|
|
* table cell, which means the result is always
|
|
|
|
* NS_STYLE_VERTICAL_ALIGN_{TOP,MIDDLE,BOTTOM,BASELINE}.
|
|
|
|
*/
|
2013-12-13 21:42:43 +04:00
|
|
|
virtual uint8_t GetVerticalAlign() const;
|
2010-08-31 20:05:12 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool HasVerticalAlignBaseline() const {
|
2010-08-31 20:05:12 +04:00
|
|
|
return GetVerticalAlign() == NS_STYLE_VERTICAL_ALIGN_BASELINE;
|
|
|
|
}
|
2010-04-27 20:15:01 +04:00
|
|
|
|
2015-06-18 12:11:40 +03:00
|
|
|
bool CellHasVisibleContent(nscoord aBSize,
|
|
|
|
nsTableFrame* tableFrame,
|
|
|
|
nsIFrame* kidFrame);
|
1998-04-14 00:24:54 +04:00
|
|
|
|
2007-01-23 07:06:56 +03:00
|
|
|
/**
|
2015-06-18 12:11:40 +03:00
|
|
|
* Get the first-line baseline of the cell relative to its block-start border
|
2007-01-23 07:06:56 +03:00
|
|
|
* edge, as if the cell were vertically aligned to the top of the row.
|
|
|
|
*/
|
|
|
|
nscoord GetCellBaseline() const;
|
|
|
|
|
1999-02-21 22:55:22 +03:00
|
|
|
/**
|
|
|
|
* return the cell's specified row span. this is what was specified in the
|
2017-06-17 03:49:09 +03:00
|
|
|
* content model or in the style info, and is always >= 0.
|
1999-02-21 22:55:22 +03:00
|
|
|
* to get the effective row span (the actual value that applies), use GetEffectiveRowSpan()
|
|
|
|
* @see nsTableFrame::GetEffectiveRowSpan()
|
|
|
|
*/
|
2017-06-17 03:49:09 +03:00
|
|
|
int32_t GetRowSpan();
|
1998-04-14 00:24:54 +04:00
|
|
|
|
1998-07-11 04:00:31 +04:00
|
|
|
// there is no set row index because row index depends on the cell's parent row only
|
|
|
|
|
2017-06-16 12:22:33 +03:00
|
|
|
// Return our cell content frame.
|
|
|
|
void AppendDirectlyOwnedAnonBoxes(nsTArray<OwnedAnonBox>& aResult) override;
|
2017-03-04 00:14:39 +03:00
|
|
|
|
1999-08-01 20:20:14 +04:00
|
|
|
/*---------------- nsITableCellLayout methods ------------------------*/
|
|
|
|
|
1999-02-21 22:55:22 +03:00
|
|
|
/**
|
|
|
|
* return the cell's starting row index (starting at 0 for the first row).
|
|
|
|
* for continued cell frames the row index is that of the cell's first-in-flow
|
1999-08-04 06:04:45 +04:00
|
|
|
* and the column index (starting at 0 for the first column
|
1999-02-21 22:55:22 +03:00
|
|
|
*/
|
2015-03-21 19:28:04 +03:00
|
|
|
NS_IMETHOD GetCellIndexes(int32_t &aRowIndex, int32_t &aColIndex) override;
|
1999-08-04 06:04:45 +04:00
|
|
|
|
|
|
|
/** return the mapped cell's row index (starting at 0 for the first row) */
|
2017-10-17 22:39:36 +03:00
|
|
|
uint32_t RowIndex() const
|
|
|
|
{
|
|
|
|
return static_cast<nsTableRowFrame*>(GetParent())->GetRowIndex();
|
|
|
|
}
|
1998-07-11 04:00:31 +04:00
|
|
|
|
1999-02-21 22:55:22 +03:00
|
|
|
/**
|
|
|
|
* return the cell's specified col span. this is what was specified in the
|
|
|
|
* content model or in the style info, and is always >= 1.
|
|
|
|
* to get the effective col span (the actual value that applies), use GetEffectiveColSpan()
|
|
|
|
* @see nsTableFrame::GetEffectiveColSpan()
|
|
|
|
*/
|
2017-06-17 03:49:09 +03:00
|
|
|
int32_t GetColSpan();
|
2010-04-27 20:15:01 +04:00
|
|
|
|
1999-02-21 22:55:22 +03:00
|
|
|
/** return the cell's column index (starting at 0 for the first column) */
|
2017-10-17 22:39:36 +03:00
|
|
|
uint32_t ColIndex() const
|
|
|
|
{
|
|
|
|
// NOTE: We copy this from previous continuations, and we don't ever have
|
|
|
|
// dynamic updates when tables split, so our mColIndex always matches our
|
|
|
|
// first continuation's.
|
|
|
|
MOZ_ASSERT(static_cast<nsTableCellFrame*>(FirstContinuation())->mColIndex ==
|
|
|
|
mColIndex,
|
|
|
|
"mColIndex out of sync with first continuation");
|
|
|
|
return mColIndex;
|
|
|
|
}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
void SetColIndex(int32_t aColIndex);
|
1998-04-23 21:29:07 +04:00
|
|
|
|
2015-06-18 12:11:40 +03:00
|
|
|
/** return the available isize given to this frame during its last reflow */
|
|
|
|
inline nscoord GetPriorAvailISize();
|
2010-04-27 20:15:01 +04:00
|
|
|
|
2015-06-18 12:11:40 +03:00
|
|
|
/** set the available isize given to this frame during its last reflow */
|
|
|
|
inline void SetPriorAvailISize(nscoord aPriorAvailISize);
|
1998-07-02 21:40:56 +04:00
|
|
|
|
1998-07-11 04:00:31 +04:00
|
|
|
/** return the desired size returned by this frame during its last reflow */
|
2014-07-24 12:30:07 +04:00
|
|
|
inline mozilla::LogicalSize GetDesiredSize();
|
1998-07-11 04:00:31 +04:00
|
|
|
|
|
|
|
/** set the desired size returned by this frame during its last reflow */
|
2016-07-21 13:36:38 +03:00
|
|
|
inline void SetDesiredSize(const ReflowOutput & aDesiredSize);
|
1998-07-11 04:00:31 +04:00
|
|
|
|
2017-08-31 16:12:14 +03:00
|
|
|
bool GetContentEmpty() const;
|
2011-09-29 10:19:26 +04:00
|
|
|
void SetContentEmpty(bool aContentEmpty);
|
1998-12-10 22:57:42 +03:00
|
|
|
|
2015-06-18 12:11:40 +03:00
|
|
|
bool HasPctOverBSize();
|
|
|
|
void SetHasPctOverBSize(bool aValue);
|
2001-11-28 03:50:08 +03:00
|
|
|
|
2017-10-17 22:38:05 +03:00
|
|
|
nsTableCellFrame* GetNextCell() const
|
|
|
|
{
|
|
|
|
nsIFrame* sibling = GetNextSibling();
|
|
|
|
#ifdef DEBUG
|
|
|
|
if (sibling) {
|
|
|
|
nsTableCellFrame* cellFrame = do_QueryFrame(sibling);
|
|
|
|
MOZ_ASSERT(cellFrame, "How do we have a non-cell sibling?");
|
|
|
|
}
|
|
|
|
#endif // DEBUG
|
|
|
|
return static_cast<nsTableCellFrame*>(sibling);
|
|
|
|
}
|
2001-11-05 03:15:51 +03:00
|
|
|
|
2015-05-04 10:09:25 +03:00
|
|
|
virtual LogicalMargin GetBorderWidth(WritingMode aWM) const;
|
2002-02-19 18:48:28 +03:00
|
|
|
|
2017-06-09 22:14:53 +03:00
|
|
|
virtual DrawResult PaintBackground(gfxContext& aRenderingContext,
|
2015-02-06 07:45:56 +03:00
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
nsPoint aPt,
|
|
|
|
uint32_t aFlags);
|
2006-01-26 05:29:17 +03:00
|
|
|
|
2015-12-04 06:16:59 +03:00
|
|
|
void DecorateForSelection(DrawTarget* aDrawTarget, nsPoint aPt);
|
2010-04-27 20:15:01 +04:00
|
|
|
|
2016-05-04 03:27:43 +03:00
|
|
|
virtual bool ComputeCustomOverflow(nsOverflowAreas& aOverflowAreas) override;
|
2013-03-08 06:18:45 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool IsFrameOfType(uint32_t aFlags) const override
|
2013-03-08 06:18:45 +04:00
|
|
|
{
|
|
|
|
return nsContainerFrame::IsFrameOfType(aFlags & ~(nsIFrame::eTablePart));
|
|
|
|
}
|
2017-07-06 15:00:35 +03:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void InvalidateFrame(uint32_t aDisplayItemKey = 0) override;
|
|
|
|
virtual void InvalidateFrameWithRect(const nsRect& aRect, uint32_t aDisplayItemKey = 0) override;
|
|
|
|
virtual void InvalidateFrameForRemoval() override { InvalidateFrameSubtree(); }
|
2011-06-16 01:03:49 +04:00
|
|
|
|
2017-08-31 16:12:14 +03:00
|
|
|
bool ShouldPaintBordersAndBackgrounds() const;
|
|
|
|
|
2017-08-31 16:12:35 +03:00
|
|
|
bool ShouldPaintBackground(nsDisplayListBuilder* aBuilder);
|
|
|
|
|
1998-10-20 21:45:07 +04:00
|
|
|
protected:
|
2017-05-26 13:11:11 +03:00
|
|
|
nsTableCellFrame(nsStyleContext* aContext, nsTableFrame* aTableFrame,
|
|
|
|
ClassID aID);
|
|
|
|
~nsTableCellFrame();
|
2017-04-30 18:30:08 +03:00
|
|
|
|
2015-06-18 12:11:40 +03:00
|
|
|
virtual LogicalSides
|
2016-07-21 13:36:39 +03:00
|
|
|
GetLogicalSkipSides(const ReflowInput* aReflowInput = nullptr) const override;
|
1998-10-20 21:45:07 +04:00
|
|
|
|
2005-03-18 05:15:44 +03:00
|
|
|
/**
|
2010-10-07 08:25:46 +04:00
|
|
|
* GetBorderOverflow says how far the cell's own borders extend
|
|
|
|
* outside its own bounds. In the separated borders model this should
|
|
|
|
* just be zero (as it is for most frames), but in the collapsed
|
2005-03-18 05:15:44 +03:00
|
|
|
* borders model (for which nsBCTableCellFrame overrides this virtual
|
2010-10-07 08:25:46 +04:00
|
|
|
* method), it considers the extents of the collapsed border.
|
2005-03-18 05:15:44 +03:00
|
|
|
*/
|
2010-10-07 08:25:46 +04:00
|
|
|
virtual nsMargin GetBorderOverflow();
|
2005-03-18 05:15:44 +03:00
|
|
|
|
2000-11-15 19:01:26 +03:00
|
|
|
friend class nsTableRowFrame;
|
1999-01-03 22:22:40 +03:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mColIndex; // the starting column for this cell
|
1998-07-02 21:40:56 +04:00
|
|
|
|
2015-06-18 12:11:40 +03:00
|
|
|
nscoord mPriorAvailISize; // the avail isize during the last reflow
|
2014-07-24 12:30:07 +04:00
|
|
|
mozilla::LogicalSize mDesiredSize; // the last desired inline and block size
|
1998-12-21 09:38:18 +03:00
|
|
|
};
|
1998-06-11 04:13:18 +04:00
|
|
|
|
2015-06-18 12:11:40 +03:00
|
|
|
inline nscoord nsTableCellFrame::GetPriorAvailISize()
|
|
|
|
{ return mPriorAvailISize; }
|
1998-07-02 21:40:56 +04:00
|
|
|
|
2015-06-18 12:11:40 +03:00
|
|
|
inline void nsTableCellFrame::SetPriorAvailISize(nscoord aPriorAvailISize)
|
|
|
|
{ mPriorAvailISize = aPriorAvailISize; }
|
1998-07-02 21:40:56 +04:00
|
|
|
|
2014-07-24 12:30:07 +04:00
|
|
|
inline mozilla::LogicalSize nsTableCellFrame::GetDesiredSize()
|
1998-07-11 04:00:31 +04:00
|
|
|
{ return mDesiredSize; }
|
|
|
|
|
2016-07-21 13:36:38 +03:00
|
|
|
inline void nsTableCellFrame::SetDesiredSize(const ReflowOutput & aDesiredSize)
|
2010-04-27 20:15:01 +04:00
|
|
|
{
|
2014-07-24 12:30:07 +04:00
|
|
|
mozilla::WritingMode wm = aDesiredSize.GetWritingMode();
|
|
|
|
mDesiredSize = aDesiredSize.Size(wm).ConvertTo(GetWritingMode(), wm);
|
1998-07-11 04:00:31 +04:00
|
|
|
}
|
|
|
|
|
2017-08-31 16:12:14 +03:00
|
|
|
inline bool nsTableCellFrame::GetContentEmpty() const
|
1999-10-08 22:52:19 +04:00
|
|
|
{
|
2015-06-23 23:41:29 +03:00
|
|
|
return HasAnyStateBits(NS_TABLE_CELL_CONTENT_EMPTY);
|
1999-10-08 22:52:19 +04:00
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
inline void nsTableCellFrame::SetContentEmpty(bool aContentEmpty)
|
1999-10-08 22:52:19 +04:00
|
|
|
{
|
1999-10-15 07:14:59 +04:00
|
|
|
if (aContentEmpty) {
|
2015-06-23 23:41:29 +03:00
|
|
|
AddStateBits(NS_TABLE_CELL_CONTENT_EMPTY);
|
1999-10-15 07:14:59 +04:00
|
|
|
} else {
|
2015-06-23 23:41:29 +03:00
|
|
|
RemoveStateBits(NS_TABLE_CELL_CONTENT_EMPTY);
|
1999-10-15 07:14:59 +04:00
|
|
|
}
|
1999-10-08 22:52:19 +04:00
|
|
|
}
|
|
|
|
|
2015-06-18 12:11:40 +03:00
|
|
|
inline bool nsTableCellFrame::HasPctOverBSize()
|
2001-11-28 03:50:08 +03:00
|
|
|
{
|
2015-06-23 23:41:29 +03:00
|
|
|
return HasAnyStateBits(NS_TABLE_CELL_HAS_PCT_OVER_BSIZE);
|
2001-11-28 03:50:08 +03:00
|
|
|
}
|
|
|
|
|
2015-06-18 12:11:40 +03:00
|
|
|
inline void nsTableCellFrame::SetHasPctOverBSize(bool aValue)
|
2001-11-28 03:50:08 +03:00
|
|
|
{
|
|
|
|
if (aValue) {
|
2015-06-23 23:41:29 +03:00
|
|
|
AddStateBits(NS_TABLE_CELL_HAS_PCT_OVER_BSIZE);
|
2001-11-28 03:50:08 +03:00
|
|
|
} else {
|
2015-06-23 23:41:29 +03:00
|
|
|
RemoveStateBits(NS_TABLE_CELL_HAS_PCT_OVER_BSIZE);
|
2001-11-28 03:50:08 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-02-19 18:48:28 +03:00
|
|
|
// nsBCTableCellFrame
|
2015-03-21 19:28:04 +03:00
|
|
|
class nsBCTableCellFrame final : public nsTableCellFrame
|
2002-02-19 18:48:28 +03:00
|
|
|
{
|
2015-02-06 07:45:56 +03:00
|
|
|
typedef mozilla::image::DrawResult DrawResult;
|
2002-02-19 18:48:28 +03:00
|
|
|
public:
|
2017-05-26 13:11:11 +03:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS(nsBCTableCellFrame)
|
2002-02-19 18:48:28 +03:00
|
|
|
|
2015-04-30 09:27:54 +03:00
|
|
|
nsBCTableCellFrame(nsStyleContext* aContext, nsTableFrame* aTableFrame);
|
2002-02-19 18:48:28 +03:00
|
|
|
|
|
|
|
~nsBCTableCellFrame();
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsMargin GetUsedBorder() const override;
|
2006-12-14 02:04:57 +03:00
|
|
|
|
2005-04-07 22:04:38 +04:00
|
|
|
// Get the *inner half of the border only*, in twips.
|
2015-05-04 10:09:25 +03:00
|
|
|
virtual LogicalMargin GetBorderWidth(WritingMode aWM) const override;
|
2002-02-19 18:48:28 +03:00
|
|
|
|
2005-04-07 22:04:38 +04:00
|
|
|
// Get the *inner half of the border only*, in pixels.
|
2015-05-04 10:09:25 +03:00
|
|
|
BCPixelSize GetBorderWidth(LogicalSide aSide) const;
|
2005-04-07 22:04:38 +04:00
|
|
|
|
|
|
|
// Set the full (both halves) width of the border
|
2015-05-04 10:09:25 +03:00
|
|
|
void SetBorderWidth(LogicalSide aSide, BCPixelSize aPixelValue);
|
2002-02-19 18:48:28 +03:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsMargin GetBorderOverflow() override;
|
2005-03-18 05:15:44 +03:00
|
|
|
|
2014-01-06 03:31:14 +04:00
|
|
|
#ifdef DEBUG_FRAME_DUMP
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsresult GetFrameName(nsAString& aResult) const override;
|
2002-02-19 18:48:28 +03:00
|
|
|
#endif
|
|
|
|
|
2017-06-09 22:14:53 +03:00
|
|
|
virtual DrawResult PaintBackground(gfxContext& aRenderingContext,
|
2015-02-06 07:45:56 +03:00
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
nsPoint aPt,
|
2015-03-21 19:28:04 +03:00
|
|
|
uint32_t aFlags) override;
|
2002-03-07 18:23:08 +03:00
|
|
|
|
2002-02-19 18:48:28 +03:00
|
|
|
private:
|
2010-04-27 20:15:01 +04:00
|
|
|
|
2005-04-07 22:04:38 +04:00
|
|
|
// These are the entire width of the border (the cell edge contains only
|
|
|
|
// the inner half, per the macros in nsTablePainter.h).
|
2015-05-04 10:09:25 +03:00
|
|
|
BCPixelSize mBStartBorder;
|
|
|
|
BCPixelSize mIEndBorder;
|
|
|
|
BCPixelSize mBEndBorder;
|
|
|
|
BCPixelSize mIStartBorder;
|
2002-02-19 18:48:28 +03:00
|
|
|
};
|
|
|
|
|
2017-10-17 22:38:05 +03:00
|
|
|
// Implemented here because that's a sane-ish way to make the includes work out.
|
|
|
|
inline nsTableCellFrame* nsTableRowFrame::GetFirstCell() const
|
|
|
|
{
|
|
|
|
nsIFrame* firstChild = mFrames.FirstChild();
|
|
|
|
#ifdef DEBUG
|
|
|
|
if (firstChild) {
|
|
|
|
nsTableCellFrame* cellFrame = do_QueryFrame(firstChild);
|
|
|
|
MOZ_ASSERT(cellFrame, "How do we have a non-cell sibling?");
|
|
|
|
}
|
|
|
|
#endif // DEBUG
|
|
|
|
return static_cast<nsTableCellFrame*>(firstChild);
|
|
|
|
}
|
|
|
|
|
1998-10-15 02:23:26 +04:00
|
|
|
#endif
|