зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
aeb05a26c6
Коммит
d1c7df5b20
|
@ -0,0 +1,47 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<style>
|
||||
.table {
|
||||
display: table;
|
||||
width: 100px;
|
||||
table-layout: fixed;
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
|
||||
.table > * {
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
display: table-cell;
|
||||
height: 30px;
|
||||
}
|
||||
|
||||
.withBorder { border: 2px solid black; }
|
||||
|
||||
.thin { width: 25px; }
|
||||
.wide { width: 75px; }
|
||||
|
||||
.teal { background: teal; }
|
||||
.purple { background: purple; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="table">
|
||||
<div class="thin teal"></div>
|
||||
<div class="wide purple"></div>
|
||||
</div>
|
||||
<div class="table">
|
||||
<div class="thin teal"></div>
|
||||
<div class="wide purple"></div>
|
||||
</div>
|
||||
<div class="table">
|
||||
<div class="thin withBorder teal"></div>
|
||||
<div class="wide withBorder purple"></div>
|
||||
</div>
|
||||
<div class="table">
|
||||
<div class="thin withBorder teal"></div>
|
||||
<div class="wide withBorder purple"></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,48 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<style>
|
||||
.table {
|
||||
display: table;
|
||||
width: 100px;
|
||||
table-layout: fixed;
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
|
||||
.table > * {
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
display: table-cell;
|
||||
height: 30px;
|
||||
}
|
||||
|
||||
.withPadding { padding: 10px; }
|
||||
.withBorder { border: 2px solid black; }
|
||||
|
||||
.thin { width: 25%; }
|
||||
.wide { width: 75%; }
|
||||
|
||||
.teal { background: teal; }
|
||||
.purple { background: purple; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="table">
|
||||
<div class="thin teal"></div>
|
||||
<div class="wide purple"></div>
|
||||
</div>
|
||||
<div class="table">
|
||||
<div class="thin withPadding teal"></div>
|
||||
<div class="wide withPadding purple"></div>
|
||||
</div>
|
||||
<div class="table">
|
||||
<div class="thin withBorder teal"></div>
|
||||
<div class="wide withBorder purple"></div>
|
||||
</div>
|
||||
<div class="table">
|
||||
<div class="thin withBorder withPadding teal"></div>
|
||||
<div class="wide withBorder withPadding purple"></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -1758,6 +1758,7 @@ fails-if(Android&&AndroidVersion<15) == 836844-1.html 836844-1-ref.html
|
|||
test-pref(layout.css.flexbox.enabled,true) == 849407-1.html 849407-1-ref.html
|
||||
== 849996-1.html 849996-1-ref.html
|
||||
== 858803-1.html 858803-1-ref.html
|
||||
== 860242-1.html 860242-1-ref.html
|
||||
!= 860370.html 860370-notref.html
|
||||
== 871338-1.html 871338-1-ref.html
|
||||
random-if(Android&&AndroidVersion>=15) == 875060-1.html 875060-1-ref.html #Bug 885303
|
||||
|
|
|
@ -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;
|
||||
|
|
Загрузка…
Ссылка в новой задаче