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/. */
|
2014-08-20 05:24:58 +04:00
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
#include "nsTableRowFrame.h"
|
2019-04-06 09:02:28 +03:00
|
|
|
|
|
|
|
#include "mozilla/Maybe.h"
|
|
|
|
#include "mozilla/PresShell.h"
|
2001-11-05 18:15:24 +03:00
|
|
|
#include "nsTableRowGroupFrame.h"
|
2004-08-01 03:15:21 +04:00
|
|
|
#include "nsPresContext.h"
|
2018-03-22 21:20:41 +03:00
|
|
|
#include "mozilla/ComputedStyle.h"
|
1998-04-14 00:24:54 +04:00
|
|
|
#include "nsStyleConsts.h"
|
2007-01-30 03:06:41 +03:00
|
|
|
#include "nsGkAtoms.h"
|
1998-04-14 00:24:54 +04:00
|
|
|
#include "nsIContent.h"
|
|
|
|
#include "nsTableFrame.h"
|
|
|
|
#include "nsTableCellFrame.h"
|
1998-07-21 03:56:17 +04:00
|
|
|
#include "nsCSSRendering.h"
|
1999-07-28 12:09:02 +04:00
|
|
|
#include "nsHTMLParts.h"
|
|
|
|
#include "nsTableColGroupFrame.h"
|
|
|
|
#include "nsTableColFrame.h"
|
|
|
|
#include "nsCOMPtr.h"
|
2006-01-26 05:29:17 +03:00
|
|
|
#include "nsDisplayList.h"
|
2013-10-02 01:00:38 +04:00
|
|
|
#include "nsIFrameInlines.h"
|
2013-01-15 16:22:03 +04:00
|
|
|
#include <algorithm>
|
1998-04-23 21:29:07 +04:00
|
|
|
|
2010-03-29 05:46:55 +04:00
|
|
|
using namespace mozilla;
|
|
|
|
|
2016-07-21 13:36:36 +03:00
|
|
|
namespace mozilla {
|
|
|
|
|
2016-07-21 13:36:36 +03:00
|
|
|
struct TableCellReflowInput : public ReflowInput {
|
|
|
|
TableCellReflowInput(nsPresContext* aPresContext,
|
2016-07-21 13:36:39 +03:00
|
|
|
const ReflowInput& aParentReflowInput, nsIFrame* aFrame,
|
2014-07-24 12:28:46 +04:00
|
|
|
const LogicalSize& aAvailableSpace, uint32_t aFlags = 0)
|
2016-07-21 13:36:39 +03:00
|
|
|
: ReflowInput(aPresContext, aParentReflowInput, aFrame, aAvailableSpace,
|
2019-04-24 20:35:31 +03:00
|
|
|
Nothing(), aFlags) {}
|
2000-05-05 03:16:42 +04:00
|
|
|
|
2015-06-20 23:00:26 +03:00
|
|
|
void FixUp(const LogicalSize& aAvailSpace);
|
2000-05-05 03:16:42 +04:00
|
|
|
};
|
|
|
|
|
2016-07-21 13:36:36 +03:00
|
|
|
} // namespace mozilla
|
|
|
|
|
2016-07-21 13:36:36 +03:00
|
|
|
void TableCellReflowInput::FixUp(const LogicalSize& aAvailSpace) {
|
2002-02-19 18:48:28 +03:00
|
|
|
// fix the mComputed values during a pass 2 reflow since the cell can be a
|
|
|
|
// percentage base
|
2016-09-01 08:01:16 +03:00
|
|
|
NS_WARNING_ASSERTION(
|
|
|
|
NS_UNCONSTRAINEDSIZE != aAvailSpace.ISize(mWritingMode),
|
|
|
|
"have unconstrained inline-size; this should only result from very large "
|
|
|
|
"sizes, not attempts at intrinsic inline size calculation");
|
2015-06-20 23:00:26 +03:00
|
|
|
if (NS_UNCONSTRAINEDSIZE != ComputedISize()) {
|
|
|
|
nscoord computedISize =
|
|
|
|
aAvailSpace.ISize(mWritingMode) -
|
|
|
|
ComputedLogicalBorderPadding().IStartEnd(mWritingMode);
|
|
|
|
computedISize = std::max(0, computedISize);
|
|
|
|
SetComputedISize(computedISize);
|
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
|
|
|
}
|
2015-06-20 23:00:26 +03:00
|
|
|
if (NS_UNCONSTRAINEDSIZE != ComputedBSize() &&
|
|
|
|
NS_UNCONSTRAINEDSIZE != aAvailSpace.BSize(mWritingMode)) {
|
|
|
|
nscoord computedBSize =
|
|
|
|
aAvailSpace.BSize(mWritingMode) -
|
|
|
|
ComputedLogicalBorderPadding().BStartEnd(mWritingMode);
|
|
|
|
computedBSize = std::max(0, computedBSize);
|
|
|
|
SetComputedBSize(computedBSize);
|
2002-02-19 18:48:28 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-07-21 13:36:39 +03:00
|
|
|
void nsTableRowFrame::InitChildReflowInput(nsPresContext& aPresContext,
|
2015-06-20 23:00:26 +03:00
|
|
|
const LogicalSize& aAvailSize,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aBorderCollapse,
|
2016-07-21 13:36:39 +03:00
|
|
|
TableCellReflowInput& aReflowInput) {
|
2002-02-19 18:48:28 +03:00
|
|
|
nsMargin collapseBorder;
|
2012-07-30 18:20:58 +04:00
|
|
|
nsMargin* pCollapseBorder = nullptr;
|
2002-02-19 18:48:28 +03:00
|
|
|
if (aBorderCollapse) {
|
|
|
|
// we only reflow cells, so don't need to check frame type
|
2016-07-21 13:36:39 +03:00
|
|
|
nsBCTableCellFrame* bcCellFrame = (nsBCTableCellFrame*)aReflowInput.mFrame;
|
2002-02-19 18:48:28 +03:00
|
|
|
if (bcCellFrame) {
|
2015-05-04 10:09:25 +03:00
|
|
|
WritingMode wm = GetWritingMode();
|
|
|
|
collapseBorder = bcCellFrame->GetBorderWidth(wm).GetPhysicalMargin(wm);
|
|
|
|
pCollapseBorder = &collapseBorder;
|
2002-02-19 18:48:28 +03:00
|
|
|
}
|
|
|
|
}
|
2019-04-24 20:35:31 +03:00
|
|
|
aReflowInput.Init(&aPresContext, Nothing(), pCollapseBorder);
|
2016-07-21 13:36:39 +03:00
|
|
|
aReflowInput.FixUp(aAvailSize);
|
2000-05-05 03:16:42 +04:00
|
|
|
}
|
|
|
|
|
2015-06-20 23:00:26 +03:00
|
|
|
void nsTableRowFrame::SetFixedBSize(nscoord aValue) {
|
|
|
|
nscoord bsize = std::max(0, aValue);
|
|
|
|
if (HasFixedBSize()) {
|
|
|
|
if (bsize > mStyleFixedBSize) {
|
|
|
|
mStyleFixedBSize = bsize;
|
2001-11-05 03:15:51 +03:00
|
|
|
}
|
2003-01-05 17:16:58 +03:00
|
|
|
} else {
|
2015-06-20 23:00:26 +03:00
|
|
|
mStyleFixedBSize = bsize;
|
|
|
|
if (bsize > 0) {
|
|
|
|
SetHasFixedBSize(true);
|
2001-11-05 03:15:51 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-06-20 23:00:26 +03:00
|
|
|
void nsTableRowFrame::SetPctBSize(float aPctValue, bool aForce) {
|
|
|
|
nscoord bsize = std::max(0, NSToCoordRound(aPctValue * 100.0f));
|
|
|
|
if (HasPctBSize()) {
|
|
|
|
if ((bsize > mStylePctBSize) || aForce) {
|
|
|
|
mStylePctBSize = bsize;
|
2001-11-05 03:15:51 +03:00
|
|
|
}
|
|
|
|
} else {
|
2015-06-20 23:00:26 +03:00
|
|
|
mStylePctBSize = bsize;
|
|
|
|
if (bsize > 0) {
|
|
|
|
SetHasPctBSize(true);
|
2001-11-05 03:15:51 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ----------- nsTableRowFrame ---------- */
|
1998-04-23 21:29:07 +04:00
|
|
|
|
2009-03-25 01:10:06 +03:00
|
|
|
NS_QUERYFRAME_HEAD(nsTableRowFrame)
|
2018-12-07 23:00:18 +03:00
|
|
|
NS_QUERYFRAME_ENTRY(nsTableRowFrame)
|
2011-12-28 00:18:48 +04:00
|
|
|
NS_QUERYFRAME_TAIL_INHERITING(nsContainerFrame)
|
2009-03-25 01:10:06 +03:00
|
|
|
|
2019-02-05 19:45:54 +03:00
|
|
|
nsTableRowFrame::nsTableRowFrame(ComputedStyle* aStyle,
|
|
|
|
nsPresContext* aPresContext, ClassID aID)
|
|
|
|
: nsContainerFrame(aStyle, aPresContext, aID),
|
2016-12-01 11:06:50 +03:00
|
|
|
mContentBSize(0),
|
|
|
|
mStylePctBSize(0),
|
|
|
|
mStyleFixedBSize(0),
|
|
|
|
mMaxCellAscent(0),
|
|
|
|
mMaxCellDescent(0),
|
|
|
|
mBStartBorderWidth(0),
|
|
|
|
mBEndBorderWidth(0),
|
|
|
|
mIEndContBorderWidth(0),
|
|
|
|
mBStartContBorderWidth(0),
|
|
|
|
mIStartContBorderWidth(0) {
|
|
|
|
mBits.mRowIndex = 0;
|
|
|
|
mBits.mHasFixedBSize = 0;
|
|
|
|
mBits.mHasPctBSize = 0;
|
|
|
|
mBits.mFirstInserted = 0;
|
2015-06-20 23:00:26 +03:00
|
|
|
ResetBSize(0);
|
2001-01-25 18:55:51 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
nsTableRowFrame::~nsTableRowFrame() {}
|
1998-04-14 00:24:54 +04:00
|
|
|
|
2014-05-25 02:20:40 +04:00
|
|
|
void nsTableRowFrame::Init(nsIContent* aContent, nsContainerFrame* aParent,
|
|
|
|
nsIFrame* aPrevInFlow) {
|
2005-11-21 01:05:24 +03:00
|
|
|
// Let the base class do its initialization
|
2013-03-20 05:47:48 +04:00
|
|
|
nsContainerFrame::Init(aContent, aParent, aPrevInFlow);
|
1999-02-25 08:31:15 +03:00
|
|
|
|
2016-08-28 05:31:50 +03:00
|
|
|
NS_ASSERTION(mozilla::StyleDisplay::TableRow == StyleDisplay()->mDisplay,
|
2008-08-14 07:49:57 +04:00
|
|
|
"wrong display on table row frame");
|
|
|
|
|
1999-02-25 08:31:15 +03:00
|
|
|
if (aPrevInFlow) {
|
|
|
|
// Set the row index
|
|
|
|
nsTableRowFrame* rowFrame = (nsTableRowFrame*)aPrevInFlow;
|
2015-04-17 21:42:05 +03:00
|
|
|
|
1999-02-25 08:31:15 +03:00
|
|
|
SetRowIndex(rowFrame->GetRowIndex());
|
2017-02-28 20:58:30 +03:00
|
|
|
} else {
|
|
|
|
mWritingMode = GetTableFrame()->GetWritingMode();
|
1999-02-25 08:31:15 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-07 03:20:33 +03:00
|
|
|
void nsTableRowFrame::DestroyFrom(nsIFrame* aDestructRoot,
|
|
|
|
PostDestroyData& aPostDestroyData) {
|
2015-06-23 23:41:29 +03:00
|
|
|
if (HasAnyStateBits(NS_FRAME_CAN_HAVE_ABSPOS_CHILDREN)) {
|
2014-03-11 02:41:17 +04:00
|
|
|
nsTableFrame::UnregisterPositionedTablePart(this, aDestructRoot);
|
|
|
|
}
|
|
|
|
|
2017-11-07 03:20:33 +03:00
|
|
|
nsContainerFrame::DestroyFrom(aDestructRoot, aPostDestroyData);
|
2014-03-11 02:41:17 +04:00
|
|
|
}
|
|
|
|
|
2019-02-26 01:09:24 +03:00
|
|
|
/* virtual */
|
|
|
|
void nsTableRowFrame::DidSetComputedStyle(ComputedStyle* aOldComputedStyle) {
|
2018-03-22 21:20:41 +03:00
|
|
|
nsContainerFrame::DidSetComputedStyle(aOldComputedStyle);
|
2012-08-14 01:13:34 +04:00
|
|
|
|
2018-03-22 21:20:41 +03:00
|
|
|
if (!aOldComputedStyle) // avoid this on init
|
2008-10-26 13:11:34 +03:00
|
|
|
return;
|
2015-04-17 21:42:05 +03:00
|
|
|
|
2015-04-30 07:24:59 +03:00
|
|
|
nsTableFrame* tableFrame = GetTableFrame();
|
2008-10-26 13:11:34 +03:00
|
|
|
if (tableFrame->IsBorderCollapse() &&
|
2018-03-22 21:20:41 +03:00
|
|
|
tableFrame->BCRecalcNeeded(aOldComputedStyle, Style())) {
|
2015-05-01 00:46:59 +03:00
|
|
|
TableArea damageArea(0, GetRowIndex(), tableFrame->GetColCount(), 1);
|
2011-10-27 17:58:44 +04:00
|
|
|
tableFrame->AddBCDamageArea(damageArea);
|
2008-10-26 13:11:34 +03:00
|
|
|
}
|
|
|
|
}
|
1999-08-03 06:41:27 +04:00
|
|
|
|
2015-06-20 23:00:26 +03:00
|
|
|
void nsTableRowFrame::AppendFrames(ChildListID aListID,
|
|
|
|
nsFrameList& aFrameList) {
|
2011-08-25 00:54:30 +04:00
|
|
|
NS_ASSERTION(aListID == kPrincipalList, "unexpected child list");
|
2006-06-29 06:32:36 +04:00
|
|
|
|
2015-04-11 03:21:06 +03:00
|
|
|
DrainSelfOverflowList(); // ensure the last frame is in mFrames
|
2012-07-30 18:20:58 +04:00
|
|
|
const nsFrameList::Slice& newCells =
|
|
|
|
mFrames.AppendFrames(nullptr, aFrameList);
|
1999-08-03 06:41:27 +04:00
|
|
|
|
|
|
|
// Add the new cell frames to the table
|
2015-04-30 07:24:59 +03:00
|
|
|
nsTableFrame* tableFrame = GetTableFrame();
|
2009-07-30 21:23:32 +04:00
|
|
|
for (nsFrameList::Enumerator e(newCells); !e.AtEnd(); e.Next()) {
|
2011-12-27 12:31:22 +04:00
|
|
|
nsIFrame* childFrame = e.get();
|
2018-09-18 04:29:19 +03:00
|
|
|
NS_ASSERTION(IsTableCell(childFrame->Type()),
|
2015-06-20 23:00:26 +03:00
|
|
|
"Not a table cell frame/pseudo frame construction failure");
|
2011-12-27 12:31:22 +04:00
|
|
|
tableFrame->AppendCell(static_cast<nsTableCellFrame&>(*childFrame),
|
|
|
|
GetRowIndex());
|
1999-08-03 06:41:27 +04:00
|
|
|
}
|
|
|
|
|
2019-04-25 08:04:15 +03:00
|
|
|
PresShell()->FrameNeedsReflow(this, IntrinsicDirty::TreeChange,
|
2017-11-09 05:00:48 +03:00
|
|
|
NS_FRAME_HAS_DIRTY_CHILDREN);
|
2006-12-13 06:45:28 +03:00
|
|
|
tableFrame->SetGeometryDirty();
|
1999-08-03 06:41:27 +04:00
|
|
|
}
|
|
|
|
|
2015-06-20 23:00:26 +03:00
|
|
|
void nsTableRowFrame::InsertFrames(ChildListID aListID, nsIFrame* aPrevFrame,
|
|
|
|
nsFrameList& aFrameList) {
|
2011-08-25 00:54:30 +04:00
|
|
|
NS_ASSERTION(aListID == kPrincipalList, "unexpected child list");
|
2006-06-29 06:32:36 +04:00
|
|
|
NS_ASSERTION(!aPrevFrame || aPrevFrame->GetParent() == this,
|
|
|
|
"inserting after sibling frame with different parent");
|
2017-08-11 07:17:10 +03:00
|
|
|
if (mFrames.IsEmpty() || (aPrevFrame && !aPrevFrame->GetNextSibling())) {
|
|
|
|
// This is actually an append (though our caller didn't figure that out),
|
|
|
|
// and our append codepath is both simpler/faster _and_ less buggy.
|
|
|
|
// https://bugzilla.mozilla.org/show_bug.cgi?id=1388898 tracks the bugginess
|
|
|
|
AppendFrames(aListID, aFrameList);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-04-11 03:21:06 +03:00
|
|
|
DrainSelfOverflowList(); // ensure aPrevFrame is in mFrames
|
2011-12-27 12:31:22 +04:00
|
|
|
// Insert Frames in the frame list
|
2012-07-30 18:20:58 +04:00
|
|
|
const nsFrameList::Slice& newCells =
|
|
|
|
mFrames.InsertFrames(nullptr, aPrevFrame, aFrameList);
|
2006-06-29 06:32:36 +04:00
|
|
|
|
1999-08-03 06:41:27 +04:00
|
|
|
// Get the table frame
|
2015-04-30 07:24:59 +03:00
|
|
|
nsTableFrame* tableFrame = GetTableFrame();
|
2017-05-01 20:32:52 +03:00
|
|
|
LayoutFrameType cellFrameType = tableFrame->IsBorderCollapse()
|
|
|
|
? LayoutFrameType::BCTableCell
|
|
|
|
: LayoutFrameType::TableCell;
|
2004-01-18 13:28:40 +03:00
|
|
|
nsTableCellFrame* prevCellFrame =
|
|
|
|
(nsTableCellFrame*)nsTableFrame::GetFrameAtOrBefore(this, aPrevFrame,
|
|
|
|
cellFrameType);
|
2009-02-05 12:09:50 +03:00
|
|
|
nsTArray<nsTableCellFrame*> cellChildren;
|
2011-12-27 12:31:22 +04:00
|
|
|
for (nsFrameList::Enumerator e(newCells); !e.AtEnd(); e.Next()) {
|
|
|
|
nsIFrame* childFrame = e.get();
|
2018-09-18 04:29:19 +03:00
|
|
|
NS_ASSERTION(IsTableCell(childFrame->Type()),
|
2015-06-20 23:00:26 +03:00
|
|
|
"Not a table cell frame/pseudo frame construction failure");
|
2011-12-27 12:31:22 +04:00
|
|
|
cellChildren.AppendElement(static_cast<nsTableCellFrame*>(childFrame));
|
1999-12-14 01:56:31 +03:00
|
|
|
}
|
|
|
|
// insert the cells into the cell map
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t colIndex = -1;
|
1999-12-14 01:56:31 +03:00
|
|
|
if (prevCellFrame) {
|
2017-10-17 22:39:36 +03:00
|
|
|
colIndex = prevCellFrame->ColIndex();
|
1999-12-14 01:56:31 +03:00
|
|
|
}
|
2005-02-07 04:58:25 +03:00
|
|
|
tableFrame->InsertCells(cellChildren, GetRowIndex(), colIndex);
|
2015-04-17 21:42:05 +03:00
|
|
|
|
2019-04-25 08:04:15 +03:00
|
|
|
PresShell()->FrameNeedsReflow(this, IntrinsicDirty::TreeChange,
|
2017-11-09 05:00:48 +03:00
|
|
|
NS_FRAME_HAS_DIRTY_CHILDREN);
|
2006-12-13 06:45:28 +03:00
|
|
|
tableFrame->SetGeometryDirty();
|
1999-08-03 06:41:27 +04:00
|
|
|
}
|
|
|
|
|
2015-06-20 23:00:26 +03:00
|
|
|
void nsTableRowFrame::RemoveFrame(ChildListID aListID, nsIFrame* aOldFrame) {
|
2011-08-25 00:54:30 +04:00
|
|
|
NS_ASSERTION(aListID == kPrincipalList, "unexpected child list");
|
2006-06-29 06:32:36 +04:00
|
|
|
|
2014-05-28 23:36:58 +04:00
|
|
|
MOZ_ASSERT((nsTableCellFrame*)do_QueryFrame(aOldFrame));
|
|
|
|
nsTableCellFrame* cellFrame = static_cast<nsTableCellFrame*>(aOldFrame);
|
|
|
|
// remove the cell from the cell map
|
2015-04-30 07:24:59 +03:00
|
|
|
nsTableFrame* tableFrame = GetTableFrame();
|
2014-05-28 23:36:58 +04:00
|
|
|
tableFrame->RemoveCell(cellFrame, GetRowIndex());
|
|
|
|
|
|
|
|
// Remove the frame and destroy it
|
|
|
|
mFrames.DestroyFrame(aOldFrame);
|
1998-09-16 21:19:20 +04:00
|
|
|
|
2019-04-25 08:04:15 +03:00
|
|
|
PresShell()->FrameNeedsReflow(this, IntrinsicDirty::TreeChange,
|
2017-11-09 05:00:48 +03:00
|
|
|
NS_FRAME_HAS_DIRTY_CHILDREN);
|
2014-05-28 23:36:58 +04:00
|
|
|
|
|
|
|
tableFrame->SetGeometryDirty();
|
1999-08-30 04:01:09 +04:00
|
|
|
}
|
|
|
|
|
2019-02-26 01:09:24 +03:00
|
|
|
/* virtual */
|
|
|
|
nsMargin nsTableRowFrame::GetUsedMargin() const { return nsMargin(0, 0, 0, 0); }
|
2006-12-14 02:04:57 +03:00
|
|
|
|
2019-02-26 01:09:24 +03:00
|
|
|
/* virtual */
|
|
|
|
nsMargin nsTableRowFrame::GetUsedBorder() const { return nsMargin(0, 0, 0, 0); }
|
2006-12-14 02:04:57 +03:00
|
|
|
|
2019-02-26 01:09:24 +03:00
|
|
|
/* virtual */
|
|
|
|
nsMargin nsTableRowFrame::GetUsedPadding() const {
|
2006-12-14 02:04:57 +03:00
|
|
|
return nsMargin(0, 0, 0, 0);
|
|
|
|
}
|
|
|
|
|
2015-06-20 23:00:26 +03:00
|
|
|
static nscoord GetBSizeOfRowsSpannedBelowFirst(
|
|
|
|
nsTableCellFrame& aTableCellFrame, nsTableFrame& aTableFrame,
|
|
|
|
const WritingMode aWM) {
|
|
|
|
nscoord bsize = 0;
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t rowSpan = aTableFrame.GetEffectiveRowSpan(aTableCellFrame);
|
2015-06-20 23:00:26 +03:00
|
|
|
// add in bsize of rows spanned beyond the 1st one
|
2003-07-07 06:01:29 +04:00
|
|
|
nsIFrame* nextRow = aTableCellFrame.GetParent()->GetNextSibling();
|
2012-08-22 19:56:38 +04:00
|
|
|
for (int32_t rowX = 1; ((rowX < rowSpan) && nextRow);) {
|
2017-04-30 18:30:08 +03:00
|
|
|
if (nextRow->IsTableRowFrame()) {
|
2015-06-20 23:00:26 +03:00
|
|
|
bsize += nextRow->BSize(aWM);
|
2000-09-05 18:57:34 +04:00
|
|
|
rowX++;
|
|
|
|
}
|
2015-06-20 23:00:26 +03:00
|
|
|
bsize += aTableFrame.GetRowSpacing(rowX);
|
2003-07-07 06:01:29 +04:00
|
|
|
nextRow = nextRow->GetNextSibling();
|
2000-09-05 18:57:34 +04:00
|
|
|
}
|
2015-06-20 23:00:26 +03:00
|
|
|
return bsize;
|
2000-09-05 18:57:34 +04:00
|
|
|
}
|
|
|
|
|
1998-07-03 00:35:23 +04:00
|
|
|
/**
|
|
|
|
* Post-reflow hook. This is where the table row does its post-processing
|
|
|
|
*/
|
2007-01-28 01:22:24 +03:00
|
|
|
void nsTableRowFrame::DidResize() {
|
2015-06-20 23:00:26 +03:00
|
|
|
// Resize and re-align the cell frames based on our row bsize
|
2015-04-30 07:24:59 +03:00
|
|
|
nsTableFrame* tableFrame = GetTableFrame();
|
2014-07-24 12:30:07 +04:00
|
|
|
|
|
|
|
WritingMode wm = GetWritingMode();
|
2016-07-21 13:36:38 +03:00
|
|
|
ReflowOutput desiredSize(wm);
|
2014-08-12 03:52:01 +04:00
|
|
|
desiredSize.SetSize(wm, GetLogicalSize(wm));
|
2010-10-07 08:25:46 +04:00
|
|
|
desiredSize.SetOverflowAreasToDesiredBounds();
|
1999-05-04 23:15:56 +04:00
|
|
|
|
2015-07-16 12:07:57 +03:00
|
|
|
nsSize containerSize = mRect.Size();
|
2015-06-27 02:50:21 +03:00
|
|
|
|
2015-06-23 21:47:45 +03:00
|
|
|
for (nsIFrame* childFrame : mFrames) {
|
2009-03-25 01:10:06 +03:00
|
|
|
nsTableCellFrame* cellFrame = do_QueryFrame(childFrame);
|
|
|
|
if (cellFrame) {
|
2015-06-20 23:00:26 +03:00
|
|
|
nscoord cellBSize = BSize(wm) + GetBSizeOfRowsSpannedBelowFirst(
|
|
|
|
*cellFrame, *tableFrame, wm);
|
1999-05-04 23:15:56 +04:00
|
|
|
|
2015-06-27 02:50:21 +03:00
|
|
|
// If the bsize for the cell has changed, we need to reset it;
|
|
|
|
// and in vertical-rl mode, we need to update the cell's block position
|
2015-07-16 12:07:57 +03:00
|
|
|
// to account for the containerSize, which may not have been known
|
2015-06-27 02:50:21 +03:00
|
|
|
// earlier, so we always apply it here.
|
2015-06-20 23:00:26 +03:00
|
|
|
LogicalSize cellSize = cellFrame->GetLogicalSize(wm);
|
2015-06-27 02:50:21 +03:00
|
|
|
if (cellSize.BSize(wm) != cellBSize || wm.IsVerticalRL()) {
|
2015-06-20 23:00:26 +03:00
|
|
|
nsRect cellOldRect = cellFrame->GetRect();
|
2015-06-27 02:50:21 +03:00
|
|
|
nsRect cellVisualOverflow = cellFrame->GetVisualOverflowRect();
|
|
|
|
|
|
|
|
if (wm.IsVerticalRL()) {
|
|
|
|
// Get the old position of the cell, as we want to preserve its
|
|
|
|
// inline coordinate.
|
|
|
|
LogicalPoint oldPos =
|
2015-07-16 12:07:57 +03:00
|
|
|
cellFrame->GetLogicalPosition(wm, containerSize);
|
2015-06-27 02:50:21 +03:00
|
|
|
|
|
|
|
// The cell should normally be aligned with the row's block-start,
|
|
|
|
// so set the B component of the position to zero:
|
|
|
|
LogicalPoint newPos(wm, oldPos.I(wm), 0);
|
|
|
|
|
|
|
|
// ...unless relative positioning is in effect, in which case the
|
|
|
|
// cell may have been moved away from the row's block-start
|
|
|
|
if (cellFrame->IsRelativelyPositioned()) {
|
|
|
|
// Find out where the cell would have been without relative
|
|
|
|
// positioning.
|
|
|
|
LogicalPoint oldNormalPos =
|
2015-07-16 12:07:57 +03:00
|
|
|
cellFrame->GetLogicalNormalPosition(wm, containerSize);
|
2015-06-27 02:50:21 +03:00
|
|
|
// The difference (if any) between oldPos and oldNormalPos reflects
|
|
|
|
// relative positioning that was applied to the cell, and which we
|
|
|
|
// need to incorporate when resetting the position.
|
|
|
|
newPos.B(wm) = oldPos.B(wm) - oldNormalPos.B(wm);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (oldPos != newPos) {
|
2015-07-16 12:07:57 +03:00
|
|
|
cellFrame->SetPosition(wm, newPos, containerSize);
|
2015-06-27 02:50:21 +03:00
|
|
|
nsTableFrame::RePositionViews(cellFrame);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
cellSize.BSize(wm) = cellBSize;
|
2015-06-20 23:00:26 +03:00
|
|
|
cellFrame->SetSize(wm, cellSize);
|
2017-06-09 05:46:34 +03:00
|
|
|
|
|
|
|
nsTableFrame* tableFrame = GetTableFrame();
|
|
|
|
if (tableFrame->IsBorderCollapse()) {
|
|
|
|
nsTableFrame::InvalidateTableFrame(cellFrame, cellOldRect,
|
|
|
|
cellVisualOverflow, false);
|
|
|
|
}
|
1998-07-03 00:35:23 +04:00
|
|
|
}
|
2008-02-08 12:36:32 +03:00
|
|
|
|
2015-06-18 12:11:40 +03:00
|
|
|
// realign cell content based on the new bsize. We might be able to
|
|
|
|
// skip this if the bsize didn't change... maybe. Hard to tell.
|
|
|
|
cellFrame->BlockDirAlignChild(wm, mMaxCellAscent);
|
2015-04-17 21:42:05 +03:00
|
|
|
|
2008-02-08 12:36:32 +03:00
|
|
|
// Always store the overflow, even if the height didn't change, since
|
|
|
|
// we'll lose part of our overflow area otherwise.
|
2010-10-07 08:25:46 +04:00
|
|
|
ConsiderChildOverflow(desiredSize.mOverflowAreas, cellFrame);
|
2008-02-08 12:36:32 +03:00
|
|
|
|
|
|
|
// Note that if the cell's *content* needs to change in response
|
2015-06-22 12:33:34 +03:00
|
|
|
// to this height, it will get a special bsize reflow.
|
1998-07-03 00:35:23 +04:00
|
|
|
}
|
|
|
|
}
|
2004-07-16 20:56:21 +04:00
|
|
|
FinishAndStoreOverflow(&desiredSize);
|
2004-04-14 10:22:52 +04:00
|
|
|
if (HasView()) {
|
2010-10-07 08:25:46 +04:00
|
|
|
nsContainerFrame::SyncFrameViewAfterReflow(PresContext(), this, GetView(),
|
|
|
|
desiredSize.VisualOverflow(), 0);
|
2004-04-14 10:22:52 +04:00
|
|
|
}
|
1998-07-03 00:35:23 +04:00
|
|
|
// Let our base class do the usual work
|
|
|
|
}
|
|
|
|
|
2000-06-05 12:25:11 +04:00
|
|
|
// returns max-ascent amongst all cells that have 'vertical-align: baseline'
|
2000-07-28 13:19:26 +04:00
|
|
|
// *including* cells with rowspans
|
2000-06-05 12:25:11 +04:00
|
|
|
nscoord nsTableRowFrame::GetMaxCellAscent() const { return mMaxCellAscent; }
|
|
|
|
|
2015-06-20 23:00:26 +03:00
|
|
|
nscoord nsTableRowFrame::GetRowBaseline(WritingMode aWM) {
|
|
|
|
if (mMaxCellAscent) {
|
2005-10-04 19:47:21 +04:00
|
|
|
return mMaxCellAscent;
|
2015-06-20 23:00:26 +03:00
|
|
|
}
|
2005-10-04 19:47:21 +04:00
|
|
|
|
2015-04-17 21:42:05 +03:00
|
|
|
// If we don't have a baseline on any of the cells we go for the lowest
|
|
|
|
// content edge of the inner block frames.
|
2005-10-04 19:47:21 +04:00
|
|
|
// Every table cell has a cell frame with its border and padding. Inside
|
|
|
|
// the cell is a block frame. The cell is as high as the tallest cell in
|
|
|
|
// the parent row. As a consequence the block frame might not touch both
|
|
|
|
// the top and the bottom padding of it parent cell frame at the same time.
|
2015-04-17 21:42:05 +03:00
|
|
|
//
|
2005-10-04 19:47:21 +04:00
|
|
|
// bbbbbbbbbbbbbbbbbb cell border: b
|
|
|
|
// bppppppppppppppppb cell padding: p
|
|
|
|
// bpxxxxxxxxxxxxxxpb inner block: x
|
|
|
|
// bpx xpb
|
|
|
|
// bpx xpb
|
|
|
|
// bpx xpb
|
|
|
|
// bpxxxxxxxxxxxxxxpb base line
|
|
|
|
// bp pb
|
|
|
|
// bp pb
|
|
|
|
// bppppppppppppppppb
|
|
|
|
// bbbbbbbbbbbbbbbbbb
|
|
|
|
|
|
|
|
nscoord ascent = 0;
|
2015-07-16 12:07:57 +03:00
|
|
|
nsSize containerSize = GetSize();
|
2015-06-23 21:47:45 +03:00
|
|
|
for (nsIFrame* childFrame : mFrames) {
|
2018-09-18 04:29:19 +03:00
|
|
|
if (IsTableCell(childFrame->Type())) {
|
2016-01-29 17:42:14 +03:00
|
|
|
nsIFrame* firstKid = childFrame->PrincipalChildList().FirstChild();
|
2015-06-20 23:00:26 +03:00
|
|
|
ascent = std::max(
|
|
|
|
ascent,
|
|
|
|
LogicalRect(aWM, firstKid->GetNormalRect(), containerSize).BEnd(aWM));
|
2005-10-04 19:47:21 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return ascent;
|
|
|
|
}
|
2015-06-20 23:00:26 +03:00
|
|
|
|
2015-06-23 23:41:31 +03:00
|
|
|
nscoord nsTableRowFrame::GetInitialBSize(nscoord aPctBasis) const {
|
2015-06-20 23:00:26 +03:00
|
|
|
nscoord bsize = 0;
|
|
|
|
if ((aPctBasis > 0) && HasPctBSize()) {
|
|
|
|
bsize = NSToCoordRound(GetPctBSize() * (float)aPctBasis);
|
2001-11-05 03:15:51 +03:00
|
|
|
}
|
2015-06-20 23:00:26 +03:00
|
|
|
if (HasFixedBSize()) {
|
|
|
|
bsize = std::max(bsize, GetFixedBSize());
|
2001-11-05 03:15:51 +03:00
|
|
|
}
|
2015-06-20 23:00:26 +03:00
|
|
|
return std::max(bsize, GetContentBSize());
|
2000-05-26 02:40:21 +04:00
|
|
|
}
|
|
|
|
|
2015-06-20 23:00:26 +03:00
|
|
|
void nsTableRowFrame::ResetBSize(nscoord aFixedBSize) {
|
|
|
|
SetHasFixedBSize(false);
|
|
|
|
SetHasPctBSize(false);
|
|
|
|
SetFixedBSize(0);
|
|
|
|
SetPctBSize(0);
|
|
|
|
SetContentBSize(0);
|
|
|
|
|
|
|
|
if (aFixedBSize > 0) {
|
|
|
|
SetFixedBSize(aFixedBSize);
|
2001-11-05 03:15:51 +03:00
|
|
|
}
|
|
|
|
|
2000-06-05 12:25:11 +04:00
|
|
|
mMaxCellAscent = 0;
|
|
|
|
mMaxCellDescent = 0;
|
2000-05-26 02:40:21 +04:00
|
|
|
}
|
|
|
|
|
2015-06-20 23:00:26 +03:00
|
|
|
void nsTableRowFrame::UpdateBSize(nscoord aBSize, nscoord aAscent,
|
|
|
|
nscoord aDescent, nsTableFrame* aTableFrame,
|
|
|
|
nsTableCellFrame* aCellFrame) {
|
2001-11-05 03:15:51 +03:00
|
|
|
if (!aTableFrame || !aCellFrame) {
|
2011-10-17 18:59:28 +04:00
|
|
|
NS_ASSERTION(false, "invalid call");
|
2001-11-05 03:15:51 +03:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-06-20 23:00:26 +03:00
|
|
|
if (aBSize != NS_UNCONSTRAINEDSIZE) {
|
2000-06-05 12:25:11 +04:00
|
|
|
if (!(aCellFrame->HasVerticalAlignBaseline())) { // only the cell's height
|
|
|
|
// matters
|
2015-06-23 23:41:31 +03:00
|
|
|
if (GetInitialBSize() < aBSize) {
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t rowSpan = aTableFrame->GetEffectiveRowSpan(*aCellFrame);
|
2000-06-05 12:25:11 +04:00
|
|
|
if (rowSpan == 1) {
|
2015-06-20 23:00:26 +03:00
|
|
|
SetContentBSize(aBSize);
|
2000-06-05 12:25:11 +04:00
|
|
|
}
|
|
|
|
}
|
2015-06-20 23:00:26 +03:00
|
|
|
} else { // the alignment on the baseline can change the bsize
|
|
|
|
NS_ASSERTION((aAscent != NS_UNCONSTRAINEDSIZE) &&
|
|
|
|
(aDescent != NS_UNCONSTRAINEDSIZE),
|
|
|
|
"invalid call");
|
2000-06-05 12:25:11 +04:00
|
|
|
// see if this is a long ascender
|
|
|
|
if (mMaxCellAscent < aAscent) {
|
|
|
|
mMaxCellAscent = aAscent;
|
|
|
|
}
|
|
|
|
// see if this is a long descender and without rowspan
|
|
|
|
if (mMaxCellDescent < aDescent) {
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t rowSpan = aTableFrame->GetEffectiveRowSpan(*aCellFrame);
|
2000-06-05 12:25:11 +04:00
|
|
|
if (rowSpan == 1) {
|
|
|
|
mMaxCellDescent = aDescent;
|
|
|
|
}
|
|
|
|
}
|
2015-06-20 23:00:26 +03:00
|
|
|
// keep the tallest bsize in sync
|
2015-06-23 23:41:31 +03:00
|
|
|
if (GetInitialBSize() < mMaxCellAscent + mMaxCellDescent) {
|
2015-06-20 23:00:26 +03:00
|
|
|
SetContentBSize(mMaxCellAscent + mMaxCellDescent);
|
2000-06-05 12:25:11 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
1998-04-14 00:24:54 +04:00
|
|
|
}
|
|
|
|
|
2016-07-21 13:36:39 +03:00
|
|
|
nscoord nsTableRowFrame::CalcBSize(const ReflowInput& aReflowInput) {
|
2015-04-30 07:24:59 +03:00
|
|
|
nsTableFrame* tableFrame = GetTableFrame();
|
2016-07-21 13:36:39 +03:00
|
|
|
nscoord computedBSize = (NS_UNCONSTRAINEDSIZE == aReflowInput.ComputedBSize())
|
|
|
|
? 0
|
|
|
|
: aReflowInput.ComputedBSize();
|
2015-06-20 23:00:26 +03:00
|
|
|
ResetBSize(computedBSize);
|
2000-05-26 02:40:21 +04:00
|
|
|
|
2016-07-21 13:36:39 +03:00
|
|
|
WritingMode wm = aReflowInput.GetWritingMode();
|
2013-02-17 01:51:02 +04:00
|
|
|
const nsStylePosition* position = StylePosition();
|
2019-02-10 15:55:16 +03:00
|
|
|
const auto& bsizeStyleCoord = position->BSize(wm);
|
2015-06-20 23:00:26 +03:00
|
|
|
if (bsizeStyleCoord.ConvertsToLength()) {
|
2019-02-10 15:55:16 +03:00
|
|
|
SetFixedBSize(bsizeStyleCoord.ToLength());
|
|
|
|
} else if (bsizeStyleCoord.ConvertsToPercentage()) {
|
|
|
|
SetPctBSize(bsizeStyleCoord.ToPercentage());
|
2001-11-05 18:15:24 +03:00
|
|
|
}
|
|
|
|
|
2015-06-29 23:02:21 +03:00
|
|
|
for (nsIFrame* kidFrame : mFrames) {
|
2009-03-25 01:10:06 +03:00
|
|
|
nsTableCellFrame* cellFrame = do_QueryFrame(kidFrame);
|
|
|
|
if (cellFrame) {
|
2015-06-20 23:00:26 +03:00
|
|
|
MOZ_ASSERT(cellFrame->GetWritingMode() == wm);
|
2014-07-24 12:30:07 +04:00
|
|
|
LogicalSize desSize = cellFrame->GetDesiredSize();
|
2016-07-21 13:36:39 +03:00
|
|
|
if ((NS_UNCONSTRAINEDSIZE == aReflowInput.AvailableBSize()) &&
|
|
|
|
!GetPrevInFlow()) {
|
2015-06-20 23:00:26 +03:00
|
|
|
CalculateCellActualBSize(cellFrame, desSize.BSize(wm), wm);
|
2001-11-29 18:41:07 +03:00
|
|
|
}
|
2015-06-20 23:00:26 +03:00
|
|
|
// bsize may have changed, adjust descent to absorb any excess difference
|
2005-10-04 19:47:21 +04:00
|
|
|
nscoord ascent;
|
2016-01-29 17:42:14 +03:00
|
|
|
if (!kidFrame->PrincipalChildList()
|
|
|
|
.FirstChild()
|
|
|
|
->PrincipalChildList()
|
|
|
|
.FirstChild())
|
2014-07-24 12:30:07 +04:00
|
|
|
ascent = desSize.BSize(wm);
|
2005-10-04 19:47:21 +04:00
|
|
|
else
|
2009-03-25 01:10:06 +03:00
|
|
|
ascent = cellFrame->GetCellBaseline();
|
2014-07-24 12:30:07 +04:00
|
|
|
nscoord descent = desSize.BSize(wm) - ascent;
|
2015-06-20 23:00:26 +03:00
|
|
|
UpdateBSize(desSize.BSize(wm), ascent, descent, tableFrame, cellFrame);
|
2000-05-26 02:40:21 +04:00
|
|
|
}
|
|
|
|
}
|
2015-06-23 23:41:31 +03:00
|
|
|
return GetInitialBSize();
|
1998-04-14 00:24:54 +04:00
|
|
|
}
|
|
|
|
|
2019-05-21 02:14:45 +03:00
|
|
|
void nsTableRowFrame::PaintCellBackgroundsForFrame(
|
|
|
|
nsIFrame* aFrame, nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsDisplayListSet& aLists, const nsPoint& aOffset) {
|
|
|
|
// Compute background rect by iterating all cell frame.
|
2019-05-21 02:15:54 +03:00
|
|
|
const nsPoint toReferenceFrame = aBuilder->ToReferenceFrame(aFrame);
|
2019-05-21 02:14:45 +03:00
|
|
|
for (nsTableCellFrame* cell = GetFirstCell(); cell;
|
|
|
|
cell = cell->GetNextCell()) {
|
|
|
|
if (!cell->ShouldPaintBackground(aBuilder)) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
auto cellRect =
|
|
|
|
cell->GetRectRelativeToSelf() + cell->GetNormalPosition() + aOffset;
|
|
|
|
if (!aBuilder->GetDirtyRect().Intersects(cellRect)) {
|
|
|
|
continue;
|
|
|
|
}
|
2019-05-21 02:15:54 +03:00
|
|
|
cellRect += toReferenceFrame;
|
2019-05-21 02:14:45 +03:00
|
|
|
nsDisplayBackgroundImage::AppendBackgroundItemsToTop(
|
|
|
|
aBuilder, aFrame, cellRect, aLists.BorderBackground(), true, nullptr,
|
2019-05-21 02:15:54 +03:00
|
|
|
aFrame->GetRectRelativeToSelf() + toReferenceFrame, cell);
|
2019-05-21 02:14:45 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-01-26 05:29:17 +03:00
|
|
|
void nsTableRowFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsDisplayListSet& aLists) {
|
2019-05-21 02:14:52 +03:00
|
|
|
DisplayOutsetBoxShadow(aBuilder, aLists.BorderBackground());
|
2019-05-21 02:14:45 +03:00
|
|
|
|
|
|
|
PaintCellBackgroundsForFrame(this, aBuilder, aLists);
|
|
|
|
|
2019-05-21 02:14:52 +03:00
|
|
|
DisplayInsetBoxShadow(aBuilder, aLists.BorderBackground());
|
2019-05-21 02:14:45 +03:00
|
|
|
|
|
|
|
DisplayOutline(aBuilder, aLists);
|
|
|
|
|
|
|
|
for (nsIFrame* kid : PrincipalChildList()) {
|
|
|
|
BuildDisplayListForChild(aBuilder, kid, aLists);
|
|
|
|
}
|
1998-04-14 00:24:54 +04:00
|
|
|
}
|
|
|
|
|
2016-07-21 13:36:39 +03:00
|
|
|
nsIFrame::LogicalSides nsTableRowFrame::GetLogicalSkipSides(
|
|
|
|
const ReflowInput* aReflowInput) const {
|
2014-05-05 21:55:54 +04:00
|
|
|
if (MOZ_UNLIKELY(StyleBorder()->mBoxDecorationBreak ==
|
2016-08-26 10:14:32 +03:00
|
|
|
StyleBoxDecorationBreak::Clone)) {
|
2014-06-28 14:13:13 +04:00
|
|
|
return LogicalSides();
|
2014-05-05 21:55:54 +04:00
|
|
|
}
|
|
|
|
|
2014-06-28 14:13:13 +04:00
|
|
|
LogicalSides skip;
|
2012-07-30 18:20:58 +04:00
|
|
|
if (nullptr != GetPrevInFlow()) {
|
2014-06-28 14:13:14 +04:00
|
|
|
skip |= eLogicalSideBitsBStart;
|
1998-10-20 21:45:07 +04:00
|
|
|
}
|
2012-07-30 18:20:58 +04:00
|
|
|
if (nullptr != GetNextInFlow()) {
|
2014-06-28 14:13:14 +04:00
|
|
|
skip |= eLogicalSideBitsBEnd;
|
1998-10-20 21:45:07 +04:00
|
|
|
}
|
|
|
|
return skip;
|
|
|
|
}
|
|
|
|
|
2015-06-20 23:00:26 +03:00
|
|
|
// Calculate the cell's actual bsize given its pass2 bsize.
|
|
|
|
// Takes into account the specified bsize (in the style).
|
|
|
|
// Modifies the desired bsize that is passed in.
|
|
|
|
nsresult nsTableRowFrame::CalculateCellActualBSize(nsTableCellFrame* aCellFrame,
|
|
|
|
nscoord& aDesiredBSize,
|
|
|
|
WritingMode aWM) {
|
|
|
|
nscoord specifiedBSize = 0;
|
2015-04-17 21:42:05 +03:00
|
|
|
|
2015-06-20 23:00:26 +03:00
|
|
|
// Get the bsize specified in the style information
|
2013-02-17 01:51:02 +04:00
|
|
|
const nsStylePosition* position = aCellFrame->StylePosition();
|
2001-11-05 03:15:51 +03:00
|
|
|
|
2015-04-30 07:24:59 +03:00
|
|
|
int32_t rowSpan = GetTableFrame()->GetEffectiveRowSpan(*aCellFrame);
|
2015-04-17 21:42:05 +03:00
|
|
|
|
2019-02-10 15:55:16 +03:00
|
|
|
const auto& bsizeStyleCoord = position->BSize(aWM);
|
2019-01-15 22:39:23 +03:00
|
|
|
if (bsizeStyleCoord.ConvertsToLength()) {
|
|
|
|
// In quirks mode, table cell isize should be content-box, but bsize
|
|
|
|
// should be border-box.
|
|
|
|
// Because of this historic anomaly, we do not use quirk.css
|
|
|
|
// (since we can't specify one value of box-sizing for isize and another
|
|
|
|
// for bsize)
|
|
|
|
specifiedBSize = bsizeStyleCoord.ToLength();
|
|
|
|
if (PresContext()->CompatibilityMode() != eCompatibility_NavQuirks &&
|
|
|
|
position->mBoxSizing == StyleBoxSizing::Content) {
|
|
|
|
specifiedBSize +=
|
|
|
|
aCellFrame->GetLogicalUsedBorderAndPadding(aWM).BStartEnd(aWM);
|
2012-11-21 20:19:30 +04:00
|
|
|
}
|
2012-06-30 20:01:31 +04:00
|
|
|
|
2019-01-15 22:39:23 +03:00
|
|
|
if (1 == rowSpan) {
|
|
|
|
SetFixedBSize(specifiedBSize);
|
2012-06-30 20:01:31 +04:00
|
|
|
}
|
2019-02-10 15:55:16 +03:00
|
|
|
} else if (bsizeStyleCoord.ConvertsToPercentage()) {
|
2019-01-15 22:39:23 +03:00
|
|
|
if (1 == rowSpan) {
|
2019-02-10 15:55:16 +03:00
|
|
|
SetPctBSize(bsizeStyleCoord.ToPercentage());
|
1999-08-26 01:49:18 +04:00
|
|
|
}
|
1999-08-22 00:16:32 +04:00
|
|
|
}
|
|
|
|
|
2015-06-20 23:00:26 +03:00
|
|
|
// If the specified bsize is greater than the desired bsize,
|
|
|
|
// then use the specified bsize
|
|
|
|
if (specifiedBSize > aDesiredBSize) {
|
|
|
|
aDesiredBSize = specifiedBSize;
|
|
|
|
}
|
1999-08-22 00:16:32 +04:00
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2015-06-18 12:11:40 +03:00
|
|
|
// Calculates the available isize for the table cell based on the known
|
|
|
|
// column isizes taking into account column spans and column spacing
|
|
|
|
static nscoord CalcAvailISize(nsTableFrame& aTableFrame,
|
2014-06-18 14:47:00 +04:00
|
|
|
nsTableCellFrame& aCellFrame) {
|
2015-06-18 12:11:40 +03:00
|
|
|
nscoord cellAvailISize = 0;
|
2017-10-17 22:39:36 +03:00
|
|
|
uint32_t colIndex = aCellFrame.ColIndex();
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t colspan = aTableFrame.GetEffectiveColSpan(aCellFrame);
|
2009-01-13 22:50:40 +03:00
|
|
|
NS_ASSERTION(colspan > 0, "effective colspan should be positive");
|
2015-06-23 21:44:36 +03:00
|
|
|
nsTableFrame* fifTable =
|
|
|
|
static_cast<nsTableFrame*>(aTableFrame.FirstInFlow());
|
2002-09-09 22:46:06 +04:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
for (int32_t spanX = 0; spanX < colspan; spanX++) {
|
2015-06-23 21:44:36 +03:00
|
|
|
cellAvailISize += fifTable->GetColumnISizeFromFirstInFlow(colIndex + spanX);
|
2009-01-13 22:50:40 +03:00
|
|
|
if (spanX > 0 && aTableFrame.ColumnHasCellSpacingBefore(colIndex + spanX)) {
|
2015-06-18 12:11:40 +03:00
|
|
|
cellAvailISize += aTableFrame.GetColSpacing(colIndex + spanX - 1);
|
2001-10-26 06:30:38 +04:00
|
|
|
}
|
|
|
|
}
|
2015-06-18 12:11:40 +03:00
|
|
|
return cellAvailISize;
|
1999-08-22 00:16:32 +04:00
|
|
|
}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
static nscoord GetSpaceBetween(int32_t aPrevColIndex, int32_t aColIndex,
|
2001-03-13 09:38:59 +03:00
|
|
|
int32_t aColSpan, nsTableFrame& aTableFrame,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aCheckVisibility) {
|
2001-03-13 09:38:59 +03:00
|
|
|
nscoord space = 0;
|
2015-06-23 21:45:17 +03:00
|
|
|
int32_t colIdx;
|
2015-06-23 21:44:36 +03:00
|
|
|
nsTableFrame* fifTable =
|
|
|
|
static_cast<nsTableFrame*>(aTableFrame.FirstInFlow());
|
2015-06-23 21:45:17 +03:00
|
|
|
for (colIdx = aPrevColIndex + 1; aColIndex > colIdx; colIdx++) {
|
2015-06-20 23:00:26 +03:00
|
|
|
bool isCollapsed = false;
|
|
|
|
if (!aCheckVisibility) {
|
2015-06-23 21:45:17 +03:00
|
|
|
space += fifTable->GetColumnISizeFromFirstInFlow(colIdx);
|
2015-06-20 23:00:26 +03:00
|
|
|
} else {
|
2015-06-23 21:45:17 +03:00
|
|
|
nsTableColFrame* colFrame = aTableFrame.GetColFrame(colIdx);
|
2015-06-20 23:00:26 +03:00
|
|
|
const nsStyleVisibility* colVis = colFrame->StyleVisibility();
|
|
|
|
bool collapseCol = (NS_STYLE_VISIBILITY_COLLAPSE == colVis->mVisible);
|
|
|
|
nsIFrame* cgFrame = colFrame->GetParent();
|
|
|
|
const nsStyleVisibility* groupVis = cgFrame->StyleVisibility();
|
|
|
|
bool collapseGroup = (NS_STYLE_VISIBILITY_COLLAPSE == groupVis->mVisible);
|
|
|
|
isCollapsed = collapseCol || collapseGroup;
|
|
|
|
if (!isCollapsed)
|
2015-06-23 21:45:17 +03:00
|
|
|
space += fifTable->GetColumnISizeFromFirstInFlow(colIdx);
|
2015-06-20 23:00:26 +03:00
|
|
|
}
|
2015-06-23 21:45:17 +03:00
|
|
|
if (!isCollapsed && aTableFrame.ColumnHasCellSpacingBefore(colIdx)) {
|
|
|
|
space += aTableFrame.GetColSpacing(colIdx - 1);
|
2001-03-13 09:38:59 +03:00
|
|
|
}
|
1999-04-22 07:51:58 +04:00
|
|
|
}
|
2001-03-13 09:38:59 +03:00
|
|
|
return space;
|
|
|
|
}
|
1999-04-22 07:51:58 +04:00
|
|
|
|
2015-06-20 23:00:26 +03:00
|
|
|
// subtract the bsizes of aRow's prev in flows from the unpaginated bsize
|
2015-12-07 04:15:53 +03:00
|
|
|
static nscoord CalcBSizeFromUnpaginatedBSize(nsTableRowFrame& aRow,
|
2015-06-20 23:00:26 +03:00
|
|
|
WritingMode aWM) {
|
|
|
|
nscoord bsize = 0;
|
2012-01-17 03:38:10 +04:00
|
|
|
nsTableRowFrame* firstInFlow =
|
2013-09-25 15:42:34 +04:00
|
|
|
static_cast<nsTableRowFrame*>(aRow.FirstInFlow());
|
2015-06-20 23:00:26 +03:00
|
|
|
if (firstInFlow->HasUnpaginatedBSize()) {
|
2015-12-07 04:15:53 +03:00
|
|
|
bsize = firstInFlow->GetUnpaginatedBSize();
|
2003-07-07 06:01:29 +04:00
|
|
|
for (nsIFrame* prevInFlow = aRow.GetPrevInFlow(); prevInFlow;
|
2004-09-14 06:28:03 +04:00
|
|
|
prevInFlow = prevInFlow->GetPrevInFlow()) {
|
2015-06-20 23:00:26 +03:00
|
|
|
bsize -= prevInFlow->BSize(aWM);
|
2002-03-27 08:50:24 +03:00
|
|
|
}
|
|
|
|
}
|
2015-06-20 23:00:26 +03:00
|
|
|
return std::max(bsize, 0);
|
2002-03-27 08:50:24 +03:00
|
|
|
}
|
|
|
|
|
2015-06-20 23:00:26 +03:00
|
|
|
void nsTableRowFrame::ReflowChildren(nsPresContext* aPresContext,
|
2016-07-21 13:36:38 +03:00
|
|
|
ReflowOutput& aDesiredSize,
|
2016-07-21 13:36:39 +03:00
|
|
|
const ReflowInput& aReflowInput,
|
2001-03-13 09:38:59 +03:00
|
|
|
nsTableFrame& aTableFrame,
|
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
|
|
|
nsReflowStatus& aStatus) {
|
2017-02-14 12:55:48 +03:00
|
|
|
aStatus.Reset();
|
1998-11-20 04:01:25 +03:00
|
|
|
|
2015-06-20 23:00:26 +03:00
|
|
|
// XXXldb Should we be checking constrained bsize instead?
|
2012-01-17 03:38:10 +04:00
|
|
|
const bool isPaginated = aPresContext->IsPaginated();
|
|
|
|
const bool borderCollapse = aTableFrame.IsBorderCollapse();
|
2014-05-13 04:47:53 +04:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t cellColSpan =
|
|
|
|
1; // must be defined here so it's set properly for non-cell kids
|
2015-04-17 21:42:05 +03:00
|
|
|
|
2001-03-13 09:38:59 +03:00
|
|
|
// remember the col index of the previous cell to handle rowspans into this
|
|
|
|
// row
|
2015-06-23 21:45:17 +03:00
|
|
|
int32_t prevColIndex = -1;
|
2015-06-20 23:00:26 +03:00
|
|
|
nscoord iCoord = 0; // running total of children inline-coord offset
|
1999-05-04 23:15:56 +04:00
|
|
|
|
2015-06-20 23:00:26 +03:00
|
|
|
// This computes the max of all cell bsizes
|
|
|
|
nscoord cellMaxBSize = 0;
|
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
|
|
|
|
1998-07-11 02:56:13 +04:00
|
|
|
// Reflow each of our existing cell frames
|
2016-07-21 13:36:39 +03:00
|
|
|
WritingMode wm = aReflowInput.GetWritingMode();
|
|
|
|
nsSize containerSize = aReflowInput.ComputedSizeAsContainerIfConstrained();
|
2015-06-20 23:00:26 +03:00
|
|
|
|
2015-06-23 21:47:45 +03:00
|
|
|
for (nsIFrame* kidFrame : mFrames) {
|
2009-03-25 01:10:06 +03:00
|
|
|
nsTableCellFrame* cellFrame = do_QueryFrame(kidFrame);
|
|
|
|
if (!cellFrame) {
|
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
|
|
|
// XXXldb nsCSSFrameConstructor needs to enforce this!
|
2018-06-18 08:43:11 +03:00
|
|
|
MOZ_ASSERT_UNREACHABLE("yikes, a non-row child");
|
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
|
|
|
|
|
|
|
// it's an unknown frame type, give it a generic reflow and ignore the
|
|
|
|
// results
|
2016-07-21 13:36:36 +03:00
|
|
|
TableCellReflowInput kidReflowInput(
|
2016-07-21 13:36:39 +03:00
|
|
|
aPresContext, aReflowInput, kidFrame,
|
2014-07-24 12:28:46 +04:00
|
|
|
LogicalSize(kidFrame->GetWritingMode(), 0, 0),
|
2016-07-21 13:36:35 +03:00
|
|
|
ReflowInput::CALLER_WILL_INIT);
|
2016-07-21 13:36:39 +03:00
|
|
|
InitChildReflowInput(*aPresContext, LogicalSize(wm), false,
|
|
|
|
kidReflowInput);
|
|
|
|
ReflowOutput desiredSize(aReflowInput);
|
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
|
|
|
nsReflowStatus status;
|
2016-07-21 13:36:39 +03:00
|
|
|
ReflowChild(kidFrame, aPresContext, desiredSize, kidReflowInput, 0, 0, 0,
|
|
|
|
status);
|
2017-12-14 18:21:49 +03:00
|
|
|
kidFrame->DidReflow(aPresContext, nullptr);
|
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
|
|
|
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
1999-08-03 06:41:27 +04:00
|
|
|
// See if we should only reflow the dirty child frames
|
2011-09-29 10:19:26 +04:00
|
|
|
bool doReflowChild = true;
|
2016-07-21 13:36:39 +03:00
|
|
|
if (!aReflowInput.ShouldReflowAllKids() && !aTableFrame.IsGeometryDirty() &&
|
2007-05-06 23:16:51 +04:00
|
|
|
!NS_SUBTREE_DIRTY(kidFrame)) {
|
2016-07-21 13:36:39 +03:00
|
|
|
if (!aReflowInput.mFlags.mSpecialBSizeReflow) doReflowChild = false;
|
|
|
|
} else if ((NS_UNCONSTRAINEDSIZE != aReflowInput.AvailableBSize())) {
|
2015-06-20 23:00:26 +03:00
|
|
|
// We don't reflow a rowspan >1 cell here with a constrained bsize.
|
2002-10-03 18:33:23 +04:00
|
|
|
// That happens in nsTableRowGroupFrame::SplitSpanningCells.
|
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
|
|
|
if (aTableFrame.GetEffectiveRowSpan(*cellFrame) > 1) {
|
2011-10-17 18:59:28 +04:00
|
|
|
doReflowChild = false;
|
2002-10-03 18:33:23 +04:00
|
|
|
}
|
|
|
|
}
|
2016-07-21 13:36:39 +03:00
|
|
|
if (aReflowInput.mFlags.mSpecialBSizeReflow) {
|
2015-06-23 23:41:29 +03:00
|
|
|
if (!isPaginated &&
|
|
|
|
!cellFrame->HasAnyStateBits(NS_FRAME_CONTAINS_RELATIVE_BSIZE)) {
|
2001-11-05 03:15:51 +03:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
2001-03-13 09:38:59 +03:00
|
|
|
|
2017-10-17 22:39:36 +03:00
|
|
|
uint32_t cellColIndex = cellFrame->ColIndex();
|
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
|
|
|
cellColSpan = aTableFrame.GetEffectiveColSpan(*cellFrame);
|
|
|
|
|
|
|
|
// If the adjacent cell is in a prior row (because of a rowspan) add in the
|
2017-10-17 22:39:36 +03:00
|
|
|
// space NOTE: prevColIndex can be -1 here.
|
|
|
|
if (prevColIndex != (static_cast<int32_t>(cellColIndex) - 1)) {
|
2015-06-20 23:00:26 +03:00
|
|
|
iCoord += GetSpaceBetween(prevColIndex, cellColIndex, cellColSpan,
|
|
|
|
aTableFrame, false);
|
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
|
|
|
}
|
|
|
|
|
|
|
|
// remember the rightmost (ltr) or leftmost (rtl) column this cell spans
|
|
|
|
// into
|
2015-06-20 23:00:26 +03:00
|
|
|
prevColIndex = cellColIndex + (cellColSpan - 1);
|
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
|
|
|
|
1999-08-03 06:41:27 +04:00
|
|
|
// Reflow the child frame
|
2008-02-08 12:36:32 +03:00
|
|
|
nsRect kidRect = kidFrame->GetRect();
|
2015-06-20 23:00:26 +03:00
|
|
|
LogicalPoint origKidNormalPosition =
|
2015-07-16 12:07:57 +03:00
|
|
|
kidFrame->GetLogicalNormalPosition(wm, containerSize);
|
2015-06-20 23:00:26 +03:00
|
|
|
// All cells' no-relative-positioning position should be snapped to the
|
|
|
|
// row's bstart edge.
|
2015-06-27 02:50:21 +03:00
|
|
|
// This doesn't hold in vertical-rl mode, where we don't yet know the
|
2015-07-16 12:07:57 +03:00
|
|
|
// correct containerSize for the row frame. In that case, we'll have to
|
2015-06-27 02:50:21 +03:00
|
|
|
// fix up child positions later, after determining our desiredSize.
|
|
|
|
NS_ASSERTION(origKidNormalPosition.B(wm) == 0 || wm.IsVerticalRL(),
|
|
|
|
"unexpected kid position");
|
|
|
|
|
2012-08-29 09:48:45 +04:00
|
|
|
nsRect kidVisualOverflow = kidFrame->GetVisualOverflowRect();
|
2015-06-20 23:00:26 +03:00
|
|
|
LogicalPoint kidPosition(wm, iCoord, 0);
|
2015-06-23 23:41:29 +03:00
|
|
|
bool firstReflow = kidFrame->HasAnyStateBits(NS_FRAME_FIRST_REFLOW);
|
2008-02-08 12:36:32 +03:00
|
|
|
|
1999-08-03 06:41:27 +04:00
|
|
|
if (doReflowChild) {
|
2015-06-18 12:11:40 +03:00
|
|
|
// Calculate the available isize for the table cell using the known
|
|
|
|
// column isizes
|
2015-06-20 23:00:26 +03:00
|
|
|
nscoord availCellISize = CalcAvailISize(aTableFrame, *cellFrame);
|
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
|
|
|
|
2016-07-21 13:36:39 +03:00
|
|
|
Maybe<TableCellReflowInput> kidReflowInput;
|
|
|
|
ReflowOutput desiredSize(aReflowInput);
|
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
|
|
|
|
2015-06-18 12:11:40 +03:00
|
|
|
// If the avail isize is not the same as last time we reflowed the cell or
|
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
|
|
|
// the cell wants to be bigger than what was available last time or
|
|
|
|
// it is a style change reflow or we are printing, then we must reflow the
|
|
|
|
// cell. Otherwise we can skip the reflow.
|
|
|
|
// XXXldb Why is this condition distinct from doReflowChild above?
|
2016-07-21 13:36:39 +03:00
|
|
|
WritingMode wm = aReflowInput.GetWritingMode();
|
2015-06-18 12:11:40 +03:00
|
|
|
NS_ASSERTION(cellFrame->GetWritingMode() == wm,
|
|
|
|
"expected consistent writing-mode within table");
|
2014-07-24 12:30:07 +04:00
|
|
|
LogicalSize cellDesiredSize = cellFrame->GetDesiredSize();
|
2015-06-23 23:41:29 +03:00
|
|
|
if ((availCellISize != cellFrame->GetPriorAvailISize()) ||
|
2015-06-18 12:11:40 +03:00
|
|
|
(cellDesiredSize.ISize(wm) > cellFrame->GetPriorAvailISize()) ||
|
2015-06-23 23:41:29 +03:00
|
|
|
HasAnyStateBits(NS_FRAME_IS_DIRTY) || isPaginated ||
|
|
|
|
NS_SUBTREE_DIRTY(cellFrame) ||
|
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
|
|
|
// See if it needs a special reflow, or if it had one that we need to
|
|
|
|
// undo.
|
2015-06-23 23:41:29 +03:00
|
|
|
cellFrame->HasAnyStateBits(NS_FRAME_CONTAINS_RELATIVE_BSIZE) ||
|
2015-06-20 23:00:26 +03:00
|
|
|
HasPctBSize()) {
|
2015-06-18 12:11:40 +03:00
|
|
|
// Reflow the cell to fit the available isize, bsize
|
|
|
|
// XXX The old IR_ChildIsDirty code used availCellISize here.
|
2016-07-21 13:36:39 +03:00
|
|
|
LogicalSize kidAvailSize(wm, availCellISize,
|
|
|
|
aReflowInput.AvailableBSize());
|
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
|
|
|
|
|
|
|
// Reflow the child
|
2016-07-21 13:36:39 +03:00
|
|
|
kidReflowInput.emplace(aPresContext, aReflowInput, kidFrame,
|
2016-07-21 13:36:35 +03:00
|
|
|
kidAvailSize, ReflowInput::CALLER_WILL_INIT);
|
2016-07-21 13:36:39 +03:00
|
|
|
InitChildReflowInput(*aPresContext, kidAvailSize, borderCollapse,
|
|
|
|
*kidReflowInput);
|
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
|
|
|
|
|
|
|
nsReflowStatus status;
|
2016-07-21 13:36:39 +03:00
|
|
|
ReflowChild(kidFrame, aPresContext, desiredSize, *kidReflowInput, wm,
|
2015-07-16 12:07:57 +03:00
|
|
|
kidPosition, containerSize, 0, status);
|
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
|
|
|
|
|
|
|
// allow the table to determine if/how the table needs to be rebalanced
|
|
|
|
// If any of the cells are not complete, then we're not complete
|
2017-02-11 17:17:26 +03:00
|
|
|
if (status.IsIncomplete()) {
|
2017-02-14 12:30:56 +03:00
|
|
|
aStatus.Reset();
|
|
|
|
aStatus.SetIncomplete();
|
1998-10-06 04:27:22 +04:00
|
|
|
}
|
2015-06-20 23:00:26 +03:00
|
|
|
} else {
|
|
|
|
if (iCoord != origKidNormalPosition.I(wm)) {
|
2010-08-31 04:49:12 +04:00
|
|
|
kidFrame->InvalidateFrameSubtree();
|
2008-02-08 12:36:32 +03:00
|
|
|
}
|
2015-04-17 21:42:05 +03:00
|
|
|
|
2015-06-18 12:11:40 +03:00
|
|
|
desiredSize.SetSize(wm, cellDesiredSize);
|
2010-10-07 08:25:46 +04:00
|
|
|
desiredSize.mOverflowAreas = cellFrame->GetOverflowAreas();
|
|
|
|
|
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
|
|
|
// if we are in a floated table, our position is not yet established, so
|
2009-02-13 02:10:59 +03:00
|
|
|
// we cannot reposition our views the containing block will do this for
|
|
|
|
// us after positioning the table
|
2012-08-02 15:38:49 +04:00
|
|
|
if (!aTableFrame.IsFloating()) {
|
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
|
|
|
// Because we may have moved the frame we need to make sure any views
|
|
|
|
// are positioned properly. We have to do this, because any one of our
|
|
|
|
// parent frames could have moved and we have no way of knowing...
|
|
|
|
nsTableFrame::RePositionViews(kidFrame);
|
2001-11-15 17:58:27 +03:00
|
|
|
}
|
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
|
|
|
}
|
2015-04-17 21:42:05 +03:00
|
|
|
|
2016-07-21 13:36:39 +03:00
|
|
|
if (NS_UNCONSTRAINEDSIZE == aReflowInput.AvailableBSize()) {
|
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
|
|
|
if (!GetPrevInFlow()) {
|
2015-06-20 23:00:26 +03:00
|
|
|
// Calculate the cell's actual bsize given its pass2 bsize. This
|
|
|
|
// function takes into account the specified bsize (in the style)
|
|
|
|
CalculateCellActualBSize(cellFrame, desiredSize.BSize(wm), wm);
|
2001-11-15 17:58:27 +03:00
|
|
|
}
|
2015-06-20 23:00:26 +03:00
|
|
|
// bsize may have changed, adjust descent to absorb any excess
|
|
|
|
// difference
|
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
|
|
|
nscoord ascent;
|
2016-01-29 17:42:14 +03:00
|
|
|
if (!kidFrame->PrincipalChildList()
|
|
|
|
.FirstChild()
|
|
|
|
->PrincipalChildList()
|
|
|
|
.FirstChild()) {
|
2015-06-18 12:11:40 +03:00
|
|
|
ascent = desiredSize.BSize(wm);
|
2014-07-24 12:30:07 +04:00
|
|
|
} else {
|
2007-01-23 07:06:56 +03:00
|
|
|
ascent = ((nsTableCellFrame*)kidFrame)->GetCellBaseline();
|
2014-07-24 12:30:07 +04:00
|
|
|
}
|
2015-06-18 12:11:40 +03:00
|
|
|
nscoord descent = desiredSize.BSize(wm) - ascent;
|
2015-06-20 23:00:26 +03:00
|
|
|
UpdateBSize(desiredSize.BSize(wm), ascent, descent, &aTableFrame,
|
|
|
|
cellFrame);
|
|
|
|
} else {
|
|
|
|
cellMaxBSize = std::max(cellMaxBSize, desiredSize.BSize(wm));
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t rowSpan =
|
|
|
|
aTableFrame.GetEffectiveRowSpan((nsTableCellFrame&)*kidFrame);
|
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
|
|
|
if (1 == rowSpan) {
|
2015-06-20 23:00:26 +03:00
|
|
|
SetContentBSize(cellMaxBSize);
|
2001-10-26 06:30:38 +04:00
|
|
|
}
|
1998-09-16 04:48:14 +04:00
|
|
|
}
|
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
|
|
|
|
|
|
|
// Place the child
|
2015-06-18 12:11:40 +03:00
|
|
|
desiredSize.ISize(wm) = availCellISize;
|
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
|
|
|
|
2016-07-21 13:36:39 +03:00
|
|
|
if (kidReflowInput) {
|
2014-08-20 05:24:58 +04:00
|
|
|
// We reflowed. Apply relative positioning in the normal way.
|
2016-07-21 13:36:39 +03:00
|
|
|
kidReflowInput->ApplyRelativePositioning(&kidPosition, containerSize);
|
2014-12-29 03:42:54 +03:00
|
|
|
} else if (kidFrame->IsRelativelyPositioned()) {
|
|
|
|
// We didn't reflow. Do the positioning part of what
|
|
|
|
// MovePositionBy does internally. (This codepath should really
|
|
|
|
// be merged into the else below if we can.)
|
2016-06-21 23:17:11 +03:00
|
|
|
nsMargin* computedOffsetProp =
|
2017-05-27 14:36:00 +03:00
|
|
|
kidFrame->GetProperty(nsIFrame::ComputedOffsetProperty());
|
2017-11-29 18:11:25 +03:00
|
|
|
|
|
|
|
// On our fist reflow sticky children may not have the property yet (we
|
|
|
|
// need to reflow the children first to size the scroll frame).
|
|
|
|
LogicalMargin computedOffsets(
|
|
|
|
wm, computedOffsetProp ? *computedOffsetProp : nsMargin());
|
|
|
|
ReflowInput::ApplyRelativePositioning(kidFrame, wm, computedOffsets,
|
|
|
|
&kidPosition, containerSize);
|
2014-08-20 05:24:58 +04:00
|
|
|
}
|
2015-06-20 23:00:26 +03:00
|
|
|
|
2015-07-16 12:07:57 +03:00
|
|
|
// In vertical-rl mode, we are likely to have containerSize.width = 0
|
|
|
|
// because ComputedWidth() was NS_UNCONSTRAINEDSIZE.
|
2015-06-20 23:00:26 +03:00
|
|
|
// For cases where that's wrong, we will fix up the position later.
|
2014-08-20 05:24:58 +04:00
|
|
|
FinishReflowChild(kidFrame, aPresContext, desiredSize, nullptr, wm,
|
2015-07-16 12:07:57 +03:00
|
|
|
kidPosition, containerSize, 0);
|
2012-07-04 04:24:55 +04:00
|
|
|
|
2017-06-09 05:46:34 +03:00
|
|
|
nsTableFrame* tableFrame = GetTableFrame();
|
|
|
|
if (tableFrame->IsBorderCollapse()) {
|
|
|
|
nsTableFrame::InvalidateTableFrame(kidFrame, kidRect, kidVisualOverflow,
|
|
|
|
firstReflow);
|
|
|
|
}
|
2015-04-17 21:42:05 +03:00
|
|
|
|
2015-06-20 23:00:26 +03:00
|
|
|
iCoord += desiredSize.ISize(wm);
|
|
|
|
} else {
|
|
|
|
if (iCoord != origKidNormalPosition.I(wm)) {
|
2008-02-08 12:36:32 +03:00
|
|
|
// Invalidate the old position
|
2010-08-31 04:49:12 +04:00
|
|
|
kidFrame->InvalidateFrameSubtree();
|
2014-08-20 05:24:58 +04:00
|
|
|
// Move to the new position. As above, we need to account for relative
|
|
|
|
// positioning.
|
2015-06-20 23:00:26 +03:00
|
|
|
kidFrame->MovePositionBy(
|
|
|
|
wm, LogicalPoint(wm, iCoord - origKidNormalPosition.I(wm), 0));
|
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
|
|
|
nsTableFrame::RePositionViews(kidFrame);
|
2008-02-08 12:36:32 +03:00
|
|
|
// invalidate the new position
|
2010-08-31 04:49:12 +04:00
|
|
|
kidFrame->InvalidateFrameSubtree();
|
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
|
|
|
}
|
2015-06-20 23:00:26 +03:00
|
|
|
// we need to account for the cell's isize even if it isn't reflowed
|
|
|
|
iCoord += kidFrame->ISize(wm);
|
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
|
|
|
|
|
|
|
if (kidFrame->GetNextInFlow()) {
|
2017-02-14 12:30:56 +03:00
|
|
|
aStatus.Reset();
|
|
|
|
aStatus.SetIncomplete();
|
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
|
|
|
}
|
2000-11-15 17:59:47 +03:00
|
|
|
}
|
2010-10-07 08:25:46 +04:00
|
|
|
ConsiderChildOverflow(aDesiredSize.mOverflowAreas, kidFrame);
|
2015-06-20 23:00:26 +03:00
|
|
|
iCoord += aTableFrame.GetColSpacing(cellColIndex);
|
1998-09-16 21:19:20 +04:00
|
|
|
}
|
|
|
|
|
2015-06-20 23:00:26 +03:00
|
|
|
// Just set our isize to what was available.
|
|
|
|
// The table will calculate the isize and not use our value.
|
2016-07-21 13:36:39 +03:00
|
|
|
aDesiredSize.ISize(wm) = aReflowInput.AvailableISize();
|
2002-03-27 08:50:24 +03:00
|
|
|
|
2016-07-21 13:36:39 +03:00
|
|
|
if (aReflowInput.mFlags.mSpecialBSizeReflow) {
|
2015-06-20 23:00:26 +03:00
|
|
|
aDesiredSize.BSize(wm) = BSize(wm);
|
2016-07-21 13:36:39 +03:00
|
|
|
} else if (NS_UNCONSTRAINEDSIZE == aReflowInput.AvailableBSize()) {
|
|
|
|
aDesiredSize.BSize(wm) = CalcBSize(aReflowInput);
|
2006-02-22 00:33:47 +03:00
|
|
|
if (GetPrevInFlow()) {
|
2015-12-07 04:15:53 +03:00
|
|
|
nscoord bsize = CalcBSizeFromUnpaginatedBSize(*this, wm);
|
2015-06-20 23:00:26 +03:00
|
|
|
aDesiredSize.BSize(wm) = std::max(aDesiredSize.BSize(wm), bsize);
|
|
|
|
} else {
|
|
|
|
if (isPaginated && HasStyleBSize()) {
|
|
|
|
// set the unpaginated bsize so next in flows can try to honor it
|
|
|
|
SetHasUnpaginatedBSize(true);
|
|
|
|
SetUnpaginatedBSize(aPresContext, aDesiredSize.BSize(wm));
|
2002-03-27 08:50:24 +03:00
|
|
|
}
|
2015-06-20 23:00:26 +03:00
|
|
|
if (isPaginated && HasUnpaginatedBSize()) {
|
|
|
|
aDesiredSize.BSize(wm) =
|
|
|
|
std::max(aDesiredSize.BSize(wm), GetUnpaginatedBSize());
|
2002-03-27 08:50:24 +03:00
|
|
|
}
|
|
|
|
}
|
2015-06-20 23:00:26 +03:00
|
|
|
} else { // constrained bsize, paginated
|
|
|
|
// Compute the bsize we should have from style (subtracting the
|
|
|
|
// bsize from our prev-in-flows from the style bsize)
|
2015-12-07 04:15:53 +03:00
|
|
|
nscoord styleBSize = CalcBSizeFromUnpaginatedBSize(*this, wm);
|
2016-07-21 13:36:39 +03:00
|
|
|
if (styleBSize > aReflowInput.AvailableBSize()) {
|
|
|
|
styleBSize = aReflowInput.AvailableBSize();
|
2017-02-11 18:06:17 +03:00
|
|
|
aStatus.SetIncomplete();
|
2015-06-20 23:00:26 +03:00
|
|
|
}
|
2015-06-20 23:00:26 +03:00
|
|
|
aDesiredSize.BSize(wm) = std::max(cellMaxBSize, styleBSize);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (wm.IsVerticalRL()) {
|
|
|
|
// Any children whose width was not the same as our final
|
|
|
|
// aDesiredSize.BSize will have been misplaced earlier at the
|
|
|
|
// FinishReflowChild stage. So fix them up now.
|
2015-06-23 21:47:45 +03:00
|
|
|
for (nsIFrame* kidFrame : mFrames) {
|
2015-06-20 23:00:26 +03:00
|
|
|
nsTableCellFrame* cellFrame = do_QueryFrame(kidFrame);
|
|
|
|
if (!cellFrame) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (kidFrame->BSize(wm) != aDesiredSize.BSize(wm)) {
|
|
|
|
kidFrame->MovePositionBy(
|
|
|
|
wm,
|
|
|
|
LogicalPoint(wm, 0, kidFrame->BSize(wm) - aDesiredSize.BSize(wm)));
|
|
|
|
nsTableFrame::RePositionViews(kidFrame);
|
|
|
|
// Do we need to InvalidateFrameSubtree() here?
|
|
|
|
}
|
|
|
|
}
|
2002-03-27 08:50:24 +03:00
|
|
|
}
|
2015-06-20 23:00:26 +03:00
|
|
|
|
2010-10-07 08:25:46 +04:00
|
|
|
aDesiredSize.UnionOverflowAreasWithDesiredBounds();
|
2004-07-16 20:56:21 +04:00
|
|
|
FinishAndStoreOverflow(&aDesiredSize);
|
1998-04-23 21:29:07 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/** Layout the entire row.
|
2015-06-20 23:00:26 +03:00
|
|
|
* This method stacks cells in the inline dir according to HTML 4.0 rules.
|
1998-04-23 21:29:07 +04:00
|
|
|
*/
|
2015-06-20 23:00:26 +03:00
|
|
|
void nsTableRowFrame::Reflow(nsPresContext* aPresContext,
|
2016-07-21 13:36:38 +03:00
|
|
|
ReflowOutput& aDesiredSize,
|
2016-07-21 13:36:39 +03:00
|
|
|
const ReflowInput& aReflowInput,
|
1998-10-02 08:10:00 +04:00
|
|
|
nsReflowStatus& aStatus) {
|
2015-03-30 01:38:40 +03:00
|
|
|
MarkInReflow();
|
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
|
|
|
DO_GLOBAL_REFLOW_COUNT("nsTableRowFrame");
|
2016-07-21 13:36:39 +03:00
|
|
|
DISPLAY_REFLOW(aPresContext, this, aReflowInput, aDesiredSize, aStatus);
|
2017-09-13 13:00:25 +03:00
|
|
|
MOZ_ASSERT(aStatus.IsEmpty(), "Caller should pass a fresh reflow status!");
|
1998-04-14 00:24:54 +04:00
|
|
|
|
2016-07-21 13:36:39 +03:00
|
|
|
WritingMode wm = aReflowInput.GetWritingMode();
|
2015-06-20 23:00:26 +03:00
|
|
|
|
2015-04-30 07:24:59 +03:00
|
|
|
nsTableFrame* tableFrame = GetTableFrame();
|
2013-02-17 01:51:02 +04:00
|
|
|
const nsStyleVisibility* rowVis = StyleVisibility();
|
2011-09-29 10:19:26 +04:00
|
|
|
bool collapseRow = (NS_STYLE_VISIBILITY_COLLAPSE == rowVis->mVisible);
|
2004-04-28 20:42:59 +04:00
|
|
|
if (collapseRow) {
|
2011-10-17 18:59:28 +04:00
|
|
|
tableFrame->SetNeedToCollapse(true);
|
2004-04-28 20:42:59 +04:00
|
|
|
}
|
|
|
|
|
2015-06-22 12:33:34 +03:00
|
|
|
// see if a special bsize reflow needs to occur due to having a pct bsize
|
2016-07-21 13:36:39 +03:00
|
|
|
nsTableFrame::CheckRequestSpecialBSizeReflow(aReflowInput);
|
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
|
|
|
|
2015-06-20 23:00:26 +03:00
|
|
|
// See if we have a cell with specified/pct bsize
|
|
|
|
InitHasCellWithStyleBSize(tableFrame);
|
2007-06-26 00:34:35 +04:00
|
|
|
|
2016-07-21 13:36:39 +03:00
|
|
|
ReflowChildren(aPresContext, aDesiredSize, aReflowInput, *tableFrame,
|
|
|
|
aStatus);
|
1998-07-02 09:39:10 +04:00
|
|
|
|
2017-02-11 17:38:48 +03:00
|
|
|
if (aPresContext->IsPaginated() && !aStatus.IsFullyComplete() &&
|
2016-07-21 13:36:39 +03:00
|
|
|
ShouldAvoidBreakInside(aReflowInput)) {
|
2017-02-14 06:52:53 +03:00
|
|
|
aStatus.SetInlineLineBreakBeforeAndReset();
|
2012-11-08 20:09:38 +04:00
|
|
|
}
|
|
|
|
|
2015-06-20 23:00:26 +03:00
|
|
|
// Just set our isize to what was available.
|
|
|
|
// The table will calculate the isize and not use our value.
|
2016-07-21 13:36:39 +03:00
|
|
|
aDesiredSize.ISize(wm) = aReflowInput.AvailableISize();
|
1999-08-31 02:30:32 +04:00
|
|
|
|
2012-08-29 09:48:45 +04:00
|
|
|
// If our parent is in initial reflow, it'll handle invalidating our
|
|
|
|
// entire overflow rect.
|
2015-06-23 23:41:29 +03:00
|
|
|
if (!GetParent()->HasAnyStateBits(NS_FRAME_FIRST_REFLOW) &&
|
2013-12-27 21:59:52 +04:00
|
|
|
nsSize(aDesiredSize.Width(), aDesiredSize.Height()) != mRect.Size()) {
|
2012-08-29 09:48:45 +04:00
|
|
|
InvalidateFrame();
|
|
|
|
}
|
|
|
|
|
2014-08-21 04:48:56 +04:00
|
|
|
// Any absolutely-positioned children will get reflowed in
|
|
|
|
// nsFrame::FixupPositionedTableParts in another pass, so propagate our
|
|
|
|
// dirtiness to them before our parent clears our dirty bits.
|
|
|
|
PushDirtyBitToAbsoluteFrames();
|
|
|
|
|
2016-07-21 13:36:39 +03:00
|
|
|
NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aDesiredSize);
|
1998-04-14 00:24:54 +04:00
|
|
|
}
|
|
|
|
|
1999-02-22 06:28:00 +03:00
|
|
|
/**
|
|
|
|
* This function is called by the row group frame's SplitRowGroup() code when
|
|
|
|
* pushing a row frame that has cell frames that span into it. The cell frame
|
|
|
|
* should be reflowed with the specified height
|
|
|
|
*/
|
2015-06-20 23:00:26 +03:00
|
|
|
nscoord nsTableRowFrame::ReflowCellFrame(nsPresContext* aPresContext,
|
2016-07-21 13:36:39 +03:00
|
|
|
const ReflowInput& aReflowInput,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aIsTopOfPage,
|
2001-04-16 18:51:52 +04:00
|
|
|
nsTableCellFrame* aCellFrame,
|
2015-06-20 23:00:26 +03:00
|
|
|
nscoord aAvailableBSize,
|
2001-04-16 18:51:52 +04:00
|
|
|
nsReflowStatus& aStatus) {
|
2016-07-21 13:36:39 +03:00
|
|
|
WritingMode wm = aReflowInput.GetWritingMode();
|
2015-06-18 12:11:40 +03:00
|
|
|
|
1999-02-22 06:28:00 +03:00
|
|
|
// Reflow the cell frame with the specified height. Use the existing width
|
2015-07-16 12:07:57 +03:00
|
|
|
nsSize containerSize = aCellFrame->GetSize();
|
|
|
|
LogicalRect cellRect = aCellFrame->GetLogicalRect(wm, containerSize);
|
2010-10-07 08:25:46 +04:00
|
|
|
nsRect cellVisualOverflow = aCellFrame->GetVisualOverflowRect();
|
2015-04-17 21:42:05 +03:00
|
|
|
|
2015-06-20 23:00:26 +03:00
|
|
|
LogicalSize cellSize = cellRect.Size(wm);
|
|
|
|
LogicalSize availSize(wm, cellRect.ISize(wm), aAvailableBSize);
|
2015-04-30 07:24:59 +03:00
|
|
|
bool borderCollapse = GetTableFrame()->IsBorderCollapse();
|
2015-06-18 12:11:40 +03:00
|
|
|
NS_ASSERTION(aCellFrame->GetWritingMode() == wm,
|
|
|
|
"expected consistent writing-mode within table");
|
2016-07-21 13:36:39 +03:00
|
|
|
TableCellReflowInput cellReflowInput(aPresContext, aReflowInput, aCellFrame,
|
|
|
|
availSize,
|
2016-07-21 13:36:35 +03:00
|
|
|
ReflowInput::CALLER_WILL_INIT);
|
2016-07-21 13:36:39 +03:00
|
|
|
InitChildReflowInput(*aPresContext, availSize, borderCollapse,
|
|
|
|
cellReflowInput);
|
|
|
|
cellReflowInput.mFlags.mIsTopOfPage = aIsTopOfPage;
|
2002-02-19 18:48:28 +03:00
|
|
|
|
2016-07-21 13:36:39 +03:00
|
|
|
ReflowOutput desiredSize(aReflowInput);
|
1999-02-22 06:28:00 +03:00
|
|
|
|
2016-07-21 13:36:39 +03:00
|
|
|
ReflowChild(aCellFrame, aPresContext, desiredSize, cellReflowInput, 0, 0,
|
1999-11-19 18:33:29 +03:00
|
|
|
NS_FRAME_NO_MOVE_FRAME, aStatus);
|
2017-02-13 11:16:44 +03:00
|
|
|
bool fullyComplete = aStatus.IsComplete() && !aStatus.IsTruncated();
|
2007-12-02 22:19:00 +03:00
|
|
|
if (fullyComplete) {
|
2015-06-20 23:00:26 +03:00
|
|
|
desiredSize.BSize(wm) = aAvailableBSize;
|
2007-12-02 22:19:00 +03:00
|
|
|
}
|
2015-06-20 23:00:26 +03:00
|
|
|
aCellFrame->SetSize(
|
|
|
|
wm, LogicalSize(wm, cellSize.ISize(wm), desiredSize.BSize(wm)));
|
2001-04-16 18:51:52 +04:00
|
|
|
|
2015-06-18 12:11:40 +03:00
|
|
|
// Note: BlockDirAlignChild can affect the overflow rect.
|
2000-06-05 12:25:11 +04:00
|
|
|
// XXX What happens if this cell has 'vertical-align: baseline' ?
|
|
|
|
// XXX Why is it assumed that the cell's ascent hasn't changed ?
|
2002-10-03 18:33:23 +04:00
|
|
|
if (fullyComplete) {
|
2015-06-18 12:11:40 +03:00
|
|
|
aCellFrame->BlockDirAlignChild(wm, mMaxCellAscent);
|
2002-10-03 18:33:23 +04:00
|
|
|
}
|
2015-04-17 21:42:05 +03:00
|
|
|
|
2015-06-20 23:00:26 +03:00
|
|
|
nsTableFrame::InvalidateTableFrame(
|
2015-07-16 12:07:57 +03:00
|
|
|
aCellFrame, cellRect.GetPhysicalRect(wm, containerSize),
|
2015-06-23 23:41:29 +03:00
|
|
|
cellVisualOverflow, aCellFrame->HasAnyStateBits(NS_FRAME_FIRST_REFLOW));
|
2015-04-17 21:42:05 +03:00
|
|
|
|
2017-12-14 18:21:49 +03:00
|
|
|
aCellFrame->DidReflow(aPresContext, nullptr);
|
2001-04-16 18:51:52 +04:00
|
|
|
|
2015-06-20 23:00:26 +03:00
|
|
|
return desiredSize.BSize(wm);
|
1999-02-22 06:28:00 +03:00
|
|
|
}
|
|
|
|
|
2006-03-04 08:26:57 +03:00
|
|
|
nscoord nsTableRowFrame::CollapseRowIfNecessary(nscoord aRowOffset,
|
2015-06-20 23:00:26 +03:00
|
|
|
nscoord aISize,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aCollapseGroup,
|
2015-06-20 23:00:26 +03:00
|
|
|
bool& aDidCollapse) {
|
2013-02-17 01:51:02 +04:00
|
|
|
const nsStyleVisibility* rowVis = StyleVisibility();
|
2011-09-29 10:19:26 +04:00
|
|
|
bool collapseRow = (NS_STYLE_VISIBILITY_COLLAPSE == rowVis->mVisible);
|
2015-04-30 07:24:59 +03:00
|
|
|
nsTableFrame* tableFrame =
|
|
|
|
static_cast<nsTableFrame*>(GetTableFrame()->FirstInFlow());
|
2006-03-04 08:26:57 +03:00
|
|
|
if (collapseRow) {
|
2011-10-17 18:59:28 +04:00
|
|
|
tableFrame->SetNeedToCollapse(true);
|
2006-03-04 08:26:57 +03:00
|
|
|
}
|
|
|
|
|
2008-02-08 12:36:32 +03:00
|
|
|
if (aRowOffset != 0) {
|
|
|
|
// We're moving, so invalidate our old position
|
2010-08-31 04:49:12 +04:00
|
|
|
InvalidateFrameSubtree();
|
2008-02-08 12:36:32 +03:00
|
|
|
}
|
2015-04-17 21:42:05 +03:00
|
|
|
|
2015-06-20 23:00:26 +03:00
|
|
|
WritingMode wm = GetWritingMode();
|
|
|
|
|
2015-07-16 12:07:57 +03:00
|
|
|
nsSize parentSize = GetParent()->GetSize();
|
|
|
|
LogicalRect rowRect = GetLogicalRect(wm, parentSize);
|
2015-06-20 23:00:26 +03:00
|
|
|
nsRect oldRect = mRect;
|
2012-08-29 09:48:45 +04:00
|
|
|
nsRect oldVisualOverflow = GetVisualOverflowRect();
|
2015-04-17 21:42:05 +03:00
|
|
|
|
2015-06-20 23:00:26 +03:00
|
|
|
rowRect.BStart(wm) -= aRowOffset;
|
|
|
|
rowRect.ISize(wm) = aISize;
|
2010-10-07 08:25:45 +04:00
|
|
|
nsOverflowAreas overflow;
|
2006-03-04 08:26:57 +03:00
|
|
|
nscoord shift = 0;
|
2015-07-16 12:07:57 +03:00
|
|
|
nsSize containerSize = mRect.Size();
|
2006-03-26 19:58:34 +04:00
|
|
|
|
2006-03-04 08:26:57 +03:00
|
|
|
if (aCollapseGroup || collapseRow) {
|
2011-10-17 18:59:28 +04:00
|
|
|
aDidCollapse = true;
|
2015-06-20 23:00:26 +03:00
|
|
|
shift = rowRect.BSize(wm);
|
2014-07-01 21:58:13 +04:00
|
|
|
nsTableCellFrame* cellFrame = GetFirstCell();
|
|
|
|
if (cellFrame) {
|
2017-10-17 22:39:36 +03:00
|
|
|
uint32_t rowIndex = cellFrame->RowIndex();
|
2015-03-20 07:16:00 +03:00
|
|
|
shift += tableFrame->GetRowSpacing(rowIndex);
|
2014-07-01 21:58:13 +04:00
|
|
|
while (cellFrame) {
|
2015-07-16 12:07:57 +03:00
|
|
|
LogicalRect cRect = cellFrame->GetLogicalRect(wm, containerSize);
|
2014-07-01 21:58:13 +04:00
|
|
|
// If aRowOffset != 0, there's no point in invalidating the cells, since
|
|
|
|
// we've already invalidated our overflow area. Note that we _do_ still
|
|
|
|
// need to invalidate if our row is not moving, because the cell might
|
|
|
|
// span out of this row, so invalidating our row rect won't do enough.
|
|
|
|
if (aRowOffset == 0) {
|
|
|
|
InvalidateFrame();
|
|
|
|
}
|
2015-06-20 23:00:26 +03:00
|
|
|
cRect.BSize(wm) = 0;
|
2015-07-16 12:07:57 +03:00
|
|
|
cellFrame->SetRect(wm, cRect, containerSize);
|
2014-07-01 21:58:13 +04:00
|
|
|
cellFrame = cellFrame->GetNextCell();
|
2008-02-08 12:36:32 +03:00
|
|
|
}
|
2014-07-01 21:58:13 +04:00
|
|
|
} else {
|
2015-03-20 07:16:00 +03:00
|
|
|
shift += tableFrame->GetRowSpacing(GetRowIndex());
|
2006-03-04 08:26:57 +03:00
|
|
|
}
|
2015-06-20 23:00:26 +03:00
|
|
|
rowRect.BSize(wm) = 0;
|
2006-03-04 08:26:57 +03:00
|
|
|
} else { // row is not collapsed
|
|
|
|
// remember the col index of the previous cell to handle rowspans into this
|
|
|
|
// row
|
2015-06-23 21:45:17 +03:00
|
|
|
int32_t prevColIndex = -1;
|
2015-06-20 23:00:26 +03:00
|
|
|
nscoord iPos = 0; // running total of children inline-axis offset
|
2015-06-23 21:44:36 +03:00
|
|
|
nsTableFrame* fifTable =
|
|
|
|
static_cast<nsTableFrame*>(tableFrame->FirstInFlow());
|
2006-03-04 08:26:57 +03:00
|
|
|
|
2015-06-23 21:47:45 +03:00
|
|
|
for (nsIFrame* kidFrame : mFrames) {
|
2009-03-25 01:10:06 +03:00
|
|
|
nsTableCellFrame* cellFrame = do_QueryFrame(kidFrame);
|
|
|
|
if (cellFrame) {
|
2017-10-17 22:39:36 +03:00
|
|
|
uint32_t cellColIndex = cellFrame->ColIndex();
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t cellColSpan = tableFrame->GetEffectiveColSpan(*cellFrame);
|
2006-03-04 08:26:57 +03:00
|
|
|
|
|
|
|
// If the adjacent cell is in a prior row (because of a rowspan) add in
|
|
|
|
// the space
|
2017-10-17 22:39:36 +03:00
|
|
|
// NOTE: prevColIndex can be -1 here.
|
|
|
|
if (prevColIndex != (static_cast<int32_t>(cellColIndex) - 1)) {
|
2015-06-20 23:00:26 +03:00
|
|
|
iPos += GetSpaceBetween(prevColIndex, cellColIndex, cellColSpan,
|
|
|
|
*tableFrame, true);
|
2006-03-04 08:26:57 +03:00
|
|
|
}
|
2015-06-20 23:00:26 +03:00
|
|
|
LogicalRect cRect(wm, iPos, 0, 0, rowRect.BSize(wm));
|
|
|
|
|
|
|
|
// remember the last (iend-wards-most) column this cell spans into
|
|
|
|
prevColIndex = cellColIndex + cellColSpan - 1;
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t actualColSpan = cellColSpan;
|
2011-09-29 10:19:26 +04:00
|
|
|
bool isVisible = false;
|
2015-06-23 21:45:17 +03:00
|
|
|
for (int32_t colIdx = cellColIndex; actualColSpan > 0;
|
|
|
|
colIdx++, actualColSpan--) {
|
|
|
|
nsTableColFrame* colFrame = tableFrame->GetColFrame(colIdx);
|
2013-02-17 01:51:02 +04:00
|
|
|
const nsStyleVisibility* colVis = colFrame->StyleVisibility();
|
2011-09-29 10:19:26 +04:00
|
|
|
bool collapseCol = (NS_STYLE_VISIBILITY_COLLAPSE == colVis->mVisible);
|
2006-03-04 08:26:57 +03:00
|
|
|
nsIFrame* cgFrame = colFrame->GetParent();
|
2013-02-17 01:51:02 +04:00
|
|
|
const nsStyleVisibility* groupVis = cgFrame->StyleVisibility();
|
2011-09-29 10:19:26 +04:00
|
|
|
bool collapseGroup =
|
|
|
|
(NS_STYLE_VISIBILITY_COLLAPSE == groupVis->mVisible);
|
|
|
|
bool isCollapsed = collapseCol || collapseGroup;
|
2009-05-16 18:22:56 +04:00
|
|
|
if (!isCollapsed) {
|
2015-06-23 21:45:17 +03:00
|
|
|
cRect.ISize(wm) += fifTable->GetColumnISizeFromFirstInFlow(colIdx);
|
2011-10-17 18:59:28 +04:00
|
|
|
isVisible = true;
|
2009-05-16 18:22:56 +04:00
|
|
|
if ((actualColSpan > 1)) {
|
|
|
|
nsTableColFrame* nextColFrame =
|
2015-06-23 21:45:17 +03:00
|
|
|
tableFrame->GetColFrame(colIdx + 1);
|
2009-05-16 18:22:56 +04:00
|
|
|
const nsStyleVisibility* nextColVis =
|
2013-02-17 01:51:02 +04:00
|
|
|
nextColFrame->StyleVisibility();
|
2009-05-16 18:22:56 +04:00
|
|
|
if ((NS_STYLE_VISIBILITY_COLLAPSE != nextColVis->mVisible) &&
|
2015-06-23 21:45:17 +03:00
|
|
|
tableFrame->ColumnHasCellSpacingBefore(colIdx + 1)) {
|
2015-06-20 23:00:26 +03:00
|
|
|
cRect.ISize(wm) += tableFrame->GetColSpacing(cellColIndex);
|
2009-05-16 18:22:56 +04:00
|
|
|
}
|
2006-03-04 08:26:57 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-06-20 23:00:26 +03:00
|
|
|
iPos += cRect.ISize(wm);
|
|
|
|
if (isVisible) {
|
|
|
|
iPos += tableFrame->GetColSpacing(cellColIndex);
|
|
|
|
}
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t actualRowSpan = tableFrame->GetEffectiveRowSpan(*cellFrame);
|
2006-03-04 08:26:57 +03:00
|
|
|
nsTableRowFrame* rowFrame = GetNextRow();
|
|
|
|
for (actualRowSpan--; actualRowSpan > 0 && rowFrame; actualRowSpan--) {
|
2013-02-17 01:51:02 +04:00
|
|
|
const nsStyleVisibility* nextRowVis = rowFrame->StyleVisibility();
|
2011-09-29 10:19:26 +04:00
|
|
|
bool collapseNextRow =
|
|
|
|
(NS_STYLE_VISIBILITY_COLLAPSE == nextRowVis->mVisible);
|
2006-03-04 08:26:57 +03:00
|
|
|
if (!collapseNextRow) {
|
2015-06-20 23:00:26 +03:00
|
|
|
LogicalRect nextRect = rowFrame->GetLogicalRect(wm, containerSize);
|
|
|
|
cRect.BSize(wm) +=
|
|
|
|
nextRect.BSize(wm) +
|
|
|
|
tableFrame->GetRowSpacing(rowFrame->GetRowIndex());
|
2006-03-04 08:26:57 +03:00
|
|
|
}
|
|
|
|
rowFrame = rowFrame->GetNextRow();
|
|
|
|
}
|
2008-02-08 12:36:32 +03:00
|
|
|
|
|
|
|
nsRect oldCellRect = cellFrame->GetRect();
|
2015-06-20 23:00:26 +03:00
|
|
|
LogicalPoint oldCellNormalPos =
|
2015-07-16 12:07:57 +03:00
|
|
|
cellFrame->GetLogicalNormalPosition(wm, containerSize);
|
2015-06-20 23:00:26 +03:00
|
|
|
|
2010-10-07 08:25:46 +04:00
|
|
|
nsRect oldCellVisualOverflow = cellFrame->GetVisualOverflowRect();
|
2008-02-08 12:36:32 +03:00
|
|
|
|
2015-06-20 23:00:26 +03:00
|
|
|
if (aRowOffset == 0 && cRect.Origin(wm) != oldCellNormalPos) {
|
2008-02-08 12:36:32 +03:00
|
|
|
// We're moving the cell. Invalidate the old overflow area
|
2010-08-31 04:49:12 +04:00
|
|
|
cellFrame->InvalidateFrameSubtree();
|
2008-02-08 12:36:32 +03:00
|
|
|
}
|
2015-04-17 21:42:05 +03:00
|
|
|
|
2015-06-20 23:00:26 +03:00
|
|
|
cellFrame->MovePositionBy(wm, cRect.Origin(wm) - oldCellNormalPos);
|
|
|
|
cellFrame->SetSize(wm, cRect.Size(wm));
|
2008-02-08 12:36:32 +03:00
|
|
|
|
|
|
|
// XXXbz This looks completely bogus in the cases when we didn't
|
|
|
|
// collapse the cell!
|
2015-06-20 23:00:26 +03:00
|
|
|
LogicalRect cellBounds(wm, 0, 0, cRect.ISize(wm), cRect.BSize(wm));
|
|
|
|
nsRect cellPhysicalBounds =
|
2015-07-16 12:07:57 +03:00
|
|
|
cellBounds.GetPhysicalRect(wm, containerSize);
|
2015-06-20 23:00:26 +03:00
|
|
|
nsOverflowAreas cellOverflow(cellPhysicalBounds, cellPhysicalBounds);
|
|
|
|
cellFrame->FinishAndStoreOverflow(cellOverflow,
|
|
|
|
cRect.Size(wm).GetPhysicalSize(wm));
|
2006-03-04 08:26:57 +03:00
|
|
|
nsTableFrame::RePositionViews(cellFrame);
|
2010-10-07 08:25:45 +04:00
|
|
|
ConsiderChildOverflow(overflow, cellFrame);
|
2015-04-17 21:42:05 +03:00
|
|
|
|
2012-08-29 09:48:45 +04:00
|
|
|
if (aRowOffset == 0) {
|
|
|
|
nsTableFrame::InvalidateTableFrame(cellFrame, oldCellRect,
|
2015-06-20 23:00:26 +03:00
|
|
|
oldCellVisualOverflow, false);
|
2012-08-29 09:48:45 +04:00
|
|
|
}
|
2006-03-04 08:26:57 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2008-02-08 12:36:32 +03:00
|
|
|
|
2015-07-16 12:07:57 +03:00
|
|
|
SetRect(wm, rowRect, containerSize);
|
2015-06-20 23:00:26 +03:00
|
|
|
overflow.UnionAllWith(nsRect(0, 0, rowRect.Width(wm), rowRect.Height(wm)));
|
|
|
|
FinishAndStoreOverflow(overflow, rowRect.Size(wm).GetPhysicalSize(wm));
|
2008-02-08 12:36:32 +03:00
|
|
|
|
2006-03-04 08:26:57 +03:00
|
|
|
nsTableFrame::RePositionViews(this);
|
2012-08-29 09:48:45 +04:00
|
|
|
nsTableFrame::InvalidateTableFrame(this, oldRect, oldVisualOverflow, false);
|
2006-03-04 08:26:57 +03:00
|
|
|
return shift;
|
|
|
|
}
|
|
|
|
|
2009-09-05 01:07:43 +04:00
|
|
|
/*
|
|
|
|
* The following method is called by the row group frame's SplitRowGroup()
|
|
|
|
* when it creates a continuing cell frame and wants to insert it into the
|
|
|
|
* row's child list.
|
1999-02-22 06:28:00 +03:00
|
|
|
*/
|
2001-04-16 18:51:52 +04:00
|
|
|
void nsTableRowFrame::InsertCellFrame(nsTableCellFrame* aFrame,
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t aColIndex) {
|
2001-04-16 18:51:52 +04:00
|
|
|
// Find the cell frame where col index < aColIndex
|
2012-07-30 18:20:58 +04:00
|
|
|
nsTableCellFrame* priorCell = nullptr;
|
2015-06-29 23:02:21 +03:00
|
|
|
for (nsIFrame* child : mFrames) {
|
2009-03-25 01:10:06 +03:00
|
|
|
nsTableCellFrame* cellFrame = do_QueryFrame(child);
|
|
|
|
if (cellFrame) {
|
2017-10-17 22:39:36 +03:00
|
|
|
uint32_t colIndex = cellFrame->ColIndex();
|
|
|
|
// Can aColIndex be -1 here? Let's assume it can for now.
|
|
|
|
if (static_cast<int32_t>(colIndex) < aColIndex) {
|
2001-04-16 18:51:52 +04:00
|
|
|
priorCell = cellFrame;
|
|
|
|
} else
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2009-09-05 01:07:43 +04:00
|
|
|
mFrames.InsertFrame(this, priorCell, aFrame);
|
1999-02-22 06:28:00 +03:00
|
|
|
}
|
|
|
|
|
2001-11-05 03:15:51 +03:00
|
|
|
nsTableRowFrame* nsTableRowFrame::GetNextRow() const {
|
2003-07-07 06:01:29 +04:00
|
|
|
nsIFrame* childFrame = GetNextSibling();
|
2001-11-05 03:15:51 +03:00
|
|
|
while (childFrame) {
|
2009-03-25 01:10:06 +03:00
|
|
|
nsTableRowFrame* rowFrame = do_QueryFrame(childFrame);
|
|
|
|
if (rowFrame) {
|
2016-08-28 05:31:50 +03:00
|
|
|
NS_ASSERTION(mozilla::StyleDisplay::TableRow ==
|
|
|
|
childFrame->StyleDisplay()->mDisplay,
|
|
|
|
"wrong display type on rowframe");
|
2009-03-25 01:10:06 +03:00
|
|
|
return rowFrame;
|
2001-11-05 03:15:51 +03:00
|
|
|
}
|
2003-07-07 06:01:29 +04:00
|
|
|
childFrame = childFrame->GetNextSibling();
|
2001-11-05 03:15:51 +03:00
|
|
|
}
|
2012-07-30 18:20:58 +04:00
|
|
|
return nullptr;
|
2001-11-05 03:15:51 +03:00
|
|
|
}
|
1999-02-24 08:54:31 +03:00
|
|
|
|
2016-01-28 06:23:59 +03:00
|
|
|
NS_DECLARE_FRAME_PROPERTY_SMALL_VALUE(RowUnpaginatedHeightProperty, nscoord)
|
2010-03-29 05:46:55 +04:00
|
|
|
|
2015-06-20 23:00:26 +03:00
|
|
|
void nsTableRowFrame::SetUnpaginatedBSize(nsPresContext* aPresContext,
|
|
|
|
nscoord aValue) {
|
2006-02-22 00:33:47 +03:00
|
|
|
NS_ASSERTION(!GetPrevInFlow(), "program error");
|
2017-05-27 14:36:00 +03:00
|
|
|
// Set the property
|
|
|
|
SetProperty(RowUnpaginatedHeightProperty(), aValue);
|
2001-11-29 18:41:07 +03:00
|
|
|
}
|
|
|
|
|
2015-12-07 04:15:53 +03:00
|
|
|
nscoord nsTableRowFrame::GetUnpaginatedBSize() {
|
2017-05-27 14:36:00 +03:00
|
|
|
return GetProperty(RowUnpaginatedHeightProperty());
|
2001-11-29 18:41:07 +03:00
|
|
|
}
|
|
|
|
|
2015-05-04 10:09:25 +03:00
|
|
|
void nsTableRowFrame::SetContinuousBCBorderWidth(LogicalSide aForSide,
|
2004-03-09 09:48:35 +03:00
|
|
|
BCPixelSize aPixelValue) {
|
|
|
|
switch (aForSide) {
|
2015-05-04 10:09:25 +03:00
|
|
|
case eLogicalSideIEnd:
|
|
|
|
mIEndContBorderWidth = aPixelValue;
|
2004-03-09 09:48:35 +03:00
|
|
|
return;
|
2015-05-04 10:09:25 +03:00
|
|
|
case eLogicalSideBStart:
|
|
|
|
mBStartContBorderWidth = aPixelValue;
|
2004-03-09 09:48:35 +03:00
|
|
|
return;
|
2015-05-04 10:09:25 +03:00
|
|
|
case eLogicalSideIStart:
|
|
|
|
mIStartContBorderWidth = aPixelValue;
|
2004-03-09 09:48:35 +03:00
|
|
|
return;
|
|
|
|
default:
|
2017-01-24 13:41:56 +03:00
|
|
|
NS_ERROR("invalid LogicalSide arg");
|
2004-03-09 09:48:35 +03:00
|
|
|
}
|
|
|
|
}
|
2012-04-25 07:06:21 +04:00
|
|
|
#ifdef ACCESSIBILITY
|
2012-09-29 01:53:44 +04:00
|
|
|
a11y::AccType nsTableRowFrame::AccessibleType() {
|
2012-12-18 05:25:52 +04:00
|
|
|
return a11y::eHTMLTableRowType;
|
2012-04-25 07:06:21 +04:00
|
|
|
}
|
|
|
|
#endif
|
2007-06-26 00:34:35 +04:00
|
|
|
/**
|
2015-06-22 12:33:34 +03:00
|
|
|
* Sets the NS_ROW_HAS_CELL_WITH_STYLE_BSIZE bit to indicate whether
|
|
|
|
* this row has any cells that have non-auto-bsize. (Row-spanning
|
2007-06-26 00:34:35 +04:00
|
|
|
* cells are ignored.)
|
|
|
|
*/
|
2015-06-20 23:00:26 +03:00
|
|
|
void nsTableRowFrame::InitHasCellWithStyleBSize(nsTableFrame* aTableFrame) {
|
|
|
|
WritingMode wm = GetWritingMode();
|
2007-06-26 00:34:35 +04:00
|
|
|
|
2015-06-23 21:47:45 +03:00
|
|
|
for (nsIFrame* kidFrame : mFrames) {
|
2009-03-25 01:10:06 +03:00
|
|
|
nsTableCellFrame* cellFrame = do_QueryFrame(kidFrame);
|
|
|
|
if (!cellFrame) {
|
2018-06-18 08:43:11 +03:00
|
|
|
MOZ_ASSERT_UNREACHABLE("Table row has a non-cell child.");
|
2007-06-26 00:34:35 +04:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
// Ignore row-spanning cells
|
2019-02-10 15:55:16 +03:00
|
|
|
const auto& cellBSize = cellFrame->StylePosition()->BSize(wm);
|
2007-06-26 00:34:35 +04:00
|
|
|
if (aTableFrame->GetEffectiveRowSpan(*cellFrame) == 1 &&
|
2019-02-10 15:55:16 +03:00
|
|
|
!cellBSize.IsAuto() &&
|
2019-01-15 22:39:23 +03:00
|
|
|
/* calc() with both percentages and lengths treated like 'auto' */
|
2019-02-10 15:55:16 +03:00
|
|
|
(cellBSize.ConvertsToLength() || cellBSize.ConvertsToPercentage())) {
|
2015-06-22 12:33:34 +03:00
|
|
|
AddStateBits(NS_ROW_HAS_CELL_WITH_STYLE_BSIZE);
|
2007-06-26 00:34:35 +04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2015-06-22 12:33:34 +03:00
|
|
|
RemoveStateBits(NS_ROW_HAS_CELL_WITH_STYLE_BSIZE);
|
2007-06-26 00:34:35 +04:00
|
|
|
}
|
2015-04-17 21:42:05 +03:00
|
|
|
|
2018-04-04 07:15:49 +03:00
|
|
|
void nsTableRowFrame::InvalidateFrame(uint32_t aDisplayItemKey,
|
|
|
|
bool aRebuildDisplayItems) {
|
|
|
|
nsIFrame::InvalidateFrame(aDisplayItemKey, aRebuildDisplayItems);
|
2018-06-07 11:31:38 +03:00
|
|
|
if (GetTableFrame()->IsBorderCollapse()) {
|
2018-04-04 07:15:49 +03:00
|
|
|
GetParent()->InvalidateFrameWithRect(
|
|
|
|
GetVisualOverflowRect() + GetPosition(), aDisplayItemKey, false);
|
2017-11-07 08:47:13 +03:00
|
|
|
}
|
2012-08-29 09:48:45 +04:00
|
|
|
}
|
|
|
|
|
2018-04-04 07:15:49 +03:00
|
|
|
void nsTableRowFrame::InvalidateFrameWithRect(const nsRect& aRect,
|
|
|
|
uint32_t aDisplayItemKey,
|
|
|
|
bool aRebuildDisplayItems) {
|
|
|
|
nsIFrame::InvalidateFrameWithRect(aRect, aDisplayItemKey,
|
|
|
|
aRebuildDisplayItems);
|
2012-08-29 09:48:45 +04:00
|
|
|
// If we have filters applied that would affects our bounds, then
|
|
|
|
// we get an inactive layer created and this is computed
|
|
|
|
// within FrameLayerBuilder
|
2018-04-04 07:15:49 +03:00
|
|
|
GetParent()->InvalidateFrameWithRect(aRect + GetPosition(), aDisplayItemKey,
|
|
|
|
false);
|
2012-08-29 09:39:31 +04:00
|
|
|
}
|
2007-06-26 00:34:35 +04:00
|
|
|
|
1998-09-15 21:58:24 +04:00
|
|
|
/* ----- global methods ----- */
|
|
|
|
|
2019-04-16 10:24:49 +03:00
|
|
|
nsTableRowFrame* NS_NewTableRowFrame(PresShell* aPresShell,
|
2018-03-22 21:20:41 +03:00
|
|
|
ComputedStyle* aStyle) {
|
2019-02-05 19:45:54 +03:00
|
|
|
return new (aPresShell) nsTableRowFrame(aStyle, aPresShell->GetPresContext());
|
1998-04-14 00:24:54 +04:00
|
|
|
}
|
|
|
|
|
2009-09-12 20:49:24 +04:00
|
|
|
NS_IMPL_FRAMEARENA_HELPERS(nsTableRowFrame)
|
|
|
|
|
2014-01-06 03:31:14 +04:00
|
|
|
#ifdef DEBUG_FRAME_DUMP
|
2001-11-14 04:33:42 +03:00
|
|
|
nsresult nsTableRowFrame::GetFrameName(nsAString& aResult) const {
|
|
|
|
return MakeFrameName(NS_LITERAL_STRING("TableRow"), aResult);
|
1998-11-19 20:22:29 +03:00
|
|
|
}
|
1999-09-01 05:02:16 +04:00
|
|
|
#endif
|