In bidi resolution, convert inline bidi continuations not at the end of a bidi run into fluid continuations. bug=423130 r=smontagu sr=dbaron a19b5=dsicore

This commit is contained in:
uriber@gmail.com 2008-03-21 01:17:41 -07:00
Родитель 224c6bfc94
Коммит d924a63db8
4 изменённых файлов: 77 добавлений и 13 удалений

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

@ -158,6 +158,27 @@ SplitInlineAncestors(nsIFrame* aFrame)
return NS_OK;
}
// Convert bidi continuations to fluid continuations for a frame and all of its
// inline ancestors.
static nsresult
JoinInlineAncestors(nsIFrame* aFrame)
{
nsIFrame* frame = aFrame;
while (frame && IsBidiSplittable(frame)) {
nsIFrame* next = frame->GetNextContinuation();
if (next) {
NS_ASSERTION (!frame->GetNextInFlow() || frame->GetNextInFlow() == next,
"next-in-flow is not next continuation!");
frame->SetNextInFlow(next);
NS_ASSERTION (!next->GetPrevInFlow() || next->GetPrevInFlow() == frame,
"prev-in-flow is not prev continuation!");
next->SetPrevInFlow(frame);
}
frame = frame->GetParent();
}
}
static nsresult
CreateBidiContinuation(nsIFrame* aFrame,
nsIFrame** aNewFrame)
@ -465,19 +486,27 @@ nsBidiPresUtils::Resolve(nsBlockFrame* aBlockFrame,
runLength -= fragmentLength;
fragmentLength -= temp;
// If the frame is at the end of a run, split all ancestor inlines that need splitting.
if (frame && fragmentLength <= 0 && runLength <= 0) {
// As long as we're on the last sibling, the parent doesn't have to be split.
nsIFrame* child = frame;
nsIFrame* parent = frame->GetParent();
while (parent &&
IsBidiSplittable(parent) &&
!child->GetNextSibling()) {
child = parent;
parent = child->GetParent();
if (frame && fragmentLength <= 0) {
if (runLength <= 0) {
// If the frame is at the end of a run, split all ancestor inlines that need splitting.
nsIFrame* child = frame;
nsIFrame* parent = frame->GetParent();
// As long as we're on the last sibling, the parent doesn't have to be split.
while (parent &&
IsBidiSplittable(parent) &&
!child->GetNextSibling()) {
child = parent;
parent = child->GetParent();
}
if (parent && IsBidiSplittable(parent))
SplitInlineAncestors(child);
}
else {
// We're not at an end of a run. If this frame's ancestors happen to have
// bidi continuations, convert them into fluid continuations.
nsIFrame* parent = frame->GetParent();
JoinInlineAncestors(parent);
}
if (parent && IsBidiSplittable(parent))
SplitInlineAncestors(child);
}
} // for
return mSuccess;

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

@ -0,0 +1,14 @@
<!DOCTYPE HTML>
<html>
<head>
<style type="text/css">
div {
float: left;
border: medium solid black;
}
</style>
</head>
<body>
<div><span style="padding-right: 10em;" id="s"><br></span></div>
</body>
</html>

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

@ -0,0 +1,21 @@
<!DOCTYPE HTML>
<html>
<head>
<script type="text/javascript">
function boom()
{
var s = document.getElementById("s");
s.removeChild(s.lastChild);
}
</script>
<style type="text/css">
div {
float: left;
border: medium solid black;
}
</style>
</head>
<body onload="boom();">
<div><span style="padding-right: 10em;" id="s"><br>&rlm;</span></div>
</body>
</html>

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

@ -771,4 +771,4 @@ fails == 413027-3.html 413027-3-ref.html
== 421234-1.html 421234-1-ref.html
== 421419-1.html 421419-1-ref.html
== 422394-1.html 422394-1-ref.html
== 423130-1.html 423130-1-ref.html