Bug 1524431 Part 2 - Check IsBidiSplittable() before processing the ancestor frames. r=jfkthame

The idea is to check IsBidiSplittable() in more places to prevent fixed
continuations created by column-span from becoming fluid ones.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Ting-Yu Lin 2019-06-11 19:27:57 +00:00
Родитель 6904399bd9
Коммит 307ef73912
4 изменённых файлов: 58 добавлений и 3 удалений

Просмотреть файл

@ -459,6 +459,7 @@ void MOZ_EXPORT DumpBidiLine(BidiLineData* aData, bool aVisualOrder) {
// Should this frame be split between text runs?
static bool IsBidiSplittable(nsIFrame* aFrame) {
MOZ_ASSERT(aFrame);
// Bidi inline containers should be split, unless they're line frames.
LayoutFrameType frameType = aFrame->Type();
return (aFrame->IsFrameOfType(nsIFrame::eBidiInlineContainer) &&
@ -555,7 +556,7 @@ static void MakeContinuationsNonFluidUpParentChain(nsIFrame* aFrame,
// If it isn't the last child, make sure that its continuation is fluid.
static void JoinInlineAncestors(nsIFrame* aFrame) {
nsIFrame* frame = aFrame;
do {
while (frame && IsBidiSplittable(frame)) {
nsIFrame* next = frame->GetNextContinuation();
if (next) {
MakeContinuationFluid(frame, next);
@ -563,7 +564,7 @@ static void JoinInlineAncestors(nsIFrame* aFrame) {
// Join the parent only as long as we're its last child.
if (frame->GetNextSibling()) break;
frame = frame->GetParent();
} while (frame && IsBidiSplittable(frame));
}
}
static nsresult CreateContinuation(nsIFrame* aFrame, nsIFrame** aNewFrame,
@ -1788,7 +1789,7 @@ void nsBidiPresUtils::RemoveBidiContinuation(BidiParagraphData* aBpd,
// so they can be reused or deleted by normal reflow code
frame->SetProperty(nsIFrame::BidiDataProperty(), bidiData);
frame->AddStateBits(NS_FRAME_IS_BIDI);
while (frame) {
while (frame && IsBidiSplittable(frame)) {
nsIFrame* prev = frame->GetPrevContinuation();
if (prev) {
MakeContinuationFluid(prev, frame);

Просмотреть файл

@ -0,0 +1,2 @@
[multicol-span-all-011.html]
prefs: [layout.css.column-span.enabled:true]

Просмотреть файл

@ -0,0 +1,24 @@
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<title>CSS Multi-column Layout Test Reference: Test a bidi-override multi-column container with a dir=rtl column-span:all child</title>
<link rel="author" title="Ting-Yu Lin" href="tlin@mozilla.com">
<link rel="author" title="Mozilla" href="http://www.mozilla.org/">
<style>
article {
column-count: 1;
column-rule: 6px solid;
width: 400px;
outline: 1px solid black;
}
h3 {
/* "column-count: 1" makes this behave like a real spanner. */
outline: 1px solid blue;
}
</style>
<article>
<div>before</div><h3 dir="rtl">spanner</h3><div>after</div>
</article>
</html>

Просмотреть файл

@ -0,0 +1,28 @@
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<title>CSS Multi-column Layout Test: Test a bidi-override multi-column container with a dir=rtl column-span:all child</title>
<link rel="author" title="Ting-Yu Lin" href="tlin@mozilla.com">
<link rel="author" title="Mozilla" href="http://www.mozilla.org/">
<link rel="help" href="https://drafts.csswg.org/css-multicol-1/#column-span">
<link rel="match" href="multicol-span-all-011-ref.html">
<meta name="assert" content="This test checks that the text is correctly split by 'dir=rtl' column-span:all child in a bidi-override multi-column container.">
<style>
article {
column-count: 2;
column-rule: 6px solid;
width: 400px;
outline: 1px solid black;
unicode-bidi: bidi-override; /* Needed to trigger bidi resolution. */
}
h3 {
column-span: all;
outline: 1px solid blue;
}
</style>
<article>
<div>before<h3 dir="rtl">spanner</h3>after</div>
</article>
</html>