2001-09-28 20:14:13 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 11:12:37 +00:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
1998-04-13 20:24:54 +00:00
|
|
|
#include "nsTableRowFrame.h"
|
2001-11-05 15:15:24 +00:00
|
|
|
#include "nsTableRowGroupFrame.h"
|
1999-07-28 08:09:02 +00:00
|
|
|
#include "nsIPresShell.h"
|
2004-07-31 23:15:21 +00:00
|
|
|
#include "nsPresContext.h"
|
2003-02-22 00:32:13 +00:00
|
|
|
#include "nsStyleContext.h"
|
1998-04-13 20:24:54 +00:00
|
|
|
#include "nsStyleConsts.h"
|
2007-01-30 00:06:41 +00:00
|
|
|
#include "nsGkAtoms.h"
|
1998-04-13 20:24:54 +00:00
|
|
|
#include "nsIContent.h"
|
|
|
|
#include "nsTableFrame.h"
|
|
|
|
#include "nsTableCellFrame.h"
|
1998-07-20 23:56:17 +00:00
|
|
|
#include "nsCSSRendering.h"
|
1999-07-28 08:09:02 +00:00
|
|
|
#include "nsHTMLParts.h"
|
|
|
|
#include "nsTableColGroupFrame.h"
|
|
|
|
#include "nsTableColFrame.h"
|
|
|
|
#include "nsCOMPtr.h"
|
2006-01-26 02:29:17 +00:00
|
|
|
#include "nsDisplayList.h"
|
2013-10-01 21:00:38 +00:00
|
|
|
#include "nsIFrameInlines.h"
|
2013-01-15 12:22:03 +00:00
|
|
|
#include <algorithm>
|
1998-04-23 17:29:07 +00:00
|
|
|
|
2010-03-29 01:46:55 +00:00
|
|
|
using namespace mozilla;
|
|
|
|
|
2000-05-04 23:16:42 +00:00
|
|
|
struct nsTableCellReflowState : public nsHTMLReflowState
|
|
|
|
{
|
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 05:38:33 +00:00
|
|
|
nsTableCellReflowState(nsPresContext* aPresContext,
|
2000-05-04 23:16:42 +00:00
|
|
|
const nsHTMLReflowState& aParentReflowState,
|
|
|
|
nsIFrame* aFrame,
|
|
|
|
const nsSize& aAvailableSpace,
|
2013-09-09 20:29:05 +00:00
|
|
|
uint32_t aFlags = 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 05:38:33 +00:00
|
|
|
: nsHTMLReflowState(aPresContext, aParentReflowState, aFrame,
|
2013-09-09 20:29:05 +00:00
|
|
|
aAvailableSpace, -1, -1, aFlags)
|
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 05:38:33 +00:00
|
|
|
{
|
|
|
|
}
|
2000-05-04 23:16:42 +00: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 05:38:33 +00:00
|
|
|
void FixUp(const nsSize& aAvailSpace);
|
2000-05-04 23:16:42 +00: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 05:38:33 +00:00
|
|
|
void nsTableCellReflowState::FixUp(const nsSize& aAvailSpace)
|
2000-05-04 23:16:42 +00:00
|
|
|
{
|
2002-02-19 15:48:28 +00:00
|
|
|
// fix the mComputed values during a pass 2 reflow since the cell can be a percentage base
|
2009-10-29 03:22:28 +00:00
|
|
|
NS_WARN_IF_FALSE(NS_UNCONSTRAINEDSIZE != aAvailSpace.width,
|
|
|
|
"have unconstrained width; this should only result from "
|
|
|
|
"very large sizes, not attempts at intrinsic width "
|
|
|
|
"calculation");
|
2007-01-26 00:05:12 +00:00
|
|
|
if (NS_UNCONSTRAINEDSIZE != ComputedWidth()) {
|
2007-08-02 18:08:05 +00:00
|
|
|
nscoord computedWidth =
|
|
|
|
aAvailSpace.width - mComputedBorderPadding.LeftRight();
|
2013-01-15 12:22:03 +00:00
|
|
|
computedWidth = std::max(0, computedWidth);
|
2007-01-26 00:05:12 +00:00
|
|
|
SetComputedWidth(computedWidth);
|
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 05:38:33 +00:00
|
|
|
}
|
2007-08-02 18:08:05 +00:00
|
|
|
if (NS_UNCONSTRAINEDSIZE != ComputedHeight() &&
|
|
|
|
NS_UNCONSTRAINEDSIZE != aAvailSpace.height) {
|
|
|
|
nscoord computedHeight =
|
|
|
|
aAvailSpace.height - mComputedBorderPadding.TopBottom();
|
2013-01-15 12:22:03 +00:00
|
|
|
computedHeight = std::max(0, computedHeight);
|
2007-08-02 18:08:05 +00:00
|
|
|
SetComputedHeight(computedHeight);
|
2002-02-19 15:48:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-07-31 23:15:21 +00:00
|
|
|
nsTableRowFrame::InitChildReflowState(nsPresContext& aPresContext,
|
2002-02-19 15:48:28 +00:00
|
|
|
const nsSize& aAvailSize,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool aBorderCollapse,
|
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 05:38:33 +00:00
|
|
|
nsTableCellReflowState& aReflowState)
|
2002-02-19 15:48:28 +00:00
|
|
|
{
|
|
|
|
nsMargin collapseBorder;
|
2012-07-30 14:20:58 +00:00
|
|
|
nsMargin* pCollapseBorder = nullptr;
|
2002-02-19 15:48:28 +00:00
|
|
|
if (aBorderCollapse) {
|
|
|
|
// we only reflow cells, so don't need to check frame type
|
|
|
|
nsBCTableCellFrame* bcCellFrame = (nsBCTableCellFrame*)aReflowState.frame;
|
|
|
|
if (bcCellFrame) {
|
2007-02-07 07:46:44 +00:00
|
|
|
pCollapseBorder = bcCellFrame->GetBorderWidth(collapseBorder);
|
2002-02-19 15:48:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
aReflowState.Init(&aPresContext, -1, -1, pCollapseBorder);
|
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 05:38:33 +00:00
|
|
|
aReflowState.FixUp(aAvailSize);
|
2000-05-04 23:16:42 +00:00
|
|
|
}
|
|
|
|
|
2001-11-05 00:15:51 +00:00
|
|
|
void
|
|
|
|
nsTableRowFrame::SetFixedHeight(nscoord aValue)
|
|
|
|
{
|
2013-01-15 12:22:03 +00:00
|
|
|
nscoord height = std::max(0, aValue);
|
2003-01-05 14:16:58 +00:00
|
|
|
if (HasFixedHeight()) {
|
|
|
|
if (height > mStyleFixedHeight) {
|
|
|
|
mStyleFixedHeight = height;
|
2001-11-05 00:15:51 +00:00
|
|
|
}
|
2003-01-05 14:16:58 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
mStyleFixedHeight = height;
|
|
|
|
if (height > 0) {
|
2011-10-17 14:59:28 +00:00
|
|
|
SetHasFixedHeight(true);
|
2001-11-05 00:15:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2001-11-05 15:15:24 +00:00
|
|
|
nsTableRowFrame::SetPctHeight(float aPctValue,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool aForce)
|
2001-11-05 00:15:51 +00:00
|
|
|
{
|
2013-01-15 12:22:03 +00:00
|
|
|
nscoord height = std::max(0, NSToCoordRound(aPctValue * 100.0f));
|
2001-11-05 00:15:51 +00:00
|
|
|
if (HasPctHeight()) {
|
2003-01-05 14:16:58 +00:00
|
|
|
if ((height > mStylePctHeight) || aForce) {
|
|
|
|
mStylePctHeight = height;
|
2001-11-05 00:15:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
2003-01-05 14:16:58 +00:00
|
|
|
mStylePctHeight = height;
|
2012-01-22 22:48:34 +00:00
|
|
|
if (height > 0) {
|
2011-10-17 14:59:28 +00:00
|
|
|
SetHasPctHeight(true);
|
2001-11-05 00:15:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ----------- nsTableRowFrame ---------- */
|
1998-04-23 17:29:07 +00:00
|
|
|
|
2009-03-24 22:10:06 +00:00
|
|
|
NS_QUERYFRAME_HEAD(nsTableRowFrame)
|
|
|
|
NS_QUERYFRAME_ENTRY(nsTableRowFrame)
|
2011-12-27 20:18:48 +00:00
|
|
|
NS_QUERYFRAME_TAIL_INHERITING(nsContainerFrame)
|
2009-03-24 22:10:06 +00:00
|
|
|
|
2006-03-26 21:30:36 +00:00
|
|
|
nsTableRowFrame::nsTableRowFrame(nsStyleContext* aContext)
|
2011-12-27 20:18:48 +00:00
|
|
|
: nsContainerFrame(aContext)
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
2001-11-05 00:15:51 +00:00
|
|
|
mBits.mRowIndex = mBits.mFirstInserted = 0;
|
|
|
|
ResetHeight(0);
|
2001-01-25 15:55:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nsTableRowFrame::~nsTableRowFrame()
|
|
|
|
{
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
2013-03-20 01:47:48 +00:00
|
|
|
void
|
2014-05-24 22:20:40 +00:00
|
|
|
nsTableRowFrame::Init(nsIContent* aContent,
|
|
|
|
nsContainerFrame* aParent,
|
|
|
|
nsIFrame* aPrevInFlow)
|
1999-02-25 05:31:15 +00:00
|
|
|
{
|
2005-11-20 22:05:24 +00:00
|
|
|
// Let the base class do its initialization
|
2013-03-20 01:47:48 +00:00
|
|
|
nsContainerFrame::Init(aContent, aParent, aPrevInFlow);
|
1999-02-25 05:31:15 +00:00
|
|
|
|
2013-02-16 21:51:02 +00:00
|
|
|
NS_ASSERTION(NS_STYLE_DISPLAY_TABLE_ROW == StyleDisplay()->mDisplay,
|
2008-08-14 03:49:57 +00:00
|
|
|
"wrong display on table row frame");
|
|
|
|
|
1999-02-25 05:31:15 +00:00
|
|
|
if (aPrevInFlow) {
|
|
|
|
// Set the row index
|
|
|
|
nsTableRowFrame* rowFrame = (nsTableRowFrame*)aPrevInFlow;
|
|
|
|
|
|
|
|
SetRowIndex(rowFrame->GetRowIndex());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-03-10 22:41:17 +00:00
|
|
|
void
|
|
|
|
nsTableRowFrame::DestroyFrom(nsIFrame* aDestructRoot)
|
|
|
|
{
|
|
|
|
if (GetStateBits() & NS_FRAME_CAN_HAVE_ABSPOS_CHILDREN) {
|
|
|
|
nsTableFrame::UnregisterPositionedTablePart(this, aDestructRoot);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsContainerFrame::DestroyFrom(aDestructRoot);
|
|
|
|
}
|
|
|
|
|
2008-10-26 10:11:34 +00:00
|
|
|
/* virtual */ void
|
|
|
|
nsTableRowFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext)
|
|
|
|
{
|
2012-08-13 21:13:34 +00:00
|
|
|
nsContainerFrame::DidSetStyleContext(aOldStyleContext);
|
|
|
|
|
2008-10-26 10:11:34 +00:00
|
|
|
if (!aOldStyleContext) //avoid this on init
|
|
|
|
return;
|
|
|
|
|
|
|
|
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
|
|
|
if (tableFrame->IsBorderCollapse() &&
|
2013-02-16 05:38:33 +00:00
|
|
|
tableFrame->BCRecalcNeeded(aOldStyleContext, StyleContext())) {
|
2012-01-22 22:48:34 +00:00
|
|
|
nsIntRect damageArea(0, GetRowIndex(), tableFrame->GetColCount(), 1);
|
2011-10-27 13:58:44 +00:00
|
|
|
tableFrame->AddBCDamageArea(damageArea);
|
2008-10-26 10:11:34 +00:00
|
|
|
}
|
|
|
|
}
|
1999-08-03 02:41:27 +00:00
|
|
|
|
2014-05-28 19:36:58 +00:00
|
|
|
void
|
2011-08-24 20:54:30 +00:00
|
|
|
nsTableRowFrame::AppendFrames(ChildListID aListID,
|
2009-07-30 17:23:32 +00:00
|
|
|
nsFrameList& aFrameList)
|
1999-08-03 02:41:27 +00:00
|
|
|
{
|
2011-08-24 20:54:30 +00:00
|
|
|
NS_ASSERTION(aListID == kPrincipalList, "unexpected child list");
|
2006-06-29 02:32:36 +00:00
|
|
|
|
2012-07-30 14:20:58 +00:00
|
|
|
const nsFrameList::Slice& newCells = mFrames.AppendFrames(nullptr, aFrameList);
|
1999-08-03 02:41:27 +00:00
|
|
|
|
|
|
|
// Add the new cell frames to the table
|
2012-01-16 23:38:10 +00:00
|
|
|
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
2009-07-30 17:23:32 +00:00
|
|
|
for (nsFrameList::Enumerator e(newCells) ; !e.AtEnd(); e.Next()) {
|
2011-12-27 08:31:22 +00:00
|
|
|
nsIFrame *childFrame = e.get();
|
|
|
|
NS_ASSERTION(IS_TABLE_CELL(childFrame->GetType()),"Not a table cell frame/pseudo frame construction failure");
|
|
|
|
tableFrame->AppendCell(static_cast<nsTableCellFrame&>(*childFrame), GetRowIndex());
|
1999-08-03 02:41:27 +00:00
|
|
|
}
|
|
|
|
|
2007-05-06 19:16:51 +00:00
|
|
|
PresContext()->PresShell()->FrameNeedsReflow(this, nsIPresShell::eTreeChange,
|
|
|
|
NS_FRAME_HAS_DIRTY_CHILDREN);
|
2006-12-13 03:45:28 +00:00
|
|
|
tableFrame->SetGeometryDirty();
|
1999-08-03 02:41:27 +00:00
|
|
|
}
|
|
|
|
|
1999-12-13 22:56:31 +00:00
|
|
|
|
2014-05-28 19:36:58 +00:00
|
|
|
void
|
2011-08-24 20:54:30 +00:00
|
|
|
nsTableRowFrame::InsertFrames(ChildListID aListID,
|
1999-08-03 02:41:27 +00:00
|
|
|
nsIFrame* aPrevFrame,
|
2009-07-30 17:23:32 +00:00
|
|
|
nsFrameList& aFrameList)
|
1999-08-03 02:41:27 +00:00
|
|
|
{
|
2011-08-24 20:54:30 +00:00
|
|
|
NS_ASSERTION(aListID == kPrincipalList, "unexpected child list");
|
2006-06-29 02:32:36 +00:00
|
|
|
NS_ASSERTION(!aPrevFrame || aPrevFrame->GetParent() == this,
|
|
|
|
"inserting after sibling frame with different parent");
|
2011-12-27 08:31:22 +00:00
|
|
|
//Insert Frames in the frame list
|
2012-07-30 14:20:58 +00:00
|
|
|
const nsFrameList::Slice& newCells = mFrames.InsertFrames(nullptr, aPrevFrame, aFrameList);
|
2006-06-29 02:32:36 +00:00
|
|
|
|
1999-08-03 02:41:27 +00:00
|
|
|
// Get the table frame
|
2006-03-04 05:26:57 +00:00
|
|
|
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
2012-01-16 23:38:10 +00:00
|
|
|
nsIAtom* cellFrameType = tableFrame->IsBorderCollapse() ? nsGkAtoms::bcTableCellFrame : nsGkAtoms::tableCellFrame;
|
2004-01-18 10:28:40 +00:00
|
|
|
nsTableCellFrame* prevCellFrame = (nsTableCellFrame *)nsTableFrame::GetFrameAtOrBefore(this, aPrevFrame, cellFrameType);
|
2009-02-05 09:09:50 +00:00
|
|
|
nsTArray<nsTableCellFrame*> cellChildren;
|
2011-12-27 08:31:22 +00:00
|
|
|
for (nsFrameList::Enumerator e(newCells); !e.AtEnd(); e.Next()) {
|
|
|
|
nsIFrame *childFrame = e.get();
|
|
|
|
NS_ASSERTION(IS_TABLE_CELL(childFrame->GetType()),"Not a table cell frame/pseudo frame construction failure");
|
|
|
|
cellChildren.AppendElement(static_cast<nsTableCellFrame*>(childFrame));
|
1999-12-13 22:56:31 +00:00
|
|
|
}
|
|
|
|
// insert the cells into the cell map
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t colIndex = -1;
|
1999-12-13 22:56:31 +00:00
|
|
|
if (prevCellFrame) {
|
|
|
|
prevCellFrame->GetColIndex(colIndex);
|
|
|
|
}
|
2005-02-07 01:58:25 +00:00
|
|
|
tableFrame->InsertCells(cellChildren, GetRowIndex(), colIndex);
|
1999-08-03 02:41:27 +00:00
|
|
|
|
2007-05-06 19:16:51 +00:00
|
|
|
PresContext()->PresShell()->FrameNeedsReflow(this, nsIPresShell::eTreeChange,
|
|
|
|
NS_FRAME_HAS_DIRTY_CHILDREN);
|
2006-12-13 03:45:28 +00:00
|
|
|
tableFrame->SetGeometryDirty();
|
1999-08-03 02:41:27 +00:00
|
|
|
}
|
|
|
|
|
2014-05-28 19:36:58 +00:00
|
|
|
void
|
2011-08-24 20:54:30 +00:00
|
|
|
nsTableRowFrame::RemoveFrame(ChildListID aListID,
|
1999-08-03 02:41:27 +00:00
|
|
|
nsIFrame* aOldFrame)
|
|
|
|
{
|
2011-08-24 20:54:30 +00:00
|
|
|
NS_ASSERTION(aListID == kPrincipalList, "unexpected child list");
|
2006-06-29 02:32:36 +00:00
|
|
|
|
2014-05-28 19:36:58 +00:00
|
|
|
MOZ_ASSERT((nsTableCellFrame*)do_QueryFrame(aOldFrame));
|
|
|
|
nsTableCellFrame* cellFrame = static_cast<nsTableCellFrame*>(aOldFrame);
|
|
|
|
// remove the cell from the cell map
|
2006-03-04 05:26:57 +00:00
|
|
|
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
2014-05-28 19:36:58 +00:00
|
|
|
tableFrame->RemoveCell(cellFrame, GetRowIndex());
|
|
|
|
|
|
|
|
// Remove the frame and destroy it
|
|
|
|
mFrames.DestroyFrame(aOldFrame);
|
1998-09-16 17:19:20 +00:00
|
|
|
|
2014-05-28 19:36:58 +00:00
|
|
|
PresContext()->PresShell()->
|
|
|
|
FrameNeedsReflow(this, nsIPresShell::eTreeChange,
|
|
|
|
NS_FRAME_HAS_DIRTY_CHILDREN);
|
|
|
|
|
|
|
|
tableFrame->SetGeometryDirty();
|
1999-08-30 00:01:09 +00:00
|
|
|
}
|
|
|
|
|
2006-12-13 23:04:57 +00:00
|
|
|
/* virtual */ nsMargin
|
|
|
|
nsTableRowFrame::GetUsedMargin() const
|
|
|
|
{
|
|
|
|
return nsMargin(0,0,0,0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* virtual */ nsMargin
|
|
|
|
nsTableRowFrame::GetUsedBorder() const
|
|
|
|
{
|
|
|
|
return nsMargin(0,0,0,0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* virtual */ nsMargin
|
|
|
|
nsTableRowFrame::GetUsedPadding() const
|
|
|
|
{
|
|
|
|
return nsMargin(0,0,0,0);
|
|
|
|
}
|
|
|
|
|
2000-09-05 14:57:34 +00:00
|
|
|
nscoord
|
|
|
|
GetHeightOfRowsSpannedBelowFirst(nsTableCellFrame& aTableCellFrame,
|
|
|
|
nsTableFrame& aTableFrame)
|
|
|
|
{
|
|
|
|
nscoord height = 0;
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t rowSpan = aTableFrame.GetEffectiveRowSpan(aTableCellFrame);
|
2000-09-05 14:57:34 +00:00
|
|
|
// add in height of rows spanned beyond the 1st one
|
2003-07-07 02:01:29 +00:00
|
|
|
nsIFrame* nextRow = aTableCellFrame.GetParent()->GetNextSibling();
|
2012-08-22 15:56:38 +00:00
|
|
|
for (int32_t rowX = 1; ((rowX < rowSpan) && nextRow);) {
|
2006-12-26 17:47:52 +00:00
|
|
|
if (nsGkAtoms::tableRowFrame == nextRow->GetType()) {
|
2003-07-07 02:01:29 +00:00
|
|
|
height += nextRow->GetSize().height;
|
2000-09-05 14:57:34 +00:00
|
|
|
rowX++;
|
|
|
|
}
|
2014-06-18 10:47:00 +00:00
|
|
|
height += aTableFrame.GetCellSpacingY(rowX);
|
2003-07-07 02:01:29 +00:00
|
|
|
nextRow = nextRow->GetNextSibling();
|
2000-09-05 14:57:34 +00:00
|
|
|
}
|
|
|
|
return height;
|
|
|
|
}
|
|
|
|
|
2001-11-05 00:15:51 +00:00
|
|
|
nsTableCellFrame*
|
|
|
|
nsTableRowFrame::GetFirstCell()
|
|
|
|
{
|
|
|
|
nsIFrame* childFrame = mFrames.FirstChild();
|
|
|
|
while (childFrame) {
|
2009-03-24 22:10:06 +00:00
|
|
|
nsTableCellFrame *cellFrame = do_QueryFrame(childFrame);
|
|
|
|
if (cellFrame) {
|
|
|
|
return cellFrame;
|
2001-11-05 00:15:51 +00:00
|
|
|
}
|
2003-07-07 02:01:29 +00:00
|
|
|
childFrame = childFrame->GetNextSibling();
|
2001-11-05 00:15:51 +00:00
|
|
|
}
|
2012-07-30 14:20:58 +00:00
|
|
|
return nullptr;
|
2001-11-05 00:15:51 +00:00
|
|
|
}
|
2000-09-05 14:57:34 +00:00
|
|
|
|
1998-07-02 20:35:23 +00:00
|
|
|
/**
|
|
|
|
* Post-reflow hook. This is where the table row does its post-processing
|
|
|
|
*/
|
1998-11-20 01:01:25 +00:00
|
|
|
void
|
2007-01-27 22:22:24 +00:00
|
|
|
nsTableRowFrame::DidResize()
|
1998-07-02 20:35:23 +00:00
|
|
|
{
|
1998-11-20 01:01:25 +00:00
|
|
|
// Resize and re-align the cell frames based on our row height
|
2006-03-04 05:26:57 +00:00
|
|
|
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
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 05:38:33 +00:00
|
|
|
nsTableIterator iter(*this);
|
2001-03-13 06:38:59 +00:00
|
|
|
nsIFrame* childFrame = iter.First();
|
2003-09-13 16:26:30 +00:00
|
|
|
|
2013-12-27 17:59:52 +00:00
|
|
|
nsHTMLReflowMetrics desiredSize(GetWritingMode()); // ???
|
|
|
|
desiredSize.Width() = mRect.width;
|
|
|
|
desiredSize.Height() = mRect.height;
|
2010-10-07 04:25:46 +00:00
|
|
|
desiredSize.SetOverflowAreasToDesiredBounds();
|
1999-05-04 19:15:56 +00:00
|
|
|
|
2001-03-13 06:38:59 +00:00
|
|
|
while (childFrame) {
|
2009-03-24 22:10:06 +00:00
|
|
|
nsTableCellFrame *cellFrame = do_QueryFrame(childFrame);
|
|
|
|
if (cellFrame) {
|
2001-03-13 06:38:59 +00:00
|
|
|
nscoord cellHeight = mRect.height + GetHeightOfRowsSpannedBelowFirst(*cellFrame, *tableFrame);
|
1999-05-04 19:15:56 +00:00
|
|
|
|
|
|
|
// resize the cell's height
|
2008-02-08 09:36:32 +00:00
|
|
|
nsRect cellRect = cellFrame->GetRect();
|
2012-08-29 05:48:45 +00:00
|
|
|
nsRect cellVisualOverflow = cellFrame->GetVisualOverflowRect();
|
2008-02-08 09:36:32 +00:00
|
|
|
if (cellRect.height != cellHeight)
|
1998-11-20 01:01:25 +00:00
|
|
|
{
|
2008-02-08 09:36:32 +00:00
|
|
|
cellFrame->SetSize(nsSize(cellRect.width, cellHeight));
|
2012-08-29 05:48:45 +00:00
|
|
|
nsTableFrame::InvalidateTableFrame(cellFrame, cellRect,
|
|
|
|
cellVisualOverflow,
|
|
|
|
false);
|
1998-07-02 20:35:23 +00:00
|
|
|
}
|
2008-02-08 09:36:32 +00:00
|
|
|
|
|
|
|
// realign cell content based on the new height. We might be able to
|
|
|
|
// skip this if the height didn't change... maybe. Hard to tell.
|
|
|
|
cellFrame->VerticallyAlignChild(mMaxCellAscent);
|
|
|
|
|
|
|
|
// Always store the overflow, even if the height didn't change, since
|
|
|
|
// we'll lose part of our overflow area otherwise.
|
2010-10-07 04:25:46 +00:00
|
|
|
ConsiderChildOverflow(desiredSize.mOverflowAreas, cellFrame);
|
2008-02-08 09:36:32 +00:00
|
|
|
|
|
|
|
// Note that if the cell's *content* needs to change in response
|
|
|
|
// to this height, it will get a special height reflow.
|
1998-07-02 20:35:23 +00:00
|
|
|
}
|
2001-03-13 06:38:59 +00:00
|
|
|
// Get the next child
|
|
|
|
childFrame = iter.Next();
|
1998-07-02 20:35:23 +00:00
|
|
|
}
|
2004-07-16 16:56:21 +00:00
|
|
|
FinishAndStoreOverflow(&desiredSize);
|
2004-04-14 06:22:52 +00:00
|
|
|
if (HasView()) {
|
2010-10-07 04:25:46 +00:00
|
|
|
nsContainerFrame::SyncFrameViewAfterReflow(PresContext(), this, GetView(),
|
|
|
|
desiredSize.VisualOverflow(), 0);
|
2004-04-14 06:22:52 +00:00
|
|
|
}
|
1998-07-02 20:35:23 +00:00
|
|
|
// Let our base class do the usual work
|
|
|
|
}
|
|
|
|
|
2000-06-05 08:25:11 +00:00
|
|
|
// returns max-ascent amongst all cells that have 'vertical-align: baseline'
|
2000-07-28 09:19:26 +00:00
|
|
|
// *including* cells with rowspans
|
2000-06-05 08:25:11 +00:00
|
|
|
nscoord nsTableRowFrame::GetMaxCellAscent() const
|
|
|
|
{
|
|
|
|
return mMaxCellAscent;
|
|
|
|
}
|
|
|
|
|
2014-06-17 12:19:38 +00:00
|
|
|
nscoord nsTableRowFrame::GetRowBaseline(WritingMode aWritingMode)
|
2005-10-04 15:47:21 +00:00
|
|
|
{
|
|
|
|
if(mMaxCellAscent)
|
|
|
|
return mMaxCellAscent;
|
|
|
|
|
|
|
|
// If we don't have a baseline on any of the cells we go for the lowest
|
|
|
|
// content edge of the inner block frames.
|
|
|
|
// 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.
|
|
|
|
//
|
|
|
|
// 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
|
|
|
|
|
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 05:38:33 +00:00
|
|
|
nsTableIterator iter(*this);
|
2005-10-04 15:47:21 +00:00
|
|
|
nsIFrame* childFrame = iter.First();
|
|
|
|
nscoord ascent = 0;
|
|
|
|
while (childFrame) {
|
|
|
|
if (IS_TABLE_CELL(childFrame->GetType())) {
|
2011-08-24 20:54:30 +00:00
|
|
|
nsIFrame* firstKid = childFrame->GetFirstPrincipalChild();
|
2013-01-15 12:22:03 +00:00
|
|
|
ascent = std::max(ascent, firstKid->GetRect().YMost());
|
2005-10-04 15:47:21 +00:00
|
|
|
}
|
|
|
|
// Get the next child
|
|
|
|
childFrame = iter.Next();
|
|
|
|
}
|
|
|
|
return ascent;
|
|
|
|
}
|
2001-11-05 00:15:51 +00:00
|
|
|
nscoord
|
|
|
|
nsTableRowFrame::GetHeight(nscoord aPctBasis) const
|
2000-05-25 22:40:21 +00:00
|
|
|
{
|
2001-11-05 00:15:51 +00:00
|
|
|
nscoord height = 0;
|
|
|
|
if ((aPctBasis > 0) && HasPctHeight()) {
|
|
|
|
height = NSToCoordRound(GetPctHeight() * (float)aPctBasis);
|
|
|
|
}
|
2003-01-05 14:16:58 +00:00
|
|
|
if (HasFixedHeight()) {
|
2013-01-15 12:22:03 +00:00
|
|
|
height = std::max(height, GetFixedHeight());
|
2001-11-05 00:15:51 +00:00
|
|
|
}
|
2013-01-15 12:22:03 +00:00
|
|
|
return std::max(height, GetContentHeight());
|
2000-05-25 22:40:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2001-11-05 00:15:51 +00:00
|
|
|
nsTableRowFrame::ResetHeight(nscoord aFixedHeight)
|
2000-05-25 22:40:21 +00:00
|
|
|
{
|
2011-10-17 14:59:28 +00:00
|
|
|
SetHasFixedHeight(false);
|
|
|
|
SetHasPctHeight(false);
|
2001-11-05 00:15:51 +00:00
|
|
|
SetFixedHeight(0);
|
2003-01-05 14:16:58 +00:00
|
|
|
SetPctHeight(0);
|
2001-11-05 00:15:51 +00:00
|
|
|
SetContentHeight(0);
|
|
|
|
|
|
|
|
if (aFixedHeight > 0) {
|
|
|
|
SetFixedHeight(aFixedHeight);
|
|
|
|
}
|
|
|
|
|
2000-06-05 08:25:11 +00:00
|
|
|
mMaxCellAscent = 0;
|
|
|
|
mMaxCellDescent = 0;
|
2000-05-25 22:40:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2001-11-05 00:15:51 +00:00
|
|
|
nsTableRowFrame::UpdateHeight(nscoord aHeight,
|
|
|
|
nscoord aAscent,
|
|
|
|
nscoord aDescent,
|
|
|
|
nsTableFrame* aTableFrame,
|
|
|
|
nsTableCellFrame* aCellFrame)
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
2001-11-05 00:15:51 +00:00
|
|
|
if (!aTableFrame || !aCellFrame) {
|
2011-10-17 14:59:28 +00:00
|
|
|
NS_ASSERTION(false , "invalid call");
|
2001-11-05 00:15:51 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2000-06-05 08:25:11 +00:00
|
|
|
if (aHeight != NS_UNCONSTRAINEDSIZE) {
|
|
|
|
if (!(aCellFrame->HasVerticalAlignBaseline())) { // only the cell's height matters
|
2001-11-05 00:15:51 +00:00
|
|
|
if (GetHeight() < aHeight) {
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t rowSpan = aTableFrame->GetEffectiveRowSpan(*aCellFrame);
|
2000-06-05 08:25:11 +00:00
|
|
|
if (rowSpan == 1) {
|
2001-11-05 00:15:51 +00:00
|
|
|
SetContentHeight(aHeight);
|
2000-06-05 08:25:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else { // the alignment on the baseline can change the height
|
|
|
|
NS_ASSERTION((aAscent != NS_UNCONSTRAINEDSIZE) && (aDescent != NS_UNCONSTRAINEDSIZE), "invalid call");
|
|
|
|
// 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 15:56:38 +00:00
|
|
|
int32_t rowSpan = aTableFrame->GetEffectiveRowSpan(*aCellFrame);
|
2000-06-05 08:25:11 +00:00
|
|
|
if (rowSpan == 1) {
|
|
|
|
mMaxCellDescent = aDescent;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// keep the tallest height in sync
|
2001-11-05 00:15:51 +00:00
|
|
|
if (GetHeight() < mMaxCellAscent + mMaxCellDescent) {
|
|
|
|
SetContentHeight(mMaxCellAscent + mMaxCellDescent);
|
2000-06-05 08:25:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
2001-11-05 00:15:51 +00:00
|
|
|
nscoord
|
|
|
|
nsTableRowFrame::CalcHeight(const nsHTMLReflowState& aReflowState)
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
2006-03-04 05:26:57 +00:00
|
|
|
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
2007-08-02 18:08:05 +00:00
|
|
|
nscoord computedHeight = (NS_UNCONSTRAINEDSIZE == aReflowState.ComputedHeight())
|
|
|
|
? 0 : aReflowState.ComputedHeight();
|
2001-11-05 00:15:51 +00:00
|
|
|
ResetHeight(computedHeight);
|
2000-05-25 22:40:21 +00:00
|
|
|
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStylePosition* position = StylePosition();
|
2012-11-21 16:19:30 +00:00
|
|
|
if (position->mHeight.ConvertsToLength()) {
|
|
|
|
SetFixedHeight(nsRuleNode::ComputeCoordPercentCalc(position->mHeight, 0));
|
2001-11-05 15:15:24 +00:00
|
|
|
}
|
|
|
|
else if (eStyleUnit_Percent == position->mHeight.GetUnit()) {
|
|
|
|
SetPctHeight(position->mHeight.GetPercentValue());
|
|
|
|
}
|
2012-11-21 16:19:30 +00:00
|
|
|
// calc() with percentages is treated like 'auto' on table rows.
|
2001-11-05 15:15:24 +00:00
|
|
|
|
2003-07-07 02:01:29 +00:00
|
|
|
for (nsIFrame* kidFrame = mFrames.FirstChild(); kidFrame;
|
|
|
|
kidFrame = kidFrame->GetNextSibling()) {
|
2009-03-24 22:10:06 +00:00
|
|
|
nsTableCellFrame *cellFrame = do_QueryFrame(kidFrame);
|
|
|
|
if (cellFrame) {
|
|
|
|
nsSize desSize = cellFrame->GetDesiredSize();
|
2013-12-27 17:59:21 +00:00
|
|
|
if ((NS_UNCONSTRAINEDSIZE == aReflowState.AvailableHeight()) && !GetPrevInFlow()) {
|
2010-03-06 09:53:02 +00:00
|
|
|
CalculateCellActualHeight(cellFrame, desSize.height);
|
2001-11-29 15:41:07 +00:00
|
|
|
}
|
2000-06-05 08:25:11 +00:00
|
|
|
// height may have changed, adjust descent to absorb any excess difference
|
2005-10-04 15:47:21 +00:00
|
|
|
nscoord ascent;
|
2011-08-24 20:54:30 +00:00
|
|
|
if (!kidFrame->GetFirstPrincipalChild()->GetFirstPrincipalChild())
|
2005-10-04 15:47:21 +00:00
|
|
|
ascent = desSize.height;
|
|
|
|
else
|
2009-03-24 22:10:06 +00:00
|
|
|
ascent = cellFrame->GetCellBaseline();
|
2000-06-05 08:25:11 +00:00
|
|
|
nscoord descent = desSize.height - ascent;
|
2009-03-24 22:10:06 +00:00
|
|
|
UpdateHeight(desSize.height, ascent, descent, tableFrame, cellFrame);
|
2000-05-25 22:40:21 +00:00
|
|
|
}
|
|
|
|
}
|
2001-11-05 00:15:51 +00:00
|
|
|
return GetHeight();
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
2006-01-26 02:29:17 +00:00
|
|
|
/**
|
|
|
|
* We need a custom display item for table row backgrounds. This is only used
|
|
|
|
* when the table row is the root of a stacking context (e.g., has 'opacity').
|
|
|
|
* Table row backgrounds can extend beyond the row frame bounds, when
|
|
|
|
* the row contains row-spanning cells.
|
|
|
|
*/
|
2008-04-06 11:34:14 +00:00
|
|
|
class nsDisplayTableRowBackground : public nsDisplayTableItem {
|
2006-01-26 02:29:17 +00:00
|
|
|
public:
|
2010-08-13 10:01:13 +00:00
|
|
|
nsDisplayTableRowBackground(nsDisplayListBuilder* aBuilder,
|
|
|
|
nsTableRowFrame* aFrame) :
|
|
|
|
nsDisplayTableItem(aBuilder, aFrame) {
|
2006-01-29 18:48:58 +00:00
|
|
|
MOZ_COUNT_CTOR(nsDisplayTableRowBackground);
|
|
|
|
}
|
|
|
|
#ifdef NS_BUILD_REFCNT_LOGGING
|
|
|
|
virtual ~nsDisplayTableRowBackground() {
|
|
|
|
MOZ_COUNT_DTOR(nsDisplayTableRowBackground);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2013-06-26 16:43:26 +00:00
|
|
|
virtual void ComputeInvalidationRegion(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsDisplayItemGeometry* aGeometry,
|
|
|
|
nsRegion *aInvalidRegion) MOZ_OVERRIDE;
|
2009-09-07 00:35:14 +00:00
|
|
|
virtual void Paint(nsDisplayListBuilder* aBuilder,
|
2014-02-24 14:41:56 +00:00
|
|
|
nsRenderingContext* aCtx) MOZ_OVERRIDE;
|
2010-07-15 21:07:49 +00:00
|
|
|
NS_DISPLAY_DECL_NAME("TableRowBackground", TYPE_TABLE_ROW_BACKGROUND)
|
2006-01-26 02:29:17 +00:00
|
|
|
};
|
1999-11-01 22:12:45 +00:00
|
|
|
|
2013-06-26 16:43:26 +00:00
|
|
|
void
|
|
|
|
nsDisplayTableRowBackground::ComputeInvalidationRegion(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsDisplayItemGeometry* aGeometry,
|
|
|
|
nsRegion *aInvalidRegion)
|
|
|
|
{
|
|
|
|
if (aBuilder->ShouldSyncDecodeImages()) {
|
|
|
|
if (nsTableFrame::AnyTablePartHasUndecodedBackgroundImage(mFrame, mFrame->GetNextSibling())) {
|
|
|
|
bool snap;
|
|
|
|
aInvalidRegion->Or(*aInvalidRegion, GetBounds(aBuilder, &snap));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
nsDisplayTableItem::ComputeInvalidationRegion(aBuilder, aGeometry, aInvalidRegion);
|
|
|
|
}
|
|
|
|
|
2006-01-26 02:29:17 +00:00
|
|
|
void
|
|
|
|
nsDisplayTableRowBackground::Paint(nsDisplayListBuilder* aBuilder,
|
2012-01-16 23:38:10 +00:00
|
|
|
nsRenderingContext* aCtx)
|
|
|
|
{
|
2006-03-04 05:26:57 +00:00
|
|
|
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(mFrame);
|
2006-01-26 02:29:17 +00:00
|
|
|
TableBackgroundPainter painter(tableFrame,
|
|
|
|
TableBackgroundPainter::eOrigin_TableRow,
|
2007-03-30 21:11:41 +00:00
|
|
|
mFrame->PresContext(), *aCtx,
|
2010-08-13 10:01:58 +00:00
|
|
|
mVisibleRect, ToReferenceFrame(),
|
2009-09-12 22:44:18 +00:00
|
|
|
aBuilder->GetBackgroundPaintFlags());
|
2007-07-08 07:08:04 +00:00
|
|
|
painter.PaintRow(static_cast<nsTableRowFrame*>(mFrame));
|
2006-01-26 02:29:17 +00:00
|
|
|
}
|
2004-03-09 06:48:35 +00:00
|
|
|
|
2013-02-14 11:12:27 +00:00
|
|
|
void
|
2006-01-26 02:29:17 +00:00
|
|
|
nsTableRowFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists)
|
|
|
|
{
|
2012-07-30 14:20:58 +00:00
|
|
|
nsDisplayTableItem* item = nullptr;
|
2012-04-03 00:30:45 +00:00
|
|
|
if (IsVisibleInSelection(aBuilder)) {
|
|
|
|
bool isRoot = aBuilder->IsAtRootOfPseudoStackingContext();
|
|
|
|
if (isRoot) {
|
|
|
|
// This background is created regardless of whether this frame is
|
|
|
|
// visible or not. Visibility decisions are delegated to the
|
|
|
|
// table background painter.
|
|
|
|
// We would use nsDisplayGeneric for this rare case except that we
|
|
|
|
// need the background to be larger than the row frame in some
|
|
|
|
// cases.
|
|
|
|
item = new (aBuilder) nsDisplayTableRowBackground(aBuilder, this);
|
2013-02-14 11:08:08 +00:00
|
|
|
aLists.BorderBackground()->AppendNewToTop(item);
|
2012-04-03 00:30:45 +00:00
|
|
|
}
|
2002-02-21 05:36:16 +00:00
|
|
|
}
|
2013-02-14 11:08:08 +00:00
|
|
|
nsTableFrame::DisplayGenericTablePart(aBuilder, this, aDirtyRect, aLists, item);
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
2014-06-28 10:13:13 +00:00
|
|
|
nsIFrame::LogicalSides
|
2014-03-13 07:39:33 +00:00
|
|
|
nsTableRowFrame::GetLogicalSkipSides(const nsHTMLReflowState* aReflowState) const
|
1998-10-20 17:45:07 +00:00
|
|
|
{
|
2014-05-05 17:55:54 +00:00
|
|
|
if (MOZ_UNLIKELY(StyleBorder()->mBoxDecorationBreak ==
|
|
|
|
NS_STYLE_BOX_DECORATION_BREAK_CLONE)) {
|
2014-06-28 10:13:13 +00:00
|
|
|
return LogicalSides();
|
2014-05-05 17:55:54 +00:00
|
|
|
}
|
|
|
|
|
2014-06-28 10:13:13 +00:00
|
|
|
LogicalSides skip;
|
2012-07-30 14:20:58 +00:00
|
|
|
if (nullptr != GetPrevInFlow()) {
|
2014-06-28 10:13:14 +00:00
|
|
|
skip |= eLogicalSideBitsBStart;
|
1998-10-20 17:45:07 +00:00
|
|
|
}
|
2012-07-30 14:20:58 +00:00
|
|
|
if (nullptr != GetNextInFlow()) {
|
2014-06-28 10:13:14 +00:00
|
|
|
skip |= eLogicalSideBitsBEnd;
|
1998-10-20 17:45:07 +00:00
|
|
|
}
|
|
|
|
return skip;
|
|
|
|
}
|
|
|
|
|
2010-03-06 09:53:02 +00:00
|
|
|
// Calculate the cell's actual height given its pass2 height.
|
|
|
|
// Takes into account the specified height (in the style).
|
|
|
|
// Modifies the desired height that is passed in.
|
1999-08-21 20:16:32 +00:00
|
|
|
nsresult
|
2010-03-06 09:53:02 +00:00
|
|
|
nsTableRowFrame::CalculateCellActualHeight(nsTableCellFrame* aCellFrame,
|
|
|
|
nscoord& aDesiredHeight)
|
1999-08-21 20:16:32 +00:00
|
|
|
{
|
2001-11-05 00:15:51 +00:00
|
|
|
nscoord specifiedHeight = 0;
|
1999-08-21 20:16:32 +00:00
|
|
|
|
|
|
|
// Get the height specified in the style information
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStylePosition* position = aCellFrame->StylePosition();
|
2001-11-05 00:15:51 +00:00
|
|
|
|
2006-03-04 05:26:57 +00:00
|
|
|
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t rowSpan = tableFrame->GetEffectiveRowSpan(*aCellFrame);
|
1999-08-21 20:16:32 +00:00
|
|
|
|
|
|
|
switch (position->mHeight.GetUnit()) {
|
2012-11-21 16:19:30 +00:00
|
|
|
case eStyleUnit_Calc: {
|
|
|
|
if (position->mHeight.CalcHasPercent()) {
|
|
|
|
// Treat this like "auto"
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
// Fall through to the coord case
|
|
|
|
}
|
2012-06-30 16:01:31 +00:00
|
|
|
case eStyleUnit_Coord: {
|
|
|
|
nscoord outsideBoxSizing = 0;
|
|
|
|
// In quirks mode, table cell width should be content-box, but height
|
|
|
|
// 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 width and another
|
|
|
|
// for height)
|
|
|
|
if (PresContext()->CompatibilityMode() != eCompatibility_NavQuirks) {
|
|
|
|
switch (position->mBoxSizing) {
|
|
|
|
case NS_STYLE_BOX_SIZING_CONTENT:
|
|
|
|
outsideBoxSizing = aCellFrame->GetUsedBorderAndPadding().TopBottom();
|
|
|
|
break;
|
|
|
|
case NS_STYLE_BOX_SIZING_PADDING:
|
|
|
|
outsideBoxSizing = aCellFrame->GetUsedBorder().TopBottom();
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
// NS_STYLE_BOX_SIZING_BORDER
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-11-21 16:19:30 +00:00
|
|
|
specifiedHeight =
|
|
|
|
nsRuleNode::ComputeCoordPercentCalc(position->mHeight, 0) +
|
|
|
|
outsideBoxSizing;
|
2012-06-30 16:01:31 +00:00
|
|
|
|
2001-11-05 00:15:51 +00:00
|
|
|
if (1 == rowSpan)
|
|
|
|
SetFixedHeight(specifiedHeight);
|
2001-03-13 06:38:59 +00:00
|
|
|
break;
|
2012-06-30 16:01:31 +00:00
|
|
|
}
|
2001-03-13 06:38:59 +00:00
|
|
|
case eStyleUnit_Percent: {
|
2001-11-05 00:15:51 +00:00
|
|
|
if (1 == rowSpan)
|
|
|
|
SetPctHeight(position->mHeight.GetPercentValue());
|
|
|
|
// pct heights are handled when all of the cells are finished, so don't set specifiedHeight
|
1999-08-25 21:49:18 +00:00
|
|
|
break;
|
|
|
|
}
|
2001-03-13 06:38:59 +00:00
|
|
|
case eStyleUnit_Auto:
|
2012-11-21 16:19:30 +00:00
|
|
|
default:
|
2001-03-13 06:38:59 +00:00
|
|
|
break;
|
1999-08-21 20:16:32 +00:00
|
|
|
}
|
|
|
|
|
2001-11-05 00:15:51 +00:00
|
|
|
// If the specified height is greater than the desired height, then use the specified height
|
1999-08-21 20:16:32 +00:00
|
|
|
if (specifiedHeight > aDesiredHeight)
|
|
|
|
aDesiredHeight = specifiedHeight;
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Calculates the available width for the table cell based on the known
|
|
|
|
// column widths taking into account column spans and column spacing
|
2009-01-13 19:50:40 +00:00
|
|
|
static nscoord
|
2001-10-26 02:30:38 +00:00
|
|
|
CalcAvailWidth(nsTableFrame& aTableFrame,
|
2014-06-18 10:47:00 +00:00
|
|
|
nsTableCellFrame& aCellFrame)
|
1999-08-21 20:16:32 +00:00
|
|
|
{
|
2009-01-13 19:50:40 +00:00
|
|
|
nscoord cellAvailWidth = 0;
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t colIndex;
|
2002-09-09 18:46:06 +00:00
|
|
|
aCellFrame.GetColIndex(colIndex);
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t colspan = aTableFrame.GetEffectiveColSpan(aCellFrame);
|
2009-01-13 19:50:40 +00:00
|
|
|
NS_ASSERTION(colspan > 0, "effective colspan should be positive");
|
2002-09-09 18:46:06 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
for (int32_t spanX = 0; spanX < colspan; spanX++) {
|
2009-01-13 19:50:40 +00:00
|
|
|
cellAvailWidth += aTableFrame.GetColumnWidth(colIndex + spanX);
|
|
|
|
if (spanX > 0 &&
|
|
|
|
aTableFrame.ColumnHasCellSpacingBefore(colIndex + spanX)) {
|
2014-06-18 10:47:00 +00:00
|
|
|
cellAvailWidth += aTableFrame.GetCellSpacingX(colIndex + spanX - 1);
|
2001-10-26 02:30:38 +00:00
|
|
|
}
|
|
|
|
}
|
2009-01-13 19:50:40 +00:00
|
|
|
return cellAvailWidth;
|
1999-08-21 20:16:32 +00:00
|
|
|
}
|
|
|
|
|
2001-03-13 06:38:59 +00:00
|
|
|
nscoord
|
2012-08-22 15:56:38 +00:00
|
|
|
GetSpaceBetween(int32_t aPrevColIndex,
|
|
|
|
int32_t aColIndex,
|
|
|
|
int32_t aColSpan,
|
2001-03-13 06:38:59 +00:00
|
|
|
nsTableFrame& aTableFrame,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool aIsLeftToRight,
|
|
|
|
bool aCheckVisibility)
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
2001-03-13 06:38:59 +00:00
|
|
|
nscoord space = 0;
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t colX;
|
2001-03-13 06:38:59 +00:00
|
|
|
if (aIsLeftToRight) {
|
|
|
|
for (colX = aPrevColIndex + 1; aColIndex > colX; colX++) {
|
2011-09-29 06:19:26 +00:00
|
|
|
bool isCollapsed = false;
|
2006-03-04 05:26:57 +00:00
|
|
|
if (!aCheckVisibility) {
|
|
|
|
space += aTableFrame.GetColumnWidth(colX);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
nsTableColFrame* colFrame = aTableFrame.GetColFrame(colX);
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStyleVisibility* colVis = colFrame->StyleVisibility();
|
2011-09-29 06:19:26 +00:00
|
|
|
bool collapseCol = (NS_STYLE_VISIBILITY_COLLAPSE == colVis->mVisible);
|
2006-03-04 05:26:57 +00:00
|
|
|
nsIFrame* cgFrame = colFrame->GetParent();
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStyleVisibility* groupVis = cgFrame->StyleVisibility();
|
2011-09-29 06:19:26 +00:00
|
|
|
bool collapseGroup = (NS_STYLE_VISIBILITY_COLLAPSE ==
|
2006-03-04 05:26:57 +00:00
|
|
|
groupVis->mVisible);
|
|
|
|
isCollapsed = collapseCol || collapseGroup;
|
|
|
|
if (!isCollapsed)
|
|
|
|
space += aTableFrame.GetColumnWidth(colX);
|
|
|
|
}
|
2008-09-24 17:14:35 +00:00
|
|
|
if (!isCollapsed && aTableFrame.ColumnHasCellSpacingBefore(colX)) {
|
2014-06-18 10:47:00 +00:00
|
|
|
space += aTableFrame.GetCellSpacingX(colX - 1);
|
2001-03-13 06:38:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t lastCol = aColIndex + aColSpan - 1;
|
2001-03-13 06:38:59 +00:00
|
|
|
for (colX = aPrevColIndex - 1; colX > lastCol; colX--) {
|
2011-09-29 06:19:26 +00:00
|
|
|
bool isCollapsed = false;
|
2006-03-04 05:26:57 +00:00
|
|
|
if (!aCheckVisibility) {
|
|
|
|
space += aTableFrame.GetColumnWidth(colX);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
nsTableColFrame* colFrame = aTableFrame.GetColFrame(colX);
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStyleVisibility* colVis = colFrame->StyleVisibility();
|
2011-09-29 06:19:26 +00:00
|
|
|
bool collapseCol = (NS_STYLE_VISIBILITY_COLLAPSE == colVis->mVisible);
|
2006-03-04 05:26:57 +00:00
|
|
|
nsIFrame* cgFrame = colFrame->GetParent();
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStyleVisibility* groupVis = cgFrame->StyleVisibility();
|
2011-09-29 06:19:26 +00:00
|
|
|
bool collapseGroup = (NS_STYLE_VISIBILITY_COLLAPSE ==
|
2006-03-04 05:26:57 +00:00
|
|
|
groupVis->mVisible);
|
|
|
|
isCollapsed = collapseCol || collapseGroup;
|
|
|
|
if (!isCollapsed)
|
|
|
|
space += aTableFrame.GetColumnWidth(colX);
|
|
|
|
}
|
2008-09-24 17:14:35 +00:00
|
|
|
if (!isCollapsed && aTableFrame.ColumnHasCellSpacingBefore(colX)) {
|
2014-06-18 10:47:00 +00:00
|
|
|
space += aTableFrame.GetCellSpacingX(colX - 1);
|
2001-03-13 06:38:59 +00:00
|
|
|
}
|
|
|
|
}
|
1999-04-22 03:51:58 +00:00
|
|
|
}
|
2001-03-13 06:38:59 +00:00
|
|
|
return space;
|
|
|
|
}
|
1999-04-22 03:51:58 +00:00
|
|
|
|
2002-03-27 05:50:24 +00:00
|
|
|
// subtract the heights of aRow's prev in flows from the unpaginated height
|
|
|
|
static
|
2009-01-14 22:16:43 +00:00
|
|
|
nscoord CalcHeightFromUnpaginatedHeight(nsPresContext* aPresContext,
|
2002-03-27 05:50:24 +00:00
|
|
|
nsTableRowFrame& aRow)
|
|
|
|
{
|
|
|
|
nscoord height = 0;
|
2012-01-16 23:38:10 +00:00
|
|
|
nsTableRowFrame* firstInFlow =
|
2013-09-25 11:42:34 +00:00
|
|
|
static_cast<nsTableRowFrame*>(aRow.FirstInFlow());
|
2002-03-27 05:50:24 +00:00
|
|
|
if (firstInFlow->HasUnpaginatedHeight()) {
|
|
|
|
height = firstInFlow->GetUnpaginatedHeight(aPresContext);
|
2003-07-07 02:01:29 +00:00
|
|
|
for (nsIFrame* prevInFlow = aRow.GetPrevInFlow(); prevInFlow;
|
2004-09-14 02:28:03 +00:00
|
|
|
prevInFlow = prevInFlow->GetPrevInFlow()) {
|
2003-07-07 02:01:29 +00:00
|
|
|
height -= prevInFlow->GetSize().height;
|
2002-03-27 05:50:24 +00:00
|
|
|
}
|
|
|
|
}
|
2013-01-15 12:22:03 +00:00
|
|
|
return std::max(height, 0);
|
2002-03-27 05:50:24 +00:00
|
|
|
}
|
|
|
|
|
2014-05-13 00:47:53 +00:00
|
|
|
void
|
2004-07-31 23:15:21 +00:00
|
|
|
nsTableRowFrame::ReflowChildren(nsPresContext* aPresContext,
|
2001-03-13 06:38:59 +00:00
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
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 05:38:33 +00:00
|
|
|
nsReflowStatus& aStatus)
|
2001-03-13 06:38:59 +00:00
|
|
|
{
|
|
|
|
aStatus = NS_FRAME_COMPLETE;
|
1998-11-20 01:01:25 +00: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 05:38:33 +00:00
|
|
|
// XXXldb Should we be checking constrained height instead?
|
2012-01-16 23:38:10 +00:00
|
|
|
const bool isPaginated = aPresContext->IsPaginated();
|
|
|
|
const bool borderCollapse = aTableFrame.IsBorderCollapse();
|
2014-05-13 00:47:53 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t cellColSpan = 1; // must be defined here so it's set properly for non-cell kids
|
2001-03-13 06:38:59 +00: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 05:38:33 +00:00
|
|
|
nsTableIterator iter(*this);
|
2001-03-13 06:38:59 +00:00
|
|
|
// remember the col index of the previous cell to handle rowspans into this row
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t firstPrevColIndex = (iter.IsLeftToRight()) ? -1 : aTableFrame.GetColCount();
|
|
|
|
int32_t prevColIndex = firstPrevColIndex;
|
2001-03-13 06:38:59 +00:00
|
|
|
nscoord x = 0; // running total of children x offset
|
1999-05-04 19:15:56 +00:00
|
|
|
|
2008-04-08 12:28:34 +00:00
|
|
|
// This computes the max of all cell heights
|
|
|
|
nscoord cellMaxHeight = 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 05:38:33 +00:00
|
|
|
|
1998-07-10 22:56:13 +00:00
|
|
|
// Reflow each of our existing cell frames
|
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 05:38:33 +00:00
|
|
|
for (nsIFrame* kidFrame = iter.First(); kidFrame; kidFrame = iter.Next()) {
|
2009-03-24 22:10:06 +00: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 05:38:33 +00:00
|
|
|
// XXXldb nsCSSFrameConstructor needs to enforce this!
|
|
|
|
NS_NOTREACHED("yikes, a non-row child");
|
|
|
|
|
|
|
|
// it's an unknown frame type, give it a generic reflow and ignore the results
|
|
|
|
nsTableCellReflowState kidReflowState(aPresContext, aReflowState,
|
2013-09-09 20:29:05 +00:00
|
|
|
kidFrame, nsSize(0,0),
|
|
|
|
nsHTMLReflowState::CALLER_WILL_INIT);
|
2011-10-17 14:59:28 +00:00
|
|
|
InitChildReflowState(*aPresContext, nsSize(0,0), false, kidReflowState);
|
2013-12-31 13:50:31 +00:00
|
|
|
nsHTMLReflowMetrics desiredSize(aReflowState);
|
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 05:38:33 +00:00
|
|
|
nsReflowStatus status;
|
|
|
|
ReflowChild(kidFrame, aPresContext, desiredSize, kidReflowState, 0, 0, 0, status);
|
2012-11-14 06:47:33 +00:00
|
|
|
kidFrame->DidReflow(aPresContext, nullptr, nsDidReflowStatus::FINISHED);
|
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 05:38:33 +00:00
|
|
|
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
1999-08-03 02:41:27 +00:00
|
|
|
// See if we should only reflow the dirty child frames
|
2011-09-29 06:19:26 +00:00
|
|
|
bool doReflowChild = true;
|
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 05:38:33 +00:00
|
|
|
if (!aReflowState.ShouldReflowAllKids() &&
|
2006-12-13 03:45:28 +00:00
|
|
|
!aTableFrame.IsGeometryDirty() &&
|
2007-05-06 19:16:51 +00:00
|
|
|
!NS_SUBTREE_DIRTY(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 05:38:33 +00:00
|
|
|
if (!aReflowState.mFlags.mSpecialHeightReflow)
|
2011-10-17 14:59:28 +00:00
|
|
|
doReflowChild = false;
|
1999-08-03 02:41:27 +00:00
|
|
|
}
|
2013-12-27 17:59:21 +00:00
|
|
|
else if ((NS_UNCONSTRAINEDSIZE != aReflowState.AvailableHeight())) {
|
2002-10-03 14:33:23 +00:00
|
|
|
// We don't reflow a rowspan >1 cell here with a constrained height.
|
|
|
|
// 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 05:38:33 +00:00
|
|
|
if (aTableFrame.GetEffectiveRowSpan(*cellFrame) > 1) {
|
2011-10-17 14:59:28 +00:00
|
|
|
doReflowChild = false;
|
2002-10-03 14:33:23 +00:00
|
|
|
}
|
|
|
|
}
|
2001-12-07 14:51:12 +00:00
|
|
|
if (aReflowState.mFlags.mSpecialHeightReflow) {
|
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 05:38:33 +00:00
|
|
|
if (!isPaginated && !(cellFrame->GetStateBits() &
|
|
|
|
NS_FRAME_CONTAINS_RELATIVE_HEIGHT)) {
|
2001-11-05 00:15:51 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
2001-03-13 06:38:59 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t cellColIndex;
|
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 05:38:33 +00:00
|
|
|
cellFrame->GetColIndex(cellColIndex);
|
|
|
|
cellColSpan = aTableFrame.GetEffectiveColSpan(*cellFrame);
|
|
|
|
|
|
|
|
// If the adjacent cell is in a prior row (because of a rowspan) add in the space
|
|
|
|
if ((iter.IsLeftToRight() && (prevColIndex != (cellColIndex - 1))) ||
|
|
|
|
(!iter.IsLeftToRight() && (prevColIndex != cellColIndex + cellColSpan))) {
|
|
|
|
x += GetSpaceBetween(prevColIndex, cellColIndex, cellColSpan, aTableFrame,
|
2014-06-18 10:47:00 +00:00
|
|
|
iter.IsLeftToRight(), 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 05:38:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// remember the rightmost (ltr) or leftmost (rtl) column this cell spans into
|
|
|
|
prevColIndex = (iter.IsLeftToRight()) ? cellColIndex + (cellColSpan - 1) : cellColIndex;
|
|
|
|
|
1999-08-03 02:41:27 +00:00
|
|
|
// Reflow the child frame
|
2008-02-08 09:36:32 +00:00
|
|
|
nsRect kidRect = kidFrame->GetRect();
|
2012-08-29 05:48:45 +00:00
|
|
|
nsRect kidVisualOverflow = kidFrame->GetVisualOverflowRect();
|
|
|
|
bool firstReflow =
|
|
|
|
(kidFrame->GetStateBits() & NS_FRAME_FIRST_REFLOW) != 0;
|
2008-02-08 09:36:32 +00:00
|
|
|
|
1999-08-03 02:41:27 +00:00
|
|
|
if (doReflowChild) {
|
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 05:38:33 +00:00
|
|
|
// Calculate the available width for the table cell using the known column widths
|
2009-01-13 19:50:40 +00:00
|
|
|
nscoord availCellWidth =
|
2014-06-18 10:47:00 +00:00
|
|
|
CalcAvailWidth(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 05:38:33 +00:00
|
|
|
|
2013-12-31 13:50:31 +00:00
|
|
|
nsHTMLReflowMetrics desiredSize(aReflowState);
|
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 05:38:33 +00:00
|
|
|
|
|
|
|
// If the avail width is not the same as last time we reflowed the cell or
|
|
|
|
// 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?
|
|
|
|
nsSize cellDesiredSize = cellFrame->GetDesiredSize();
|
|
|
|
if ((availCellWidth != cellFrame->GetPriorAvailWidth()) ||
|
|
|
|
(cellDesiredSize.width > cellFrame->GetPriorAvailWidth()) ||
|
|
|
|
(GetStateBits() & NS_FRAME_IS_DIRTY) ||
|
|
|
|
isPaginated ||
|
2007-05-06 19:16:51 +00:00
|
|
|
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 05:38:33 +00:00
|
|
|
// See if it needs a special reflow, or if it had one that we need to undo.
|
|
|
|
(cellFrame->GetStateBits() & NS_FRAME_CONTAINS_RELATIVE_HEIGHT) ||
|
|
|
|
HasPctHeight()) {
|
|
|
|
// Reflow the cell to fit the available width, height
|
|
|
|
// XXX The old IR_ChildIsDirty code used availCellWidth here.
|
2013-12-27 17:59:21 +00:00
|
|
|
nsSize kidAvailSize(availCellWidth, aReflowState.AvailableHeight());
|
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 05:38:33 +00:00
|
|
|
|
|
|
|
// Reflow the child
|
|
|
|
nsTableCellReflowState kidReflowState(aPresContext, aReflowState,
|
2013-09-09 20:29:05 +00:00
|
|
|
kidFrame, kidAvailSize,
|
|
|
|
nsHTMLReflowState::CALLER_WILL_INIT);
|
2007-02-07 07:46:44 +00:00
|
|
|
InitChildReflowState(*aPresContext, kidAvailSize, borderCollapse,
|
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 05:38:33 +00:00
|
|
|
kidReflowState);
|
|
|
|
|
|
|
|
nsReflowStatus status;
|
2014-05-13 00:47:53 +00:00
|
|
|
ReflowChild(kidFrame, aPresContext, desiredSize, kidReflowState,
|
|
|
|
x, 0, 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 05:38:33 +00: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
|
|
|
|
if (NS_FRAME_IS_NOT_COMPLETE(status)) {
|
|
|
|
aStatus = NS_FRAME_NOT_COMPLETE;
|
1998-10-06 00:27:22 +00: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 05:38:33 +00:00
|
|
|
}
|
|
|
|
else {
|
2008-02-08 09:36:32 +00:00
|
|
|
if (x != kidRect.x) {
|
2010-08-31 00:49:12 +00:00
|
|
|
kidFrame->InvalidateFrameSubtree();
|
2008-02-08 09:36:32 +00:00
|
|
|
}
|
|
|
|
|
2013-12-27 17:59:52 +00:00
|
|
|
desiredSize.Width() = cellDesiredSize.width;
|
|
|
|
desiredSize.Height() = cellDesiredSize.height;
|
2010-10-07 04:25:46 +00: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 05:38:33 +00:00
|
|
|
// if we are in a floated table, our position is not yet established, so we cannot reposition our views
|
2009-02-12 23:10:59 +00:00
|
|
|
// the containing block will do this for us after positioning the table
|
2012-08-02 11:38:49 +00: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 05:38:33 +00: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 14:58:27 +00: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 05:38:33 +00:00
|
|
|
}
|
|
|
|
|
2013-12-27 17:59:21 +00:00
|
|
|
if (NS_UNCONSTRAINEDSIZE == aReflowState.AvailableHeight()) {
|
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 05:38:33 +00:00
|
|
|
if (!GetPrevInFlow()) {
|
2010-03-06 09:53:02 +00:00
|
|
|
// Calculate the cell's actual height given its pass2 height. This
|
|
|
|
// function takes into account the specified height (in the style)
|
2013-12-27 17:59:52 +00:00
|
|
|
CalculateCellActualHeight(cellFrame, desiredSize.Height());
|
2001-11-15 14:58:27 +00: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 05:38:33 +00:00
|
|
|
// height may have changed, adjust descent to absorb any excess difference
|
|
|
|
nscoord ascent;
|
2011-08-24 20:54:30 +00:00
|
|
|
if (!kidFrame->GetFirstPrincipalChild()->GetFirstPrincipalChild())
|
2013-12-27 17:59:52 +00:00
|
|
|
ascent = desiredSize.Height();
|
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 05:38:33 +00:00
|
|
|
else
|
2007-01-23 04:06:56 +00:00
|
|
|
ascent = ((nsTableCellFrame *)kidFrame)->GetCellBaseline();
|
2013-12-27 17:59:52 +00:00
|
|
|
nscoord descent = desiredSize.Height() - ascent;
|
|
|
|
UpdateHeight(desiredSize.Height(), ascent, descent, &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 05:38:33 +00:00
|
|
|
}
|
|
|
|
else {
|
2013-12-27 17:59:52 +00:00
|
|
|
cellMaxHeight = std::max(cellMaxHeight, desiredSize.Height());
|
2012-08-22 15:56:38 +00: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 05:38:33 +00:00
|
|
|
if (1 == rowSpan) {
|
2008-04-08 12:28:34 +00:00
|
|
|
SetContentHeight(cellMaxHeight);
|
2001-10-26 02:30:38 +00:00
|
|
|
}
|
1998-09-16 00:48:14 +00: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 05:38:33 +00:00
|
|
|
|
|
|
|
// Place the child
|
2013-12-27 17:59:52 +00:00
|
|
|
desiredSize.Width() = availCellWidth;
|
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 05:38:33 +00:00
|
|
|
|
2014-01-17 01:34:44 +00:00
|
|
|
FinishReflowChild(kidFrame, aPresContext, desiredSize, nullptr, x, 0, 0);
|
2012-07-04 00:24:55 +00:00
|
|
|
|
2012-08-29 05:48:45 +00:00
|
|
|
nsTableFrame::InvalidateTableFrame(kidFrame, kidRect, kidVisualOverflow,
|
|
|
|
firstReflow);
|
|
|
|
|
2013-12-27 17:59:52 +00:00
|
|
|
x += desiredSize.Width();
|
1998-10-23 17:24:57 +00: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 05:38:33 +00:00
|
|
|
else {
|
|
|
|
if (kidRect.x != x) {
|
2008-02-08 09:36:32 +00:00
|
|
|
// Invalidate the old position
|
2010-08-31 00:49:12 +00:00
|
|
|
kidFrame->InvalidateFrameSubtree();
|
2008-02-08 09:36:32 +00:00
|
|
|
// move to the new position
|
|
|
|
kidFrame->SetPosition(nsPoint(x, kidRect.y));
|
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 05:38:33 +00:00
|
|
|
nsTableFrame::RePositionViews(kidFrame);
|
2008-02-08 09:36:32 +00:00
|
|
|
// invalidate the new position
|
2010-08-31 00:49:12 +00: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 05:38:33 +00:00
|
|
|
}
|
2000-11-15 14:59:47 +00:00
|
|
|
// we need to account for the cell's width even if it isn't reflowed
|
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 05:38:33 +00:00
|
|
|
x += kidRect.width;
|
|
|
|
|
|
|
|
if (kidFrame->GetNextInFlow()) {
|
|
|
|
aStatus = NS_FRAME_NOT_COMPLETE;
|
|
|
|
}
|
2000-11-15 14:59:47 +00:00
|
|
|
}
|
2010-10-07 04:25:46 +00:00
|
|
|
ConsiderChildOverflow(aDesiredSize.mOverflowAreas, kidFrame);
|
2014-06-18 10:47:00 +00:00
|
|
|
x += aTableFrame.GetCellSpacingX(cellColIndex);
|
1998-09-16 17:19:20 +00:00
|
|
|
}
|
|
|
|
|
2001-03-13 06:38:59 +00:00
|
|
|
// just set our width to what was available. The table will calculate the width and not use our value.
|
2013-12-27 17:59:52 +00:00
|
|
|
aDesiredSize.Width() = aReflowState.AvailableWidth();
|
2002-03-27 05:50:24 +00:00
|
|
|
|
2002-03-31 17:44:57 +00:00
|
|
|
if (aReflowState.mFlags.mSpecialHeightReflow) {
|
2013-12-27 17:59:52 +00:00
|
|
|
aDesiredSize.Height() = mRect.height;
|
2002-03-31 17:44:57 +00:00
|
|
|
}
|
2013-12-27 17:59:21 +00:00
|
|
|
else if (NS_UNCONSTRAINEDSIZE == aReflowState.AvailableHeight()) {
|
2013-12-27 17:59:52 +00:00
|
|
|
aDesiredSize.Height() = CalcHeight(aReflowState);
|
2006-02-21 21:33:47 +00:00
|
|
|
if (GetPrevInFlow()) {
|
2002-03-27 05:50:24 +00:00
|
|
|
nscoord height = CalcHeightFromUnpaginatedHeight(aPresContext, *this);
|
2013-12-27 17:59:52 +00:00
|
|
|
aDesiredSize.Height() = std::max(aDesiredSize.Height(), height);
|
2002-03-27 05:50:24 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
if (isPaginated && HasStyleHeight()) {
|
|
|
|
// set the unpaginated height so next in flows can try to honor it
|
2011-10-17 14:59:28 +00:00
|
|
|
SetHasUnpaginatedHeight(true);
|
2013-12-27 17:59:52 +00:00
|
|
|
SetUnpaginatedHeight(aPresContext, aDesiredSize.Height());
|
2002-03-27 05:50:24 +00:00
|
|
|
}
|
|
|
|
if (isPaginated && HasUnpaginatedHeight()) {
|
2013-12-27 17:59:52 +00:00
|
|
|
aDesiredSize.Height() = std::max(aDesiredSize.Height(), GetUnpaginatedHeight(aPresContext));
|
2002-03-27 05:50:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else { // constrained height, paginated
|
2008-04-08 12:28:34 +00:00
|
|
|
// Compute the height we should have from style (subtracting the
|
|
|
|
// height from our prev-in-flows from the style height)
|
|
|
|
nscoord styleHeight = CalcHeightFromUnpaginatedHeight(aPresContext, *this);
|
2013-12-27 17:59:21 +00:00
|
|
|
if (styleHeight > aReflowState.AvailableHeight()) {
|
|
|
|
styleHeight = aReflowState.AvailableHeight();
|
2008-04-08 12:28:34 +00:00
|
|
|
NS_FRAME_SET_INCOMPLETE(aStatus);
|
|
|
|
}
|
2013-12-27 17:59:52 +00:00
|
|
|
aDesiredSize.Height() = std::max(cellMaxHeight, styleHeight);
|
2002-03-27 05:50:24 +00:00
|
|
|
}
|
2010-10-07 04:25:46 +00:00
|
|
|
aDesiredSize.UnionOverflowAreasWithDesiredBounds();
|
2004-07-16 16:56:21 +00:00
|
|
|
FinishAndStoreOverflow(&aDesiredSize);
|
1998-04-23 17:29:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/** Layout the entire row.
|
1998-07-02 05:39:10 +00:00
|
|
|
* This method stacks cells horizontally according to HTML 4.0 rules.
|
1998-04-23 17:29:07 +00:00
|
|
|
*/
|
2014-05-13 00:47:52 +00:00
|
|
|
void
|
2004-07-31 23:15:21 +00:00
|
|
|
nsTableRowFrame::Reflow(nsPresContext* aPresContext,
|
1998-10-02 04:10:00 +00:00
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsReflowStatus& aStatus)
|
1998-04-23 17:29:07 +00: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 05:38:33 +00:00
|
|
|
DO_GLOBAL_REFLOW_COUNT("nsTableRowFrame");
|
2001-11-14 13:40:03 +00:00
|
|
|
DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
|
1998-04-13 20:24:54 +00:00
|
|
|
|
2006-03-04 05:26:57 +00:00
|
|
|
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStyleVisibility* rowVis = StyleVisibility();
|
2011-09-29 06:19:26 +00:00
|
|
|
bool collapseRow = (NS_STYLE_VISIBILITY_COLLAPSE == rowVis->mVisible);
|
2004-04-28 16:42:59 +00:00
|
|
|
if (collapseRow) {
|
2011-10-17 14:59:28 +00:00
|
|
|
tableFrame->SetNeedToCollapse(true);
|
2004-04-28 16:42:59 +00:00
|
|
|
}
|
|
|
|
|
2002-04-01 06:46:17 +00:00
|
|
|
// see if a special height reflow needs to occur due to having a pct height
|
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 05:38:33 +00:00
|
|
|
nsTableFrame::CheckRequestSpecialHeightReflow(aReflowState);
|
|
|
|
|
2007-06-25 20:34:35 +00:00
|
|
|
// See if we have a cell with specified/pct height
|
|
|
|
InitHasCellWithStyleHeight(tableFrame);
|
|
|
|
|
2014-05-13 00:47:52 +00:00
|
|
|
ReflowChildren(aPresContext, aDesiredSize, aReflowState, *tableFrame, aStatus);
|
1998-07-02 05:39:10 +00:00
|
|
|
|
2012-11-08 16:09:38 +00:00
|
|
|
if (aPresContext->IsPaginated() && !NS_FRAME_IS_FULLY_COMPLETE(aStatus) &&
|
|
|
|
ShouldAvoidBreakInside(aReflowState)) {
|
|
|
|
aStatus = NS_INLINE_LINE_BREAK_BEFORE();
|
|
|
|
}
|
|
|
|
|
2001-03-13 06:38:59 +00:00
|
|
|
// just set our width to what was available. The table will calculate the width and not use our value.
|
2013-12-27 17:59:52 +00:00
|
|
|
aDesiredSize.Width() = aReflowState.AvailableWidth();
|
1999-08-30 22:30:32 +00:00
|
|
|
|
2012-08-29 05:48:45 +00:00
|
|
|
// If our parent is in initial reflow, it'll handle invalidating our
|
|
|
|
// entire overflow rect.
|
|
|
|
if (!(GetParent()->GetStateBits() & NS_FRAME_FIRST_REFLOW) &&
|
2013-12-27 17:59:52 +00:00
|
|
|
nsSize(aDesiredSize.Width(), aDesiredSize.Height()) != mRect.Size()) {
|
2012-08-29 05:48:45 +00:00
|
|
|
InvalidateFrame();
|
|
|
|
}
|
|
|
|
|
2002-05-28 22:50:43 +00:00
|
|
|
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
1999-02-22 03:28:00 +00: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
|
|
|
|
*/
|
2001-04-16 14:51:52 +00:00
|
|
|
nscoord
|
2004-07-31 23:15:21 +00:00
|
|
|
nsTableRowFrame::ReflowCellFrame(nsPresContext* aPresContext,
|
2001-04-16 14:51:52 +00:00
|
|
|
const nsHTMLReflowState& aReflowState,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool aIsTopOfPage,
|
2001-04-16 14:51:52 +00:00
|
|
|
nsTableCellFrame* aCellFrame,
|
|
|
|
nscoord aAvailableHeight,
|
|
|
|
nsReflowStatus& aStatus)
|
1999-02-22 03:28:00 +00:00
|
|
|
{
|
|
|
|
// Reflow the cell frame with the specified height. Use the existing width
|
2008-02-08 09:36:32 +00:00
|
|
|
nsRect cellRect = aCellFrame->GetRect();
|
2010-10-07 04:25:46 +00:00
|
|
|
nsRect cellVisualOverflow = aCellFrame->GetVisualOverflowRect();
|
1999-02-22 03:28:00 +00:00
|
|
|
|
2012-01-16 23:38:10 +00:00
|
|
|
nsSize availSize(cellRect.width, aAvailableHeight);
|
2012-01-16 23:38:10 +00:00
|
|
|
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
2012-01-16 23:38:10 +00:00
|
|
|
bool borderCollapse = tableFrame->IsBorderCollapse();
|
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 05:38:33 +00:00
|
|
|
nsTableCellReflowState cellReflowState(aPresContext, aReflowState,
|
2013-09-09 20:29:05 +00:00
|
|
|
aCellFrame, availSize,
|
|
|
|
nsHTMLReflowState::CALLER_WILL_INIT);
|
2007-02-07 07:46:44 +00:00
|
|
|
InitChildReflowState(*aPresContext, availSize, borderCollapse, cellReflowState);
|
2007-02-21 19:42:21 +00:00
|
|
|
cellReflowState.mFlags.mIsTopOfPage = aIsTopOfPage;
|
2002-02-19 15:48:28 +00:00
|
|
|
|
2013-12-31 13:50:31 +00:00
|
|
|
nsHTMLReflowMetrics desiredSize(aReflowState);
|
1999-02-22 03:28:00 +00:00
|
|
|
|
1999-11-19 15:33:29 +00:00
|
|
|
ReflowChild(aCellFrame, aPresContext, desiredSize, cellReflowState,
|
|
|
|
0, 0, NS_FRAME_NO_MOVE_FRAME, aStatus);
|
2011-09-29 06:19:26 +00:00
|
|
|
bool fullyComplete = NS_FRAME_IS_COMPLETE(aStatus) && !NS_FRAME_IS_TRUNCATED(aStatus);
|
2007-12-02 19:19:00 +00:00
|
|
|
if (fullyComplete) {
|
2013-12-27 17:59:52 +00:00
|
|
|
desiredSize.Height() = aAvailableHeight;
|
2007-12-02 19:19:00 +00:00
|
|
|
}
|
2013-12-27 17:59:52 +00:00
|
|
|
aCellFrame->SetSize(nsSize(cellRect.width, desiredSize.Height()));
|
2001-04-16 14:51:52 +00:00
|
|
|
|
2008-03-16 20:32:48 +00:00
|
|
|
// Note: VerticallyAlignChild can affect the overflow rect.
|
2000-06-05 08:25:11 +00: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 14:33:23 +00:00
|
|
|
if (fullyComplete) {
|
2007-01-27 22:22:24 +00:00
|
|
|
aCellFrame->VerticallyAlignChild(mMaxCellAscent);
|
2002-10-03 14:33:23 +00:00
|
|
|
}
|
2008-03-16 20:32:48 +00:00
|
|
|
|
2012-08-29 05:48:45 +00:00
|
|
|
nsTableFrame::InvalidateTableFrame(aCellFrame, cellRect,
|
|
|
|
cellVisualOverflow,
|
|
|
|
(aCellFrame->GetStateBits() &
|
|
|
|
NS_FRAME_FIRST_REFLOW) != 0);
|
|
|
|
|
2012-11-14 06:47:33 +00:00
|
|
|
aCellFrame->DidReflow(aPresContext, nullptr, nsDidReflowStatus::FINISHED);
|
2001-04-16 14:51:52 +00:00
|
|
|
|
2013-12-27 17:59:52 +00:00
|
|
|
return desiredSize.Height();
|
1999-02-22 03:28:00 +00:00
|
|
|
}
|
|
|
|
|
2006-03-04 05:26:57 +00:00
|
|
|
nscoord
|
|
|
|
nsTableRowFrame::CollapseRowIfNecessary(nscoord aRowOffset,
|
|
|
|
nscoord aWidth,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool aCollapseGroup,
|
|
|
|
bool& aDidCollapse)
|
2006-03-04 05:26:57 +00:00
|
|
|
{
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStyleVisibility* rowVis = StyleVisibility();
|
2011-09-29 06:19:26 +00:00
|
|
|
bool collapseRow = (NS_STYLE_VISIBILITY_COLLAPSE == rowVis->mVisible);
|
2012-01-16 23:38:10 +00:00
|
|
|
nsTableFrame* tableFrame = static_cast<nsTableFrame*>(
|
2013-09-25 11:42:34 +00:00
|
|
|
nsTableFrame::GetTableFrame(this)->FirstInFlow());
|
2006-03-04 05:26:57 +00:00
|
|
|
if (collapseRow) {
|
2011-10-17 14:59:28 +00:00
|
|
|
tableFrame->SetNeedToCollapse(true);
|
2006-03-04 05:26:57 +00:00
|
|
|
}
|
|
|
|
|
2008-02-08 09:36:32 +00:00
|
|
|
if (aRowOffset != 0) {
|
|
|
|
// We're moving, so invalidate our old position
|
2010-08-31 00:49:12 +00:00
|
|
|
InvalidateFrameSubtree();
|
2008-02-08 09:36:32 +00:00
|
|
|
}
|
|
|
|
|
2006-03-04 05:26:57 +00:00
|
|
|
nsRect rowRect = GetRect();
|
2012-08-29 05:48:45 +00:00
|
|
|
nsRect oldRect = rowRect;
|
|
|
|
nsRect oldVisualOverflow = GetVisualOverflowRect();
|
2008-02-08 09:36:32 +00:00
|
|
|
|
2006-03-04 05:26:57 +00:00
|
|
|
rowRect.y -= aRowOffset;
|
|
|
|
rowRect.width = aWidth;
|
2010-10-07 04:25:45 +00:00
|
|
|
nsOverflowAreas overflow;
|
2006-03-04 05:26:57 +00:00
|
|
|
nscoord shift = 0;
|
2006-03-26 15:58:34 +00:00
|
|
|
|
2006-03-04 05:26:57 +00:00
|
|
|
if (aCollapseGroup || collapseRow) {
|
2011-10-17 14:59:28 +00:00
|
|
|
aDidCollapse = true;
|
2014-07-01 17:58:13 +00:00
|
|
|
shift = rowRect.height;
|
|
|
|
nsTableCellFrame* cellFrame = GetFirstCell();
|
|
|
|
if (cellFrame) {
|
|
|
|
int32_t rowIndex;
|
|
|
|
cellFrame->GetRowIndex(rowIndex);
|
|
|
|
shift += tableFrame->GetCellSpacingY(rowIndex);
|
|
|
|
while (cellFrame) {
|
|
|
|
nsRect cRect = cellFrame->GetRect();
|
|
|
|
// 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();
|
|
|
|
}
|
|
|
|
cRect.height = 0;
|
|
|
|
cellFrame->SetRect(cRect);
|
|
|
|
cellFrame = cellFrame->GetNextCell();
|
2008-02-08 09:36:32 +00:00
|
|
|
}
|
2014-07-01 17:58:13 +00:00
|
|
|
} else {
|
|
|
|
shift += tableFrame->GetCellSpacingY(GetRowIndex());
|
2006-03-04 05:26:57 +00:00
|
|
|
}
|
|
|
|
rowRect.height = 0;
|
|
|
|
}
|
|
|
|
else { // row is not collapsed
|
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 05:38:33 +00:00
|
|
|
nsTableIterator iter(*this);
|
2006-03-04 05:26:57 +00:00
|
|
|
// remember the col index of the previous cell to handle rowspans into this
|
|
|
|
// row
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t firstPrevColIndex = (iter.IsLeftToRight()) ? -1 :
|
2006-03-04 05:26:57 +00:00
|
|
|
tableFrame->GetColCount();
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t prevColIndex = firstPrevColIndex;
|
2006-03-04 05:26:57 +00:00
|
|
|
nscoord x = 0; // running total of children x offset
|
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t colIncrement = iter.IsLeftToRight() ? 1 : -1;
|
2006-03-04 05:26:57 +00:00
|
|
|
|
|
|
|
nsIFrame* kidFrame = iter.First();
|
|
|
|
while (kidFrame) {
|
2009-03-24 22:10:06 +00:00
|
|
|
nsTableCellFrame *cellFrame = do_QueryFrame(kidFrame);
|
|
|
|
if (cellFrame) {
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t cellColIndex;
|
2006-03-04 05:26:57 +00:00
|
|
|
cellFrame->GetColIndex(cellColIndex);
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t cellColSpan = tableFrame->GetEffectiveColSpan(*cellFrame);
|
2006-03-04 05:26:57 +00:00
|
|
|
|
|
|
|
// If the adjacent cell is in a prior row (because of a rowspan) add in
|
|
|
|
// the space
|
|
|
|
if ((iter.IsLeftToRight() && (prevColIndex != (cellColIndex - 1))) ||
|
|
|
|
(!iter.IsLeftToRight() &&
|
|
|
|
(prevColIndex != cellColIndex + cellColSpan))) {
|
|
|
|
x += GetSpaceBetween(prevColIndex, cellColIndex, cellColSpan,
|
2014-06-18 10:47:00 +00:00
|
|
|
*tableFrame, iter.IsLeftToRight(),
|
2011-10-17 14:59:28 +00:00
|
|
|
true);
|
2006-03-04 05:26:57 +00:00
|
|
|
}
|
2008-02-08 09:36:32 +00:00
|
|
|
nsRect cRect(x, 0, 0, rowRect.height);
|
2006-03-04 05:26:57 +00:00
|
|
|
|
|
|
|
// remember the rightmost (ltr) or leftmost (rtl) column this cell
|
|
|
|
// spans into
|
|
|
|
prevColIndex = (iter.IsLeftToRight()) ?
|
|
|
|
cellColIndex + (cellColSpan - 1) : cellColIndex;
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t startIndex = (iter.IsLeftToRight()) ?
|
2006-03-26 15:58:34 +00:00
|
|
|
cellColIndex : cellColIndex + (cellColSpan - 1);
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t actualColSpan = cellColSpan;
|
2011-09-29 06:19:26 +00:00
|
|
|
bool isVisible = false;
|
2012-08-22 15:56:38 +00:00
|
|
|
for (int32_t colX = startIndex; actualColSpan > 0;
|
2006-03-04 05:26:57 +00:00
|
|
|
colX += colIncrement, actualColSpan--) {
|
|
|
|
|
|
|
|
nsTableColFrame* colFrame = tableFrame->GetColFrame(colX);
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStyleVisibility* colVis = colFrame->StyleVisibility();
|
2011-09-29 06:19:26 +00:00
|
|
|
bool collapseCol = (NS_STYLE_VISIBILITY_COLLAPSE ==
|
2006-03-04 05:26:57 +00:00
|
|
|
colVis->mVisible);
|
|
|
|
nsIFrame* cgFrame = colFrame->GetParent();
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStyleVisibility* groupVis = cgFrame->StyleVisibility();
|
2011-09-29 06:19:26 +00:00
|
|
|
bool collapseGroup = (NS_STYLE_VISIBILITY_COLLAPSE ==
|
2006-03-04 05:26:57 +00:00
|
|
|
groupVis->mVisible);
|
2011-09-29 06:19:26 +00:00
|
|
|
bool isCollapsed = collapseCol || collapseGroup;
|
2009-05-16 14:22:56 +00:00
|
|
|
if (!isCollapsed) {
|
2006-03-04 05:26:57 +00:00
|
|
|
cRect.width += tableFrame->GetColumnWidth(colX);
|
2011-10-17 14:59:28 +00:00
|
|
|
isVisible = true;
|
2009-05-16 14:22:56 +00:00
|
|
|
if ((actualColSpan > 1)) {
|
|
|
|
nsTableColFrame* nextColFrame =
|
|
|
|
tableFrame->GetColFrame(colX + colIncrement);
|
|
|
|
const nsStyleVisibility* nextColVis =
|
2013-02-16 21:51:02 +00:00
|
|
|
nextColFrame->StyleVisibility();
|
2009-05-16 14:22:56 +00:00
|
|
|
if ( (NS_STYLE_VISIBILITY_COLLAPSE != nextColVis->mVisible) &&
|
|
|
|
tableFrame->ColumnHasCellSpacingBefore(colX + colIncrement)) {
|
2014-06-18 10:47:00 +00:00
|
|
|
cRect.width += tableFrame->GetCellSpacingX(cellColIndex);
|
2009-05-16 14:22:56 +00:00
|
|
|
}
|
2006-03-04 05:26:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
x += cRect.width;
|
|
|
|
if (isVisible)
|
2014-06-18 10:47:00 +00:00
|
|
|
x += tableFrame->GetCellSpacingX(cellColIndex);
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t actualRowSpan = tableFrame->GetEffectiveRowSpan(*cellFrame);
|
2006-03-04 05:26:57 +00:00
|
|
|
nsTableRowFrame* rowFrame = GetNextRow();
|
|
|
|
for (actualRowSpan--; actualRowSpan > 0 && rowFrame; actualRowSpan--) {
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStyleVisibility* nextRowVis = rowFrame->StyleVisibility();
|
2011-09-29 06:19:26 +00:00
|
|
|
bool collapseNextRow = (NS_STYLE_VISIBILITY_COLLAPSE ==
|
2006-03-04 05:26:57 +00:00
|
|
|
nextRowVis->mVisible);
|
|
|
|
if (!collapseNextRow) {
|
|
|
|
nsRect nextRect = rowFrame->GetRect();
|
2014-06-18 10:47:00 +00:00
|
|
|
cRect.height += nextRect.height +
|
|
|
|
tableFrame->GetCellSpacingY(rowFrame->GetRowIndex());
|
2006-03-04 05:26:57 +00:00
|
|
|
}
|
|
|
|
rowFrame = rowFrame->GetNextRow();
|
|
|
|
}
|
2008-02-08 09:36:32 +00:00
|
|
|
|
|
|
|
nsRect oldCellRect = cellFrame->GetRect();
|
2010-10-07 04:25:46 +00:00
|
|
|
nsRect oldCellVisualOverflow = cellFrame->GetVisualOverflowRect();
|
2008-02-08 09:36:32 +00:00
|
|
|
|
|
|
|
if (aRowOffset == 0 && cRect.TopLeft() != oldCellRect.TopLeft()) {
|
|
|
|
// We're moving the cell. Invalidate the old overflow area
|
2010-08-31 00:49:12 +00:00
|
|
|
cellFrame->InvalidateFrameSubtree();
|
2008-02-08 09:36:32 +00:00
|
|
|
}
|
|
|
|
|
2006-03-04 05:26:57 +00:00
|
|
|
cellFrame->SetRect(cRect);
|
2008-02-08 09:36:32 +00:00
|
|
|
|
|
|
|
// XXXbz This looks completely bogus in the cases when we didn't
|
|
|
|
// collapse the cell!
|
2010-10-07 04:25:45 +00:00
|
|
|
nsRect cellBounds(0, 0, cRect.width, cRect.height);
|
|
|
|
nsOverflowAreas cellOverflow(cellBounds, cellBounds);
|
2013-08-14 12:27:20 +00:00
|
|
|
cellFrame->FinishAndStoreOverflow(cellOverflow, cRect.Size());
|
2006-03-04 05:26:57 +00:00
|
|
|
nsTableFrame::RePositionViews(cellFrame);
|
2010-10-07 04:25:45 +00:00
|
|
|
ConsiderChildOverflow(overflow, cellFrame);
|
2012-08-29 05:48:45 +00:00
|
|
|
|
|
|
|
if (aRowOffset == 0) {
|
|
|
|
nsTableFrame::InvalidateTableFrame(cellFrame, oldCellRect,
|
|
|
|
oldCellVisualOverflow,
|
|
|
|
false);
|
|
|
|
}
|
2006-03-04 05:26:57 +00:00
|
|
|
}
|
|
|
|
kidFrame = iter.Next(); // Get the next child
|
|
|
|
}
|
|
|
|
}
|
2008-02-08 09:36:32 +00:00
|
|
|
|
2006-03-04 05:26:57 +00:00
|
|
|
SetRect(rowRect);
|
2013-08-14 12:27:20 +00:00
|
|
|
overflow.UnionAllWith(nsRect(0, 0, rowRect.width, rowRect.height));
|
|
|
|
FinishAndStoreOverflow(overflow, rowRect.Size());
|
2008-02-08 09:36:32 +00:00
|
|
|
|
2006-03-04 05:26:57 +00:00
|
|
|
nsTableFrame::RePositionViews(this);
|
2012-08-29 05:48:45 +00:00
|
|
|
nsTableFrame::InvalidateTableFrame(this, oldRect, oldVisualOverflow, false);
|
2006-03-04 05:26:57 +00:00
|
|
|
return shift;
|
|
|
|
}
|
|
|
|
|
2009-09-04 21:07:43 +00: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 03:28:00 +00:00
|
|
|
*/
|
2001-04-16 14:51:52 +00:00
|
|
|
void
|
|
|
|
nsTableRowFrame::InsertCellFrame(nsTableCellFrame* aFrame,
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t aColIndex)
|
2001-04-16 14:51:52 +00:00
|
|
|
{
|
|
|
|
// Find the cell frame where col index < aColIndex
|
2012-07-30 14:20:58 +00:00
|
|
|
nsTableCellFrame* priorCell = nullptr;
|
2003-07-07 02:01:29 +00:00
|
|
|
for (nsIFrame* child = mFrames.FirstChild(); child;
|
|
|
|
child = child->GetNextSibling()) {
|
2009-03-24 22:10:06 +00:00
|
|
|
nsTableCellFrame *cellFrame = do_QueryFrame(child);
|
|
|
|
if (cellFrame) {
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t colIndex;
|
2001-04-16 14:51:52 +00:00
|
|
|
cellFrame->GetColIndex(colIndex);
|
|
|
|
if (colIndex < aColIndex) {
|
|
|
|
priorCell = cellFrame;
|
|
|
|
}
|
|
|
|
else break;
|
|
|
|
}
|
|
|
|
}
|
2009-09-04 21:07:43 +00:00
|
|
|
mFrames.InsertFrame(this, priorCell, aFrame);
|
1999-02-22 03:28:00 +00:00
|
|
|
}
|
|
|
|
|
2003-10-31 20:19:18 +00:00
|
|
|
nsIAtom*
|
|
|
|
nsTableRowFrame::GetType() const
|
1999-02-24 05:54:31 +00:00
|
|
|
{
|
2006-12-26 17:47:52 +00:00
|
|
|
return nsGkAtoms::tableRowFrame;
|
1999-02-24 05:54:31 +00:00
|
|
|
}
|
|
|
|
|
2001-11-05 00:15:51 +00:00
|
|
|
nsTableRowFrame*
|
|
|
|
nsTableRowFrame::GetNextRow() const
|
|
|
|
{
|
2003-07-07 02:01:29 +00:00
|
|
|
nsIFrame* childFrame = GetNextSibling();
|
2001-11-05 00:15:51 +00:00
|
|
|
while (childFrame) {
|
2009-03-24 22:10:06 +00:00
|
|
|
nsTableRowFrame *rowFrame = do_QueryFrame(childFrame);
|
|
|
|
if (rowFrame) {
|
2013-02-16 21:51:02 +00:00
|
|
|
NS_ASSERTION(NS_STYLE_DISPLAY_TABLE_ROW == childFrame->StyleDisplay()->mDisplay, "wrong display type on rowframe");
|
2009-03-24 22:10:06 +00:00
|
|
|
return rowFrame;
|
2001-11-05 00:15:51 +00:00
|
|
|
}
|
2003-07-07 02:01:29 +00:00
|
|
|
childFrame = childFrame->GetNextSibling();
|
2001-11-05 00:15:51 +00:00
|
|
|
}
|
2012-07-30 14:20:58 +00:00
|
|
|
return nullptr;
|
2001-11-05 00:15:51 +00:00
|
|
|
}
|
1999-02-24 05:54:31 +00:00
|
|
|
|
2012-07-30 14:20:58 +00:00
|
|
|
NS_DECLARE_FRAME_PROPERTY(RowUnpaginatedHeightProperty, nullptr)
|
2010-03-29 01:46:55 +00:00
|
|
|
|
2001-11-29 15:41:07 +00:00
|
|
|
void
|
2004-07-31 23:15:21 +00:00
|
|
|
nsTableRowFrame::SetUnpaginatedHeight(nsPresContext* aPresContext,
|
2009-01-14 22:16:43 +00:00
|
|
|
nscoord aValue)
|
2001-11-29 15:41:07 +00:00
|
|
|
{
|
2006-02-21 21:33:47 +00:00
|
|
|
NS_ASSERTION(!GetPrevInFlow(), "program error");
|
2010-03-29 01:46:55 +00:00
|
|
|
// Get the property
|
|
|
|
aPresContext->PropertyTable()->
|
|
|
|
Set(this, RowUnpaginatedHeightProperty(), NS_INT32_TO_PTR(aValue));
|
2001-11-29 15:41:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nscoord
|
2004-07-31 23:15:21 +00:00
|
|
|
nsTableRowFrame::GetUnpaginatedHeight(nsPresContext* aPresContext)
|
2001-11-29 15:41:07 +00:00
|
|
|
{
|
2013-09-25 11:42:34 +00:00
|
|
|
FrameProperties props = FirstInFlow()->Properties();
|
2010-03-29 01:46:55 +00:00
|
|
|
return NS_PTR_TO_INT32(props.Get(RowUnpaginatedHeightProperty()));
|
2001-11-29 15:41:07 +00:00
|
|
|
}
|
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
void nsTableRowFrame::SetContinuousBCBorderWidth(uint8_t aForSide,
|
2004-03-09 06:48:35 +00:00
|
|
|
BCPixelSize aPixelValue)
|
|
|
|
{
|
|
|
|
switch (aForSide) {
|
|
|
|
case NS_SIDE_RIGHT:
|
|
|
|
mRightContBorderWidth = aPixelValue;
|
|
|
|
return;
|
|
|
|
case NS_SIDE_TOP:
|
|
|
|
mTopContBorderWidth = aPixelValue;
|
|
|
|
return;
|
|
|
|
case NS_SIDE_LEFT:
|
|
|
|
mLeftContBorderWidth = aPixelValue;
|
|
|
|
return;
|
|
|
|
default:
|
|
|
|
NS_ERROR("invalid NS_SIDE arg");
|
|
|
|
}
|
|
|
|
}
|
2012-04-25 03:06:21 +00:00
|
|
|
#ifdef ACCESSIBILITY
|
2012-09-28 21:53:44 +00:00
|
|
|
a11y::AccType
|
|
|
|
nsTableRowFrame::AccessibleType()
|
2012-04-25 03:06:21 +00:00
|
|
|
{
|
2012-12-18 01:25:52 +00:00
|
|
|
return a11y::eHTMLTableRowType;
|
2012-04-25 03:06:21 +00:00
|
|
|
}
|
|
|
|
#endif
|
2007-06-25 20:34:35 +00:00
|
|
|
/**
|
|
|
|
* Sets the NS_ROW_HAS_CELL_WITH_STYLE_HEIGHT bit to indicate whether
|
|
|
|
* this row has any cells that have non-auto-height. (Row-spanning
|
|
|
|
* cells are ignored.)
|
|
|
|
*/
|
|
|
|
void nsTableRowFrame::InitHasCellWithStyleHeight(nsTableFrame* aTableFrame)
|
|
|
|
{
|
|
|
|
nsTableIterator iter(*this);
|
|
|
|
|
|
|
|
for (nsIFrame* kidFrame = iter.First(); kidFrame; kidFrame = iter.Next()) {
|
2009-03-24 22:10:06 +00:00
|
|
|
nsTableCellFrame *cellFrame = do_QueryFrame(kidFrame);
|
|
|
|
if (!cellFrame) {
|
2007-06-25 20:34:35 +00:00
|
|
|
NS_NOTREACHED("Table row has a non-cell child.");
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
// Ignore row-spanning cells
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStyleCoord &cellHeight = cellFrame->StylePosition()->mHeight;
|
2007-06-25 20:34:35 +00:00
|
|
|
if (aTableFrame->GetEffectiveRowSpan(*cellFrame) == 1 &&
|
2010-08-25 10:17:55 +00:00
|
|
|
cellHeight.GetUnit() != eStyleUnit_Auto &&
|
2012-11-21 16:19:30 +00:00
|
|
|
/* calc() with percentages treated like 'auto' */
|
|
|
|
(!cellHeight.IsCalcUnit() || !cellHeight.HasPercent())) {
|
2007-06-25 20:34:35 +00:00
|
|
|
AddStateBits(NS_ROW_HAS_CELL_WITH_STYLE_HEIGHT);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
RemoveStateBits(NS_ROW_HAS_CELL_WITH_STYLE_HEIGHT);
|
|
|
|
}
|
2012-08-29 05:39:31 +00:00
|
|
|
|
|
|
|
void
|
2012-08-29 05:48:45 +00:00
|
|
|
nsTableRowFrame::InvalidateFrame(uint32_t aDisplayItemKey)
|
|
|
|
{
|
|
|
|
nsIFrame::InvalidateFrame(aDisplayItemKey);
|
|
|
|
GetParent()->InvalidateFrameWithRect(GetVisualOverflowRect() + GetPosition(), aDisplayItemKey);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
nsTableRowFrame::InvalidateFrameWithRect(const nsRect& aRect, uint32_t aDisplayItemKey)
|
2012-08-29 05:39:31 +00:00
|
|
|
{
|
2012-08-29 05:48:45 +00:00
|
|
|
nsIFrame::InvalidateFrameWithRect(aRect, aDisplayItemKey);
|
|
|
|
// If we have filters applied that would affects our bounds, then
|
|
|
|
// we get an inactive layer created and this is computed
|
|
|
|
// within FrameLayerBuilder
|
|
|
|
GetParent()->InvalidateFrameWithRect(aRect + GetPosition(), aDisplayItemKey);
|
2012-08-29 05:39:31 +00:00
|
|
|
}
|
2007-06-25 20:34:35 +00:00
|
|
|
|
1998-09-15 17:58:24 +00:00
|
|
|
/* ----- global methods ----- */
|
|
|
|
|
2014-05-24 22:20:40 +00:00
|
|
|
nsTableRowFrame*
|
2006-03-26 21:30:36 +00:00
|
|
|
NS_NewTableRowFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
2006-03-26 21:30:36 +00:00
|
|
|
return new (aPresShell) nsTableRowFrame(aContext);
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
2009-09-12 16:49:24 +00:00
|
|
|
NS_IMPL_FRAMEARENA_HELPERS(nsTableRowFrame)
|
|
|
|
|
2014-01-05 23:31:14 +00:00
|
|
|
#ifdef DEBUG_FRAME_DUMP
|
2014-02-18 07:47:48 +00:00
|
|
|
nsresult
|
2001-11-14 01:33:42 +00:00
|
|
|
nsTableRowFrame::GetFrameName(nsAString& aResult) const
|
1998-11-19 17:22:29 +00:00
|
|
|
{
|
2001-11-14 01:33:42 +00:00
|
|
|
return MakeFrameName(NS_LITERAL_STRING("TableRow"), aResult);
|
1998-11-19 17:22:29 +00:00
|
|
|
}
|
1999-09-01 01:02:16 +00:00
|
|
|
#endif
|