diff --git a/layout/generic/nsContainerFrame.cpp b/layout/generic/nsContainerFrame.cpp index 9415cb755447..d6786b07b84e 100644 --- a/layout/generic/nsContainerFrame.cpp +++ b/layout/generic/nsContainerFrame.cpp @@ -660,13 +660,19 @@ nsContainerFrame::DoInlineIntrinsicWidth(nsIRenderingContext *aRenderingContext, // messy the bidi situations are, since per CSS2.1 section 8.6 // (implemented in bug 328168), the startSide border is always on the // first line. - aData->currentLine += - GetCoord(stylePadding->mPadding.Get(startSide), 0) + - styleBorder->GetBorderWidth(startSide) + - GetCoord(styleMargin->mMargin.Get(startSide), 0); + // This frame is a first-in-flow, but it might have a previous bidi + // continuation, in which case that continuation should handle the startSide + // border. + if (!GetPrevContinuation()) { + aData->currentLine += + GetCoord(stylePadding->mPadding.Get(startSide), 0) + + styleBorder->GetBorderWidth(startSide) + + GetCoord(styleMargin->mMargin.Get(startSide), 0); + } const nsLineList_iterator* savedLine = aData->line; + nsContainerFrame *lastInFlow; for (nsContainerFrame *nif = this; nif; nif = (nsContainerFrame*) nif->GetNextInFlow()) { for (nsIFrame *kid = nif->mFrames.FirstChild(); kid; @@ -682,6 +688,7 @@ nsContainerFrame::DoInlineIntrinsicWidth(nsIRenderingContext *aRenderingContext, // After we advance to our next-in-flow, the stored line may not // longer be the correct line. Just forget it. aData->line = nsnull; + lastInFlow = nif; } aData->line = savedLine; @@ -690,10 +697,15 @@ nsContainerFrame::DoInlineIntrinsicWidth(nsIRenderingContext *aRenderingContext, // messy the bidi situations are, since per CSS2.1 section 8.6 // (implemented in bug 328168), the endSide border is always on the // last line. - aData->currentLine += - GetCoord(stylePadding->mPadding.Get(endSide), 0) + - styleBorder->GetBorderWidth(endSide) + - GetCoord(styleMargin->mMargin.Get(endSide), 0); + // We reached the last-in-flow, but it might have a next bidi + // continuation, in which case that continuation should handle + // the endSide border. + if (!lastInFlow->GetNextContinuation()) { + aData->currentLine += + GetCoord(stylePadding->mPadding.Get(endSide), 0) + + styleBorder->GetBorderWidth(endSide) + + GetCoord(styleMargin->mMargin.Get(endSide), 0); + } } /* virtual */ nsSize diff --git a/layout/reftests/bugs/421419-1-ref.html b/layout/reftests/bugs/421419-1-ref.html new file mode 100644 index 000000000000..0ee5a5c6c16d --- /dev/null +++ b/layout/reftests/bugs/421419-1-ref.html @@ -0,0 +1,14 @@ + + + + + + +

+ + \ No newline at end of file diff --git a/layout/reftests/bugs/421419-1.html b/layout/reftests/bugs/421419-1.html new file mode 100644 index 000000000000..1a3b5f79fd1b --- /dev/null +++ b/layout/reftests/bugs/421419-1.html @@ -0,0 +1,14 @@ + + + + + + +

+ + \ No newline at end of file diff --git a/layout/reftests/bugs/reftest.list b/layout/reftests/bugs/reftest.list index 196680426a17..9f77f8c3255c 100644 --- a/layout/reftests/bugs/reftest.list +++ b/layout/reftests/bugs/reftest.list @@ -754,3 +754,4 @@ random == 403134-1.html 403134-1-ref.html # bug 405377 == 420069-2.html 420069-2-ref.html # == 420351-1.html 420351-1-ref.html == 421234-1.html 421234-1-ref.html +== 421419-1.html 421419-1-ref.html