diff --git a/layout/base/nsBidiPresUtils.cpp b/layout/base/nsBidiPresUtils.cpp index 56134eb7cae0..f02bb2aa4cf2 100644 --- a/layout/base/nsBidiPresUtils.cpp +++ b/layout/base/nsBidiPresUtils.cpp @@ -1486,6 +1486,9 @@ nscoord nsBidiPresUtils::ReorderFrames(nsIFrame* aFirstFrameOnLine, // aNumFramesOnLine to -1 makes InitLogicalArrayFromLine look at all of // them. aNumFramesOnLine = -1; + // As the line frame itself has been adjusted at its inline-start position + // by the caller, we do not want to apply this to its children. + aStart = 0; } BidiLineData bld(aFirstFrameOnLine, aNumFramesOnLine); diff --git a/layout/generic/nsLineLayout.cpp b/layout/generic/nsLineLayout.cpp index 7d0484af77ea..dc9e90e3b61a 100644 --- a/layout/generic/nsLineLayout.cpp +++ b/layout/generic/nsLineLayout.cpp @@ -3186,6 +3186,14 @@ void nsLineLayout::TextAlignLine(nsLineBox* aLine, bool aIsLastLine) { lineWM, mContainerSize, psd->mIStart + mTextIndent + dx); if (dx) { + if (startFrame->mFrame->IsLineFrame()) { + // If startFrame is a ::first-line frame, the mIStart and mTextIndent + // offsets will already have been applied to its position. But we still + // need to apply the text-align adjustment |dx| to its position. + startFrame->mBounds.IStart(lineWM) += dx; + startFrame->mFrame->SetRect(lineWM, startFrame->mBounds, + ContainerSizeForSpan(psd)); + } aLine->IndentBy(dx, ContainerSize()); } } else if (dx) { diff --git a/testing/web-platform/meta/css/selectors/floating-first-letter-05d0.html.ini b/testing/web-platform/meta/css/selectors/floating-first-letter-05d0.html.ini deleted file mode 100644 index 4f4c1a4cf6d5..000000000000 --- a/testing/web-platform/meta/css/selectors/floating-first-letter-05d0.html.ini +++ /dev/null @@ -1,4 +0,0 @@ -[floating-first-letter-05d0.html] - type: reftest - expected: FAIL - bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1495674