Bug 140611: When a block element is first in RTL <LI>, bullet moves left. patch by Lina Kemmel lkemmel@il.ibm.com, r=smontagu, sr=dbaron.

This commit is contained in:
smontagu%smontagu.org 2004-06-20 09:51:10 +00:00
Родитель bed5e31996
Коммит e1cc6b919a
6 изменённых файлов: 76 добавлений и 90 удалений

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

@ -24,6 +24,7 @@
* Steve Clark <buster@netscape.com>
* Robert O'Callahan <roc+moz@cs.cmu.edu>
* L. David Baron <dbaron@dbaron.org>
* IBM Corporation
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
@ -6434,12 +6435,14 @@ nsBlockFrame::ReflowBullet(nsBlockReflowState& aState,
// from the rest of the frames in the line
nscoord x =
#ifdef IBMBIDI
// For direction RTL: set x to the right margin for now.
// This value will be used to indent the bullet from the right most
// egde of the previous frame in nsLineLayout::HorizontalAlignFrames.
(NS_STYLE_DIRECTION_RTL == GetStyleVisibility()->mDirection)
? reflowState.mComputedMargin.right :
#endif // IBMBIDI
(rs.availableWidth != NS_UNCONSTRAINEDSIZE &&
NS_STYLE_DIRECTION_RTL == GetStyleVisibility()->mDirection)
// According to the CSS2 spec, section 12.6.1, outside marker box
// is distanced from the associated principal box's border edge.
// |rs.availableWidth| reflects exactly a border edge: it includes
// border, padding, and content area, without margins.
? rs.availableWidth + reflowState.mComputedMargin.left :
#endif
- reflowState.mComputedMargin.right - aMetrics.width;
// Approximate the bullets position; vertical alignment will provide

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

@ -24,6 +24,7 @@
* Pierre Phaneuf <pp@ludusdesign.com>
* L. David Baron <dbaron@dbaron.org>
* Robert O'Callahan <roc+moz@cs.cmu.edu>
* IBM Corporation
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
@ -2783,13 +2784,6 @@ nsLineLayout::HorizontalAlignFrames(nsRect& aLineBounds,
#endif
return PR_TRUE;
}
#ifdef IBMBIDI
if (NS_STYLE_DIRECTION_RTL == psd->mDirection) {
// This is to ensure proper indentation (e.g. of list items)
availWidth -= aLineBounds.x;
}
else
#endif // IBMBIDI
availWidth -= psd->mLeftEdge;
nscoord remainingWidth = availWidth - aLineBounds.width;
#ifdef NOISY_HORIZONTAL_ALIGN
@ -2798,13 +2792,15 @@ nsLineLayout::HorizontalAlignFrames(nsRect& aLineBounds,
availWidth, aLineBounds.width, remainingWidth);
#endif
#ifdef IBMBIDI
if (remainingWidth + aLineBounds.x > 0)
#else
nscoord dx = 0;
#endif
// XXXldb What if it's less than 0??
if (remainingWidth > 0)
#endif
{
#ifndef IBMBIDI
nscoord dx = 0;
#endif
switch (mTextAlign) {
case NS_STYLE_TEXT_ALIGN_DEFAULT:
if (NS_STYLE_DIRECTION_LTR == psd->mDirection) {
@ -2852,55 +2848,49 @@ nsLineLayout::HorizontalAlignFrames(nsRect& aLineBounds,
break;
}
#ifdef IBMBIDI
PerFrameData* lastPfd = psd->mLastFrame;
}
// If we need to move the frames but we're shrink wrapping, then
// we need to wait until the final width is known
if (aShrinkWrapWidth) {
return PR_FALSE;
}
PRBool isRTL = ( (NS_STYLE_DIRECTION_RTL == psd->mDirection)
&& (!psd->mChangedFrameDirection) );
if (dx || isRTL) {
PerFrameData* bulletPfd = nsnull;
nscoord maxX = aLineBounds.XMost() + dx;
PRBool isVisualRTL = PR_FALSE;
if (lastPfd->GetFlag(PFD_ISBULLET)
&& (NS_STYLE_DIRECTION_RTL == psd->mDirection) ) {
bulletPfd = lastPfd;
lastPfd = lastPfd->mPrev;
}
PRUint32 maxX = lastPfd->mBounds.XMost() + dx;
PRBool visualRTL = PR_FALSE;
if ( (NS_STYLE_DIRECTION_RTL == psd->mDirection)
&& (!psd->mChangedFrameDirection) ) {
if (isRTL) {
if (psd->mLastFrame->GetFlag(PFD_ISBULLET) )
bulletPfd = psd->mLastFrame;
psd->mChangedFrameDirection = PR_TRUE;
/* Assume that all frames have been right aligned.*/
if (aShrinkWrapWidth) {
return PR_FALSE;
}
visualRTL = mPresContext->IsVisualMode();
if (bulletPfd) {
bulletPfd->mBounds.x += maxX;
bulletPfd->mFrame->SetRect(bulletPfd->mBounds);
}
isVisualRTL = mPresContext->IsVisualMode();
}
if ( (0 != dx) || (visualRTL) )
if (dx || isVisualRTL) {
#else
if (0 != dx)
#endif // IBMBIDI
{
if (0 != dx) {
// If we need to move the frames but we're shrink wrapping, then
// we need to wait until the final width is known
if (aShrinkWrapWidth) {
return PR_FALSE;
}
#endif
for (PerFrameData* pfd = psd->mFirstFrame; pfd
#ifdef IBMBIDI
&& bulletPfd != pfd
#endif
; pfd = pfd->mNext) {
pfd->mBounds.x += dx;
#ifdef IBMBIDI
if (visualRTL) {
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->mFrame->SetRect(pfd->mBounds);
}
aLineBounds.x += dx;

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

@ -24,6 +24,7 @@
* Steve Clark <buster@netscape.com>
* Robert O'Callahan <roc+moz@cs.cmu.edu>
* L. David Baron <dbaron@dbaron.org>
* IBM Corporation
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
@ -6434,12 +6435,14 @@ nsBlockFrame::ReflowBullet(nsBlockReflowState& aState,
// from the rest of the frames in the line
nscoord x =
#ifdef IBMBIDI
// For direction RTL: set x to the right margin for now.
// This value will be used to indent the bullet from the right most
// egde of the previous frame in nsLineLayout::HorizontalAlignFrames.
(NS_STYLE_DIRECTION_RTL == GetStyleVisibility()->mDirection)
? reflowState.mComputedMargin.right :
#endif // IBMBIDI
(rs.availableWidth != NS_UNCONSTRAINEDSIZE &&
NS_STYLE_DIRECTION_RTL == GetStyleVisibility()->mDirection)
// According to the CSS2 spec, section 12.6.1, outside marker box
// is distanced from the associated principal box's border edge.
// |rs.availableWidth| reflects exactly a border edge: it includes
// border, padding, and content area, without margins.
? rs.availableWidth + reflowState.mComputedMargin.left :
#endif
- reflowState.mComputedMargin.right - aMetrics.width;
// Approximate the bullets position; vertical alignment will provide

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

@ -24,6 +24,7 @@
* Pierre Phaneuf <pp@ludusdesign.com>
* L. David Baron <dbaron@dbaron.org>
* Robert O'Callahan <roc+moz@cs.cmu.edu>
* IBM Corporation
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
@ -2783,13 +2784,6 @@ nsLineLayout::HorizontalAlignFrames(nsRect& aLineBounds,
#endif
return PR_TRUE;
}
#ifdef IBMBIDI
if (NS_STYLE_DIRECTION_RTL == psd->mDirection) {
// This is to ensure proper indentation (e.g. of list items)
availWidth -= aLineBounds.x;
}
else
#endif // IBMBIDI
availWidth -= psd->mLeftEdge;
nscoord remainingWidth = availWidth - aLineBounds.width;
#ifdef NOISY_HORIZONTAL_ALIGN
@ -2798,13 +2792,15 @@ nsLineLayout::HorizontalAlignFrames(nsRect& aLineBounds,
availWidth, aLineBounds.width, remainingWidth);
#endif
#ifdef IBMBIDI
if (remainingWidth + aLineBounds.x > 0)
#else
nscoord dx = 0;
#endif
// XXXldb What if it's less than 0??
if (remainingWidth > 0)
#endif
{
#ifndef IBMBIDI
nscoord dx = 0;
#endif
switch (mTextAlign) {
case NS_STYLE_TEXT_ALIGN_DEFAULT:
if (NS_STYLE_DIRECTION_LTR == psd->mDirection) {
@ -2852,55 +2848,49 @@ nsLineLayout::HorizontalAlignFrames(nsRect& aLineBounds,
break;
}
#ifdef IBMBIDI
PerFrameData* lastPfd = psd->mLastFrame;
}
// If we need to move the frames but we're shrink wrapping, then
// we need to wait until the final width is known
if (aShrinkWrapWidth) {
return PR_FALSE;
}
PRBool isRTL = ( (NS_STYLE_DIRECTION_RTL == psd->mDirection)
&& (!psd->mChangedFrameDirection) );
if (dx || isRTL) {
PerFrameData* bulletPfd = nsnull;
nscoord maxX = aLineBounds.XMost() + dx;
PRBool isVisualRTL = PR_FALSE;
if (lastPfd->GetFlag(PFD_ISBULLET)
&& (NS_STYLE_DIRECTION_RTL == psd->mDirection) ) {
bulletPfd = lastPfd;
lastPfd = lastPfd->mPrev;
}
PRUint32 maxX = lastPfd->mBounds.XMost() + dx;
PRBool visualRTL = PR_FALSE;
if ( (NS_STYLE_DIRECTION_RTL == psd->mDirection)
&& (!psd->mChangedFrameDirection) ) {
if (isRTL) {
if (psd->mLastFrame->GetFlag(PFD_ISBULLET) )
bulletPfd = psd->mLastFrame;
psd->mChangedFrameDirection = PR_TRUE;
/* Assume that all frames have been right aligned.*/
if (aShrinkWrapWidth) {
return PR_FALSE;
}
visualRTL = mPresContext->IsVisualMode();
if (bulletPfd) {
bulletPfd->mBounds.x += maxX;
bulletPfd->mFrame->SetRect(bulletPfd->mBounds);
}
isVisualRTL = mPresContext->IsVisualMode();
}
if ( (0 != dx) || (visualRTL) )
if (dx || isVisualRTL) {
#else
if (0 != dx)
#endif // IBMBIDI
{
if (0 != dx) {
// If we need to move the frames but we're shrink wrapping, then
// we need to wait until the final width is known
if (aShrinkWrapWidth) {
return PR_FALSE;
}
#endif
for (PerFrameData* pfd = psd->mFirstFrame; pfd
#ifdef IBMBIDI
&& bulletPfd != pfd
#endif
; pfd = pfd->mNext) {
pfd->mBounds.x += dx;
#ifdef IBMBIDI
if (visualRTL) {
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->mFrame->SetRect(pfd->mBounds);
}
aLineBounds.x += dx;

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

@ -110,7 +110,7 @@
*|*::-moz-list-bullet, *|*::-moz-list-number {
display: inline;
vertical-align: baseline;
margin-right: 8px;
-moz-margin-end: 8px;
}
/* Links */

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

@ -110,7 +110,7 @@
*|*::-moz-list-bullet, *|*::-moz-list-number {
display: inline;
vertical-align: baseline;
margin-right: 8px;
-moz-margin-end: 8px;
}
/* Links */