Bug 1676585 Part 2 - Use LogicalRect to compute joining boxes' border area. r=mats

The original code doesn't work for "writing-mode:vertical-rl" because
its block flow direction is the opposite of "writing-mode:vertical-lr."

Differential Revision: https://phabricator.services.mozilla.com/D96786
This commit is contained in:
Ting-Yu Lin 2020-11-17 05:36:42 +00:00
parent 7e3b64c3f2
commit bccb437849
5 changed files with 150 additions and 8 deletions

View File

@ -524,22 +524,23 @@ static nsRect JoinBoxesForBlockAxisSlice(nsIFrame* aFrame,
const nsRect& aBorderArea) {
// Inflate the block-axis size as if our continuations were laid out
// adjacent in that axis. Note that we don't touch the inline size.
nsRect borderArea = aBorderArea;
const auto wm = aFrame->GetWritingMode();
const nsSize dummyContainerSize;
LogicalRect borderArea(wm, aBorderArea, dummyContainerSize);
nscoord bSize = 0;
auto wm = aFrame->GetWritingMode();
nsIFrame* f = aFrame->GetNextContinuation();
for (; f; f = f->GetNextContinuation()) {
bSize += f->BSize(wm);
}
(wm.IsVertical() ? borderArea.width : borderArea.height) += bSize;
borderArea.BSize(wm) += bSize;
bSize = 0;
f = aFrame->GetPrevContinuation();
for (; f; f = f->GetPrevContinuation()) {
bSize += f->BSize(wm);
}
(wm.IsVertical() ? borderArea.x : borderArea.y) -= bSize;
(wm.IsVertical() ? borderArea.width : borderArea.height) += bSize;
return borderArea;
borderArea.BStart(wm) -= bSize;
borderArea.BSize(wm) += bSize;
return borderArea.GetPhysicalRect(wm, dummyContainerSize);
}
/**

View File

@ -9,4 +9,5 @@ fuzzy-if(!Android,0-1,0-62) fuzzy-if(Android,0-8,0-6627) random-if(/^Windows\x20
random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == box-decoration-break-bug-1235152.html box-decoration-break-bug-1235152-ref.html # Bug 1392106
random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == box-decoration-break-bug-1249913.html box-decoration-break-bug-1249913-ref.html # Bug 1392106
== vertical-wm-001.html vertical-wm-001-ref.html
== vertical-wm-002.html vertical-wm-002-ref.html
random-if(Android) == 1405443.html 1405443-ref.html

View File

@ -0,0 +1,71 @@
<!DOCTYPE HTML>
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<html><head>
<meta charset="utf-8">
<title>Reference: splitting vertical writing-mode blocks</title>
<link rel="author" title="Mats Palmgren" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1328095">
<style type="text/css">
body,html { padding:30px; margin:0; }
.col {
columns: 2;
column-gap: 0;
column-fill: auto;
block-size: 90px;
inline-size: 140px;
border:1px solid;
}
.vl { writing-mode: vertical-rl; }
x {
display:block;
break-inside:avoid;
page-break-inside:avoid;
vertical-align: top;
inline-size: 20px;
block-size: 20px;
background:silver;
}
x:nth-of-type(2n) {background:purple;}
blue { display:block; inline-size: 70px; border-block-start: 25px solid blue; }
grey { display:block; inline-size: 70px; border-block-start: 17px solid grey; }
</style>
</head>
<body>
<div class="col vl">
<div class="inner" style="margin-left:40px"></div>
<blue></blue>
<x></x><x></x>
<grey></grey>
</div>
<div class="col">
<div class="inner" style="margin-top:40px"></div>
<blue></blue>
<x></x><x></x>
<grey></grey>
</div>
<div class="col vl">
<div class="inner" style="margin-left:40px"></div>
<blue></blue>
<x></x><x></x>
<div style="width:45px"></div>
<grey></grey>
</div>
<div class="col vl">
<div class="inner" style="margin-left:40px"></div>
<blue></blue>
<x></x><x></x>
<div style="width:60px"></div>
<grey></grey>
</div>
</body>
</html>

View File

@ -0,0 +1,71 @@
<!DOCTYPE HTML>
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<html><head>
<meta charset="utf-8">
<title>Testcase: splitting vertical writing-mode blocks</title>
<link rel="author" title="Mats Palmgren" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1328095">
<link rel="help" href="http://dev.w3.org/csswg/css-break/#break-decoration">
<link rel="help" href="https://drafts.csswg.org/css-writing-modes-3/">
<link rel="match" href="vertical-wm-002-ref.html">
<style type="text/css">
body,html { padding:30px; margin:0; }
.col {
columns: 2;
column-gap: 0;
column-fill: auto;
block-size: 90px;
inline-size: 140px;
border:1px solid;
}
.vl { writing-mode: vertical-rl; }
.inner {
border-block-start: 25px solid blue;
border-block-end: 17px solid grey;
inline-size: 70px;
}
x {
display:block;
break-inside:avoid;
page-break-inside:avoid;
vertical-align: top;
inline-size: 20px;
block-size: 20px;
background:silver;
}
x:nth-of-type(2n) {background:purple;}
</style>
</head>
<body>
<div class="col vl">
<div class="inner" style="margin-block-start:40px">
<x></x><x></x>
</div>
</div>
<div class="col">
<div class="inner" style="margin-block-start:40px">
<x></x><x></x>
</div>
</div>
<div class="col vl">
<div class="inner" style="margin-block-start:40px; block-size:90px">
<x></x><x></x>
</div>
</div>
<div class="col vl">
<div class="inner" style="margin-block-start:40px; block-size:100px">
<x></x><x></x>
</div>
</div>
</body>
</html>

View File

@ -1,2 +0,0 @@
[borders-007.html]
expected: FAIL