From 2be0ebd6db9ddc99a7e042c6a6ed32ad64f0d7e8 Mon Sep 17 00:00:00 2001 From: Simon Montagu Date: Wed, 9 May 2012 11:44:52 +0300 Subject: [PATCH] Make unicode-bidi: [-moz-]plaintext apply to inline elements. Bug 746987, r=roc --- layout/base/nsBidiPresUtils.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/layout/base/nsBidiPresUtils.cpp b/layout/base/nsBidiPresUtils.cpp index a22a2e91905..13637603dad 100644 --- a/layout/base/nsBidiPresUtils.cpp +++ b/layout/base/nsBidiPresUtils.cpp @@ -164,12 +164,18 @@ struct BidiParagraphData { mPrevFrame = aBpd->mPrevFrame; mParagraphDepth = aBpd->mParagraphDepth + 1; + const nsStyleTextReset* text = aBDIFrame->GetStyleTextReset(); bool isRTL = (NS_STYLE_DIRECTION_RTL == aBDIFrame->GetStyleVisibility()->mDirection); - mParaLevel = mParagraphDepth * 2; - if (isRTL) ++mParaLevel; - if (aBDIFrame->GetStyleTextReset()->mUnicodeBidi & NS_STYLE_UNICODE_BIDI_OVERRIDE) { + if (text->mUnicodeBidi & NS_STYLE_UNICODE_BIDI_PLAINTEXT) { + mParaLevel = NSBIDI_DEFAULT_LTR; + } else { + mParaLevel = mParagraphDepth * 2; + if (isRTL) ++mParaLevel; + } + + if (text->mUnicodeBidi & NS_STYLE_UNICODE_BIDI_OVERRIDE) { PushBidiControl(isRTL ? kRLO : kLRO); } } @@ -1131,7 +1137,8 @@ nsBidiPresUtils::TraverseFrames(nsBlockFrame* aBlockFrame, nsIFrame* kid = frame->GetFirstPrincipalChild(); if (kid) { const nsStyleTextReset* text = frame->GetStyleTextReset(); - if (text->mUnicodeBidi & NS_STYLE_UNICODE_BIDI_ISOLATE) { + if (text->mUnicodeBidi & NS_STYLE_UNICODE_BIDI_ISOLATE || + text->mUnicodeBidi & NS_STYLE_UNICODE_BIDI_PLAINTEXT) { // css "unicode-bidi: isolate" and html5 bdi: // resolve the element as a separate paragraph BidiParagraphData* subParagraph = aBpd->GetSubParagraph();