mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 11:25:00 +00:00
Bug 1164693 - Part 2: Frames in a non-bidi paragraph with newline shouldn't be marked as bidi. r=smontagu
This commit is contained in:
parent
b1d966b6e0
commit
6f16984aef
@ -734,31 +734,44 @@ nsBidiPresUtils::ResolveParagraph(nsBlockFrame* aBlockFrame,
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (runCount == 1 && frameCount == 1 &&
|
bool isNonBidi = false;
|
||||||
|
|
||||||
|
nsIFrame* frame0 = frameCount > 0 ? aBpd->FrameAt(0) : nullptr;
|
||||||
|
nsIFrame* frame1 = frameCount > 1 ? aBpd->FrameAt(1) : nullptr;
|
||||||
|
|
||||||
|
// Non-bidi frames
|
||||||
|
if (runCount == 1 && (frameCount == 1 || frameCount == 2) &&
|
||||||
aBpd->mParagraphDepth == 0 && aBpd->GetDirection() == NSBIDI_LTR &&
|
aBpd->mParagraphDepth == 0 && aBpd->GetDirection() == NSBIDI_LTR &&
|
||||||
aBpd->GetParaLevel() == 0) {
|
aBpd->GetParaLevel() == 0 &&
|
||||||
// We have a single left-to-right frame in a left-to-right paragraph,
|
frame0 != NS_BIDI_CONTROL_FRAME &&
|
||||||
|
!frame0->Properties().Get(nsIFrame::EmbeddingLevelProperty()) &&
|
||||||
|
!frame0->Properties().Get(nsIFrame::BaseLevelProperty())) {
|
||||||
|
// We have a left-to-right frame in a left-to-right paragraph,
|
||||||
// without bidi isolation from the surrounding text.
|
// without bidi isolation from the surrounding text.
|
||||||
// Make sure that the embedding level and base level frame properties aren't
|
// The embedding level and base level frame properties aren't
|
||||||
// set (because if they are this frame used to have some other direction,
|
// set (because if they are this frame used to have some other direction,
|
||||||
// so we can't do this optimization), and we're done.
|
// so we can't do this optimization)
|
||||||
nsIFrame* frame = aBpd->FrameAt(0);
|
// As long as this is the only frame, or it's followed by a linebreak,
|
||||||
if (frame != NS_BIDI_CONTROL_FRAME &&
|
// this is a non-bidi paragraph.
|
||||||
!frame->Properties().Get(nsIFrame::EmbeddingLevelProperty()) &&
|
if (!frame1 || (frame1 != NS_BIDI_CONTROL_FRAME &&
|
||||||
!frame->Properties().Get(nsIFrame::BaseLevelProperty())) {
|
frame1->GetType() == nsGkAtoms::brFrame)) {
|
||||||
|
isNonBidi = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isNonBidi) {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
#ifdef NOISY_BIDI
|
#ifdef NOISY_BIDI
|
||||||
printf("early return for single direction frame %p\n", (void*)frame);
|
printf("early return for single direction frame %p\n", (void*)frame);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
frame->AddStateBits(NS_FRAME_IS_BIDI);
|
return NS_OK;
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIFrame* firstFrame = nullptr;
|
nsIFrame* firstFrame = nullptr;
|
||||||
nsIFrame* lastFrame = nullptr;
|
nsIFrame* lastFrame = nullptr;
|
||||||
|
|
||||||
|
// Bidi frames
|
||||||
for (; ;) {
|
for (; ;) {
|
||||||
if (fragmentLength <= 0) {
|
if (fragmentLength <= 0) {
|
||||||
// Get the next frame from mLogicalFrames
|
// Get the next frame from mLogicalFrames
|
||||||
|
Loading…
Reference in New Issue
Block a user