int span = col.getStyle().getColSpan(); Length w = col.getStyle().asLength(c, CSSName.WIDTH); if (w.isVariable() && col.getParent() != null) { w = col.getParent().getStyle().asLength(c, CSSName.WIDTH); if (w.isFixed() && w.value() > 0) { effWidth = w.value(); effWidth = Math.min(effWidth, Length.MAX_WIDTH); table.appendColumn(span - usedSpan); nEffCols++; _widths.add(new Length()); if ((w.isFixed() || w.isPercent()) && w.value() > 0) { _widths.set(cCol + i, new Length(w.value() * eSpan, w.type())); usedWidth += effWidth * eSpan; int span = cell.getStyle().getColSpan(); long effWidth = 0; if (w.isFixed() && w.value() > 0) { effWidth = w.value(); if (columnWidth.isVariable() && !w.isVariable()) { _widths.set(cCol + i, new Length(w.value() * eSpan, w.type())); usedWidth += effWidth * eSpan;
public Length asLength(CssContext c, CSSName cssName) { Length result = new Length(); FSDerivedValue value = valueByName(cssName); if (value instanceof LengthValue || value instanceof NumberValue) { if (value.hasAbsoluteUnit()) { result.setValue((int) value.getFloatProportionalTo(cssName, 0, c)); result.setType(Length.FIXED); } else { result.setValue((int) value.asFloat()); result.setType(Length.PERCENT); } } return result; }
public Length getOuterStyleWidth(CssContext c) { Length result = getStyle().asLength(c, CSSName.WIDTH); if (result.isVariable() || result.isPercent()) { return result; } int bordersAndPadding = 0; BorderPropertySet border = getBorder(c); bordersAndPadding += (int)border.left() + (int)border.right(); RectPropertySet padding = getPadding(c); bordersAndPadding += (int)padding.left() + (int)padding.right(); result.setValue(result.value() + bordersAndPadding); return result; }
if ( l.isFixed() ) { calcWidth[i] = l.value(); available -= l.value(); for ( int i = 0; i < nEffCols; i++ ) { Length l = (Length)_widths.get(i); if ( l.isPercent() ) { totalPercent += l.value(); if ( l.isPercent() ) { long w = base * l.value() / totalPercent; available -= w; calcWidth[i] = w; for ( int i = 0; i < nEffCols; i++ ) { Length l = (Length)_widths.get(i); if ( l.isVariable() ) { totalVariable++; if ( l.isVariable() ) { int w = available / totalVariable; available -= w;
available -= w; Length width = layoutStruct[i].effWidth(); switch (width.type()) { case Length.PERCENT: havePercent = true; totalPercent += width.value(); break; case Length.FIXED: for (int i = 0; i < nEffCols; i++) { Length width = layoutStruct[i].effWidth(); if (width.isPercent()) { long w = Math.max(layoutStruct[i].effMinWidth(), width.minWidth(tableWidth)); available += layoutStruct[i].calcWidth() - w; layoutStruct[i].setCalcWidth(w); if (layoutStruct[i].effWidth().isPercent()) { long w = layoutStruct[i].calcWidth(); long reduction = Math.min(w, excess); for (int i = 0; i < nEffCols; ++i) { Length width = layoutStruct[i].effWidth(); if (width.isFixed() && width.value() > layoutStruct[i].calcWidth()) { available += layoutStruct[i].calcWidth() - width.value(); layoutStruct[i].setCalcWidth(width.value()); if (width.isVariable() && totalVariable != 0) { long w = Math.max(layoutStruct[i].calcWidth(), available
w.setValue(Math.min(Length.MAX_WIDTH, Math.max(0, w.value()))); switch (w.type()) { case Length.FIXED: if (w.value() > 0 && !l.width().isPercent()) { if (l.width().isFixed()) { if (w.value() > l.width().value()) { l.width().setValue(w.value()); if (w.value() > l.maxWidth()) { l.setMaxWidth(w.value()); if (w.value() > 0 && (!l.width().isPercent() || w.value() > l.width().value())) { l.setWidth(w); break;
minWidth += layoutStruct[i].effMinWidth(); maxWidth += layoutStruct[i].effMaxWidth(); if (layoutStruct[i].effWidth().isPercent()) { long percent = Math.min(layoutStruct[i].effWidth().value(), remainingPercent); long pw = (layoutStruct[i].effMaxWidth() * 100) / Math.max(percent, 1); remainingPercent -= percent; if (tw.isFixed() && tw.value() > 0) { table.calcDimensions(c); int width = table.getWidth();
public Length getOuterStyleOrColWidth(CssContext c) { Length result = getOuterStyleWidth(c); if (getStyle().getColSpan() > 1 || ! result.isVariable()) { return result; } TableColumn col = getTable().colElement(getCol()); if (col != null) { // XXX Need to add in collapsed borders from cell (if collapsing borders) result = col.getStyle().asLength(c, CSSName.WIDTH); } return result; }
private void initWidths() { _widths = new ArrayList(_table.numEffCols()); for (int i = 0; i < _table.numEffCols(); i++) { _widths.add(new Length()); } }
public void calcMinMaxWidth(LayoutContext c) { int bs = _table.marginsBordersPaddingAndSpacing(c, true); _table.calcDimensions(c); // Reset to allow layout to have another crack at this. If we're // participating in a nested max/min-width calculation, the values // calculated above may be wrong and may need updating once our // parent has a width. _table.setDimensionsCalculated(false); int mw = calcWidthArray(c) + bs; _table.setMinWidth(Math.max(mw, _table.getWidth())); _table.setMaxWidth(_table.getMinWidth()); boolean haveNonFixed = false; for (int i = 0; i < _widths.size(); i++) { Length w = (Length)_widths.get(i); if (! w.isFixed()) { haveNonFixed = true; break; } } if (haveNonFixed) { _table.setMaxWidth(Length.MAX_WIDTH); } }
available -= w; Length width = layoutStruct[i].effWidth(); switch (width.type()) { case Length.PERCENT: havePercent = true; totalPercent += width.value(); break; case Length.FIXED: for (int i = 0; i < nEffCols; i++) { Length width = layoutStruct[i].effWidth(); if (width.isPercent()) { long w = Math.max(layoutStruct[i].effMinWidth(), width.minWidth(tableWidth)); available += layoutStruct[i].calcWidth() - w; layoutStruct[i].setCalcWidth(w); if (layoutStruct[i].effWidth().isPercent()) { long w = layoutStruct[i].calcWidth(); long reduction = Math.min(w, excess); for (int i = 0; i < nEffCols; ++i) { Length width = layoutStruct[i].effWidth(); if (width.isFixed() && width.value() > layoutStruct[i].calcWidth()) { available += layoutStruct[i].calcWidth() - width.value(); layoutStruct[i].setCalcWidth(width.value()); if (width.isVariable() && totalVariable != 0) { long w = Math.max(layoutStruct[i].calcWidth(), available
w.setValue(Math.min(Length.MAX_WIDTH, Math.max(0, w.value()))); switch (w.type()) { case Length.FIXED: if (w.value() > 0 && !l.width().isPercent()) { if (l.width().isFixed()) { if (w.value() > l.width().value()) { l.width().setValue(w.value()); if (w.value() > l.maxWidth()) { l.setMaxWidth(w.value()); if (w.value() > 0 && (!l.width().isPercent() || w.value() > l.width().value())) { l.setWidth(w); break;
public Length getOuterStyleWidth(CssContext c) { Length result = getStyle().asLength(c, CSSName.WIDTH); if (result.isVariable() || result.isPercent()) { return result; } int bordersAndPadding = 0; BorderPropertySet border = getBorder(c); bordersAndPadding += (int)border.left() + (int)border.right(); RectPropertySet padding = getPadding(c); bordersAndPadding += (int)padding.left() + (int)padding.right(); result.setValue(result.value() + bordersAndPadding); return result; }
minWidth += layoutStruct[i].effMinWidth(); maxWidth += layoutStruct[i].effMaxWidth(); if (layoutStruct[i].effWidth().isPercent()) { long percent = Math.min(layoutStruct[i].effWidth().value(), remainingPercent); long pw = (layoutStruct[i].effMaxWidth() * 100) / Math.max(percent, 1); remainingPercent -= percent; if (tw.isFixed() && tw.value() > 0) { table.calcDimensions(c); int width = table.getContentWidth() + table.marginsBordersPaddingAndSpacing(c, true);
public Length getOuterStyleOrColWidth(CssContext c) { Length result = getOuterStyleWidth(c); if (getStyle().getColSpan() > 1 || ! result.isVariable()) { return result; } TableColumn col = getTable().colElement(getCol()); if (col != null) { // XXX Need to add in collapsed borders from cell (if collapsing borders) result = col.getStyle().asLength(c, CSSName.WIDTH); } return result; }
private void initWidths() { _widths = new ArrayList(_table.numEffCols()); for (int i = 0; i < _table.numEffCols(); i++) { _widths.add(new Length()); } }
public void calcMinMaxWidth(LayoutContext c) { int bs = _table.marginsBordersPaddingAndSpacing(c); _table.calcDimensions(c); // Reset to allow layout to have another crack at this. If we're // participating in a nested max/min-width calculation, the values // calculated above may be wrong and may need updating once our // parent has a width. _table.setDimensionsCalculated(false); int mw = calcWidthArray(c) + bs; _table.setMinWidth(Math.max(mw, _table.getWidth())); _table.setMaxWidth(_table.getMinWidth()); boolean haveNonFixed = false; for (int i = 0; i < _widths.size(); i++) { Length w = (Length)_widths.get(i); if (! w.isFixed()) { haveNonFixed = true; break; } } if (haveNonFixed) { _table.setMaxWidth(Length.MAX_WIDTH); } }
if ( l.isFixed() ) { calcWidth[i] = l.value(); available -= l.value(); for ( int i = 0; i < nEffCols; i++ ) { Length l = (Length)_widths.get(i); if ( l.isPercent() ) { totalPercent += l.value(); if ( l.isPercent() ) { long w = base * l.value() / totalPercent; available -= w; calcWidth[i] = w; for ( int i = 0; i < nEffCols; i++ ) { Length l = (Length)_widths.get(i); if ( l.isVariable() ) { totalVariable++; if ( l.isVariable() ) { int w = available / totalVariable; available -= w;
public Length asLength(CssContext c, CSSName cssName) { Length result = new Length(); FSDerivedValue value = valueByName(cssName); if (value instanceof LengthValue || value instanceof NumberValue) { if (value.hasAbsoluteUnit()) { result.setValue((int) value.getFloatProportionalTo(cssName, 0, c)); result.setType(Length.FIXED); } else { result.setValue((int) value.asFloat()); result.setType(Length.PERCENT); } } return result; }
public void calcMinMaxWidth(LayoutContext c) { super.calcMinMaxWidth(c); Layout[] layoutStruct = getLayoutStruct(); if (layoutStruct.length == 3) { Layout center = layoutStruct[1]; if (! (center.width().isVariable() && center.maxWidth() == 0)) { if (layoutStruct[0].minWidth() > layoutStruct[2].minWidth()) { layoutStruct[2] = layoutStruct[0]; } else if (layoutStruct[2].minWidth() > layoutStruct[0].minWidth()) { layoutStruct[0] = layoutStruct[2]; } else { Layout l = new Layout(); l.setMinWidth(Math.max(layoutStruct[0].minWidth(), layoutStruct[2].minWidth())); l.setEffMinWidth(l.minWidth()); l.setMaxWidth(Math.max(layoutStruct[0].maxWidth(), layoutStruct[2].maxWidth())); l.setEffMaxWidth(l.maxWidth()); layoutStruct[0] = l; layoutStruct[2] = l; } } } } }