Bug 470418 - Leak nsStyleContext with RTL, text-transform; r,sr=roc

This commit is contained in:
Jonathan Kew 2009-01-01 16:34:13 +03:30
Родитель ef8c06266a
Коммит 36c5e3637e
3 изменённых файлов: 19 добавлений и 8 удалений

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

@ -20,6 +20,8 @@
* *
* Contributor(s): * Contributor(s):
* Vladimir Vukicevic <vladimir@pobox.com> * Vladimir Vukicevic <vladimir@pobox.com>
* Ehsan Akhgari <ehsan.akhgari@gmail.com>
* Jonathan Kew <jfkthame@gmail.com>
* *
* Alternatively, the contents of this file may be used under the terms of * Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or * either the GNU General Public License Version 2 or later (the "GPL"), or
@ -48,12 +50,18 @@ class THEBES_API gfxTextRunWordCache {
public: public:
enum { enum {
TEXT_IN_CACHE = 0x10000000, TEXT_IN_CACHE = 0x10000000,
/**
* nsTextFrameThebes sets these, but they're defined here rather than in
* nsTextFrameUtils.h because the cache also needs to check the _INCOMING flag
*/
TEXT_TRAILING_ARABICCHAR = 0x20000000,
/** /**
* When set, the previous character for this textrun was an Arabic * When set, the previous character for this textrun was an Arabic
* character. This is used for the context detection necessary for * character. This is used for the context detection necessary for
* bidi.numeral implementation. * bidi.numeral implementation.
*/ */
TEXT_INCOMING_ARABICCHAR = 0x10000000 TEXT_INCOMING_ARABICCHAR = 0x40000000
}; };
/** /**

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

@ -1136,7 +1136,7 @@ void BuildTextRunsScanner::FlushFrames(PRBool aFlushLineBreaks, PRBool aSuppress
if (!mSkipIncompleteTextRuns && mCurrentFramesAllSameTextRun && if (!mSkipIncompleteTextRuns && mCurrentFramesAllSameTextRun &&
((mCurrentFramesAllSameTextRun->GetFlags() & nsTextFrameUtils::TEXT_INCOMING_WHITESPACE) != 0) == ((mCurrentFramesAllSameTextRun->GetFlags() & nsTextFrameUtils::TEXT_INCOMING_WHITESPACE) != 0) ==
((mCurrentRunContextInfo & nsTextFrameUtils::INCOMING_WHITESPACE) != 0) && ((mCurrentRunContextInfo & nsTextFrameUtils::INCOMING_WHITESPACE) != 0) &&
((mCurrentFramesAllSameTextRun->GetFlags() & nsTextFrameUtils::TEXT_INCOMING_ARABICCHAR) != 0) == ((mCurrentFramesAllSameTextRun->GetFlags() & gfxTextRunWordCache::TEXT_INCOMING_ARABICCHAR) != 0) ==
((mCurrentRunContextInfo & nsTextFrameUtils::INCOMING_ARABICCHAR) != 0) && ((mCurrentRunContextInfo & nsTextFrameUtils::INCOMING_ARABICCHAR) != 0) &&
IsTextRunValidForMappedFlows(mCurrentFramesAllSameTextRun)) { IsTextRunValidForMappedFlows(mCurrentFramesAllSameTextRun)) {
// Optimization: We do not need to (re)build the textrun. // Optimization: We do not need to (re)build the textrun.
@ -1149,7 +1149,7 @@ void BuildTextRunsScanner::FlushFrames(PRBool aFlushLineBreaks, PRBool aSuppress
if (textRun->GetFlags() & nsTextFrameUtils::TEXT_TRAILING_WHITESPACE) { if (textRun->GetFlags() & nsTextFrameUtils::TEXT_TRAILING_WHITESPACE) {
mNextRunContextInfo |= nsTextFrameUtils::INCOMING_WHITESPACE; mNextRunContextInfo |= nsTextFrameUtils::INCOMING_WHITESPACE;
} }
if (textRun->GetFlags() & nsTextFrameUtils::TEXT_TRAILING_ARABICCHAR) { if (textRun->GetFlags() & gfxTextRunWordCache::TEXT_TRAILING_ARABICCHAR) {
mNextRunContextInfo |= nsTextFrameUtils::INCOMING_ARABICCHAR; mNextRunContextInfo |= nsTextFrameUtils::INCOMING_ARABICCHAR;
} }
} else { } else {
@ -1485,7 +1485,7 @@ BuildTextRunsScanner::BuildTextRunForFrames(void* aTextBuffer)
textFlags |= nsTextFrameUtils::TEXT_INCOMING_WHITESPACE; textFlags |= nsTextFrameUtils::TEXT_INCOMING_WHITESPACE;
} }
if (mCurrentRunContextInfo & nsTextFrameUtils::INCOMING_ARABICCHAR) { if (mCurrentRunContextInfo & nsTextFrameUtils::INCOMING_ARABICCHAR) {
textFlags |= nsTextFrameUtils::TEXT_INCOMING_ARABICCHAR; textFlags |= gfxTextRunWordCache::TEXT_INCOMING_ARABICCHAR;
} }
nsAutoTArray<PRInt32,50> textBreakPoints; nsAutoTArray<PRInt32,50> textBreakPoints;
@ -1658,7 +1658,7 @@ BuildTextRunsScanner::BuildTextRunForFrames(void* aTextBuffer)
textFlags |= nsTextFrameUtils::TEXT_TRAILING_WHITESPACE; textFlags |= nsTextFrameUtils::TEXT_TRAILING_WHITESPACE;
} }
if (mNextRunContextInfo & nsTextFrameUtils::INCOMING_ARABICCHAR) { if (mNextRunContextInfo & nsTextFrameUtils::INCOMING_ARABICCHAR) {
textFlags |= nsTextFrameUtils::TEXT_TRAILING_ARABICCHAR; textFlags |= gfxTextRunWordCache::TEXT_TRAILING_ARABICCHAR;
} }
// ContinueTextRunAcrossFrames guarantees that it doesn't matter which // ContinueTextRunAcrossFrames guarantees that it doesn't matter which
// frame's style is used, so use the last frame's // frame's style is used, so use the last frame's

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

@ -79,9 +79,12 @@ public:
// We normally don't use this break opportunity because the following text // We normally don't use this break opportunity because the following text
// will have a break opportunity at the start, but it's useful for line // will have a break opportunity at the start, but it's useful for line
// layout to know about it in case the following content is not text // layout to know about it in case the following content is not text
TEXT_HAS_TRAILING_BREAK = 0x4000000, TEXT_HAS_TRAILING_BREAK = 0x4000000
TEXT_TRAILING_ARABICCHAR = 0x8000000,
TEXT_INCOMING_ARABICCHAR = 0x10000000 // The following are defined by gfxTextRunWordCache rather than here,
// so that it also has access to the _INCOMING flag
// TEXT_TRAILING_ARABICCHAR
// TEXT_INCOMING_ARABICCHAR
}; };
// These constants are used in TransformText to represent context information // These constants are used in TransformText to represent context information