Bug 1628804 - Ensure nsIFrame::ContentSize() returning non-negative sizes. r=dholbert,AlaskanEmily

Differential Revision: https://phabricator.services.mozilla.com/D70558

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Ting-Yu Lin 2020-04-10 22:51:13 +00:00
parent 8d0d00e527
commit 6da8fe2e7f
3 changed files with 27 additions and 1 deletions

View File

@ -0,0 +1,21 @@
<style>
.c {
box-decoration-break: clone;
padding-bottom: 41vmax;
}
</style>
<script>
go = () => {
try { b.appendChild(a) } catch(e) { }
}
</script>
<body onload=go()>
<button style="columns: 72 0px">
<dl style="columns: 1">
<dd>-</dd>
<dt id="b" style="float: left" class="c">x</dt>
</dl>
<dl>
<map id="a">
<canvas></canvas>
<details open="">x</details>

View File

@ -758,4 +758,5 @@ load 1618312.html
load 1618564.html
load 1625051-1.html
load 1625051-2.html
load 1628804.html
load very-large-frameset.html

View File

@ -1023,7 +1023,11 @@ class nsIFrame : public nsQueryFrame {
mozilla::LogicalSize ContentSize(mozilla::WritingMode aWritingMode) const {
const auto bp = GetLogicalUsedBorderAndPadding(aWritingMode)
.ApplySkipSides(GetLogicalSkipSides());
return GetLogicalSize(aWritingMode) - bp.Size(aWritingMode);
const auto size = GetLogicalSize(aWritingMode);
return mozilla::LogicalSize(
aWritingMode,
std::max(0, size.ISize(aWritingMode) - bp.IStartEnd(aWritingMode)),
std::max(0, size.BSize(aWritingMode) - bp.BStartEnd(aWritingMode)));
}
/**