mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-04 07:40:42 +00:00
Do bidi reordering for visual RTL frames in the same way as other bidi frames. Bug 492231, r+sr=roc
This commit is contained in:
parent
913de0f878
commit
3c67dd2a7e
@ -4082,7 +4082,8 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState,
|
||||
#ifdef IBMBIDI
|
||||
// XXXldb Why don't we do this earlier?
|
||||
if (aState.mPresContext->BidiEnabled()) {
|
||||
if (!aState.mPresContext->IsVisualMode()) {
|
||||
if (!aState.mPresContext->IsVisualMode() ||
|
||||
GetStyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL) {
|
||||
nsBidiPresUtils* bidiUtils = aState.mPresContext->GetBidiUtils();
|
||||
|
||||
if (bidiUtils && bidiUtils->IsSuccessful() ) {
|
||||
|
@ -2416,15 +2416,9 @@ nsLineLayout::HorizontalAlignFrames(nsRect& aLineBounds,
|
||||
printf(": availWidth=%d lineWidth=%d delta=%d\n",
|
||||
availWidth, aLineBounds.width, remainingWidth);
|
||||
#endif
|
||||
#ifdef IBMBIDI
|
||||
nscoord dx = 0;
|
||||
#endif
|
||||
|
||||
if (remainingWidth > 0)
|
||||
{
|
||||
#ifndef IBMBIDI
|
||||
nscoord dx = 0;
|
||||
#endif
|
||||
if (remainingWidth > 0) {
|
||||
switch (mTextAlign) {
|
||||
case NS_STYLE_TEXT_ALIGN_JUSTIFY:
|
||||
// If this is not the last line then go ahead and justify the
|
||||
@ -2480,7 +2474,6 @@ nsLineLayout::HorizontalAlignFrames(nsRect& aLineBounds,
|
||||
dx = remainingWidth / 2;
|
||||
break;
|
||||
}
|
||||
#ifdef IBMBIDI
|
||||
}
|
||||
else if (remainingWidth < 0) {
|
||||
if (NS_STYLE_DIRECTION_RTL == psd->mDirection) {
|
||||
@ -2493,7 +2486,6 @@ nsLineLayout::HorizontalAlignFrames(nsRect& aLineBounds,
|
||||
&& (!psd->mChangedFrameDirection) );
|
||||
if (dx || isRTL) {
|
||||
nscoord maxX = aLineBounds.XMost() + dx;
|
||||
PRBool isVisualRTL = PR_FALSE;
|
||||
|
||||
if (isRTL) {
|
||||
if (psd->mLastFrame->GetFlag(PFD_ISBULLET) ) {
|
||||
@ -2503,42 +2495,14 @@ nsLineLayout::HorizontalAlignFrames(nsRect& aLineBounds,
|
||||
}
|
||||
|
||||
psd->mChangedFrameDirection = PR_TRUE;
|
||||
|
||||
isVisualRTL = mPresContext->IsVisualMode();
|
||||
}
|
||||
if (dx || isVisualRTL)
|
||||
#else
|
||||
if (0 != dx)
|
||||
#endif
|
||||
{
|
||||
if (dx) {
|
||||
for (PerFrameData* pfd = psd->mFirstFrame; pfd; pfd = pfd->mNext) {
|
||||
#ifdef IBMBIDI
|
||||
if (isVisualRTL) {
|
||||
// XXXldb Ugh. Could we handle this earlier so we don't get here?
|
||||
maxX = pfd->mBounds.x = maxX - (pfd->mMargin.left + pfd->mBounds.width + pfd->mMargin.right);
|
||||
}
|
||||
else
|
||||
#endif // IBMBIDI
|
||||
pfd->mBounds.x += dx;
|
||||
pfd->mBounds.x += dx;
|
||||
pfd->mFrame->SetRect(pfd->mBounds);
|
||||
}
|
||||
aLineBounds.x += dx;
|
||||
}
|
||||
#ifndef IBMBIDI
|
||||
if ((NS_STYLE_DIRECTION_RTL == psd->mDirection) &&
|
||||
!psd->mChangedFrameDirection) {
|
||||
psd->mChangedFrameDirection = PR_TRUE;
|
||||
|
||||
PerFrameData* pfd = psd->mFirstFrame;
|
||||
PRUint32 maxX = psd->mRightEdge;
|
||||
while (nsnull != pfd) {
|
||||
pfd->mBounds.x = maxX - (pfd->mMargin.left + pfd->mBounds.width + pfd->mMargin.right);
|
||||
pfd->mFrame->SetRect(pfd->mBounds);
|
||||
maxX = pfd->mBounds.x;
|
||||
pfd = pfd->mNext;
|
||||
}
|
||||
}
|
||||
#endif // ndef IBMBIDI
|
||||
}
|
||||
}
|
||||
|
||||
|
7
layout/reftests/bidi/492231-1-ref.html
Normal file
7
layout/reftests/bidi/492231-1-ref.html
Normal file
@ -0,0 +1,7 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head><meta charset="iso-8859-8"></head>
|
||||
<body style="direction: rtl;">
|
||||
<span>+ש</span>
|
||||
</body>
|
||||
</html>
|
7
layout/reftests/bidi/492231-1.html
Normal file
7
layout/reftests/bidi/492231-1.html
Normal file
@ -0,0 +1,7 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head><meta charset="iso-8859-8"></head>
|
||||
<body onload="document.body.style.direction = 'rtl';">
|
||||
<span>+ש</span>
|
||||
</body>
|
||||
</html>
|
@ -39,3 +39,4 @@ random-if(MOZ_WIDGET_TOOLKIT=="gtk2") == 386339.html 386339-ref.html
|
||||
== 425338-1b.html 425338-1-ref.html
|
||||
== 489517-1.html 489517-1-ref.html
|
||||
== 489887-1.html 489887-1-ref.html
|
||||
== 492231-1.html 492231-1-ref.html
|
||||
|
Loading…
x
Reference in New Issue
Block a user