When creating a bidi continuation for a frame with fluid continuations, set the length of all the frames in the continuation chain to zero except the last one. Bug 409375, r+sr+blocking1.9=roc

This commit is contained in:
smontagu@smontagu.org 2008-01-29 20:13:06 -08:00
Родитель 9b2bdc68e0
Коммит 8c8525f6e4
5 изменённых файлов: 56 добавлений и 6 удалений

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

@ -426,8 +426,9 @@ nsBidiPresUtils::Resolve(nsBlockFrame* aBlockFrame,
// IBMBIDI - Egypt - End
if ( (runLength > 0) && (runLength < fragmentLength) ) {
frame->AdjustOffsetsForBidi(contentOffset, contentOffset + runLength);
if (!EnsureBidiContinuation(frame, &nextBidi, frameIndex) ) {
if (!EnsureBidiContinuation(frame, &nextBidi, frameIndex,
contentOffset,
contentOffset + runLength) ) {
break;
}
if (lineNeedsUpdate) {
@ -1036,10 +1037,14 @@ nsBidiPresUtils::GetFrameToLeftOf(const nsIFrame* aFrame,
PRBool
nsBidiPresUtils::EnsureBidiContinuation(nsIFrame* aFrame,
nsIFrame** aNewFrame,
PRInt32& aFrameIndex)
PRInt32& aFrameIndex,
PRInt32 aStart,
PRInt32 aEnd)
{
NS_PRECONDITION(aNewFrame, "null OUT ptr");
NS_PRECONDITION(aFrame, "aFrame is null");
NS_ASSERTION(!aFrame->GetPrevInFlow(),
"Calling EnsureBidiContinuation on non-first-in-flow");
*aNewFrame = nsnull;
nsBidiLevel embeddingLevel = NS_GET_EMBEDDING_LEVEL(aFrame);
@ -1062,9 +1067,11 @@ nsBidiPresUtils::EnsureBidiContinuation(nsIFrame* aFrame,
frame->SetProperty(nsGkAtoms::charType, NS_INT32_TO_PTR(charType));
frame->AddStateBits(NS_FRAME_IS_BIDI);
aFrameIndex++;
aFrame->AdjustOffsetsForBidi(aStart, aStart);
aFrame = frame;
}
aFrame->AdjustOffsetsForBidi(aStart, aEnd);
if (!*aNewFrame) {
mSuccess = CreateBidiContinuation(aFrame, aNewFrame);
if (NS_FAILED(mSuccess) ) {

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

@ -360,22 +360,36 @@ private:
/**
* Helper method for Resolve()
* Truncate a text frame and possibly create a continuation frame with the
* remainder of its content.
* Truncate a text frame to the end of a single-directional run and possibly
* create a continuation frame for the remainder of its content.
*
* @param aFrame the original frame
* @param aNewFrame [OUT] the new frame that was created
* @param aFrameIndex [IN/OUT] index of aFrame in mLogicalFrames
* @param aStart [IN] the start of the content mapped by aFrame (and
* any fluid continuations)
* @param aEnd [IN] the offset of the end of the single-directional
* text run.
*
* If there is already a bidi continuation for this frame in mLogicalFrames,
* no new frame will be created. On exit aNewFrame will point to the existing
* bidi continuation and aFrameIndex will contain its index.
*
* If aFrame has fluid continuations (which can happen when re-resolving
* after line breaking) all the frames in the continuation chain except for
* the last one will be set to zero length and the last one will be truncated
* at aEnd.
*
* aFrame must always be a first-in-flow.
*
* @see Resolve()
* @see RemoveBidiContinuation()
*/
PRBool EnsureBidiContinuation(nsIFrame* aFrame,
nsIFrame** aNewFrame,
PRInt32& aFrameIndex);
PRInt32& aFrameIndex,
PRInt32 aStart,
PRInt32 aEnd);
/**
* Helper method for Resolve()

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

@ -0,0 +1,14 @@
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div dir="rtl">
<pre>
English
</pre>
</div>
</body>
</html>

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

@ -0,0 +1,14 @@
<!DOCTYPE html>
<html>
<head>
</head>
<body onload="document.getElementById('div').style.direction = 'rtl';">
<div id="div">
<pre>
English
</pre>
</div>
</body>
</html>

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

@ -19,5 +19,6 @@ random-if(MOZ_WIDGET_TOOLKIT=="gtk2") == mixedChartype-03.html mixedChartype-03-
random-if(MOZ_WIDGET_TOOLKIT=="gtk2") == mixedChartype-03-j.html mixedChartype-03-ref.html
== 386339.html 386339-ref.html
fails-if(MOZ_WIDGET_TOOLKIT!="gtk2") == 387653.html 387653-ref.html # Linux-specific bug
== 409375.html 409375-ref.html
== 413542-1.html 413542-1-ref.html
== 413542-2.html 413542-2-ref.html