From b6136890380afad9bd0cc005881f086c14321960 Mon Sep 17 00:00:00 2001 From: "smontagu%netscape.com" Date: Tue, 19 Mar 2002 00:45:50 +0000 Subject: [PATCH] Fix for bug 81032, "nsOutlinerBodyFrame.cpp need to be bidi enable". r=mkaply, sr=hyatt, a=asa --- .../src/outliner/src/nsOutlinerBodyFrame.cpp | 32 ++++++++++++++++++- .../xul/base/src/tree/src/nsTreeBodyFrame.cpp | 32 ++++++++++++++++++- 2 files changed, 62 insertions(+), 2 deletions(-) diff --git a/layout/xul/base/src/outliner/src/nsOutlinerBodyFrame.cpp b/layout/xul/base/src/outliner/src/nsOutlinerBodyFrame.cpp index 76ff0219dec..ecd1dfb1870 100644 --- a/layout/xul/base/src/outliner/src/nsOutlinerBodyFrame.cpp +++ b/layout/xul/base/src/outliner/src/nsOutlinerBodyFrame.cpp @@ -86,6 +86,7 @@ #include "nsChildIterator.h" #include "nsIScrollableView.h" #include "nsITheme.h" +#include "nsITimelineService.h" #ifdef USE_IMG2 #include "imgIRequest.h" @@ -94,6 +95,10 @@ #include "imgILoader.h" #endif +#ifdef IBMBIDI +#include "nsBidiPresUtils.h" +#endif + #define ELLIPSIS "..." // The style context cache impl @@ -2713,9 +2718,34 @@ NS_IMETHODIMP nsOutlinerBodyFrame::PaintText(int aRowIndex, fontMet->GetStrikeout(offset, size); aRenderingContext.FillRect(textRect.x, textRect.y + baseline - offset, width, size); } - +#ifdef MOZ_TIMELINE + NS_TIMELINE_START_TIMER("Render Outline Text"); +#endif +#ifdef IBMBIDI + nsresult rv = NS_ERROR_FAILURE; + nsBidiPresUtils* bidiUtils; + aPresContext->GetBidiUtils(&bidiUtils); + + if (bidiUtils) { + const nsStyleVisibility* vis; + GetStyleData(eStyleStruct_Visibility, (const nsStyleStruct*&) vis); + nsBidiDirection direction = + (NS_STYLE_DIRECTION_RTL == vis->mDirection) ? + NSBIDI_RTL : NSBIDI_LTR; + PRUnichar* buffer = (PRUnichar*) text.get(); + rv = bidiUtils->RenderText(buffer, text.Length(), direction, + aPresContext, aRenderingContext, + textRect.x, textRect.y + baseline); + } + if (NS_FAILED(rv)) +#endif // IBMBIDI aRenderingContext.DrawString(text, textRect.x, textRect.y + baseline); } +#ifdef MOZ_TIMELINE + NS_TIMELINE_STOP_TIMER("Render Outline Text"); + NS_TIMELINE_MARK_TIMER("Render Outline Text"); +#endif + return NS_OK; } diff --git a/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp b/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp index 76ff0219dec..ecd1dfb1870 100644 --- a/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp +++ b/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp @@ -86,6 +86,7 @@ #include "nsChildIterator.h" #include "nsIScrollableView.h" #include "nsITheme.h" +#include "nsITimelineService.h" #ifdef USE_IMG2 #include "imgIRequest.h" @@ -94,6 +95,10 @@ #include "imgILoader.h" #endif +#ifdef IBMBIDI +#include "nsBidiPresUtils.h" +#endif + #define ELLIPSIS "..." // The style context cache impl @@ -2713,9 +2718,34 @@ NS_IMETHODIMP nsOutlinerBodyFrame::PaintText(int aRowIndex, fontMet->GetStrikeout(offset, size); aRenderingContext.FillRect(textRect.x, textRect.y + baseline - offset, width, size); } - +#ifdef MOZ_TIMELINE + NS_TIMELINE_START_TIMER("Render Outline Text"); +#endif +#ifdef IBMBIDI + nsresult rv = NS_ERROR_FAILURE; + nsBidiPresUtils* bidiUtils; + aPresContext->GetBidiUtils(&bidiUtils); + + if (bidiUtils) { + const nsStyleVisibility* vis; + GetStyleData(eStyleStruct_Visibility, (const nsStyleStruct*&) vis); + nsBidiDirection direction = + (NS_STYLE_DIRECTION_RTL == vis->mDirection) ? + NSBIDI_RTL : NSBIDI_LTR; + PRUnichar* buffer = (PRUnichar*) text.get(); + rv = bidiUtils->RenderText(buffer, text.Length(), direction, + aPresContext, aRenderingContext, + textRect.x, textRect.y + baseline); + } + if (NS_FAILED(rv)) +#endif // IBMBIDI aRenderingContext.DrawString(text, textRect.x, textRect.y + baseline); } +#ifdef MOZ_TIMELINE + NS_TIMELINE_STOP_TIMER("Render Outline Text"); + NS_TIMELINE_MARK_TIMER("Render Outline Text"); +#endif + return NS_OK; }