--- a/textrendering/textformatting/tagma/TMINTERP.CPP Fri Jun 11 15:33:54 2010 +0300
+++ b/textrendering/textformatting/tagma/TMINTERP.CPP Tue Jul 06 16:23:19 2010 +0300
@@ -23,6 +23,11 @@
#include "TmHighlightSource.h"
#include <s32mem.h>
#include <frmtlay.h>
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "TMINTERPTraces.h"
+#endif
+
TTmInterpreterParam::TTmInterpreterParam(const CTmTextLayout& aTextLayout):
iByteCode(&aTextLayout.Code()),
@@ -321,7 +326,11 @@
{
iTmTextDrawExt = &iTmTextDrawExtDefault;
}
- __ASSERT_ALWAYS(iTmTextDrawExt != NULL, Panic(ENotImplemented));
+ if(!iTmTextDrawExt)
+ {
+ OstTrace0( TRACE_FATAL, RTMGENERALINTERPRETER_RTMGENERALINTERPRETER, "ENotImplemented" );
+ __ASSERT_ALWAYS(0, Panic(ENotImplemented));
+ }
}
/**
@@ -371,6 +380,10 @@
{
while (Next())
{
+ if (Op() != EOpLine)
+ {
+ OstTrace0( TRACE_FATAL, TTMINTERPRETER_LINES, "ECorrupt" );
+ }
__ASSERT_ALWAYS(Op() == EOpLine, Panic(ECorrupt));
Skip();
}
@@ -386,6 +399,10 @@
{
while (Next())
{
+ if (Op() != EOpLine)
+ {
+ OstTrace0( TRACE_FATAL, TTMINTERPRETER_PARAGRAPHS, "ECorrupt" );
+ }
__ASSERT_ALWAYS(Op() == EOpLine, Panic(ECorrupt));
Skip();
}
@@ -410,12 +427,20 @@
if (!Next())
return EFalse;
+ if (Op() != EOpLine)
+ {
+ OstTrace0( TRACE_FATAL, TTMINTERPRETER_DOCPOSTOLINE, "ECorrupt" );
+ }
__ASSERT_ALWAYS(Op() == EOpLine, Panic(ECorrupt));
while (!PosIsInLine(doc_pos))
{
Skip();
if (!Next())
return EFalse;
+ if (Op() != EOpLine)
+ {
+ OstTrace0( TRACE_FATAL, DUP1_TTMINTERPRETER_DOCPOSTOLINE, "ECorrupt" );
+ }
__ASSERT_ALWAYS(Op() == EOpLine, Panic(ECorrupt));
}
@@ -452,6 +477,10 @@
{
while (Next())
{
+ if (Op() != EOpLine)
+ {
+ OstTrace0( TRACE_FATAL, TTMINTERPRETER_LINENUMBERTOLINE, "ECorrupt" );
+ }
__ASSERT_ALWAYS(Op() == EOpLine, Panic(ECorrupt));
if (iLineInfo.iLineNumber == aLineNumber)
return TRUE;
@@ -477,6 +506,10 @@
{
while (Next())
{
+ if (Op() != EOpLine)
+ {
+ OstTrace0( TRACE_FATAL, TTMINTERPRETER_PARNUMBERTOLINE, "ECorrupt" );
+ }
__ASSERT_ALWAYS(Op() == EOpLine, Panic(ECorrupt));
if (iLineInfo.iParNumber == aParNumber)
{
@@ -498,6 +531,10 @@
{
while (Next())
{
+ if (Op() != EOpLine)
+ {
+ OstTrace0( TRACE_FATAL, TTMINTERPRETER_YPOSTOLINE, "ECorrupt" );
+ }
__ASSERT_ALWAYS(Op() == EOpLine, Panic(ECorrupt));
if (iLineInfo.iOuterRect.iTl.iY <= aYPos && iLineInfo.iOuterRect.iBr.iY > aYPos)
return TRUE;
@@ -522,6 +559,10 @@
int width = 0;
while (Next())
{
+ if (Op() != EOpLine)
+ {
+ OstTrace0( TRACE_FATAL, TTMINTERPRETER_WIDTHOFWIDESTLINE, "ECorrupt" );
+ }
__ASSERT_ALWAYS(Op() == EOpLine, Panic(ECorrupt));
// Quit if below the range.
if (iLineInfo.iOuterRect.iTl.iY >= aBottom)
@@ -562,6 +603,10 @@
return;
while (iLineInfo.iOuterRect.iBr.iY < aTopY)
{
+ if (Op() != EOpLine)
+ {
+ OstTrace0( TRACE_FATAL, TTMINTERPRETER_HORIZONTALEXTREMES, "ECorrupt" );
+ }
__ASSERT_ALWAYS(Op() == EOpLine, Panic(ECorrupt));
Skip();
if (!Next())
@@ -569,6 +614,10 @@
}
while (iLineInfo.iOuterRect.iTl.iY <= aBottomY)
{
+ if (Op() != EOpLine)
+ {
+ OstTrace0( TRACE_FATAL, DUP1_TTMINTERPRETER_HORIZONTALEXTREMES, "ECorrupt" );
+ }
__ASSERT_ALWAYS(Op() == EOpLine, Panic(ECorrupt));
if (iLineInfo.iInnerRect.iTl.iX < aLeft)
aLeft = iLineInfo.iInnerRect.iTl.iX;
@@ -716,6 +765,10 @@
if (!aByteCodeIterator.VisualEndOfLineIsAmbiguous())
iIgnorePosition = aByteCodeIterator.LineInfo().iEnd;
+ if (aByteCodeIterator.Op() != TTmInterpreter::EOpText)
+ {
+ OstTrace0( TRACE_DUMP, DUP1_RTMGRAPHEMEINTEXTCHUNKITERATOR_BEGIN, "EInvariant" );
+ }
__ASSERT_DEBUG(aByteCodeIterator.Op() == TTmInterpreter::EOpText, TmPanic(EInvariant));
if (iFont)
@@ -788,6 +841,10 @@
*/
TInt RTmGraphemeInTextChunkIterator::Next()
{
+ if (AtEnd())
+ {
+ OstTrace0( TRACE_DUMP, RTMGRAPHEMEINTEXTCHUNKITERATOR_NEXT, "EBadArg" );
+ }
__ASSERT_DEBUG(!AtEnd(), TmPanic(EBadArg));
TInt previousPositionInBuffer = iPosition.iPosInText;
TInt previousPosition = iReverse?
@@ -806,6 +863,10 @@
TInt numCodePoints = iPosition.iPosInText - previousPositionInBuffer;
TInt currentPosition = iReverse?
iEndChar - iPosition.iPosInText : iStartChar + iPosition.iPosInText;
+ if (currentPosition == previousPosition)
+ {
+ OstTrace0( TRACE_DUMP, DUP1_RTMGRAPHEMEINTEXTCHUNKITERATOR_NEXT, "EInvariant" );
+ }
__ASSERT_DEBUG(currentPosition != previousPosition, TmPanic(EInvariant));
TInt cachePos = 0;
@@ -837,6 +898,10 @@
}
++cachePos;
}
+ if (0 >= cachePos)
+ {
+ OstTrace0( TRACE_DUMP, DUP2_RTMGRAPHEMEINTEXTCHUNKITERATOR_NEXT, "EInvariant" );
+ }
__ASSERT_DEBUG(0 < cachePos, TmPanic(EInvariant));
return cachePos;
}
@@ -868,6 +933,10 @@
*/
void RTmGraphemeInTextChunkIteratorNice::Next()
{
+ if (AtEnd())
+ {
+ OstTrace0( TRACE_DUMP, RTMGRAPHEMEINTEXTCHUNKITERATORNICE_NEXT, "EBadArg" );
+ }
__ASSERT_DEBUG(!AtEnd(), TmPanic(EBadArg));
// Return if we have not finished moving through the cache.
if (++iCurrent != iEnd)
@@ -910,6 +979,10 @@
*/
void RTmGraphemeInTextChunkIteratorNice::FindEdge(const TTmDocPos& aDocPos)
{
+ if (AtEnd())
+ {
+ OstTrace0( TRACE_DUMP, RTMGRAPHEMEINTEXTCHUNKITERATORNICE_FINDEDGE, "EBadArg" );
+ }
__ASSERT_DEBUG(!AtEnd(), TmPanic(EBadArg));
while (RTmGraphemeEdgeIterator::ETotalMatch !=
RTmGraphemeEdgeIterator::DocPosMatches(aDocPos, *Get()))
@@ -1056,6 +1129,10 @@
*/
void RTmGraphemeEdgeIterator::Next()
{
+ if (AtEnd())
+ {
+ OstTrace0( TRACE_DUMP, RTMGRAPHEMEEDGEITERATOR_NEXT, "EBadArg" );
+ }
__ASSERT_DEBUG(!AtEnd(), TmPanic(EBadArg));
--iCacheSize;
if (0 != iCacheSize)
@@ -1078,6 +1155,10 @@
{
// The WHILE loop assures that there is always sufficientByteCode avaliable.
TBool haveSufficientByteCode = iByteCodeIterator->Next();
+ if (!haveSufficientByteCode)
+ {
+ OstTrace0( TRACE_DUMP, DUP1_RTMGRAPHEMEEDGEITERATOR_NEXT, "EBadArg" );
+ }
__ASSERT_DEBUG(haveSufficientByteCode, TmPanic(EBadArg));
iByteCodeIterator->Skip();
@@ -1619,6 +1700,10 @@
: RTmTextCache::ELeftToRight;
User::LeaveIfError(iTextCache.GetDisplayedText(StartChar(), EndChar(),
directionality, buffer,aContextChar, 0, &font));
+ if (!font)
+ {
+ OstTrace0( TRACE_DUMP, RTMGENERALINTERPRETER_GETDISPLAYEDTEXTL, "EInvariant" );
+ }
__ASSERT_DEBUG(font, TmPanic(EInvariant));
CFont::TPositionParam p;
int length = EndChar() - StartChar() + 1;
@@ -1966,6 +2051,10 @@
TBool RTmDrawingInterpreter::GetAdjustedHighlightClipRegion(const TRect& aClipRect, RRegion& aHighlightRegion) const
{
+ if (NULL == iHighlightExtensions)
+ {
+ OstTrace0( TRACE_DUMP, RTMDRAWINGINTERPRETER_GETADJUSTEDHIGHLIGHTCLIPREGION, "EInvariant" );
+ }
__ASSERT_DEBUG(NULL != iHighlightExtensions, TmPanic(EInvariant));
aHighlightRegion.Clear();
@@ -2023,6 +2112,10 @@
TBool RTmDrawingInterpreter::GetFirstAdjustedHighlightClipRect(RTmBoundingRectInterpreter& aInterpreter,
const TRect& aClipRect, TRect& aRect) const
{
+ if (NULL == iHighlightExtensions)
+ {
+ OstTrace0( TRACE_DUMP, RTMDRAWINGINTERPRETER_GETFIRSTADJUSTEDHIGHLIGHTCLIPRECT, "EInvariant" );
+ }
__ASSERT_DEBUG(NULL != iHighlightExtensions, TmPanic(EInvariant));
if (iHighlightEndPos > iHighlightStartPos)
@@ -2063,7 +2156,15 @@
TBool RTmDrawingInterpreter::GetNextAdjustedHighlightClipRect(RTmBoundingRectInterpreter& aInterpreter,
const TRect& aClipRect, TRect& aRect) const
{
+ if (NULL == iHighlightExtensions)
+ {
+ OstTrace0( TRACE_DUMP, RTMDRAWINGINTERPRETER_GETNEXTADJUSTEDHIGHLIGHTCLIPRECT, "EInvariant" );
+ }
__ASSERT_DEBUG(NULL != iHighlightExtensions, TmPanic(EInvariant));
+ if (iHighlightEndPos <= iHighlightStartPos)
+ {
+ OstTrace0( TRACE_DUMP, DUP1_RTMDRAWINGINTERPRETER_GETNEXTADJUSTEDHIGHLIGHTCLIPRECT, "EInvariant" );
+ }
__ASSERT_DEBUG(iHighlightEndPos > iHighlightStartPos, TmPanic(EInvariant));
TBool found = aInterpreter.NextRect(aRect);
@@ -3145,6 +3246,11 @@
TBool TTmByteCodeFinder::FindByteCode(TBool aToParStart,TBool aToParEnd,TInt aMaxExtraLines,TInfo& aInfo,
TBidirectionalContext* aStartBdState,TBidirectionalContext* aEndBdState)
{
+ if (!((aStartBdState && aEndBdState)
+ || (!aStartBdState && !aEndBdState)))
+ {
+ OstTrace0( TRACE_DUMP, TTMBYTECODEFINDER_FINDBYTECODE, "EBadArg" );
+ }
__ASSERT_DEBUG((aStartBdState && aEndBdState)
|| (!aStartBdState && !aEndBdState), TmPanic(EBadArg));
if (aStartBdState)
@@ -3163,6 +3269,10 @@
TBool get_info = EFalse;
while (Next())
{
+ if (Op() != EOpLine)
+ {
+ OstTrace0( TRACE_DUMP, DUP1_TTMBYTECODEFINDER_FINDBYTECODE, "ECorrupt" );
+ }
__ASSERT_ALWAYS(Op() == EOpLine, Panic(ECorrupt));
contextChar = LineContextCharChar();
foundStart = iStartDocPos >= StartChar() && iStartDocPos < EndChar();
@@ -3196,6 +3306,10 @@
do
{
// Operators must all be EOpLine because we're skipping from line to line
+ if (Op() != EOpLine)
+ {
+ OstTrace0( TRACE_FATAL, DUP3_TTMBYTECODEFINDER_FINDBYTECODE, "ECorrupt" );
+ }
__ASSERT_ALWAYS(Op() == EOpLine, Panic(ECorrupt));
aInfo.iBounds.iBr = LineInfo().iOuterRect.iBr;
aInfo.iEndCodePos = EndCodePos();
@@ -3233,6 +3347,10 @@
TInt heightToSkip = aTotalHeight - aMaxHeight;
TInt cumulativeHeight = 0;
+ if (!((aStartBdState && aEndBdState) || (!aStartBdState && !aEndBdState)))
+ {
+ OstTrace0( TRACE_DUMP, TTMBYTECODEFINDER_FINDBYTECODEATEND, "EBadArg" );
+ }
__ASSERT_DEBUG((aStartBdState && aEndBdState) || (!aStartBdState && !aEndBdState), TmPanic(EBadArg));
if (aStartBdState)
{
@@ -3246,6 +3364,10 @@
TBool foundStart = EFalse;
while (Next())
{
+ if (Op() != EOpLine)
+ {
+ OstTrace0( TRACE_FATAL, DUP1_TTMBYTECODEFINDER_FINDBYTECODEATEND, "ECorrupt" );
+ }
__ASSERT_ALWAYS(Op() == EOpLine, Panic(ECorrupt));
if (cumulativeHeight > heightToSkip)
{
@@ -3267,6 +3389,10 @@
TBool foundEnd = EFalse;
while (Next())
{
+ if (Op() != EOpLine)
+ {
+ OstTrace0( TRACE_FATAL, DUP2_TTMBYTECODEFINDER_FINDBYTECODEATEND, "ECorrupt" );
+ }
__ASSERT_ALWAYS(Op() == EOpLine, Panic(ECorrupt));
foundEnd = ETrue;
aInfo.iBounds.iBr = LineInfo().iOuterRect.iBr;