本文整理汇总了C++中nsTableFrame::GetEffectiveRowSpan方法的典型用法代码示例。如果您正苦于以下问题:C++ nsTableFrame::GetEffectiveRowSpan方法的具体用法?C++ nsTableFrame::GetEffectiveRowSpan怎么用?C++ nsTableFrame::GetEffectiveRowSpan使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nsTableFrame
的用法示例。
在下文中一共展示了nsTableFrame::GetEffectiveRowSpan方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
// the computed bsize for the cell, which descendants use for percent bsize calculations
// it is the bsize (minus border, padding) of the cell's first in flow during its final
// reflow without an unconstrained bsize.
static nscoord
CalcUnpaginatedBSize(nsPresContext* aPresContext,
nsTableCellFrame& aCellFrame,
nsTableFrame& aTableFrame,
nscoord aBlockDirBorderPadding)
{
const nsTableCellFrame* firstCellInFlow =
static_cast<nsTableCellFrame*>(aCellFrame.FirstInFlow());
nsTableFrame* firstTableInFlow =
static_cast<nsTableFrame*>(aTableFrame.FirstInFlow());
nsTableRowFrame* row =
static_cast<nsTableRowFrame*>(firstCellInFlow->GetParent());
nsTableRowGroupFrame* firstRGInFlow =
static_cast<nsTableRowGroupFrame*>(row->GetParent());
int32_t rowIndex;
firstCellInFlow->GetRowIndex(rowIndex);
int32_t rowSpan = aTableFrame.GetEffectiveRowSpan(*firstCellInFlow);
nscoord computedBSize = firstTableInFlow->GetRowSpacing(rowIndex,
rowIndex + rowSpan - 1);
computedBSize -= aBlockDirBorderPadding;
int32_t rowX;
for (row = firstRGInFlow->GetFirstRow(), rowX = 0; row; row = row->GetNextRow(), rowX++) {
if (rowX > rowIndex + rowSpan - 1) {
break;
}
else if (rowX >= rowIndex) {
computedBSize += row->GetUnpaginatedBSize(aPresContext);
}
}
return computedBSize;
}
示例2: if
// the computed height for the cell, which descendants use for percent height calculations
// it is the height (minus border, padding) of the cell's first in flow during its final
// reflow without an unconstrained height.
static nscoord
CalcUnpaginagedHeight(nsPresContext* aPresContext,
nsTableCellFrame& aCellFrame,
nsTableFrame& aTableFrame,
nscoord aVerticalBorderPadding)
{
const nsTableCellFrame* firstCellInFlow = (nsTableCellFrame*)aCellFrame.GetFirstInFlow();
nsTableFrame* firstTableInFlow = (nsTableFrame*)aTableFrame.GetFirstInFlow();
nsTableRowFrame* row
= static_cast<nsTableRowFrame*>(firstCellInFlow->GetParent());
nsTableRowGroupFrame* firstRGInFlow
= static_cast<nsTableRowGroupFrame*>(row->GetParent());
int32_t rowIndex;
firstCellInFlow->GetRowIndex(rowIndex);
int32_t rowSpan = aTableFrame.GetEffectiveRowSpan(*firstCellInFlow);
nscoord cellSpacing = firstTableInFlow->GetCellSpacingX();
nscoord computedHeight = ((rowSpan - 1) * cellSpacing) - aVerticalBorderPadding;
int32_t rowX;
for (row = firstRGInFlow->GetFirstRow(), rowX = 0; row; row = row->GetNextRow(), rowX++) {
if (rowX > rowIndex + rowSpan - 1) {
break;
}
else if (rowX >= rowIndex) {
computedHeight += row->GetUnpaginatedHeight(aPresContext);
}
}
return computedHeight;
}
示例3:
nscoord
GetHeightOfRowsSpannedBelowFirst(nsTableCellFrame& aTableCellFrame,
nsTableFrame& aTableFrame)
{
nscoord height = 0;
nscoord cellSpacingY = aTableFrame.GetCellSpacingY();
PRInt32 rowSpan = aTableFrame.GetEffectiveRowSpan(aTableCellFrame);
// add in height of rows spanned beyond the 1st one
nsIFrame* nextRow = aTableCellFrame.GetParent()->GetNextSibling();
for (PRInt32 rowX = 1; ((rowX < rowSpan) && nextRow);) {
if (nsGkAtoms::tableRowFrame == nextRow->GetType()) {
height += nextRow->GetSize().height;
rowX++;
}
height += cellSpacingY;
nextRow = nextRow->GetNextSibling();
}
return height;
}
示例4: iter
nsresult
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?
const bool isPaginated = aPresContext->IsPaginated();
const bool borderCollapse = aTableFrame.IsBorderCollapse();
nsresult rv = NS_OK;
nscoord cellSpacingX = aTableFrame.GetCellSpacingX();
PRInt32 cellColSpan = 1; // must be defined here so it's set properly for non-cell kids
nsTableIterator iter(*this);
// remember the col index of the previous cell to handle rowspans into this row
PRInt32 firstPrevColIndex = (iter.IsLeftToRight()) ? -1 : aTableFrame.GetColCount();
PRInt32 prevColIndex = firstPrevColIndex;
nscoord x = 0; // running total of children x offset
// This computes the max of all cell heights
nscoord cellMaxHeight = 0;
// Reflow each of our existing cell frames
for (nsIFrame* kidFrame = iter.First(); kidFrame; kidFrame = iter.Next()) {
nsTableCellFrame *cellFrame = do_QueryFrame(kidFrame);
if (!cellFrame) {
// 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,
kidFrame, nsSize(0,0), false);
InitChildReflowState(*aPresContext, nsSize(0,0), false, kidReflowState);
nsHTMLReflowMetrics desiredSize;
nsReflowStatus status;
ReflowChild(kidFrame, aPresContext, desiredSize, kidReflowState, 0, 0, 0, status);
kidFrame->DidReflow(aPresContext, nullptr, NS_FRAME_REFLOW_FINISHED);
continue;
}
// See if we should only reflow the dirty child frames
bool doReflowChild = true;
if (!aReflowState.ShouldReflowAllKids() &&
!aTableFrame.IsGeometryDirty() &&
!NS_SUBTREE_DIRTY(kidFrame)) {
if (!aReflowState.mFlags.mSpecialHeightReflow)
doReflowChild = false;
}
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) {
doReflowChild = false;
}
}
if (aReflowState.mFlags.mSpecialHeightReflow) {
if (!isPaginated && !(cellFrame->GetStateBits() &
NS_FRAME_CONTAINS_RELATIVE_HEIGHT)) {
continue;
}
}
PRInt32 cellColIndex;
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,
cellSpacingX, iter.IsLeftToRight(), false);
}
// remember the rightmost (ltr) or leftmost (rtl) column this cell spans into
prevColIndex = (iter.IsLeftToRight()) ? cellColIndex + (cellColSpan - 1) : cellColIndex;
// Reflow the child frame
nsRect kidRect = kidFrame->GetRect();
nsRect kidVisualOverflow = kidFrame->GetVisualOverflowRect();
bool firstReflow =
(kidFrame->GetStateBits() & NS_FRAME_FIRST_REFLOW) != 0;
if (doReflowChild) {
// Calculate the available width for the table cell using the known column widths
nscoord availCellWidth =
CalcAvailWidth(aTableFrame, *cellFrame, cellSpacingX);
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()) ||
//.........这里部分代码省略.........