зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1786353 - Use logical sides when calculating table cell baseline. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D155396
This commit is contained in:
Родитель
ee7b59a571
Коммит
13d8c567da
|
@ -534,13 +534,16 @@ nscoord nsTableCellFrame::GetCellBaseline() const {
|
|||
// Ignore the position of the inner frame relative to the cell frame
|
||||
// since we want the position as though the inner were top-aligned.
|
||||
nsIFrame* inner = mFrames.FirstChild();
|
||||
nscoord borderPadding = GetUsedBorderAndPadding().top;
|
||||
const auto wm = GetWritingMode();
|
||||
const auto borderPadding = GetLogicalUsedBorderAndPadding(wm);
|
||||
nscoord result;
|
||||
if (!StyleDisplay()->IsContainLayout() &&
|
||||
nsLayoutUtils::GetFirstLineBaseline(GetWritingMode(), inner, &result)) {
|
||||
return result + borderPadding;
|
||||
nsLayoutUtils::GetFirstLineBaseline(wm, inner, &result)) {
|
||||
return result + borderPadding.BStart(wm);
|
||||
}
|
||||
return inner->GetContentRectRelativeToSelf().YMost() + borderPadding;
|
||||
const auto logicalSize = inner->GetLogicalSize(wm);
|
||||
// ::-moz-cell-content shouldn't have any border/padding.
|
||||
return logicalSize.BSize(wm) + borderPadding.BStart(wm);
|
||||
}
|
||||
|
||||
int32_t nsTableCellFrame::GetRowSpan() {
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
<!DOCTYPE html>
|
||||
<title>Reference: Table Baseline Alignment in Vertical Writing Mode</title>
|
||||
<link rel="author" title="David Shin" href="dshin@mozilla.com" />
|
||||
<link rel="help" href="https://drafts.csswg.org/css-tables-3/#table-cell-baseline" />
|
||||
<style>
|
||||
.table {
|
||||
border: 1px solid;
|
||||
border-width: 1px 2px 3px 4px;
|
||||
padding: 5px 6px 7px 8px;
|
||||
border-spacing: 0;
|
||||
width: fit-content;
|
||||
}
|
||||
.inner {
|
||||
width: 50px;
|
||||
height: 100px;
|
||||
background: green;
|
||||
}
|
||||
</style>
|
||||
<div class="table">
|
||||
<div class="table"><div class="inner"></div></div>
|
||||
<div class="table"><div class="inner"></div></div>
|
||||
</div>
|
||||
<div class="table">
|
||||
<div class="table"><div class="inner"></div></div>
|
||||
<div class="table"><div class="inner">
|
|
@ -0,0 +1,30 @@
|
|||
<!DOCTYPE html>
|
||||
<title>Table Baseline Alignment in Vertical Writing Mode</title>
|
||||
<link rel="author" title="David Shin" href="dshin@mozilla.com" />
|
||||
<link rel="help" href="https://drafts.csswg.org/css-tables-3/#table-cell-baseline" />
|
||||
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1786353" />
|
||||
<link rel="match" href="baseline-vertical-ref.html" />
|
||||
<meta name="assert" content="Table with baseline alignment, vertical writing mode and tall elements should not generate excess space.">
|
||||
<style>
|
||||
table, tr, td {
|
||||
border: 1px solid;
|
||||
border-width: 1px 2px 3px 4px;
|
||||
padding: 5px 6px 7px 8px;
|
||||
border-spacing: 0;
|
||||
}
|
||||
td {
|
||||
vertical-align: baseline;
|
||||
background: red;
|
||||
background-clip: content-box;
|
||||
}
|
||||
div {
|
||||
width: 50px;
|
||||
height: 100px;
|
||||
background: green;
|
||||
}
|
||||
</style>
|
||||
<table style="writing-mode: vertical-lr;"><tr>
|
||||
<td><div></div></td><td><div></div></td>
|
||||
</tr></table>
|
||||
<table style="writing-mode: vertical-rl;"><tr>
|
||||
<td><div></div></td><td><div></div>
|
Загрузка…
Ссылка в новой задаче