2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 04:12:37 -07: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/. */
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsTableRowFrame.h"
|
|
|
|
#include "nsTableRowGroupFrame.h"
|
|
|
|
#include "nsIPresShell.h"
|
|
|
|
#include "nsPresContext.h"
|
|
|
|
#include "nsStyleContext.h"
|
|
|
|
#include "nsStyleConsts.h"
|
|
|
|
#include "nsGkAtoms.h"
|
|
|
|
#include "nsIContent.h"
|
|
|
|
#include "nsTableFrame.h"
|
|
|
|
#include "nsTableCellFrame.h"
|
|
|
|
#include "nsCSSRendering.h"
|
|
|
|
#include "nsHTMLParts.h"
|
|
|
|
#include "nsTableColGroupFrame.h"
|
|
|
|
#include "nsTableColFrame.h"
|
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsDisplayList.h"
|
2013-01-15 04:22:03 -08:00
|
|
|
#include <algorithm>
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2010-03-28 18:46:55 -07:00
|
|
|
using namespace mozilla;
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
struct nsTableCellReflowState : public nsHTMLReflowState
|
|
|
|
{
|
|
|
|
nsTableCellReflowState(nsPresContext* aPresContext,
|
|
|
|
const nsHTMLReflowState& aParentReflowState,
|
|
|
|
nsIFrame* aFrame,
|
|
|
|
const nsSize& aAvailableSpace,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aInit = true)
|
2007-03-22 10:30:00 -07:00
|
|
|
: nsHTMLReflowState(aPresContext, aParentReflowState, aFrame,
|
|
|
|
aAvailableSpace, -1, -1, aInit)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void FixUp(const nsSize& aAvailSpace);
|
|
|
|
};
|
|
|
|
|
|
|
|
void nsTableCellReflowState::FixUp(const nsSize& aAvailSpace)
|
|
|
|
{
|
|
|
|
// fix the mComputed values during a pass 2 reflow since the cell can be a percentage base
|
2009-10-28 20:22:28 -07: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-03-22 10:30:00 -07:00
|
|
|
if (NS_UNCONSTRAINEDSIZE != ComputedWidth()) {
|
2007-08-02 11:08:05 -07:00
|
|
|
nscoord computedWidth =
|
|
|
|
aAvailSpace.width - mComputedBorderPadding.LeftRight();
|
2013-01-15 04:22:03 -08:00
|
|
|
computedWidth = std::max(0, computedWidth);
|
2007-03-22 10:30:00 -07:00
|
|
|
SetComputedWidth(computedWidth);
|
|
|
|
}
|
2007-08-02 11:08:05 -07:00
|
|
|
if (NS_UNCONSTRAINEDSIZE != ComputedHeight() &&
|
|
|
|
NS_UNCONSTRAINEDSIZE != aAvailSpace.height) {
|
|
|
|
nscoord computedHeight =
|
|
|
|
aAvailSpace.height - mComputedBorderPadding.TopBottom();
|
2013-01-15 04:22:03 -08:00
|
|
|
computedHeight = std::max(0, computedHeight);
|
2007-08-02 11:08:05 -07:00
|
|
|
SetComputedHeight(computedHeight);
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
nsTableRowFrame::InitChildReflowState(nsPresContext& aPresContext,
|
|
|
|
const nsSize& aAvailSize,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aBorderCollapse,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsTableCellReflowState& aReflowState)
|
|
|
|
{
|
|
|
|
nsMargin collapseBorder;
|
2012-07-30 07:20:58 -07:00
|
|
|
nsMargin* pCollapseBorder = nullptr;
|
2007-03-22 10:30:00 -07:00
|
|
|
if (aBorderCollapse) {
|
|
|
|
// we only reflow cells, so don't need to check frame type
|
|
|
|
nsBCTableCellFrame* bcCellFrame = (nsBCTableCellFrame*)aReflowState.frame;
|
|
|
|
if (bcCellFrame) {
|
|
|
|
pCollapseBorder = bcCellFrame->GetBorderWidth(collapseBorder);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
aReflowState.Init(&aPresContext, -1, -1, pCollapseBorder);
|
|
|
|
aReflowState.FixUp(aAvailSize);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
nsTableRowFrame::SetFixedHeight(nscoord aValue)
|
|
|
|
{
|
2013-01-15 04:22:03 -08:00
|
|
|
nscoord height = std::max(0, aValue);
|
2007-03-22 10:30:00 -07:00
|
|
|
if (HasFixedHeight()) {
|
|
|
|
if (height > mStyleFixedHeight) {
|
|
|
|
mStyleFixedHeight = height;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
mStyleFixedHeight = height;
|
|
|
|
if (height > 0) {
|
2011-10-17 07:59:28 -07:00
|
|
|
SetHasFixedHeight(true);
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
nsTableRowFrame::SetPctHeight(float aPctValue,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aForce)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2013-01-15 04:22:03 -08:00
|
|
|
nscoord height = std::max(0, NSToCoordRound(aPctValue * 100.0f));
|
2007-03-22 10:30:00 -07:00
|
|
|
if (HasPctHeight()) {
|
|
|
|
if ((height > mStylePctHeight) || aForce) {
|
|
|
|
mStylePctHeight = height;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
mStylePctHeight = height;
|
2012-01-22 14:48:34 -08:00
|
|
|
if (height > 0) {
|
2011-10-17 07:59:28 -07:00
|
|
|
SetHasPctHeight(true);
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ----------- nsTableRowFrame ---------- */
|
|
|
|
|
2009-03-24 15:10:06 -07:00
|
|
|
NS_QUERYFRAME_HEAD(nsTableRowFrame)
|
|
|
|
NS_QUERYFRAME_ENTRY(nsTableRowFrame)
|
2011-12-27 12:18:48 -08:00
|
|
|
NS_QUERYFRAME_TAIL_INHERITING(nsContainerFrame)
|
2009-03-24 15:10:06 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
nsTableRowFrame::nsTableRowFrame(nsStyleContext* aContext)
|
2011-12-27 12:18:48 -08:00
|
|
|
: nsContainerFrame(aContext)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
mBits.mRowIndex = mBits.mFirstInserted = 0;
|
|
|
|
ResetHeight(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsTableRowFrame::~nsTableRowFrame()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsTableRowFrame::Init(nsIContent* aContent,
|
|
|
|
nsIFrame* aParent,
|
|
|
|
nsIFrame* aPrevInFlow)
|
|
|
|
{
|
|
|
|
nsresult rv;
|
|
|
|
|
|
|
|
// Let the base class do its initialization
|
2011-12-27 12:18:48 -08:00
|
|
|
rv = nsContainerFrame::Init(aContent, aParent, aPrevInFlow);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2008-08-13 20:49:57 -07:00
|
|
|
NS_ASSERTION(NS_STYLE_DISPLAY_TABLE_ROW == GetStyleDisplay()->mDisplay,
|
|
|
|
"wrong display on table row frame");
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
if (aPrevInFlow) {
|
|
|
|
// Set the row index
|
|
|
|
nsTableRowFrame* rowFrame = (nsTableRowFrame*)aPrevInFlow;
|
|
|
|
|
|
|
|
SetRowIndex(rowFrame->GetRowIndex());
|
|
|
|
}
|
|
|
|
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
2008-10-26 03:11:34 -07:00
|
|
|
/* virtual */ void
|
|
|
|
nsTableRowFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext)
|
|
|
|
{
|
2012-08-13 14:13:34 -07:00
|
|
|
nsContainerFrame::DidSetStyleContext(aOldStyleContext);
|
|
|
|
|
2008-10-26 03:11:34 -07:00
|
|
|
if (!aOldStyleContext) //avoid this on init
|
|
|
|
return;
|
|
|
|
|
|
|
|
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
|
|
|
if (tableFrame->IsBorderCollapse() &&
|
2013-02-15 21:38:33 -08:00
|
|
|
tableFrame->BCRecalcNeeded(aOldStyleContext, StyleContext())) {
|
2012-01-22 14:48:34 -08:00
|
|
|
nsIntRect damageArea(0, GetRowIndex(), tableFrame->GetColCount(), 1);
|
2011-10-27 06:58:44 -07:00
|
|
|
tableFrame->AddBCDamageArea(damageArea);
|
2008-10-26 03:11:34 -07:00
|
|
|
}
|
|
|
|
}
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2011-08-24 13:54:30 -07:00
|
|
|
nsTableRowFrame::AppendFrames(ChildListID aListID,
|
2009-07-30 10:23:32 -07:00
|
|
|
nsFrameList& aFrameList)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2011-08-24 13:54:30 -07:00
|
|
|
NS_ASSERTION(aListID == kPrincipalList, "unexpected child list");
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-07-30 07:20:58 -07:00
|
|
|
const nsFrameList::Slice& newCells = mFrames.AppendFrames(nullptr, aFrameList);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// Add the new cell frames to the table
|
2012-01-16 15:38:10 -08:00
|
|
|
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
2009-07-30 10:23:32 -07:00
|
|
|
for (nsFrameList::Enumerator e(newCells) ; !e.AtEnd(); e.Next()) {
|
2011-12-27 00:31:22 -08: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());
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2007-05-06 12:16:51 -07:00
|
|
|
PresContext()->PresShell()->FrameNeedsReflow(this, nsIPresShell::eTreeChange,
|
|
|
|
NS_FRAME_HAS_DIRTY_CHILDREN);
|
2007-03-22 10:30:00 -07:00
|
|
|
tableFrame->SetGeometryDirty();
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2011-08-24 13:54:30 -07:00
|
|
|
nsTableRowFrame::InsertFrames(ChildListID aListID,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsIFrame* aPrevFrame,
|
2009-07-30 10:23:32 -07:00
|
|
|
nsFrameList& aFrameList)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2011-08-24 13:54:30 -07:00
|
|
|
NS_ASSERTION(aListID == kPrincipalList, "unexpected child list");
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_ASSERTION(!aPrevFrame || aPrevFrame->GetParent() == this,
|
|
|
|
"inserting after sibling frame with different parent");
|
2011-12-27 00:31:22 -08:00
|
|
|
//Insert Frames in the frame list
|
2012-07-30 07:20:58 -07:00
|
|
|
const nsFrameList::Slice& newCells = mFrames.InsertFrames(nullptr, aPrevFrame, aFrameList);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// Get the table frame
|
|
|
|
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
2012-01-16 15:38:10 -08:00
|
|
|
nsIAtom* cellFrameType = tableFrame->IsBorderCollapse() ? nsGkAtoms::bcTableCellFrame : nsGkAtoms::tableCellFrame;
|
2007-03-22 10:30:00 -07:00
|
|
|
nsTableCellFrame* prevCellFrame = (nsTableCellFrame *)nsTableFrame::GetFrameAtOrBefore(this, aPrevFrame, cellFrameType);
|
2009-02-05 01:09:50 -08:00
|
|
|
nsTArray<nsTableCellFrame*> cellChildren;
|
2011-12-27 00:31:22 -08: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));
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
// insert the cells into the cell map
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t colIndex = -1;
|
2007-03-22 10:30:00 -07:00
|
|
|
if (prevCellFrame) {
|
|
|
|
prevCellFrame->GetColIndex(colIndex);
|
|
|
|
}
|
|
|
|
tableFrame->InsertCells(cellChildren, GetRowIndex(), colIndex);
|
|
|
|
|
2007-05-06 12:16:51 -07:00
|
|
|
PresContext()->PresShell()->FrameNeedsReflow(this, nsIPresShell::eTreeChange,
|
|
|
|
NS_FRAME_HAS_DIRTY_CHILDREN);
|
2007-03-22 10:30:00 -07:00
|
|
|
tableFrame->SetGeometryDirty();
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2011-08-24 13:54:30 -07:00
|
|
|
nsTableRowFrame::RemoveFrame(ChildListID aListID,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsIFrame* aOldFrame)
|
|
|
|
{
|
2011-08-24 13:54:30 -07:00
|
|
|
NS_ASSERTION(aListID == kPrincipalList, "unexpected child list");
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
2012-01-16 15:38:10 -08:00
|
|
|
nsTableCellFrame *cellFrame = do_QueryFrame(aOldFrame);
|
|
|
|
if (cellFrame) {
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t colIndex;
|
2012-01-16 15:38:10 -08:00
|
|
|
cellFrame->GetColIndex(colIndex);
|
|
|
|
// remove the cell from the cell map
|
|
|
|
tableFrame->RemoveCell(cellFrame, GetRowIndex());
|
|
|
|
|
|
|
|
// Remove the frame and destroy it
|
|
|
|
mFrames.DestroyFrame(aOldFrame);
|
|
|
|
|
|
|
|
PresContext()->PresShell()->
|
|
|
|
FrameNeedsReflow(this, nsIPresShell::eTreeChange,
|
|
|
|
NS_FRAME_HAS_DIRTY_CHILDREN);
|
|
|
|
tableFrame->SetGeometryDirty();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
NS_ERROR("unexpected frame type");
|
|
|
|
return NS_ERROR_INVALID_ARG;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* 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);
|
|
|
|
}
|
|
|
|
|
|
|
|
nscoord
|
|
|
|
GetHeightOfRowsSpannedBelowFirst(nsTableCellFrame& aTableCellFrame,
|
|
|
|
nsTableFrame& aTableFrame)
|
|
|
|
{
|
|
|
|
nscoord height = 0;
|
|
|
|
nscoord cellSpacingY = aTableFrame.GetCellSpacingY();
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t rowSpan = aTableFrame.GetEffectiveRowSpan(aTableCellFrame);
|
2007-03-22 10:30:00 -07:00
|
|
|
// add in height of rows spanned beyond the 1st one
|
|
|
|
nsIFrame* nextRow = aTableCellFrame.GetParent()->GetNextSibling();
|
2012-08-22 08:56:38 -07:00
|
|
|
for (int32_t rowX = 1; ((rowX < rowSpan) && nextRow);) {
|
2007-03-22 10:30:00 -07:00
|
|
|
if (nsGkAtoms::tableRowFrame == nextRow->GetType()) {
|
|
|
|
height += nextRow->GetSize().height;
|
|
|
|
rowX++;
|
|
|
|
}
|
|
|
|
height += cellSpacingY;
|
|
|
|
nextRow = nextRow->GetNextSibling();
|
|
|
|
}
|
|
|
|
return height;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsTableCellFrame*
|
|
|
|
nsTableRowFrame::GetFirstCell()
|
|
|
|
{
|
|
|
|
nsIFrame* childFrame = mFrames.FirstChild();
|
|
|
|
while (childFrame) {
|
2009-03-24 15:10:06 -07:00
|
|
|
nsTableCellFrame *cellFrame = do_QueryFrame(childFrame);
|
|
|
|
if (cellFrame) {
|
|
|
|
return cellFrame;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
childFrame = childFrame->GetNextSibling();
|
|
|
|
}
|
2012-07-30 07:20:58 -07:00
|
|
|
return nullptr;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Post-reflow hook. This is where the table row does its post-processing
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
nsTableRowFrame::DidResize()
|
|
|
|
{
|
|
|
|
// Resize and re-align the cell frames based on our row height
|
|
|
|
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
|
|
|
nsTableIterator iter(*this);
|
|
|
|
nsIFrame* childFrame = iter.First();
|
|
|
|
|
|
|
|
nsHTMLReflowMetrics desiredSize;
|
|
|
|
desiredSize.width = mRect.width;
|
|
|
|
desiredSize.height = mRect.height;
|
2010-10-06 21:25:46 -07:00
|
|
|
desiredSize.SetOverflowAreasToDesiredBounds();
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
while (childFrame) {
|
2009-03-24 15:10:06 -07:00
|
|
|
nsTableCellFrame *cellFrame = do_QueryFrame(childFrame);
|
|
|
|
if (cellFrame) {
|
2007-03-22 10:30:00 -07:00
|
|
|
nscoord cellHeight = mRect.height + GetHeightOfRowsSpannedBelowFirst(*cellFrame, *tableFrame);
|
|
|
|
|
|
|
|
// resize the cell's height
|
2008-02-08 01:36:32 -08:00
|
|
|
nsRect cellRect = cellFrame->GetRect();
|
2012-08-28 22:48:45 -07:00
|
|
|
nsRect cellVisualOverflow = cellFrame->GetVisualOverflowRect();
|
2008-02-08 01:36:32 -08:00
|
|
|
if (cellRect.height != cellHeight)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2008-02-08 01:36:32 -08:00
|
|
|
cellFrame->SetSize(nsSize(cellRect.width, cellHeight));
|
2012-08-28 22:48:45 -07:00
|
|
|
nsTableFrame::InvalidateTableFrame(cellFrame, cellRect,
|
|
|
|
cellVisualOverflow,
|
|
|
|
false);
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
2008-02-08 01:36:32 -08: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-06 21:25:46 -07:00
|
|
|
ConsiderChildOverflow(desiredSize.mOverflowAreas, cellFrame);
|
2008-02-08 01:36:32 -08:00
|
|
|
|
|
|
|
// Note that if the cell's *content* needs to change in response
|
|
|
|
// to this height, it will get a special height reflow.
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
// Get the next child
|
|
|
|
childFrame = iter.Next();
|
|
|
|
}
|
|
|
|
FinishAndStoreOverflow(&desiredSize);
|
|
|
|
if (HasView()) {
|
2010-10-06 21:25:46 -07:00
|
|
|
nsContainerFrame::SyncFrameViewAfterReflow(PresContext(), this, GetView(),
|
|
|
|
desiredSize.VisualOverflow(), 0);
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
// Let our base class do the usual work
|
|
|
|
}
|
|
|
|
|
|
|
|
// returns max-ascent amongst all cells that have 'vertical-align: baseline'
|
|
|
|
// *including* cells with rowspans
|
|
|
|
nscoord nsTableRowFrame::GetMaxCellAscent() const
|
|
|
|
{
|
|
|
|
return mMaxCellAscent;
|
|
|
|
}
|
|
|
|
|
|
|
|
nscoord nsTableRowFrame::GetRowBaseline()
|
|
|
|
{
|
|
|
|
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
|
|
|
|
|
|
|
|
nsTableIterator iter(*this);
|
|
|
|
nsIFrame* childFrame = iter.First();
|
|
|
|
nscoord ascent = 0;
|
|
|
|
while (childFrame) {
|
|
|
|
if (IS_TABLE_CELL(childFrame->GetType())) {
|
2011-08-24 13:54:30 -07:00
|
|
|
nsIFrame* firstKid = childFrame->GetFirstPrincipalChild();
|
2013-01-15 04:22:03 -08:00
|
|
|
ascent = std::max(ascent, firstKid->GetRect().YMost());
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
// Get the next child
|
|
|
|
childFrame = iter.Next();
|
|
|
|
}
|
|
|
|
return ascent;
|
|
|
|
}
|
|
|
|
nscoord
|
|
|
|
nsTableRowFrame::GetHeight(nscoord aPctBasis) const
|
|
|
|
{
|
|
|
|
nscoord height = 0;
|
|
|
|
if ((aPctBasis > 0) && HasPctHeight()) {
|
|
|
|
height = NSToCoordRound(GetPctHeight() * (float)aPctBasis);
|
|
|
|
}
|
|
|
|
if (HasFixedHeight()) {
|
2013-01-15 04:22:03 -08:00
|
|
|
height = std::max(height, GetFixedHeight());
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
2013-01-15 04:22:03 -08:00
|
|
|
return std::max(height, GetContentHeight());
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
nsTableRowFrame::ResetHeight(nscoord aFixedHeight)
|
|
|
|
{
|
2011-10-17 07:59:28 -07:00
|
|
|
SetHasFixedHeight(false);
|
|
|
|
SetHasPctHeight(false);
|
2007-03-22 10:30:00 -07:00
|
|
|
SetFixedHeight(0);
|
|
|
|
SetPctHeight(0);
|
|
|
|
SetContentHeight(0);
|
|
|
|
|
|
|
|
if (aFixedHeight > 0) {
|
|
|
|
SetFixedHeight(aFixedHeight);
|
|
|
|
}
|
|
|
|
|
|
|
|
mMaxCellAscent = 0;
|
|
|
|
mMaxCellDescent = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
nsTableRowFrame::UpdateHeight(nscoord aHeight,
|
|
|
|
nscoord aAscent,
|
|
|
|
nscoord aDescent,
|
|
|
|
nsTableFrame* aTableFrame,
|
|
|
|
nsTableCellFrame* aCellFrame)
|
|
|
|
{
|
|
|
|
if (!aTableFrame || !aCellFrame) {
|
2011-10-17 07:59:28 -07:00
|
|
|
NS_ASSERTION(false , "invalid call");
|
2007-03-22 10:30:00 -07:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (aHeight != NS_UNCONSTRAINEDSIZE) {
|
|
|
|
if (!(aCellFrame->HasVerticalAlignBaseline())) { // only the cell's height matters
|
|
|
|
if (GetHeight() < aHeight) {
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t rowSpan = aTableFrame->GetEffectiveRowSpan(*aCellFrame);
|
2007-03-22 10:30:00 -07:00
|
|
|
if (rowSpan == 1) {
|
|
|
|
SetContentHeight(aHeight);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
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 08:56:38 -07:00
|
|
|
int32_t rowSpan = aTableFrame->GetEffectiveRowSpan(*aCellFrame);
|
2007-03-22 10:30:00 -07:00
|
|
|
if (rowSpan == 1) {
|
|
|
|
mMaxCellDescent = aDescent;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// keep the tallest height in sync
|
|
|
|
if (GetHeight() < mMaxCellAscent + mMaxCellDescent) {
|
|
|
|
SetContentHeight(mMaxCellAscent + mMaxCellDescent);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
nscoord
|
|
|
|
nsTableRowFrame::CalcHeight(const nsHTMLReflowState& aReflowState)
|
|
|
|
{
|
|
|
|
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
2007-08-02 11:08:05 -07:00
|
|
|
nscoord computedHeight = (NS_UNCONSTRAINEDSIZE == aReflowState.ComputedHeight())
|
|
|
|
? 0 : aReflowState.ComputedHeight();
|
2007-03-22 10:30:00 -07:00
|
|
|
ResetHeight(computedHeight);
|
|
|
|
|
|
|
|
const nsStylePosition* position = GetStylePosition();
|
2012-11-21 08:19:30 -08:00
|
|
|
if (position->mHeight.ConvertsToLength()) {
|
|
|
|
SetFixedHeight(nsRuleNode::ComputeCoordPercentCalc(position->mHeight, 0));
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
else if (eStyleUnit_Percent == position->mHeight.GetUnit()) {
|
|
|
|
SetPctHeight(position->mHeight.GetPercentValue());
|
|
|
|
}
|
2012-11-21 08:19:30 -08:00
|
|
|
// calc() with percentages is treated like 'auto' on table rows.
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
for (nsIFrame* kidFrame = mFrames.FirstChild(); kidFrame;
|
|
|
|
kidFrame = kidFrame->GetNextSibling()) {
|
2009-03-24 15:10:06 -07:00
|
|
|
nsTableCellFrame *cellFrame = do_QueryFrame(kidFrame);
|
|
|
|
if (cellFrame) {
|
|
|
|
nsSize desSize = cellFrame->GetDesiredSize();
|
2007-03-22 10:30:00 -07:00
|
|
|
if ((NS_UNCONSTRAINEDSIZE == aReflowState.availableHeight) && !GetPrevInFlow()) {
|
2010-03-06 01:53:02 -08:00
|
|
|
CalculateCellActualHeight(cellFrame, desSize.height);
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
// height may have changed, adjust descent to absorb any excess difference
|
|
|
|
nscoord ascent;
|
2011-08-24 13:54:30 -07:00
|
|
|
if (!kidFrame->GetFirstPrincipalChild()->GetFirstPrincipalChild())
|
2007-03-22 10:30:00 -07:00
|
|
|
ascent = desSize.height;
|
|
|
|
else
|
2009-03-24 15:10:06 -07:00
|
|
|
ascent = cellFrame->GetCellBaseline();
|
2007-03-22 10:30:00 -07:00
|
|
|
nscoord descent = desSize.height - ascent;
|
2009-03-24 15:10:06 -07:00
|
|
|
UpdateHeight(desSize.height, ascent, descent, tableFrame, cellFrame);
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return GetHeight();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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 04:34:14 -07:00
|
|
|
class nsDisplayTableRowBackground : public nsDisplayTableItem {
|
2007-03-22 10:30:00 -07:00
|
|
|
public:
|
2010-08-13 03:01:13 -07:00
|
|
|
nsDisplayTableRowBackground(nsDisplayListBuilder* aBuilder,
|
|
|
|
nsTableRowFrame* aFrame) :
|
|
|
|
nsDisplayTableItem(aBuilder, aFrame) {
|
2007-03-22 10:30:00 -07:00
|
|
|
MOZ_COUNT_CTOR(nsDisplayTableRowBackground);
|
|
|
|
}
|
|
|
|
#ifdef NS_BUILD_REFCNT_LOGGING
|
|
|
|
virtual ~nsDisplayTableRowBackground() {
|
|
|
|
MOZ_COUNT_DTOR(nsDisplayTableRowBackground);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2009-09-06 17:35:14 -07:00
|
|
|
virtual void Paint(nsDisplayListBuilder* aBuilder,
|
2011-04-07 18:04:40 -07:00
|
|
|
nsRenderingContext* aCtx);
|
2010-07-15 14:07:49 -07:00
|
|
|
NS_DISPLAY_DECL_NAME("TableRowBackground", TYPE_TABLE_ROW_BACKGROUND)
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
void
|
|
|
|
nsDisplayTableRowBackground::Paint(nsDisplayListBuilder* aBuilder,
|
2012-01-16 15:38:10 -08:00
|
|
|
nsRenderingContext* aCtx)
|
|
|
|
{
|
2007-03-22 10:30:00 -07:00
|
|
|
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(mFrame);
|
|
|
|
TableBackgroundPainter painter(tableFrame,
|
|
|
|
TableBackgroundPainter::eOrigin_TableRow,
|
2007-03-30 14:11:41 -07:00
|
|
|
mFrame->PresContext(), *aCtx,
|
2010-08-13 03:01:58 -07:00
|
|
|
mVisibleRect, ToReferenceFrame(),
|
2009-09-12 15:44:18 -07:00
|
|
|
aBuilder->GetBackgroundPaintFlags());
|
2007-07-08 00:08:04 -07:00
|
|
|
painter.PaintRow(static_cast<nsTableRowFrame*>(mFrame));
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsTableRowFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists)
|
|
|
|
{
|
2012-07-30 07:20:58 -07:00
|
|
|
nsDisplayTableItem* item = nullptr;
|
2012-04-02 17:30:45 -07: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);
|
|
|
|
nsresult rv = aLists.BorderBackground()->AppendNewToTop(item);
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
}
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
2008-04-06 04:34:14 -07:00
|
|
|
return nsTableFrame::DisplayGenericTablePart(aBuilder, this, aDirtyRect, aLists, item);
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2012-08-09 00:09:40 -07:00
|
|
|
int
|
2007-03-22 10:30:00 -07:00
|
|
|
nsTableRowFrame::GetSkipSides() const
|
|
|
|
{
|
2012-08-09 00:09:40 -07:00
|
|
|
int skip = 0;
|
2012-07-30 07:20:58 -07:00
|
|
|
if (nullptr != GetPrevInFlow()) {
|
2007-03-22 10:30:00 -07:00
|
|
|
skip |= 1 << NS_SIDE_TOP;
|
|
|
|
}
|
2012-07-30 07:20:58 -07:00
|
|
|
if (nullptr != GetNextInFlow()) {
|
2007-03-22 10:30:00 -07:00
|
|
|
skip |= 1 << NS_SIDE_BOTTOM;
|
|
|
|
}
|
|
|
|
return skip;
|
|
|
|
}
|
|
|
|
|
2010-03-06 01:53:02 -08: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.
|
2007-03-22 10:30:00 -07:00
|
|
|
nsresult
|
2010-03-06 01:53:02 -08:00
|
|
|
nsTableRowFrame::CalculateCellActualHeight(nsTableCellFrame* aCellFrame,
|
|
|
|
nscoord& aDesiredHeight)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
nscoord specifiedHeight = 0;
|
|
|
|
|
|
|
|
// Get the height specified in the style information
|
|
|
|
const nsStylePosition* position = aCellFrame->GetStylePosition();
|
|
|
|
|
|
|
|
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t rowSpan = tableFrame->GetEffectiveRowSpan(*aCellFrame);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
switch (position->mHeight.GetUnit()) {
|
2012-11-21 08:19:30 -08:00
|
|
|
case eStyleUnit_Calc: {
|
|
|
|
if (position->mHeight.CalcHasPercent()) {
|
|
|
|
// Treat this like "auto"
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
// Fall through to the coord case
|
|
|
|
}
|
2012-06-30 09:01:31 -07: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 08:19:30 -08:00
|
|
|
specifiedHeight =
|
|
|
|
nsRuleNode::ComputeCoordPercentCalc(position->mHeight, 0) +
|
|
|
|
outsideBoxSizing;
|
2012-06-30 09:01:31 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
if (1 == rowSpan)
|
|
|
|
SetFixedHeight(specifiedHeight);
|
|
|
|
break;
|
2012-06-30 09:01:31 -07:00
|
|
|
}
|
2007-03-22 10:30:00 -07:00
|
|
|
case eStyleUnit_Percent: {
|
|
|
|
if (1 == rowSpan)
|
|
|
|
SetPctHeight(position->mHeight.GetPercentValue());
|
|
|
|
// pct heights are handled when all of the cells are finished, so don't set specifiedHeight
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case eStyleUnit_Auto:
|
2012-11-21 08:19:30 -08:00
|
|
|
default:
|
2007-03-22 10:30:00 -07:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
// If the specified height is greater than the desired height, then use the specified height
|
|
|
|
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 11:50:40 -08:00
|
|
|
static nscoord
|
2007-03-22 10:30:00 -07:00
|
|
|
CalcAvailWidth(nsTableFrame& aTableFrame,
|
|
|
|
nsTableCellFrame& aCellFrame,
|
2009-01-13 11:50:40 -08:00
|
|
|
nscoord aCellSpacingX)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2009-01-13 11:50:40 -08:00
|
|
|
nscoord cellAvailWidth = 0;
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t colIndex;
|
2007-03-22 10:30:00 -07:00
|
|
|
aCellFrame.GetColIndex(colIndex);
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t colspan = aTableFrame.GetEffectiveColSpan(aCellFrame);
|
2009-01-13 11:50:40 -08:00
|
|
|
NS_ASSERTION(colspan > 0, "effective colspan should be positive");
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
for (int32_t spanX = 0; spanX < colspan; spanX++) {
|
2009-01-13 11:50:40 -08:00
|
|
|
cellAvailWidth += aTableFrame.GetColumnWidth(colIndex + spanX);
|
|
|
|
if (spanX > 0 &&
|
|
|
|
aTableFrame.ColumnHasCellSpacingBefore(colIndex + spanX)) {
|
|
|
|
cellAvailWidth += aCellSpacingX;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
}
|
2009-01-13 11:50:40 -08:00
|
|
|
return cellAvailWidth;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
nscoord
|
2012-08-22 08:56:38 -07:00
|
|
|
GetSpaceBetween(int32_t aPrevColIndex,
|
|
|
|
int32_t aColIndex,
|
|
|
|
int32_t aColSpan,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsTableFrame& aTableFrame,
|
|
|
|
nscoord aCellSpacingX,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aIsLeftToRight,
|
|
|
|
bool aCheckVisibility)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
nscoord space = 0;
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t colX;
|
2007-03-22 10:30:00 -07:00
|
|
|
if (aIsLeftToRight) {
|
|
|
|
for (colX = aPrevColIndex + 1; aColIndex > colX; colX++) {
|
2011-09-28 23:19:26 -07:00
|
|
|
bool isCollapsed = false;
|
2007-03-22 10:30:00 -07:00
|
|
|
if (!aCheckVisibility) {
|
|
|
|
space += aTableFrame.GetColumnWidth(colX);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
nsTableColFrame* colFrame = aTableFrame.GetColFrame(colX);
|
|
|
|
const nsStyleVisibility* colVis = colFrame->GetStyleVisibility();
|
2011-09-28 23:19:26 -07:00
|
|
|
bool collapseCol = (NS_STYLE_VISIBILITY_COLLAPSE == colVis->mVisible);
|
2007-03-22 10:30:00 -07:00
|
|
|
nsIFrame* cgFrame = colFrame->GetParent();
|
|
|
|
const nsStyleVisibility* groupVis = cgFrame->GetStyleVisibility();
|
2011-09-28 23:19:26 -07:00
|
|
|
bool collapseGroup = (NS_STYLE_VISIBILITY_COLLAPSE ==
|
2007-03-22 10:30:00 -07:00
|
|
|
groupVis->mVisible);
|
|
|
|
isCollapsed = collapseCol || collapseGroup;
|
|
|
|
if (!isCollapsed)
|
|
|
|
space += aTableFrame.GetColumnWidth(colX);
|
|
|
|
}
|
2008-09-24 10:14:35 -07:00
|
|
|
if (!isCollapsed && aTableFrame.ColumnHasCellSpacingBefore(colX)) {
|
2007-03-22 10:30:00 -07:00
|
|
|
space += aCellSpacingX;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t lastCol = aColIndex + aColSpan - 1;
|
2007-03-22 10:30:00 -07:00
|
|
|
for (colX = aPrevColIndex - 1; colX > lastCol; colX--) {
|
2011-09-28 23:19:26 -07:00
|
|
|
bool isCollapsed = false;
|
2007-03-22 10:30:00 -07:00
|
|
|
if (!aCheckVisibility) {
|
|
|
|
space += aTableFrame.GetColumnWidth(colX);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
nsTableColFrame* colFrame = aTableFrame.GetColFrame(colX);
|
|
|
|
const nsStyleVisibility* colVis = colFrame->GetStyleVisibility();
|
2011-09-28 23:19:26 -07:00
|
|
|
bool collapseCol = (NS_STYLE_VISIBILITY_COLLAPSE == colVis->mVisible);
|
2007-03-22 10:30:00 -07:00
|
|
|
nsIFrame* cgFrame = colFrame->GetParent();
|
|
|
|
const nsStyleVisibility* groupVis = cgFrame->GetStyleVisibility();
|
2011-09-28 23:19:26 -07:00
|
|
|
bool collapseGroup = (NS_STYLE_VISIBILITY_COLLAPSE ==
|
2007-03-22 10:30:00 -07:00
|
|
|
groupVis->mVisible);
|
|
|
|
isCollapsed = collapseCol || collapseGroup;
|
|
|
|
if (!isCollapsed)
|
|
|
|
space += aTableFrame.GetColumnWidth(colX);
|
|
|
|
}
|
2008-09-24 10:14:35 -07:00
|
|
|
if (!isCollapsed && aTableFrame.ColumnHasCellSpacingBefore(colX)) {
|
2007-03-22 10:30:00 -07:00
|
|
|
space += aCellSpacingX;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return space;
|
|
|
|
}
|
|
|
|
|
|
|
|
// subtract the heights of aRow's prev in flows from the unpaginated height
|
|
|
|
static
|
2009-01-14 14:16:43 -08:00
|
|
|
nscoord CalcHeightFromUnpaginatedHeight(nsPresContext* aPresContext,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsTableRowFrame& aRow)
|
|
|
|
{
|
|
|
|
nscoord height = 0;
|
2012-01-16 15:38:10 -08:00
|
|
|
nsTableRowFrame* firstInFlow =
|
|
|
|
static_cast<nsTableRowFrame*>(aRow.GetFirstInFlow());
|
2007-03-22 10:30:00 -07:00
|
|
|
if (firstInFlow->HasUnpaginatedHeight()) {
|
|
|
|
height = firstInFlow->GetUnpaginatedHeight(aPresContext);
|
|
|
|
for (nsIFrame* prevInFlow = aRow.GetPrevInFlow(); prevInFlow;
|
|
|
|
prevInFlow = prevInFlow->GetPrevInFlow()) {
|
|
|
|
height -= prevInFlow->GetSize().height;
|
|
|
|
}
|
|
|
|
}
|
2013-01-15 04:22:03 -08:00
|
|
|
return std::max(height, 0);
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2010-10-06 21:25:46 -07:00
|
|
|
nsresult
|
2007-03-22 10:30:00 -07:00
|
|
|
nsTableRowFrame::ReflowChildren(nsPresContext* aPresContext,
|
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsTableFrame& aTableFrame,
|
|
|
|
nsReflowStatus& aStatus)
|
|
|
|
{
|
|
|
|
aStatus = NS_FRAME_COMPLETE;
|
|
|
|
|
|
|
|
// XXXldb Should we be checking constrained height instead?
|
2012-01-16 15:38:10 -08:00
|
|
|
const bool isPaginated = aPresContext->IsPaginated();
|
|
|
|
const bool borderCollapse = aTableFrame.IsBorderCollapse();
|
2007-03-22 10:30:00 -07:00
|
|
|
nsresult rv = NS_OK;
|
|
|
|
nscoord cellSpacingX = aTableFrame.GetCellSpacingX();
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t cellColSpan = 1; // must be defined here so it's set properly for non-cell kids
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
nsTableIterator iter(*this);
|
|
|
|
// remember the col index of the previous cell to handle rowspans into this row
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t firstPrevColIndex = (iter.IsLeftToRight()) ? -1 : aTableFrame.GetColCount();
|
|
|
|
int32_t prevColIndex = firstPrevColIndex;
|
2007-03-22 10:30:00 -07:00
|
|
|
nscoord x = 0; // running total of children x offset
|
|
|
|
|
2008-04-08 05:28:34 -07:00
|
|
|
// This computes the max of all cell heights
|
|
|
|
nscoord cellMaxHeight = 0;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// Reflow each of our existing cell frames
|
|
|
|
for (nsIFrame* kidFrame = iter.First(); kidFrame; kidFrame = iter.Next()) {
|
2009-03-24 15:10:06 -07:00
|
|
|
nsTableCellFrame *cellFrame = do_QueryFrame(kidFrame);
|
|
|
|
if (!cellFrame) {
|
2007-03-22 10:30:00 -07: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,
|
2011-10-17 07:59:28 -07:00
|
|
|
kidFrame, nsSize(0,0), false);
|
|
|
|
InitChildReflowState(*aPresContext, nsSize(0,0), false, kidReflowState);
|
2007-03-22 10:30:00 -07:00
|
|
|
nsHTMLReflowMetrics desiredSize;
|
|
|
|
nsReflowStatus status;
|
|
|
|
ReflowChild(kidFrame, aPresContext, desiredSize, kidReflowState, 0, 0, 0, status);
|
2012-11-13 22:47:33 -08:00
|
|
|
kidFrame->DidReflow(aPresContext, nullptr, nsDidReflowStatus::FINISHED);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
// See if we should only reflow the dirty child frames
|
2011-09-28 23:19:26 -07:00
|
|
|
bool doReflowChild = true;
|
2007-03-22 10:30:00 -07:00
|
|
|
if (!aReflowState.ShouldReflowAllKids() &&
|
|
|
|
!aTableFrame.IsGeometryDirty() &&
|
2007-05-06 12:16:51 -07:00
|
|
|
!NS_SUBTREE_DIRTY(kidFrame)) {
|
2007-03-22 10:30:00 -07:00
|
|
|
if (!aReflowState.mFlags.mSpecialHeightReflow)
|
2011-10-17 07:59:28 -07:00
|
|
|
doReflowChild = false;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
else if ((NS_UNCONSTRAINEDSIZE != aReflowState.availableHeight)) {
|
|
|
|
// We don't reflow a rowspan >1 cell here with a constrained height.
|
|
|
|
// That happens in nsTableRowGroupFrame::SplitSpanningCells.
|
|
|
|
if (aTableFrame.GetEffectiveRowSpan(*cellFrame) > 1) {
|
2011-10-17 07:59:28 -07:00
|
|
|
doReflowChild = false;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (aReflowState.mFlags.mSpecialHeightReflow) {
|
|
|
|
if (!isPaginated && !(cellFrame->GetStateBits() &
|
|
|
|
NS_FRAME_CONTAINS_RELATIVE_HEIGHT)) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t cellColIndex;
|
2007-03-22 10:30:00 -07: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,
|
2011-10-17 07:59:28 -07:00
|
|
|
cellSpacingX, iter.IsLeftToRight(), false);
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
// remember the rightmost (ltr) or leftmost (rtl) column this cell spans into
|
|
|
|
prevColIndex = (iter.IsLeftToRight()) ? cellColIndex + (cellColSpan - 1) : cellColIndex;
|
|
|
|
|
|
|
|
// Reflow the child frame
|
2008-02-08 01:36:32 -08:00
|
|
|
nsRect kidRect = kidFrame->GetRect();
|
2012-08-28 22:48:45 -07:00
|
|
|
nsRect kidVisualOverflow = kidFrame->GetVisualOverflowRect();
|
|
|
|
bool firstReflow =
|
|
|
|
(kidFrame->GetStateBits() & NS_FRAME_FIRST_REFLOW) != 0;
|
2008-02-08 01:36:32 -08:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
if (doReflowChild) {
|
|
|
|
// Calculate the available width for the table cell using the known column widths
|
2009-01-13 11:50:40 -08:00
|
|
|
nscoord availCellWidth =
|
|
|
|
CalcAvailWidth(aTableFrame, *cellFrame, cellSpacingX);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
nsHTMLReflowMetrics desiredSize;
|
|
|
|
|
|
|
|
// 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 12:16:51 -07:00
|
|
|
NS_SUBTREE_DIRTY(cellFrame) ||
|
2007-03-22 10:30:00 -07: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.
|
2009-01-13 11:50:40 -08:00
|
|
|
nsSize kidAvailSize(availCellWidth, aReflowState.availableHeight);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// Reflow the child
|
|
|
|
nsTableCellReflowState kidReflowState(aPresContext, aReflowState,
|
2011-10-17 07:59:28 -07:00
|
|
|
kidFrame, kidAvailSize, false);
|
2007-03-22 10:30:00 -07:00
|
|
|
InitChildReflowState(*aPresContext, kidAvailSize, borderCollapse,
|
|
|
|
kidReflowState);
|
|
|
|
|
|
|
|
nsReflowStatus status;
|
|
|
|
rv = ReflowChild(kidFrame, aPresContext, desiredSize, kidReflowState,
|
2008-02-08 01:36:32 -08:00
|
|
|
x, 0, NS_FRAME_INVALIDATE_ON_MOVE, status);
|
2007-03-22 10:30:00 -07: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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
2008-02-08 01:36:32 -08:00
|
|
|
if (x != kidRect.x) {
|
2010-08-30 17:49:12 -07:00
|
|
|
kidFrame->InvalidateFrameSubtree();
|
2008-02-08 01:36:32 -08:00
|
|
|
}
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
desiredSize.width = cellDesiredSize.width;
|
|
|
|
desiredSize.height = cellDesiredSize.height;
|
2010-10-06 21:25:46 -07:00
|
|
|
desiredSize.mOverflowAreas = cellFrame->GetOverflowAreas();
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
// if we are in a floated table, our position is not yet established, so we cannot reposition our views
|
2009-02-12 15:10:59 -08:00
|
|
|
// the containing block will do this for us after positioning the table
|
2012-08-02 04:38:49 -07:00
|
|
|
if (!aTableFrame.IsFloating()) {
|
2007-03-22 10:30:00 -07: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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (NS_UNCONSTRAINEDSIZE == aReflowState.availableHeight) {
|
|
|
|
if (!GetPrevInFlow()) {
|
2010-03-06 01:53:02 -08:00
|
|
|
// Calculate the cell's actual height given its pass2 height. This
|
|
|
|
// function takes into account the specified height (in the style)
|
|
|
|
CalculateCellActualHeight(cellFrame, desiredSize.height);
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
// height may have changed, adjust descent to absorb any excess difference
|
|
|
|
nscoord ascent;
|
2011-08-24 13:54:30 -07:00
|
|
|
if (!kidFrame->GetFirstPrincipalChild()->GetFirstPrincipalChild())
|
2007-03-22 10:30:00 -07:00
|
|
|
ascent = desiredSize.height;
|
|
|
|
else
|
|
|
|
ascent = ((nsTableCellFrame *)kidFrame)->GetCellBaseline();
|
|
|
|
nscoord descent = desiredSize.height - ascent;
|
|
|
|
UpdateHeight(desiredSize.height, ascent, descent, &aTableFrame, cellFrame);
|
|
|
|
}
|
|
|
|
else {
|
2013-01-15 04:22:03 -08:00
|
|
|
cellMaxHeight = std::max(cellMaxHeight, desiredSize.height);
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t rowSpan = aTableFrame.GetEffectiveRowSpan((nsTableCellFrame&)*kidFrame);
|
2007-03-22 10:30:00 -07:00
|
|
|
if (1 == rowSpan) {
|
2008-04-08 05:28:34 -07:00
|
|
|
SetContentHeight(cellMaxHeight);
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Place the child
|
2009-01-13 11:50:40 -08:00
|
|
|
desiredSize.width = availCellWidth;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-07-30 07:20:58 -07:00
|
|
|
FinishReflowChild(kidFrame, aPresContext, nullptr, desiredSize, x, 0, 0);
|
2012-07-03 17:24:55 -07:00
|
|
|
|
2012-08-28 22:48:45 -07:00
|
|
|
nsTableFrame::InvalidateTableFrame(kidFrame, kidRect, kidVisualOverflow,
|
|
|
|
firstReflow);
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
x += desiredSize.width;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if (kidRect.x != x) {
|
2008-02-08 01:36:32 -08:00
|
|
|
// Invalidate the old position
|
2010-08-30 17:49:12 -07:00
|
|
|
kidFrame->InvalidateFrameSubtree();
|
2008-02-08 01:36:32 -08:00
|
|
|
// move to the new position
|
|
|
|
kidFrame->SetPosition(nsPoint(x, kidRect.y));
|
2007-03-22 10:30:00 -07:00
|
|
|
nsTableFrame::RePositionViews(kidFrame);
|
2008-02-08 01:36:32 -08:00
|
|
|
// invalidate the new position
|
2010-08-30 17:49:12 -07:00
|
|
|
kidFrame->InvalidateFrameSubtree();
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
// we need to account for the cell's width even if it isn't reflowed
|
|
|
|
x += kidRect.width;
|
|
|
|
|
|
|
|
if (kidFrame->GetNextInFlow()) {
|
|
|
|
aStatus = NS_FRAME_NOT_COMPLETE;
|
|
|
|
}
|
|
|
|
}
|
2010-10-06 21:25:46 -07:00
|
|
|
ConsiderChildOverflow(aDesiredSize.mOverflowAreas, kidFrame);
|
2007-03-22 10:30:00 -07:00
|
|
|
x += cellSpacingX;
|
|
|
|
}
|
|
|
|
|
|
|
|
// just set our width to what was available. The table will calculate the width and not use our value.
|
|
|
|
aDesiredSize.width = aReflowState.availableWidth;
|
|
|
|
|
|
|
|
if (aReflowState.mFlags.mSpecialHeightReflow) {
|
|
|
|
aDesiredSize.height = mRect.height;
|
|
|
|
}
|
|
|
|
else if (NS_UNCONSTRAINEDSIZE == aReflowState.availableHeight) {
|
|
|
|
aDesiredSize.height = CalcHeight(aReflowState);
|
|
|
|
if (GetPrevInFlow()) {
|
|
|
|
nscoord height = CalcHeightFromUnpaginatedHeight(aPresContext, *this);
|
2013-01-15 04:22:03 -08:00
|
|
|
aDesiredSize.height = std::max(aDesiredSize.height, height);
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
if (isPaginated && HasStyleHeight()) {
|
|
|
|
// set the unpaginated height so next in flows can try to honor it
|
2011-10-17 07:59:28 -07:00
|
|
|
SetHasUnpaginatedHeight(true);
|
2007-03-22 10:30:00 -07:00
|
|
|
SetUnpaginatedHeight(aPresContext, aDesiredSize.height);
|
|
|
|
}
|
|
|
|
if (isPaginated && HasUnpaginatedHeight()) {
|
2013-01-15 04:22:03 -08:00
|
|
|
aDesiredSize.height = std::max(aDesiredSize.height, GetUnpaginatedHeight(aPresContext));
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else { // constrained height, paginated
|
2008-04-08 05:28:34 -07: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);
|
|
|
|
if (styleHeight > aReflowState.availableHeight) {
|
|
|
|
styleHeight = aReflowState.availableHeight;
|
|
|
|
NS_FRAME_SET_INCOMPLETE(aStatus);
|
|
|
|
}
|
2013-01-15 04:22:03 -08:00
|
|
|
aDesiredSize.height = std::max(cellMaxHeight, styleHeight);
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
2010-10-06 21:25:46 -07:00
|
|
|
aDesiredSize.UnionOverflowAreasWithDesiredBounds();
|
2007-03-22 10:30:00 -07:00
|
|
|
FinishAndStoreOverflow(&aDesiredSize);
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Layout the entire row.
|
|
|
|
* This method stacks cells horizontally according to HTML 4.0 rules.
|
|
|
|
*/
|
|
|
|
NS_METHOD
|
|
|
|
nsTableRowFrame::Reflow(nsPresContext* aPresContext,
|
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsReflowStatus& aStatus)
|
|
|
|
{
|
|
|
|
DO_GLOBAL_REFLOW_COUNT("nsTableRowFrame");
|
|
|
|
DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
|
|
|
|
nsresult rv = NS_OK;
|
|
|
|
|
|
|
|
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
|
|
|
const nsStyleVisibility* rowVis = GetStyleVisibility();
|
2011-09-28 23:19:26 -07:00
|
|
|
bool collapseRow = (NS_STYLE_VISIBILITY_COLLAPSE == rowVis->mVisible);
|
2007-03-22 10:30:00 -07:00
|
|
|
if (collapseRow) {
|
2011-10-17 07:59:28 -07:00
|
|
|
tableFrame->SetNeedToCollapse(true);
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
// see if a special height reflow needs to occur due to having a pct height
|
|
|
|
nsTableFrame::CheckRequestSpecialHeightReflow(aReflowState);
|
|
|
|
|
2007-06-25 13:34:35 -07:00
|
|
|
// See if we have a cell with specified/pct height
|
|
|
|
InitHasCellWithStyleHeight(tableFrame);
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
rv = ReflowChildren(aPresContext, aDesiredSize, aReflowState, *tableFrame,
|
|
|
|
aStatus);
|
|
|
|
|
2012-11-08 08:09:38 -08:00
|
|
|
if (aPresContext->IsPaginated() && !NS_FRAME_IS_FULLY_COMPLETE(aStatus) &&
|
|
|
|
ShouldAvoidBreakInside(aReflowState)) {
|
|
|
|
aStatus = NS_INLINE_LINE_BREAK_BEFORE();
|
|
|
|
}
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
// just set our width to what was available. The table will calculate the width and not use our value.
|
|
|
|
aDesiredSize.width = aReflowState.availableWidth;
|
|
|
|
|
2012-08-28 22:48:45 -07:00
|
|
|
// If our parent is in initial reflow, it'll handle invalidating our
|
|
|
|
// entire overflow rect.
|
|
|
|
if (!(GetParent()->GetStateBits() & NS_FRAME_FIRST_REFLOW) &&
|
|
|
|
nsSize(aDesiredSize.width, aDesiredSize.height) != mRect.Size()) {
|
|
|
|
InvalidateFrame();
|
|
|
|
}
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
nscoord
|
|
|
|
nsTableRowFrame::ReflowCellFrame(nsPresContext* aPresContext,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aIsTopOfPage,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsTableCellFrame* aCellFrame,
|
|
|
|
nscoord aAvailableHeight,
|
|
|
|
nsReflowStatus& aStatus)
|
|
|
|
{
|
|
|
|
// Reflow the cell frame with the specified height. Use the existing width
|
2008-02-08 01:36:32 -08:00
|
|
|
nsRect cellRect = aCellFrame->GetRect();
|
2010-10-06 21:25:46 -07:00
|
|
|
nsRect cellVisualOverflow = aCellFrame->GetVisualOverflowRect();
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-01-16 15:38:10 -08:00
|
|
|
nsSize availSize(cellRect.width, aAvailableHeight);
|
2012-01-16 15:38:10 -08:00
|
|
|
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
2012-01-16 15:38:10 -08:00
|
|
|
bool borderCollapse = tableFrame->IsBorderCollapse();
|
2007-03-22 10:30:00 -07:00
|
|
|
nsTableCellReflowState cellReflowState(aPresContext, aReflowState,
|
2011-10-17 07:59:28 -07:00
|
|
|
aCellFrame, availSize, false);
|
2007-03-22 10:30:00 -07:00
|
|
|
InitChildReflowState(*aPresContext, availSize, borderCollapse, cellReflowState);
|
|
|
|
cellReflowState.mFlags.mIsTopOfPage = aIsTopOfPage;
|
|
|
|
|
|
|
|
nsHTMLReflowMetrics desiredSize;
|
|
|
|
|
|
|
|
ReflowChild(aCellFrame, aPresContext, desiredSize, cellReflowState,
|
|
|
|
0, 0, NS_FRAME_NO_MOVE_FRAME, aStatus);
|
2011-09-28 23:19:26 -07:00
|
|
|
bool fullyComplete = NS_FRAME_IS_COMPLETE(aStatus) && !NS_FRAME_IS_TRUNCATED(aStatus);
|
2007-12-02 11:19:00 -08:00
|
|
|
if (fullyComplete) {
|
|
|
|
desiredSize.height = aAvailableHeight;
|
|
|
|
}
|
2008-02-08 01:36:32 -08:00
|
|
|
aCellFrame->SetSize(nsSize(cellRect.width, desiredSize.height));
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2008-03-16 13:32:48 -07:00
|
|
|
// Note: VerticallyAlignChild can affect the overflow rect.
|
2007-03-22 10:30:00 -07:00
|
|
|
// XXX What happens if this cell has 'vertical-align: baseline' ?
|
|
|
|
// XXX Why is it assumed that the cell's ascent hasn't changed ?
|
|
|
|
if (fullyComplete) {
|
|
|
|
aCellFrame->VerticallyAlignChild(mMaxCellAscent);
|
|
|
|
}
|
2008-03-16 13:32:48 -07:00
|
|
|
|
2012-08-28 22:48:45 -07:00
|
|
|
nsTableFrame::InvalidateTableFrame(aCellFrame, cellRect,
|
|
|
|
cellVisualOverflow,
|
|
|
|
(aCellFrame->GetStateBits() &
|
|
|
|
NS_FRAME_FIRST_REFLOW) != 0);
|
|
|
|
|
2012-11-13 22:47:33 -08:00
|
|
|
aCellFrame->DidReflow(aPresContext, nullptr, nsDidReflowStatus::FINISHED);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
return desiredSize.height;
|
|
|
|
}
|
|
|
|
|
|
|
|
nscoord
|
|
|
|
nsTableRowFrame::CollapseRowIfNecessary(nscoord aRowOffset,
|
|
|
|
nscoord aWidth,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aCollapseGroup,
|
|
|
|
bool& aDidCollapse)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
const nsStyleVisibility* rowVis = GetStyleVisibility();
|
2011-09-28 23:19:26 -07:00
|
|
|
bool collapseRow = (NS_STYLE_VISIBILITY_COLLAPSE == rowVis->mVisible);
|
2012-01-16 15:38:10 -08:00
|
|
|
nsTableFrame* tableFrame = static_cast<nsTableFrame*>(
|
|
|
|
nsTableFrame::GetTableFrame(this)->GetFirstInFlow());
|
2007-03-22 10:30:00 -07:00
|
|
|
if (collapseRow) {
|
2011-10-17 07:59:28 -07:00
|
|
|
tableFrame->SetNeedToCollapse(true);
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2008-02-08 01:36:32 -08:00
|
|
|
if (aRowOffset != 0) {
|
|
|
|
// We're moving, so invalidate our old position
|
2010-08-30 17:49:12 -07:00
|
|
|
InvalidateFrameSubtree();
|
2008-02-08 01:36:32 -08:00
|
|
|
}
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
nsRect rowRect = GetRect();
|
2012-08-28 22:48:45 -07:00
|
|
|
nsRect oldRect = rowRect;
|
|
|
|
nsRect oldVisualOverflow = GetVisualOverflowRect();
|
2008-02-08 01:36:32 -08:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
rowRect.y -= aRowOffset;
|
|
|
|
rowRect.width = aWidth;
|
2010-10-06 21:25:45 -07:00
|
|
|
nsOverflowAreas overflow;
|
2007-03-22 10:30:00 -07:00
|
|
|
nscoord shift = 0;
|
|
|
|
nscoord cellSpacingX = tableFrame->GetCellSpacingX();
|
|
|
|
nscoord cellSpacingY = tableFrame->GetCellSpacingY();
|
|
|
|
|
|
|
|
if (aCollapseGroup || collapseRow) {
|
|
|
|
nsTableCellFrame* cellFrame = GetFirstCell();
|
2011-10-17 07:59:28 -07:00
|
|
|
aDidCollapse = true;
|
2007-03-22 10:30:00 -07:00
|
|
|
shift = rowRect.height + cellSpacingY;
|
|
|
|
while (cellFrame) {
|
|
|
|
nsRect cRect = cellFrame->GetRect();
|
2008-02-08 01:36:32 -08:00
|
|
|
// If aRowOffset != 0, there's no point in invalidating the cells, since
|
|
|
|
// we've already invalidated our overflow area. Note that we _do_ still
|
|
|
|
// need to invalidate if our row is not moving, because the cell might
|
|
|
|
// span out of this row, so invalidating our row rect won't do enough.
|
|
|
|
if (aRowOffset == 0) {
|
2012-08-28 22:39:31 -07:00
|
|
|
InvalidateFrame();
|
2008-02-08 01:36:32 -08:00
|
|
|
}
|
2007-03-22 10:30:00 -07:00
|
|
|
cRect.height = 0;
|
|
|
|
cellFrame->SetRect(cRect);
|
|
|
|
cellFrame = cellFrame->GetNextCell();
|
|
|
|
}
|
|
|
|
rowRect.height = 0;
|
|
|
|
}
|
|
|
|
else { // row is not collapsed
|
|
|
|
nsTableIterator iter(*this);
|
|
|
|
// remember the col index of the previous cell to handle rowspans into this
|
|
|
|
// row
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t firstPrevColIndex = (iter.IsLeftToRight()) ? -1 :
|
2007-03-22 10:30:00 -07:00
|
|
|
tableFrame->GetColCount();
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t prevColIndex = firstPrevColIndex;
|
2007-03-22 10:30:00 -07:00
|
|
|
nscoord x = 0; // running total of children x offset
|
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t colIncrement = iter.IsLeftToRight() ? 1 : -1;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
//nscoord x = cellSpacingX;
|
|
|
|
|
|
|
|
nsIFrame* kidFrame = iter.First();
|
|
|
|
while (kidFrame) {
|
2009-03-24 15:10:06 -07:00
|
|
|
nsTableCellFrame *cellFrame = do_QueryFrame(kidFrame);
|
|
|
|
if (cellFrame) {
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t cellColIndex;
|
2007-03-22 10:30:00 -07:00
|
|
|
cellFrame->GetColIndex(cellColIndex);
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t cellColSpan = tableFrame->GetEffectiveColSpan(*cellFrame);
|
2007-03-22 10:30:00 -07: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,
|
|
|
|
*tableFrame, cellSpacingX, iter.IsLeftToRight(),
|
2011-10-17 07:59:28 -07:00
|
|
|
true);
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
2008-02-08 01:36:32 -08:00
|
|
|
nsRect cRect(x, 0, 0, rowRect.height);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// remember the rightmost (ltr) or leftmost (rtl) column this cell
|
|
|
|
// spans into
|
|
|
|
prevColIndex = (iter.IsLeftToRight()) ?
|
|
|
|
cellColIndex + (cellColSpan - 1) : cellColIndex;
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t startIndex = (iter.IsLeftToRight()) ?
|
2007-03-22 10:30:00 -07:00
|
|
|
cellColIndex : cellColIndex + (cellColSpan - 1);
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t actualColSpan = cellColSpan;
|
2011-09-28 23:19:26 -07:00
|
|
|
bool isVisible = false;
|
2012-08-22 08:56:38 -07:00
|
|
|
for (int32_t colX = startIndex; actualColSpan > 0;
|
2007-03-22 10:30:00 -07:00
|
|
|
colX += colIncrement, actualColSpan--) {
|
|
|
|
|
|
|
|
nsTableColFrame* colFrame = tableFrame->GetColFrame(colX);
|
|
|
|
const nsStyleVisibility* colVis = colFrame->GetStyleVisibility();
|
2011-09-28 23:19:26 -07:00
|
|
|
bool collapseCol = (NS_STYLE_VISIBILITY_COLLAPSE ==
|
2007-03-22 10:30:00 -07:00
|
|
|
colVis->mVisible);
|
|
|
|
nsIFrame* cgFrame = colFrame->GetParent();
|
|
|
|
const nsStyleVisibility* groupVis = cgFrame->GetStyleVisibility();
|
2011-09-28 23:19:26 -07:00
|
|
|
bool collapseGroup = (NS_STYLE_VISIBILITY_COLLAPSE ==
|
2007-03-22 10:30:00 -07:00
|
|
|
groupVis->mVisible);
|
2011-09-28 23:19:26 -07:00
|
|
|
bool isCollapsed = collapseCol || collapseGroup;
|
2009-05-16 07:22:56 -07:00
|
|
|
if (!isCollapsed) {
|
2007-03-22 10:30:00 -07:00
|
|
|
cRect.width += tableFrame->GetColumnWidth(colX);
|
2011-10-17 07:59:28 -07:00
|
|
|
isVisible = true;
|
2009-05-16 07:22:56 -07:00
|
|
|
if ((actualColSpan > 1)) {
|
|
|
|
nsTableColFrame* nextColFrame =
|
|
|
|
tableFrame->GetColFrame(colX + colIncrement);
|
|
|
|
const nsStyleVisibility* nextColVis =
|
2007-03-22 10:30:00 -07:00
|
|
|
nextColFrame->GetStyleVisibility();
|
2009-05-16 07:22:56 -07:00
|
|
|
if ( (NS_STYLE_VISIBILITY_COLLAPSE != nextColVis->mVisible) &&
|
|
|
|
tableFrame->ColumnHasCellSpacingBefore(colX + colIncrement)) {
|
|
|
|
cRect.width += cellSpacingX;
|
|
|
|
}
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
x += cRect.width;
|
|
|
|
if (isVisible)
|
|
|
|
x += cellSpacingX;
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t actualRowSpan = tableFrame->GetEffectiveRowSpan(*cellFrame);
|
2007-03-22 10:30:00 -07:00
|
|
|
nsTableRowFrame* rowFrame = GetNextRow();
|
|
|
|
for (actualRowSpan--; actualRowSpan > 0 && rowFrame; actualRowSpan--) {
|
|
|
|
const nsStyleVisibility* nextRowVis = rowFrame->GetStyleVisibility();
|
2011-09-28 23:19:26 -07:00
|
|
|
bool collapseNextRow = (NS_STYLE_VISIBILITY_COLLAPSE ==
|
2007-03-22 10:30:00 -07:00
|
|
|
nextRowVis->mVisible);
|
|
|
|
if (!collapseNextRow) {
|
|
|
|
nsRect nextRect = rowFrame->GetRect();
|
|
|
|
cRect.height += nextRect.height + cellSpacingY;
|
|
|
|
}
|
|
|
|
rowFrame = rowFrame->GetNextRow();
|
|
|
|
}
|
2008-02-08 01:36:32 -08:00
|
|
|
|
|
|
|
nsRect oldCellRect = cellFrame->GetRect();
|
2010-10-06 21:25:46 -07:00
|
|
|
nsRect oldCellVisualOverflow = cellFrame->GetVisualOverflowRect();
|
2008-02-08 01:36:32 -08:00
|
|
|
|
|
|
|
if (aRowOffset == 0 && cRect.TopLeft() != oldCellRect.TopLeft()) {
|
|
|
|
// We're moving the cell. Invalidate the old overflow area
|
2010-08-30 17:49:12 -07:00
|
|
|
cellFrame->InvalidateFrameSubtree();
|
2008-02-08 01:36:32 -08:00
|
|
|
}
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
cellFrame->SetRect(cRect);
|
2008-02-08 01:36:32 -08:00
|
|
|
|
|
|
|
// XXXbz This looks completely bogus in the cases when we didn't
|
|
|
|
// collapse the cell!
|
2010-10-06 21:25:45 -07:00
|
|
|
nsRect cellBounds(0, 0, cRect.width, cRect.height);
|
|
|
|
nsOverflowAreas cellOverflow(cellBounds, cellBounds);
|
|
|
|
cellFrame->FinishAndStoreOverflow(cellOverflow,
|
|
|
|
nsSize(cRect.width, cRect.height));
|
2007-03-22 10:30:00 -07:00
|
|
|
nsTableFrame::RePositionViews(cellFrame);
|
2010-10-06 21:25:45 -07:00
|
|
|
ConsiderChildOverflow(overflow, cellFrame);
|
2012-08-28 22:48:45 -07:00
|
|
|
|
|
|
|
if (aRowOffset == 0) {
|
|
|
|
nsTableFrame::InvalidateTableFrame(cellFrame, oldCellRect,
|
|
|
|
oldCellVisualOverflow,
|
|
|
|
false);
|
|
|
|
}
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
kidFrame = iter.Next(); // Get the next child
|
|
|
|
}
|
|
|
|
}
|
2008-02-08 01:36:32 -08:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
SetRect(rowRect);
|
2010-10-06 21:25:45 -07:00
|
|
|
overflow.UnionAllWith(nsRect(0,0,rowRect.width, rowRect.height));
|
|
|
|
FinishAndStoreOverflow(overflow, nsSize(rowRect.width, rowRect.height));
|
2008-02-08 01:36:32 -08:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
nsTableFrame::RePositionViews(this);
|
2012-08-28 22:48:45 -07:00
|
|
|
nsTableFrame::InvalidateTableFrame(this, oldRect, oldVisualOverflow, false);
|
2007-03-22 10:30:00 -07:00
|
|
|
return shift;
|
|
|
|
}
|
|
|
|
|
2009-09-04 14:07:43 -07: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.
|
2007-03-22 10:30:00 -07:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
nsTableRowFrame::InsertCellFrame(nsTableCellFrame* aFrame,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t aColIndex)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
// Find the cell frame where col index < aColIndex
|
2012-07-30 07:20:58 -07:00
|
|
|
nsTableCellFrame* priorCell = nullptr;
|
2007-03-22 10:30:00 -07:00
|
|
|
for (nsIFrame* child = mFrames.FirstChild(); child;
|
|
|
|
child = child->GetNextSibling()) {
|
2009-03-24 15:10:06 -07:00
|
|
|
nsTableCellFrame *cellFrame = do_QueryFrame(child);
|
|
|
|
if (cellFrame) {
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t colIndex;
|
2007-03-22 10:30:00 -07:00
|
|
|
cellFrame->GetColIndex(colIndex);
|
|
|
|
if (colIndex < aColIndex) {
|
|
|
|
priorCell = cellFrame;
|
|
|
|
}
|
|
|
|
else break;
|
|
|
|
}
|
|
|
|
}
|
2009-09-04 14:07:43 -07:00
|
|
|
mFrames.InsertFrame(this, priorCell, aFrame);
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
nsIAtom*
|
|
|
|
nsTableRowFrame::GetType() const
|
|
|
|
{
|
|
|
|
return nsGkAtoms::tableRowFrame;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsTableRowFrame*
|
|
|
|
nsTableRowFrame::GetNextRow() const
|
|
|
|
{
|
|
|
|
nsIFrame* childFrame = GetNextSibling();
|
|
|
|
while (childFrame) {
|
2009-03-24 15:10:06 -07:00
|
|
|
nsTableRowFrame *rowFrame = do_QueryFrame(childFrame);
|
|
|
|
if (rowFrame) {
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_ASSERTION(NS_STYLE_DISPLAY_TABLE_ROW == childFrame->GetStyleDisplay()->mDisplay, "wrong display type on rowframe");
|
2009-03-24 15:10:06 -07:00
|
|
|
return rowFrame;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
childFrame = childFrame->GetNextSibling();
|
|
|
|
}
|
2012-07-30 07:20:58 -07:00
|
|
|
return nullptr;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2012-07-30 07:20:58 -07:00
|
|
|
NS_DECLARE_FRAME_PROPERTY(RowUnpaginatedHeightProperty, nullptr)
|
2010-03-28 18:46:55 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
void
|
|
|
|
nsTableRowFrame::SetUnpaginatedHeight(nsPresContext* aPresContext,
|
2009-01-14 14:16:43 -08:00
|
|
|
nscoord aValue)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
NS_ASSERTION(!GetPrevInFlow(), "program error");
|
2010-03-28 18:46:55 -07:00
|
|
|
// Get the property
|
|
|
|
aPresContext->PropertyTable()->
|
|
|
|
Set(this, RowUnpaginatedHeightProperty(), NS_INT32_TO_PTR(aValue));
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
nscoord
|
|
|
|
nsTableRowFrame::GetUnpaginatedHeight(nsPresContext* aPresContext)
|
|
|
|
{
|
2010-03-28 18:46:55 -07:00
|
|
|
FrameProperties props = GetFirstInFlow()->Properties();
|
|
|
|
return NS_PTR_TO_INT32(props.Get(RowUnpaginatedHeightProperty()));
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
void nsTableRowFrame::SetContinuousBCBorderWidth(uint8_t aForSide,
|
2007-03-22 10:30:00 -07: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-24 20:06:21 -07:00
|
|
|
#ifdef ACCESSIBILITY
|
2012-09-28 14:53:44 -07:00
|
|
|
a11y::AccType
|
|
|
|
nsTableRowFrame::AccessibleType()
|
2012-04-24 20:06:21 -07:00
|
|
|
{
|
2012-12-17 17:25:52 -08:00
|
|
|
return a11y::eHTMLTableRowType;
|
2012-04-24 20:06:21 -07:00
|
|
|
}
|
|
|
|
#endif
|
2007-06-25 13:34:35 -07: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 15:10:06 -07:00
|
|
|
nsTableCellFrame *cellFrame = do_QueryFrame(kidFrame);
|
|
|
|
if (!cellFrame) {
|
2007-06-25 13:34:35 -07:00
|
|
|
NS_NOTREACHED("Table row has a non-cell child.");
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
// Ignore row-spanning cells
|
2010-08-25 03:17:55 -07:00
|
|
|
const nsStyleCoord &cellHeight = cellFrame->GetStylePosition()->mHeight;
|
2007-06-25 13:34:35 -07:00
|
|
|
if (aTableFrame->GetEffectiveRowSpan(*cellFrame) == 1 &&
|
2010-08-25 03:17:55 -07:00
|
|
|
cellHeight.GetUnit() != eStyleUnit_Auto &&
|
2012-11-21 08:19:30 -08:00
|
|
|
/* calc() with percentages treated like 'auto' */
|
|
|
|
(!cellHeight.IsCalcUnit() || !cellHeight.HasPercent())) {
|
2007-06-25 13:34:35 -07:00
|
|
|
AddStateBits(NS_ROW_HAS_CELL_WITH_STYLE_HEIGHT);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
RemoveStateBits(NS_ROW_HAS_CELL_WITH_STYLE_HEIGHT);
|
|
|
|
}
|
2012-08-28 22:39:31 -07:00
|
|
|
|
|
|
|
void
|
2012-08-28 22:48:45 -07: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-28 22:39:31 -07:00
|
|
|
{
|
2012-08-28 22:48:45 -07: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-28 22:39:31 -07:00
|
|
|
}
|
2007-06-25 13:34:35 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
/* ----- global methods ----- */
|
|
|
|
|
|
|
|
nsIFrame*
|
|
|
|
NS_NewTableRowFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
|
|
|
|
{
|
|
|
|
return new (aPresShell) nsTableRowFrame(aContext);
|
|
|
|
}
|
|
|
|
|
2009-09-12 09:49:24 -07:00
|
|
|
NS_IMPL_FRAMEARENA_HELPERS(nsTableRowFrame)
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
#ifdef DEBUG
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsTableRowFrame::GetFrameName(nsAString& aResult) const
|
|
|
|
{
|
|
|
|
return MakeFrameName(NS_LITERAL_STRING("TableRow"), aResult);
|
|
|
|
}
|
|
|
|
#endif
|