Bug 860242: If box-sizing includes border/padding, then don't add border/padding to cell-width, in fixed table layout's percent-width case. r=dbaron

This commit is contained in:
Daniel Holbert
2013-07-11 16:46:06 -07:00
parent 934c425031
commit 3e9f8df6a7
4 changed files with 112 additions and 2 deletions

View File

@@ -251,8 +251,22 @@ FixedTableLayoutStrategy::ComputeColumnWidths(const nsHTMLReflowState& aReflowSt
nsIFrame::IntrinsicWidthOffsetData offsets =
cellFrame->IntrinsicWidthOffsets(aReflowState.rendContext);
float pct = styleWidth->GetPercentValue();
colWidth = NSToCoordFloor(pct * float(tableWidth)) +
offsets.hPadding + offsets.hBorder;
colWidth = NSToCoordFloor(pct * float(tableWidth));
nscoord boxSizingAdjust = 0;
switch (cellFrame->StylePosition()->mBoxSizing) {
case NS_STYLE_BOX_SIZING_CONTENT:
boxSizingAdjust += offsets.hPadding;
// Fall through
case NS_STYLE_BOX_SIZING_PADDING:
boxSizingAdjust += offsets.hBorder;
// Fall through
case NS_STYLE_BOX_SIZING_BORDER:
// Don't add anything
break;
}
colWidth += boxSizingAdjust;
pct /= float(colSpan);
colFrame->AddPrefPercent(pct);
pctTotal += pct;