diff --git a/layout/generic/nsBlockFrame.cpp b/layout/generic/nsBlockFrame.cpp index 3d91fc820b5a..e603c8f4462c 100644 --- a/layout/generic/nsBlockFrame.cpp +++ b/layout/generic/nsBlockFrame.cpp @@ -24,6 +24,7 @@ * Steve Clark * Robert O'Callahan * L. David Baron + * 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 diff --git a/layout/generic/nsLineLayout.cpp b/layout/generic/nsLineLayout.cpp index 4d7266ff1616..cd3a2e33b6fc 100644 --- a/layout/generic/nsLineLayout.cpp +++ b/layout/generic/nsLineLayout.cpp @@ -24,6 +24,7 @@ * Pierre Phaneuf * L. David Baron * Robert O'Callahan + * 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; diff --git a/layout/html/base/src/nsBlockFrame.cpp b/layout/html/base/src/nsBlockFrame.cpp index 3d91fc820b5a..e603c8f4462c 100644 --- a/layout/html/base/src/nsBlockFrame.cpp +++ b/layout/html/base/src/nsBlockFrame.cpp @@ -24,6 +24,7 @@ * Steve Clark * Robert O'Callahan * L. David Baron + * 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 diff --git a/layout/html/base/src/nsLineLayout.cpp b/layout/html/base/src/nsLineLayout.cpp index 4d7266ff1616..cd3a2e33b6fc 100644 --- a/layout/html/base/src/nsLineLayout.cpp +++ b/layout/html/base/src/nsLineLayout.cpp @@ -24,6 +24,7 @@ * Pierre Phaneuf * L. David Baron * Robert O'Callahan + * 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; diff --git a/layout/html/document/src/ua.css b/layout/html/document/src/ua.css index 1dc8943a8602..bb4973a8faa5 100644 --- a/layout/html/document/src/ua.css +++ b/layout/html/document/src/ua.css @@ -110,7 +110,7 @@ *|*::-moz-list-bullet, *|*::-moz-list-number { display: inline; vertical-align: baseline; - margin-right: 8px; + -moz-margin-end: 8px; } /* Links */ diff --git a/layout/style/ua.css b/layout/style/ua.css index 1dc8943a8602..bb4973a8faa5 100644 --- a/layout/style/ua.css +++ b/layout/style/ua.css @@ -110,7 +110,7 @@ *|*::-moz-list-bullet, *|*::-moz-list-number { display: inline; vertical-align: baseline; - margin-right: 8px; + -moz-margin-end: 8px; } /* Links */