зеркало из https://github.com/mozilla/pjs.git
When measuring text, make sure nsTextTransformer::GetNextWord looks only at the part of the text content covered by the current frame. bug=333769 r+sr=roc
This commit is contained in:
Родитель
49e00219a8
Коммит
d76593004d
|
@ -6332,14 +6332,14 @@ nsTextFrame::ComputeWordFragmentDimensions(nsPresContext* aPresContext,
|
|||
PRBool aCanBreakBefore)
|
||||
{
|
||||
nsTextTransformer tx(aPresContext);
|
||||
tx.Init(aNextFrame, aContent, 0);
|
||||
PRInt32 nextFrameStart, nextFrameEnd;
|
||||
aNextFrame->GetOffsets(nextFrameStart, nextFrameEnd);
|
||||
tx.Init(aNextFrame, aContent, nextFrameStart);
|
||||
PRBool isWhitespace, wasTransformed;
|
||||
PRInt32 wordLen, contentLen;
|
||||
nsTextDimensions dimensions;
|
||||
#ifdef IBMBIDI
|
||||
if (aNextFrame->GetStateBits() & NS_FRAME_IS_BIDI) {
|
||||
PRInt32 nextFrameStart, nextFrameEnd;
|
||||
aNextFrame->GetOffsets(nextFrameStart, nextFrameEnd);
|
||||
wordLen = nextFrameEnd;
|
||||
} else {
|
||||
wordLen = -1;
|
||||
|
@ -6367,7 +6367,7 @@ nsTextFrame::ComputeWordFragmentDimensions(nsPresContext* aPresContext,
|
|||
*aMoreSize = wordLen + aRunningWordLen - aWordBufSize;
|
||||
return dimensions; // 0
|
||||
}
|
||||
if (contentLen < tx.GetContentLength())
|
||||
if (nextFrameStart + contentLen < nextFrameEnd)
|
||||
*aMoreSize = -1;
|
||||
|
||||
// Convert any spaces in the current word back to nbsp's. This keeps
|
||||
|
|
|
@ -680,6 +680,11 @@ nsTextTransformer::ScanPreData_F(PRInt32* aWordLen,
|
|||
{
|
||||
const nsTextFragment* frag = mFrag;
|
||||
PRInt32 fragLen = frag->GetLength();
|
||||
#ifdef IBMBIDI
|
||||
if (*aWordLen > 0 && *aWordLen < fragLen) {
|
||||
fragLen = *aWordLen;
|
||||
}
|
||||
#endif
|
||||
PRInt32 offset = mOffset;
|
||||
PRUnichar* bp = mTransformBuf.GetBuffer() + mBufferPos;
|
||||
PRUnichar* endbp = mTransformBuf.GetBufferEnd();
|
||||
|
@ -958,6 +963,9 @@ nsTextTransformer::GetNextWord(PRBool aInWord,
|
|||
isWhitespace = PR_TRUE;
|
||||
}
|
||||
else if (frag->Is2b()) {
|
||||
#ifdef IBMBIDI
|
||||
wordLen = *aWordLenResult;
|
||||
#endif
|
||||
offset = ScanPreData_F(&wordLen, aWasTransformed);
|
||||
}
|
||||
else {
|
||||
|
|
Загрузка…
Ссылка в новой задаче