本文整理汇总了C++中LayoutTableCell::clearPreferredLogicalWidthsDirty方法的典型用法代码示例。如果您正苦于以下问题:C++ LayoutTableCell::clearPreferredLogicalWidthsDirty方法的具体用法?C++ LayoutTableCell::clearPreferredLogicalWidthsDirty怎么用?C++ LayoutTableCell::clearPreferredLogicalWidthsDirty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LayoutTableCell
的用法示例。
在下文中一共展示了LayoutTableCell::clearPreferredLogicalWidthsDirty方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: calcWidthArray
int TableLayoutAlgorithmFixed::calcWidthArray()
{
// FIXME: We might want to wait until we have all of the first row before computing for the first time.
int usedWidth = 0;
// iterate over all <col> elements
unsigned nEffCols = m_table->numEffectiveColumns();
m_width.resize(nEffCols);
m_width.fill(Length(Auto));
unsigned currentEffectiveColumn = 0;
for (LayoutTableCol* col = m_table->firstColumn(); col; col = col->nextColumn()) {
// LayoutTableCols don't have the concept of preferred logical width, but we need to clear their dirty bits
// so that if we call setPreferredWidthsDirty(true) on a col or one of its descendants, we'll mark it's
// ancestors as dirty.
col->clearPreferredLogicalWidthsDirtyBits();
// Width specified by column-groups that have column child does not affect column width in fixed layout tables
if (col->isTableColumnGroupWithColumnChildren())
continue;
Length colStyleLogicalWidth = col->style()->logicalWidth();
int effectiveColWidth = 0;
if (colStyleLogicalWidth.isFixed() && colStyleLogicalWidth.value() > 0)
effectiveColWidth = colStyleLogicalWidth.value();
unsigned span = col->span();
while (span) {
unsigned spanInCurrentEffectiveColumn;
if (currentEffectiveColumn >= nEffCols) {
m_table->appendEffectiveColumn(span);
nEffCols++;
m_width.append(Length());
spanInCurrentEffectiveColumn = span;
} else {
if (span < m_table->spanOfEffectiveColumn(currentEffectiveColumn)) {
m_table->splitEffectiveColumn(currentEffectiveColumn, span);
nEffCols++;
m_width.append(Length());
}
spanInCurrentEffectiveColumn = m_table->spanOfEffectiveColumn(currentEffectiveColumn);
}
// TODO(alancutter): Make this work correctly for calc lengths.
if ((colStyleLogicalWidth.isFixed() || colStyleLogicalWidth.hasPercent()) && colStyleLogicalWidth.isPositive()) {
m_width[currentEffectiveColumn] = colStyleLogicalWidth;
m_width[currentEffectiveColumn] *= spanInCurrentEffectiveColumn;
usedWidth += effectiveColWidth * spanInCurrentEffectiveColumn;
}
span -= spanInCurrentEffectiveColumn;
currentEffectiveColumn++;
}
}
// Iterate over the first row in case some are unspecified.
LayoutTableSection* section = m_table->topNonEmptySection();
if (!section)
return usedWidth;
unsigned currentColumn = 0;
LayoutTableRow* firstRow = section->firstRow();
for (LayoutTableCell* cell = firstRow->firstCell(); cell; cell = cell->nextCell()) {
Length logicalWidth = cell->styleOrColLogicalWidth();
// FIXME: calc() on tables should be handled consistently with other lengths. See bug: https://crbug.com/382725
if (logicalWidth.isCalculated())
logicalWidth = Length(); // Make it Auto
unsigned span = cell->colSpan();
int fixedBorderBoxLogicalWidth = 0;
// FIXME: Support other length types. If the width is non-auto, it should probably just use
// LayoutBox::computeLogicalWidthUsing to compute the width.
if (logicalWidth.isFixed() && logicalWidth.isPositive()) {
fixedBorderBoxLogicalWidth = cell->adjustBorderBoxLogicalWidthForBoxSizing(logicalWidth.value());
logicalWidth.setValue(fixedBorderBoxLogicalWidth);
}
unsigned usedSpan = 0;
while (usedSpan < span && currentColumn < nEffCols) {
float eSpan = m_table->spanOfEffectiveColumn(currentColumn);
// Only set if no col element has already set it.
if (m_width[currentColumn].isAuto() && logicalWidth.type() != Auto) {
m_width[currentColumn] = logicalWidth;
m_width[currentColumn] *= eSpan / span;
usedWidth += fixedBorderBoxLogicalWidth * eSpan / span;
}
usedSpan += eSpan;
++currentColumn;
}
// TableLayoutAlgorithmFixed doesn't use min/maxPreferredLogicalWidths, but we need to clear the
// dirty bit on the cell so that we'll correctly mark its ancestors dirty
// in case we later call setPreferredLogicalWidthsDirty() on it later.
if (cell->preferredLogicalWidthsDirty())
cell->clearPreferredLogicalWidthsDirty();
}
return usedWidth;
}