Fix for bug 81032, "nsOutlinerBodyFrame.cpp need to be bidi enable". r=mkaply, sr=hyatt, a=asa

This commit is contained in:
smontagu%netscape.com 2002-03-19 00:45:50 +00:00
Родитель 74b23f7c19
Коммит b613689038
2 изменённых файлов: 62 добавлений и 2 удалений

Просмотреть файл

@ -86,6 +86,7 @@
#include "nsChildIterator.h" #include "nsChildIterator.h"
#include "nsIScrollableView.h" #include "nsIScrollableView.h"
#include "nsITheme.h" #include "nsITheme.h"
#include "nsITimelineService.h"
#ifdef USE_IMG2 #ifdef USE_IMG2
#include "imgIRequest.h" #include "imgIRequest.h"
@ -94,6 +95,10 @@
#include "imgILoader.h" #include "imgILoader.h"
#endif #endif
#ifdef IBMBIDI
#include "nsBidiPresUtils.h"
#endif
#define ELLIPSIS "..." #define ELLIPSIS "..."
// The style context cache impl // The style context cache impl
@ -2713,9 +2718,34 @@ NS_IMETHODIMP nsOutlinerBodyFrame::PaintText(int aRowIndex,
fontMet->GetStrikeout(offset, size); fontMet->GetStrikeout(offset, size);
aRenderingContext.FillRect(textRect.x, textRect.y + baseline - offset, width, 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); 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; return NS_OK;
} }

Просмотреть файл

@ -86,6 +86,7 @@
#include "nsChildIterator.h" #include "nsChildIterator.h"
#include "nsIScrollableView.h" #include "nsIScrollableView.h"
#include "nsITheme.h" #include "nsITheme.h"
#include "nsITimelineService.h"
#ifdef USE_IMG2 #ifdef USE_IMG2
#include "imgIRequest.h" #include "imgIRequest.h"
@ -94,6 +95,10 @@
#include "imgILoader.h" #include "imgILoader.h"
#endif #endif
#ifdef IBMBIDI
#include "nsBidiPresUtils.h"
#endif
#define ELLIPSIS "..." #define ELLIPSIS "..."
// The style context cache impl // The style context cache impl
@ -2713,9 +2718,34 @@ NS_IMETHODIMP nsOutlinerBodyFrame::PaintText(int aRowIndex,
fontMet->GetStrikeout(offset, size); fontMet->GetStrikeout(offset, size);
aRenderingContext.FillRect(textRect.x, textRect.y + baseline - offset, width, 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); 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; return NS_OK;
} }