зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1362167 - Split gfxShapedText.mFlags into two 16-bit flags fields, and arrange storage more compactly to reduce size of gfxShapedWord and gfxTextRun objects. r=jrmuizel
This commit is contained in:
Родитель
e55e10e447
Коммит
6fc5313103
|
@ -4266,7 +4266,7 @@ struct MOZ_STACK_CLASS CanvasBidiProcessor : public nsBidiPresUtils::BidiProcess
|
|||
{
|
||||
mFontgrp->UpdateUserFonts(); // ensure user font generation is current
|
||||
// adjust flags for current direction run
|
||||
uint32_t flags = mTextRunFlags;
|
||||
uint16_t flags = mTextRunFlags;
|
||||
if (aDirection == NSBIDI_RTL) {
|
||||
flags |= gfxTextRunFactory::TEXT_IS_RTL;
|
||||
} else {
|
||||
|
@ -4276,7 +4276,7 @@ struct MOZ_STACK_CLASS CanvasBidiProcessor : public nsBidiPresUtils::BidiProcess
|
|||
aLength,
|
||||
mDrawTarget,
|
||||
mAppUnitsPerDevPixel,
|
||||
flags,
|
||||
flags, 0,
|
||||
mMissingFonts);
|
||||
}
|
||||
|
||||
|
@ -4489,7 +4489,7 @@ struct MOZ_STACK_CLASS CanvasBidiProcessor : public nsBidiPresUtils::BidiProcess
|
|||
gfxRect mBoundingBox;
|
||||
|
||||
// flags to use when creating textrun, based on CSS style
|
||||
uint32_t mTextRunFlags;
|
||||
uint16_t mTextRunFlags;
|
||||
|
||||
// true iff the bounding box should be measured
|
||||
bool mDoMeasureBoundingBox;
|
||||
|
|
|
@ -38,7 +38,7 @@ public:
|
|||
reinterpret_cast<const uint8_t*>(aString), aLength,
|
||||
aDrawTarget,
|
||||
aMetrics->AppUnitsPerDevPixel(),
|
||||
ComputeFlags(aMetrics),
|
||||
ComputeFlags(aMetrics), 0,
|
||||
nullptr);
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ public:
|
|||
aString, aLength,
|
||||
aDrawTarget,
|
||||
aMetrics->AppUnitsPerDevPixel(),
|
||||
ComputeFlags(aMetrics),
|
||||
ComputeFlags(aMetrics), 0,
|
||||
nullptr);
|
||||
}
|
||||
|
||||
|
@ -57,8 +57,8 @@ public:
|
|||
gfxTextRun *operator->() { return mTextRun.get(); }
|
||||
|
||||
private:
|
||||
static uint32_t ComputeFlags(nsFontMetrics* aMetrics) {
|
||||
uint32_t flags = 0;
|
||||
static uint16_t ComputeFlags(nsFontMetrics* aMetrics) {
|
||||
uint16_t flags = 0;
|
||||
if (aMetrics->GetTextRunRTL()) {
|
||||
flags |= gfxTextRunFactory::TEXT_IS_RTL;
|
||||
}
|
||||
|
|
|
@ -2571,7 +2571,7 @@ gfxFont::GetShapedWord(DrawTarget *aDrawTarget,
|
|||
Script aRunScript,
|
||||
bool aVertical,
|
||||
int32_t aAppUnitsPerDevUnit,
|
||||
uint32_t aFlags,
|
||||
uint16_t aFlags,
|
||||
RoundingFlags aRounding,
|
||||
gfxTextPerfMetrics *aTextPerf GFX_MAYBE_UNUSED)
|
||||
{
|
||||
|
@ -2966,7 +2966,7 @@ gfxFont::SplitAndInitTextRun(DrawTarget *aDrawTarget,
|
|||
InitWordCache();
|
||||
|
||||
// the only flags we care about for ShapedWord construction/caching
|
||||
uint32_t flags = aTextRun->GetFlags();
|
||||
uint16_t flags = aTextRun->GetFlags();
|
||||
flags &= (gfxTextRunFactory::TEXT_IS_RTL |
|
||||
gfxTextRunFactory::TEXT_DISABLE_OPTIONAL_LIGATURES |
|
||||
gfxTextRunFactory::TEXT_USE_MATH_SCRIPT |
|
||||
|
@ -3018,7 +3018,7 @@ gfxFont::SplitAndInitTextRun(DrawTarget *aDrawTarget,
|
|||
return false;
|
||||
}
|
||||
} else if (length > 0) {
|
||||
uint32_t wordFlags = flags;
|
||||
uint16_t wordFlags = flags;
|
||||
// in the 8-bit version of this method, TEXT_IS_8BIT was
|
||||
// already set as part of |flags|, so no need for a per-word
|
||||
// adjustment here
|
||||
|
@ -3257,7 +3257,7 @@ gfxFont::InitFakeSmallCapsRun(DrawTarget *aDrawTarget,
|
|||
};
|
||||
RefPtr<gfxTextRun> tempRun(
|
||||
gfxTextRun::Create(¶ms, convertedString.Length(),
|
||||
aTextRun->GetFontGroup(), 0));
|
||||
aTextRun->GetFontGroup(), 0, 0));
|
||||
tempRun->AddGlyphRun(f, aMatchType, 0, true, aOrientation);
|
||||
if (!f->SplitAndInitTextRun(aDrawTarget, tempRun.get(),
|
||||
convertedString.BeginReading(),
|
||||
|
@ -3267,7 +3267,7 @@ gfxFont::InitFakeSmallCapsRun(DrawTarget *aDrawTarget,
|
|||
} else {
|
||||
RefPtr<gfxTextRun> mergedRun(
|
||||
gfxTextRun::Create(¶ms, runLength,
|
||||
aTextRun->GetFontGroup(), 0));
|
||||
aTextRun->GetFontGroup(), 0, 0));
|
||||
MergeCharactersInTextRun(mergedRun.get(), tempRun.get(),
|
||||
charsToMergeArray.Elements(),
|
||||
deletedCharsArray.Elements());
|
||||
|
|
|
@ -461,43 +461,34 @@ class gfxTextRunFactory {
|
|||
public:
|
||||
typedef mozilla::gfx::DrawTarget DrawTarget;
|
||||
|
||||
// Flags in the mask 0xFFFF0000 are reserved for textrun clients
|
||||
// Flags in the mask 0x0000F000 are reserved for per-platform fonts
|
||||
// Flags in the mask 0x00000FFF are set by the textrun creator.
|
||||
// Flags that live in the gfxShapedText::mFlags field.
|
||||
// (Note that gfxTextRun has an additional mFlags2 field for use
|
||||
// by textrun clients like nsTextFrame.)
|
||||
enum {
|
||||
CACHE_TEXT_FLAGS = 0xF0000000,
|
||||
USER_TEXT_FLAGS = 0x0FFF0000,
|
||||
TEXTRUN_TEXT_FLAGS = 0x0000FFFF,
|
||||
SETTABLE_FLAGS = CACHE_TEXT_FLAGS | USER_TEXT_FLAGS,
|
||||
|
||||
/**
|
||||
* When set, the text string pointer used to create the text run
|
||||
* is guaranteed to be available during the lifetime of the text run.
|
||||
*/
|
||||
TEXT_IS_PERSISTENT = 0x0001,
|
||||
/**
|
||||
* When set, the text is known to be all-ASCII (< 128).
|
||||
*/
|
||||
TEXT_IS_ASCII = 0x0002,
|
||||
/**
|
||||
* When set, the text is RTL.
|
||||
*/
|
||||
TEXT_IS_RTL = 0x0004,
|
||||
TEXT_IS_RTL = 0x0002,
|
||||
/**
|
||||
* When set, spacing is enabled and the textrun needs to call GetSpacing
|
||||
* on the spacing provider.
|
||||
*/
|
||||
TEXT_ENABLE_SPACING = 0x0008,
|
||||
TEXT_ENABLE_SPACING = 0x0004,
|
||||
/**
|
||||
* When set, the text has no characters above 255 and it is stored
|
||||
* in the textrun in 8-bit format.
|
||||
*/
|
||||
TEXT_IS_8BIT = 0x0008,
|
||||
/**
|
||||
* When set, GetHyphenationBreaks may return true for some character
|
||||
* positions, otherwise it will always return false for all characters.
|
||||
*/
|
||||
TEXT_ENABLE_HYPHEN_BREAKS = 0x0010,
|
||||
/**
|
||||
* When set, the text has no characters above 255 and it is stored
|
||||
* in the textrun in 8-bit format.
|
||||
*/
|
||||
TEXT_IS_8BIT = 0x0020,
|
||||
/**
|
||||
* When set, the RunMetrics::mBoundingBox field will be initialized
|
||||
* properly based on glyph extents, in particular, glyph extents that
|
||||
|
@ -505,31 +496,41 @@ public:
|
|||
* and advance width of the glyph). When not set, it may just be the
|
||||
* standard font-box even if glyphs overflow.
|
||||
*/
|
||||
TEXT_NEED_BOUNDING_BOX = 0x0040,
|
||||
TEXT_NEED_BOUNDING_BOX = 0x0020,
|
||||
/**
|
||||
* When set, optional ligatures are disabled. Ligatures that are
|
||||
* required for legible text should still be enabled.
|
||||
*/
|
||||
TEXT_DISABLE_OPTIONAL_LIGATURES = 0x0080,
|
||||
TEXT_DISABLE_OPTIONAL_LIGATURES = 0x0040,
|
||||
/**
|
||||
* When set, the textrun should favour speed of construction over
|
||||
* quality. This may involve disabling ligatures and/or kerning or
|
||||
* other effects.
|
||||
*/
|
||||
TEXT_OPTIMIZE_SPEED = 0x0100,
|
||||
/**
|
||||
* For internal use by the memory reporter when accounting for
|
||||
* storage used by textruns.
|
||||
* Because the reporter may visit each textrun multiple times while
|
||||
* walking the frame trees and textrun cache, it needs to mark
|
||||
* textruns that have been seen so as to avoid multiple-accounting.
|
||||
*/
|
||||
TEXT_RUN_SIZE_ACCOUNTED = 0x0200,
|
||||
TEXT_OPTIMIZE_SPEED = 0x0080,
|
||||
/**
|
||||
* When set, the textrun should discard control characters instead of
|
||||
* turning them into hexboxes.
|
||||
*/
|
||||
TEXT_HIDE_CONTROL_CHARACTERS = 0x0400,
|
||||
TEXT_HIDE_CONTROL_CHARACTERS = 0x0100,
|
||||
|
||||
/**
|
||||
* nsTextFrameThebes sets these, but they're defined here rather than
|
||||
* in nsTextFrameUtils.h because ShapedWord creation/caching also needs
|
||||
* to check the _INCOMING flag
|
||||
*/
|
||||
TEXT_TRAILING_ARABICCHAR = 0x0200,
|
||||
/**
|
||||
* When set, the previous character for this textrun was an Arabic
|
||||
* character. This is used for the context detection necessary for
|
||||
* bidi.numeral implementation.
|
||||
*/
|
||||
TEXT_INCOMING_ARABICCHAR = 0x0400,
|
||||
|
||||
/**
|
||||
* Set if the textrun should use the OpenType 'math' script.
|
||||
*/
|
||||
TEXT_USE_MATH_SCRIPT = 0x0800,
|
||||
|
||||
/**
|
||||
* Field for orientation of the textrun and glyphs within it.
|
||||
|
@ -549,28 +550,12 @@ public:
|
|||
* characters, and separate glyphRuns created for the resulting
|
||||
* glyph orientations.
|
||||
*/
|
||||
TEXT_ORIENT_MASK = 0xF000,
|
||||
TEXT_ORIENT_MASK = 0x7000,
|
||||
TEXT_ORIENT_HORIZONTAL = 0x0000,
|
||||
TEXT_ORIENT_VERTICAL_UPRIGHT = 0x1000,
|
||||
TEXT_ORIENT_VERTICAL_SIDEWAYS_RIGHT = 0x2000,
|
||||
TEXT_ORIENT_VERTICAL_MIXED = 0x3000,
|
||||
TEXT_ORIENT_VERTICAL_SIDEWAYS_LEFT = 0x4000,
|
||||
TEXT_ORIENT_VERTICAL_MIXED = 0x8000,
|
||||
|
||||
/**
|
||||
* nsTextFrameThebes sets these, but they're defined here rather than
|
||||
* in nsTextFrameUtils.h because ShapedWord creation/caching also needs
|
||||
* to check the _INCOMING flag
|
||||
*/
|
||||
TEXT_TRAILING_ARABICCHAR = 0x20000000,
|
||||
/**
|
||||
* When set, the previous character for this textrun was an Arabic
|
||||
* character. This is used for the context detection necessary for
|
||||
* bidi.numeral implementation.
|
||||
*/
|
||||
TEXT_INCOMING_ARABICCHAR = 0x40000000,
|
||||
|
||||
// Set if the textrun should use the OpenType 'math' script.
|
||||
TEXT_USE_MATH_SCRIPT = 0x80000000,
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -691,7 +676,7 @@ class gfxShapedText
|
|||
public:
|
||||
typedef mozilla::unicode::Script Script;
|
||||
|
||||
gfxShapedText(uint32_t aLength, uint32_t aFlags,
|
||||
gfxShapedText(uint32_t aLength, uint16_t aFlags,
|
||||
int32_t aAppUnitsPerDevUnit)
|
||||
: mLength(aLength)
|
||||
, mFlags(aFlags)
|
||||
|
@ -968,7 +953,7 @@ public:
|
|||
const uint8_t *aString,
|
||||
uint32_t aLength);
|
||||
|
||||
uint32_t GetFlags() const {
|
||||
uint16_t GetFlags() const {
|
||||
return mFlags;
|
||||
}
|
||||
|
||||
|
@ -1161,9 +1146,9 @@ protected:
|
|||
uint32_t mLength;
|
||||
|
||||
// Shaping flags (direction, ligature-suppression)
|
||||
uint32_t mFlags;
|
||||
uint16_t mFlags;
|
||||
|
||||
int32_t mAppUnitsPerDevUnit;
|
||||
uint16_t mAppUnitsPerDevUnit;
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -1190,7 +1175,7 @@ public:
|
|||
static gfxShapedWord* Create(const uint8_t *aText, uint32_t aLength,
|
||||
Script aRunScript,
|
||||
int32_t aAppUnitsPerDevUnit,
|
||||
uint32_t aFlags,
|
||||
uint16_t aFlags,
|
||||
gfxFontShaper::RoundingFlags aRounding) {
|
||||
NS_ASSERTION(aLength <= gfxPlatform::GetPlatform()->WordCacheCharLimit(),
|
||||
"excessive length for gfxShapedWord!");
|
||||
|
@ -1214,7 +1199,7 @@ public:
|
|||
static gfxShapedWord* Create(const char16_t *aText, uint32_t aLength,
|
||||
Script aRunScript,
|
||||
int32_t aAppUnitsPerDevUnit,
|
||||
uint32_t aFlags,
|
||||
uint16_t aFlags,
|
||||
gfxFontShaper::RoundingFlags aRounding) {
|
||||
NS_ASSERTION(aLength <= gfxPlatform::GetPlatform()->WordCacheCharLimit(),
|
||||
"excessive length for gfxShapedWord!");
|
||||
|
@ -1301,7 +1286,7 @@ private:
|
|||
// Construct storage for a ShapedWord, ready to receive glyph data
|
||||
gfxShapedWord(const uint8_t *aText, uint32_t aLength,
|
||||
Script aRunScript,
|
||||
int32_t aAppUnitsPerDevUnit, uint32_t aFlags,
|
||||
int32_t aAppUnitsPerDevUnit, uint16_t aFlags,
|
||||
gfxFontShaper::RoundingFlags aRounding)
|
||||
: gfxShapedText(aLength, aFlags | gfxTextRunFactory::TEXT_IS_8BIT,
|
||||
aAppUnitsPerDevUnit)
|
||||
|
@ -1316,7 +1301,7 @@ private:
|
|||
|
||||
gfxShapedWord(const char16_t *aText, uint32_t aLength,
|
||||
Script aRunScript,
|
||||
int32_t aAppUnitsPerDevUnit, uint32_t aFlags,
|
||||
int32_t aAppUnitsPerDevUnit, uint16_t aFlags,
|
||||
gfxFontShaper::RoundingFlags aRounding)
|
||||
: gfxShapedText(aLength, aFlags, aAppUnitsPerDevUnit)
|
||||
, mScript(aRunScript)
|
||||
|
@ -1787,7 +1772,7 @@ public:
|
|||
Script aRunScript,
|
||||
bool aVertical,
|
||||
int32_t aAppUnitsPerDevUnit,
|
||||
uint32_t aFlags,
|
||||
uint16_t aFlags,
|
||||
RoundingFlags aRounding,
|
||||
gfxTextPerfMetrics *aTextPerf);
|
||||
|
||||
|
@ -2042,7 +2027,7 @@ protected:
|
|||
const char16_t *mDouble;
|
||||
} mText;
|
||||
uint32_t mLength;
|
||||
uint32_t mFlags;
|
||||
uint16_t mFlags;
|
||||
Script mScript;
|
||||
int32_t mAppUnitsPerDevUnit;
|
||||
PLDHashNumber mHashKey;
|
||||
|
@ -2052,7 +2037,7 @@ protected:
|
|||
CacheHashKey(const uint8_t *aText, uint32_t aLength,
|
||||
uint32_t aStringHash,
|
||||
Script aScriptCode, int32_t aAppUnitsPerDevUnit,
|
||||
uint32_t aFlags, RoundingFlags aRounding)
|
||||
uint16_t aFlags, RoundingFlags aRounding)
|
||||
: mLength(aLength),
|
||||
mFlags(aFlags),
|
||||
mScript(aScriptCode),
|
||||
|
@ -2073,7 +2058,7 @@ protected:
|
|||
CacheHashKey(const char16_t *aText, uint32_t aLength,
|
||||
uint32_t aStringHash,
|
||||
Script aScriptCode, int32_t aAppUnitsPerDevUnit,
|
||||
uint32_t aFlags, RoundingFlags aRounding)
|
||||
uint16_t aFlags, RoundingFlags aRounding)
|
||||
: mLength(aLength),
|
||||
mFlags(aFlags),
|
||||
mScript(aScriptCode),
|
||||
|
|
|
@ -145,7 +145,8 @@ gfxTextRun::AllocateStorageForTextRun(size_t aSize, uint32_t aLength)
|
|||
|
||||
already_AddRefed<gfxTextRun>
|
||||
gfxTextRun::Create(const gfxTextRunFactory::Parameters *aParams,
|
||||
uint32_t aLength, gfxFontGroup *aFontGroup, uint32_t aFlags)
|
||||
uint32_t aLength, gfxFontGroup *aFontGroup,
|
||||
uint16_t aFlags, uint16_t aFlags2)
|
||||
{
|
||||
void *storage = AllocateStorageForTextRun(sizeof(gfxTextRun), aLength);
|
||||
if (!storage) {
|
||||
|
@ -153,16 +154,19 @@ gfxTextRun::Create(const gfxTextRunFactory::Parameters *aParams,
|
|||
}
|
||||
|
||||
RefPtr<gfxTextRun> result = new (storage) gfxTextRun(aParams, aLength,
|
||||
aFontGroup, aFlags);
|
||||
aFontGroup,
|
||||
aFlags, aFlags2);
|
||||
return result.forget();
|
||||
}
|
||||
|
||||
gfxTextRun::gfxTextRun(const gfxTextRunFactory::Parameters *aParams,
|
||||
uint32_t aLength, gfxFontGroup *aFontGroup, uint32_t aFlags)
|
||||
uint32_t aLength, gfxFontGroup *aFontGroup,
|
||||
uint16_t aFlags, uint16_t aFlags2)
|
||||
: gfxShapedText(aLength, aFlags, aParams->mAppUnitsPerDevUnit)
|
||||
, mSingleGlyphRun()
|
||||
, mUserData(aParams->mUserData)
|
||||
, mFontGroup(aFontGroup)
|
||||
, mFlags2(aFlags2)
|
||||
, mReleasedFontGroup(false)
|
||||
, mHasGlyphRunArray(false)
|
||||
, mShapingState(eShapingState_Normal)
|
||||
|
@ -197,7 +201,8 @@ gfxTextRun::~gfxTextRun()
|
|||
#endif
|
||||
#ifdef DEBUG
|
||||
// Make it easy to detect a dead text run
|
||||
mFlags = 0xFFFFFFFF;
|
||||
mFlags = 0xFFFF;
|
||||
mFlags2 = 0xFFFF;
|
||||
#endif
|
||||
|
||||
if (mHasGlyphRunArray) {
|
||||
|
@ -1601,8 +1606,7 @@ gfxTextRun::SetSpaceGlyph(gfxFont* aFont, DrawTarget* aDrawTarget,
|
|||
|
||||
aFont->InitWordCache();
|
||||
static const uint8_t space = ' ';
|
||||
uint32_t flags = gfxTextRunFactory::TEXT_IS_8BIT |
|
||||
gfxTextRunFactory::TEXT_IS_ASCII |
|
||||
uint16_t flags = gfxTextRunFactory::TEXT_IS_8BIT |
|
||||
gfxTextRunFactory::TEXT_IS_PERSISTENT |
|
||||
aOrientation;
|
||||
bool vertical =
|
||||
|
@ -2168,19 +2172,21 @@ gfxFontGroup::IsInvalidChar(char16_t ch)
|
|||
}
|
||||
|
||||
already_AddRefed<gfxTextRun>
|
||||
gfxFontGroup::MakeEmptyTextRun(const Parameters *aParams, uint32_t aFlags)
|
||||
gfxFontGroup::MakeEmptyTextRun(const Parameters *aParams,
|
||||
uint16_t aFlags, uint16_t aFlags2)
|
||||
{
|
||||
aFlags |= TEXT_IS_8BIT | TEXT_IS_ASCII | TEXT_IS_PERSISTENT;
|
||||
return gfxTextRun::Create(aParams, 0, this, aFlags);
|
||||
aFlags |= TEXT_IS_8BIT | TEXT_IS_PERSISTENT;
|
||||
return gfxTextRun::Create(aParams, 0, this, aFlags, aFlags2);
|
||||
}
|
||||
|
||||
already_AddRefed<gfxTextRun>
|
||||
gfxFontGroup::MakeSpaceTextRun(const Parameters *aParams, uint32_t aFlags)
|
||||
gfxFontGroup::MakeSpaceTextRun(const Parameters *aParams,
|
||||
uint16_t aFlags, uint16_t aFlags2)
|
||||
{
|
||||
aFlags |= TEXT_IS_8BIT | TEXT_IS_ASCII | TEXT_IS_PERSISTENT;
|
||||
aFlags |= TEXT_IS_8BIT | TEXT_IS_PERSISTENT;
|
||||
|
||||
RefPtr<gfxTextRun> textRun =
|
||||
gfxTextRun::Create(aParams, 1, this, aFlags);
|
||||
gfxTextRun::Create(aParams, 1, this, aFlags, aFlags2);
|
||||
if (!textRun) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -2226,10 +2232,11 @@ gfxFontGroup::MakeSpaceTextRun(const Parameters *aParams, uint32_t aFlags)
|
|||
|
||||
already_AddRefed<gfxTextRun>
|
||||
gfxFontGroup::MakeBlankTextRun(uint32_t aLength,
|
||||
const Parameters *aParams, uint32_t aFlags)
|
||||
const Parameters *aParams,
|
||||
uint16_t aFlags, uint16_t aFlags2)
|
||||
{
|
||||
RefPtr<gfxTextRun> textRun =
|
||||
gfxTextRun::Create(aParams, aLength, this, aFlags);
|
||||
gfxTextRun::Create(aParams, aLength, this, aFlags, aFlags2);
|
||||
if (!textRun) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -2254,12 +2261,12 @@ gfxFontGroup::MakeHyphenTextRun(DrawTarget* aDrawTarget,
|
|||
gfxFont *font = GetFirstValidFont(uint32_t(hyphen));
|
||||
if (font->HasCharacter(hyphen)) {
|
||||
return MakeTextRun(&hyphen, 1, aDrawTarget, aAppUnitsPerDevUnit,
|
||||
gfxFontGroup::TEXT_IS_PERSISTENT, nullptr);
|
||||
gfxFontGroup::TEXT_IS_PERSISTENT, 0, nullptr);
|
||||
}
|
||||
|
||||
static const uint8_t dash = '-';
|
||||
return MakeTextRun(&dash, 1, aDrawTarget, aAppUnitsPerDevUnit,
|
||||
gfxFontGroup::TEXT_IS_PERSISTENT, nullptr);
|
||||
gfxFontGroup::TEXT_IS_PERSISTENT, 0, nullptr);
|
||||
}
|
||||
|
||||
gfxFloat
|
||||
|
@ -2279,14 +2286,15 @@ gfxFontGroup::GetHyphenWidth(const gfxTextRun::PropertyProvider* aProvider)
|
|||
|
||||
already_AddRefed<gfxTextRun>
|
||||
gfxFontGroup::MakeTextRun(const uint8_t *aString, uint32_t aLength,
|
||||
const Parameters *aParams, uint32_t aFlags,
|
||||
const Parameters *aParams,
|
||||
uint16_t aFlags, uint16_t aFlags2,
|
||||
gfxMissingFontRecorder *aMFR)
|
||||
{
|
||||
if (aLength == 0) {
|
||||
return MakeEmptyTextRun(aParams, aFlags);
|
||||
return MakeEmptyTextRun(aParams, aFlags, aFlags2);
|
||||
}
|
||||
if (aLength == 1 && aString[0] == ' ') {
|
||||
return MakeSpaceTextRun(aParams, aFlags);
|
||||
return MakeSpaceTextRun(aParams, aFlags, aFlags2);
|
||||
}
|
||||
|
||||
aFlags |= TEXT_IS_8BIT;
|
||||
|
@ -2296,11 +2304,11 @@ gfxFontGroup::MakeTextRun(const uint8_t *aString, uint32_t aLength,
|
|||
// Short-circuit for size-0 fonts, as Windows and ATSUI can't handle
|
||||
// them, and always create at least size 1 fonts, i.e. they still
|
||||
// render something for size 0 fonts.
|
||||
return MakeBlankTextRun(aLength, aParams, aFlags);
|
||||
return MakeBlankTextRun(aLength, aParams, aFlags, aFlags2);
|
||||
}
|
||||
|
||||
RefPtr<gfxTextRun> textRun = gfxTextRun::Create(aParams, aLength, this,
|
||||
aFlags);
|
||||
aFlags, aFlags2);
|
||||
if (!textRun) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -2314,22 +2322,23 @@ gfxFontGroup::MakeTextRun(const uint8_t *aString, uint32_t aLength,
|
|||
|
||||
already_AddRefed<gfxTextRun>
|
||||
gfxFontGroup::MakeTextRun(const char16_t *aString, uint32_t aLength,
|
||||
const Parameters *aParams, uint32_t aFlags,
|
||||
const Parameters *aParams,
|
||||
uint16_t aFlags, uint16_t aFlags2,
|
||||
gfxMissingFontRecorder *aMFR)
|
||||
{
|
||||
if (aLength == 0) {
|
||||
return MakeEmptyTextRun(aParams, aFlags);
|
||||
return MakeEmptyTextRun(aParams, aFlags, aFlags2);
|
||||
}
|
||||
if (aLength == 1 && aString[0] == ' ') {
|
||||
return MakeSpaceTextRun(aParams, aFlags);
|
||||
return MakeSpaceTextRun(aParams, aFlags, aFlags2);
|
||||
}
|
||||
if (MOZ_UNLIKELY(GetStyle()->size == 0) ||
|
||||
MOZ_UNLIKELY(GetStyle()->sizeAdjust == 0.0f)) {
|
||||
return MakeBlankTextRun(aLength, aParams, aFlags);
|
||||
return MakeBlankTextRun(aLength, aParams, aFlags, aFlags2);
|
||||
}
|
||||
|
||||
RefPtr<gfxTextRun> textRun = gfxTextRun::Create(aParams, aLength, this,
|
||||
aFlags);
|
||||
aFlags, aFlags2);
|
||||
if (!textRun) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -2747,7 +2756,8 @@ gfxFontGroup::InitScriptRun(DrawTarget* aDrawTarget,
|
|||
}
|
||||
|
||||
gfxTextRun *
|
||||
gfxFontGroup::GetEllipsisTextRun(int32_t aAppUnitsPerDevPixel, uint32_t aFlags,
|
||||
gfxFontGroup::GetEllipsisTextRun(int32_t aAppUnitsPerDevPixel,
|
||||
uint16_t aFlags,
|
||||
LazyReferenceDrawTargetGetter& aRefDrawTargetGetter)
|
||||
{
|
||||
MOZ_ASSERT(!(aFlags & ~TEXT_ORIENT_MASK),
|
||||
|
@ -2773,7 +2783,7 @@ gfxFontGroup::GetEllipsisTextRun(int32_t aAppUnitsPerDevPixel, uint32_t aFlags,
|
|||
};
|
||||
mCachedEllipsisTextRun =
|
||||
MakeTextRun(ellipsis.get(), ellipsis.Length(), ¶ms,
|
||||
aFlags | TEXT_IS_PERSISTENT, nullptr);
|
||||
aFlags | TEXT_IS_PERSISTENT, 0, nullptr);
|
||||
if (!mCachedEllipsisTextRun) {
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include "harfbuzz/hb.h"
|
||||
#include "nsUnicodeScriptCodes.h"
|
||||
#include "nsColor.h"
|
||||
#include "nsTextFrameUtils.h"
|
||||
|
||||
#ifdef DEBUG
|
||||
#include <stdio.h>
|
||||
|
@ -431,15 +432,11 @@ public:
|
|||
void *GetUserData() const { return mUserData; }
|
||||
void SetUserData(void *aUserData) { mUserData = aUserData; }
|
||||
|
||||
void SetFlagBits(uint32_t aFlags) {
|
||||
NS_ASSERTION(!(aFlags & ~gfxTextRunFactory::SETTABLE_FLAGS),
|
||||
"Only user flags should be mutable");
|
||||
mFlags |= aFlags;
|
||||
void SetFlagBits(uint16_t aFlags) {
|
||||
mFlags2 |= aFlags;
|
||||
}
|
||||
void ClearFlagBits(uint32_t aFlags) {
|
||||
NS_ASSERTION(!(aFlags & ~gfxTextRunFactory::SETTABLE_FLAGS),
|
||||
"Only user flags should be mutable");
|
||||
mFlags &= ~aFlags;
|
||||
void ClearFlagBits(uint16_t aFlags) {
|
||||
mFlags2 &= ~aFlags;
|
||||
}
|
||||
const gfxSkipChars& GetSkipChars() const { return mSkipChars; }
|
||||
gfxFontGroup *GetFontGroup() const { return mFontGroup; }
|
||||
|
@ -450,7 +447,7 @@ public:
|
|||
static already_AddRefed<gfxTextRun>
|
||||
Create(const gfxTextRunFactory::Parameters *aParams,
|
||||
uint32_t aLength, gfxFontGroup *aFontGroup,
|
||||
uint32_t aFlags);
|
||||
uint16_t aFlags, uint16_t aFlags2);
|
||||
|
||||
// The text is divided into GlyphRuns as necessary. (In the vast majority
|
||||
// of cases, a gfxTextRun contains just a single GlyphRun.)
|
||||
|
@ -642,23 +639,27 @@ public:
|
|||
virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf)
|
||||
MOZ_MUST_OVERRIDE;
|
||||
|
||||
uint16_t GetFlags2() const {
|
||||
return mFlags2;
|
||||
}
|
||||
|
||||
// Get the size, if it hasn't already been gotten, marking as it goes.
|
||||
size_t MaybeSizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) {
|
||||
if (mFlags & gfxTextRunFactory::TEXT_RUN_SIZE_ACCOUNTED) {
|
||||
if (mFlags2 & nsTextFrameUtils::TEXT_RUN_SIZE_ACCOUNTED) {
|
||||
return 0;
|
||||
}
|
||||
mFlags |= gfxTextRunFactory::TEXT_RUN_SIZE_ACCOUNTED;
|
||||
mFlags2 |= nsTextFrameUtils::TEXT_RUN_SIZE_ACCOUNTED;
|
||||
return SizeOfIncludingThis(aMallocSizeOf);
|
||||
}
|
||||
void ResetSizeOfAccountingFlags() {
|
||||
mFlags &= ~gfxTextRunFactory::TEXT_RUN_SIZE_ACCOUNTED;
|
||||
mFlags2 &= ~nsTextFrameUtils::TEXT_RUN_SIZE_ACCOUNTED;
|
||||
}
|
||||
|
||||
// shaping state - for some font features, fallback is required that
|
||||
// affects the entire run. for example, fallback for one script/font
|
||||
// portion of a textrun requires fallback to be applied to the entire run
|
||||
|
||||
enum ShapingState {
|
||||
enum ShapingState : uint8_t {
|
||||
eShapingState_Normal, // default state
|
||||
eShapingState_ShapingWithFeature, // have shaped with feature
|
||||
eShapingState_ShapingWithFallback, // have shaped with fallback
|
||||
|
@ -701,7 +702,8 @@ protected:
|
|||
* follow the base textrun object.
|
||||
*/
|
||||
gfxTextRun(const gfxTextRunFactory::Parameters *aParams,
|
||||
uint32_t aLength, gfxFontGroup *aFontGroup, uint32_t aFlags);
|
||||
uint32_t aLength, gfxFontGroup *aFontGroup,
|
||||
uint16_t aFlags, uint16_t aFlags2);
|
||||
|
||||
/**
|
||||
* Helper for the Create() factory method to allocate the required
|
||||
|
@ -805,6 +807,8 @@ private:
|
|||
// may be released by ReleaseFontGroup()
|
||||
gfxSkipChars mSkipChars;
|
||||
|
||||
uint16_t mFlags2; // additional flags (see also gfxShapedText::mFlags)
|
||||
|
||||
bool mSkipDrawing; // true if the font group we used had a user font
|
||||
// download that's in progress, so we should hide text
|
||||
// until the download completes (or timeout fires)
|
||||
|
@ -860,7 +864,8 @@ public:
|
|||
*/
|
||||
virtual already_AddRefed<gfxTextRun>
|
||||
MakeTextRun(const char16_t *aString, uint32_t aLength,
|
||||
const Parameters *aParams, uint32_t aFlags,
|
||||
const Parameters *aParams,
|
||||
uint16_t aFlags, uint16_t aFlags2,
|
||||
gfxMissingFontRecorder *aMFR);
|
||||
/**
|
||||
* Make a textrun for a given string.
|
||||
|
@ -870,7 +875,8 @@ public:
|
|||
*/
|
||||
virtual already_AddRefed<gfxTextRun>
|
||||
MakeTextRun(const uint8_t *aString, uint32_t aLength,
|
||||
const Parameters *aParams, uint32_t aFlags,
|
||||
const Parameters *aParams,
|
||||
uint16_t aFlags, uint16_t aFlags2,
|
||||
gfxMissingFontRecorder *aMFR);
|
||||
|
||||
/**
|
||||
|
@ -882,13 +888,13 @@ public:
|
|||
MakeTextRun(const T* aString, uint32_t aLength,
|
||||
DrawTarget* aRefDrawTarget,
|
||||
int32_t aAppUnitsPerDevUnit,
|
||||
uint32_t aFlags,
|
||||
uint16_t aFlags, uint16_t aFlags2,
|
||||
gfxMissingFontRecorder *aMFR)
|
||||
{
|
||||
gfxTextRunFactory::Parameters params = {
|
||||
aRefDrawTarget, nullptr, nullptr, nullptr, 0, aAppUnitsPerDevUnit
|
||||
};
|
||||
return MakeTextRun(aString, aLength, ¶ms, aFlags, aMFR);
|
||||
return MakeTextRun(aString, aLength, ¶ms, aFlags, aFlags2, aMFR);
|
||||
}
|
||||
|
||||
// Get the (possibly-cached) width of the hyphen character.
|
||||
|
@ -969,7 +975,8 @@ public:
|
|||
// (which might use a different appUnitsPerDev value or flags) for the font
|
||||
// group, or until UpdateUserFonts is called, or the fontgroup is destroyed.
|
||||
// Get it/use it/forget it :) - don't keep a reference that might go stale.
|
||||
gfxTextRun* GetEllipsisTextRun(int32_t aAppUnitsPerDevPixel, uint32_t aFlags,
|
||||
gfxTextRun* GetEllipsisTextRun(int32_t aAppUnitsPerDevPixel,
|
||||
uint16_t aFlags,
|
||||
LazyReferenceDrawTargetGetter& aRefDrawTargetGetter);
|
||||
|
||||
protected:
|
||||
|
@ -1161,14 +1168,16 @@ protected:
|
|||
* call a font shaper to generate glyphs.
|
||||
*/
|
||||
already_AddRefed<gfxTextRun>
|
||||
MakeEmptyTextRun(const Parameters *aParams, uint32_t aFlags);
|
||||
MakeEmptyTextRun(const Parameters *aParams,
|
||||
uint16_t aFlags, uint16_t aFlags2);
|
||||
|
||||
already_AddRefed<gfxTextRun>
|
||||
MakeSpaceTextRun(const Parameters *aParams, uint32_t aFlags);
|
||||
MakeSpaceTextRun(const Parameters *aParams,
|
||||
uint16_t aFlags, uint16_t aFlags2);
|
||||
|
||||
already_AddRefed<gfxTextRun>
|
||||
MakeBlankTextRun(uint32_t aLength, const Parameters *aParams,
|
||||
uint32_t aFlags);
|
||||
uint16_t aFlags, uint16_t aFlags2);
|
||||
|
||||
// Initialize the list of fonts
|
||||
void BuildFontList();
|
||||
|
|
|
@ -6997,13 +6997,13 @@ nsLayoutUtils::GetReferenceFrame(nsIFrame* aFrame)
|
|||
}
|
||||
}
|
||||
|
||||
/* static */ uint32_t
|
||||
/* static */ uint16_t
|
||||
nsLayoutUtils::GetTextRunFlagsForStyle(nsStyleContext* aStyleContext,
|
||||
const nsStyleFont* aStyleFont,
|
||||
const nsStyleText* aStyleText,
|
||||
nscoord aLetterSpacing)
|
||||
{
|
||||
uint32_t result = 0;
|
||||
uint16_t result = 0;
|
||||
if (aLetterSpacing != 0 ||
|
||||
aStyleText->mTextJustify == StyleTextJustify::InterCharacter) {
|
||||
result |= gfxTextRunFactory::TEXT_DISABLE_OPTIONAL_LIGATURES;
|
||||
|
@ -7027,7 +7027,7 @@ nsLayoutUtils::GetTextRunFlagsForStyle(nsStyleContext* aStyleContext,
|
|||
return result | GetTextRunOrientFlagsForStyle(aStyleContext);
|
||||
}
|
||||
|
||||
/* static */ uint32_t
|
||||
/* static */ uint16_t
|
||||
nsLayoutUtils::GetTextRunOrientFlagsForStyle(nsStyleContext* aStyleContext)
|
||||
{
|
||||
uint8_t writingMode = aStyleContext->StyleVisibility()->mWritingMode;
|
||||
|
|
|
@ -1997,7 +1997,7 @@ public:
|
|||
* -- TEXT_OPTIMIZE_SPEED if the text-rendering CSS property and font size
|
||||
* and prefs indicate we should be optimizing for speed over quality
|
||||
*/
|
||||
static uint32_t GetTextRunFlagsForStyle(nsStyleContext* aStyleContext,
|
||||
static uint16_t GetTextRunFlagsForStyle(nsStyleContext* aStyleContext,
|
||||
const nsStyleFont* aStyleFont,
|
||||
const nsStyleText* aStyleText,
|
||||
nscoord aLetterSpacing);
|
||||
|
@ -2005,7 +2005,7 @@ public:
|
|||
/**
|
||||
* Get orientation flags for textrun construction.
|
||||
*/
|
||||
static uint32_t GetTextRunOrientFlagsForStyle(nsStyleContext* aStyleContext);
|
||||
static uint16_t GetTextRunOrientFlagsForStyle(nsStyleContext* aStyleContext);
|
||||
|
||||
/**
|
||||
* Takes two rectangles whose origins must be the same, and computes
|
||||
|
|
|
@ -542,7 +542,7 @@ MathMLTextRunFactory::RebuildTextRun(nsTransformedTextRun* aTextRun,
|
|||
bool mergeNeeded = false;
|
||||
|
||||
bool singleCharMI =
|
||||
aTextRun->GetFlags() & nsTextFrameUtils::TEXT_IS_SINGLE_CHAR_MI;
|
||||
aTextRun->GetFlags2() & nsTextFrameUtils::TEXT_IS_SINGLE_CHAR_MI;
|
||||
|
||||
uint32_t length = aTextRun->GetLength();
|
||||
const char16_t* str = aTextRun->mString.BeginReading();
|
||||
|
@ -710,7 +710,7 @@ MathMLTextRunFactory::RebuildTextRun(nsTransformedTextRun* aTextRun,
|
|||
}
|
||||
}
|
||||
|
||||
uint32_t flags;
|
||||
uint16_t flags;
|
||||
gfxTextRunFactory::Parameters innerParams =
|
||||
GetParametersForInner(aTextRun, &flags, aRefDrawTarget);
|
||||
|
||||
|
@ -760,12 +760,12 @@ MathMLTextRunFactory::RebuildTextRun(nsTransformedTextRun* aTextRun,
|
|||
if (mInnerTransformingTextRunFactory) {
|
||||
transformedChild = mInnerTransformingTextRunFactory->MakeTextRun(
|
||||
convertedString.BeginReading(), convertedString.Length(),
|
||||
&innerParams, newFontGroup, flags, Move(styleArray), false);
|
||||
&innerParams, newFontGroup, flags, 0, Move(styleArray), false);
|
||||
child = transformedChild.get();
|
||||
} else {
|
||||
cachedChild = newFontGroup->MakeTextRun(
|
||||
convertedString.BeginReading(), convertedString.Length(),
|
||||
&innerParams, flags, aMFR);
|
||||
&innerParams, flags, 0, aMFR);
|
||||
child = cachedChild.get();
|
||||
}
|
||||
if (!child)
|
||||
|
|
|
@ -101,6 +101,7 @@ EXPORTS += [
|
|||
'nsRubyTextFrame.h',
|
||||
'nsSplittableFrame.h',
|
||||
'nsSubDocumentFrame.h',
|
||||
'nsTextFrameUtils.h',
|
||||
'nsTextRunTransformations.h',
|
||||
'RubyUtils.h',
|
||||
'ScrollbarActivity.h',
|
||||
|
|
|
@ -259,7 +259,7 @@ static const nsFrameState TEXT_WHITESPACE_FLAGS =
|
|||
*/
|
||||
|
||||
/**
|
||||
* This is our user data for the textrun, when textRun->GetFlags() has
|
||||
* This is our user data for the textrun, when textRun->GetFlags2() has
|
||||
* TEXT_IS_SIMPLE_FLOW set, and also TEXT_MIGHT_HAVE_GLYPH_CHANGES.
|
||||
*
|
||||
* This allows having an array of observers if there are fonts whose glyphs
|
||||
|
@ -310,7 +310,7 @@ struct TextRunUserData {
|
|||
};
|
||||
|
||||
/**
|
||||
* This is our user data for the textrun, when textRun->GetFlags() does not
|
||||
* This is our user data for the textrun, when textRun->GetFlags2() does not
|
||||
* have TEXT_IS_SIMPLE_FLOW set and has the TEXT_MIGHT HAVE_GLYPH_CHANGES flag.
|
||||
*/
|
||||
struct ComplexTextRunUserData : public TextRunUserData {
|
||||
|
@ -510,12 +510,12 @@ static void
|
|||
DestroyTextRunUserData(gfxTextRun* aTextRun)
|
||||
{
|
||||
MOZ_ASSERT(aTextRun->GetUserData());
|
||||
if (aTextRun->GetFlags() & nsTextFrameUtils::TEXT_IS_SIMPLE_FLOW) {
|
||||
if (aTextRun->GetFlags() & nsTextFrameUtils::TEXT_MIGHT_HAVE_GLYPH_CHANGES) {
|
||||
if (aTextRun->GetFlags2() & nsTextFrameUtils::TEXT_IS_SIMPLE_FLOW) {
|
||||
if (aTextRun->GetFlags2() & nsTextFrameUtils::TEXT_MIGHT_HAVE_GLYPH_CHANGES) {
|
||||
delete static_cast<SimpleTextRunUserData*>(aTextRun->GetUserData());
|
||||
}
|
||||
} else {
|
||||
if (aTextRun->GetFlags() & nsTextFrameUtils::TEXT_MIGHT_HAVE_GLYPH_CHANGES) {
|
||||
if (aTextRun->GetFlags2() & nsTextFrameUtils::TEXT_MIGHT_HAVE_GLYPH_CHANGES) {
|
||||
DestroyComplexUserData(
|
||||
static_cast<ComplexTextRunUserData*>(aTextRun->GetUserData()));
|
||||
} else {
|
||||
|
@ -531,10 +531,10 @@ static TextRunMappedFlow*
|
|||
GetMappedFlows(const gfxTextRun* aTextRun)
|
||||
{
|
||||
MOZ_ASSERT(aTextRun->GetUserData(), "UserData must exist.");
|
||||
MOZ_ASSERT(!(aTextRun->GetFlags() & nsTextFrameUtils::TEXT_IS_SIMPLE_FLOW),
|
||||
MOZ_ASSERT(!(aTextRun->GetFlags2() & nsTextFrameUtils::TEXT_IS_SIMPLE_FLOW),
|
||||
"The method should not be called for simple flows.");
|
||||
TextRunMappedFlow* flows;
|
||||
if (aTextRun->GetFlags() & nsTextFrameUtils::TEXT_MIGHT_HAVE_GLYPH_CHANGES) {
|
||||
if (aTextRun->GetFlags2() & nsTextFrameUtils::TEXT_MIGHT_HAVE_GLYPH_CHANGES) {
|
||||
flows = reinterpret_cast<TextRunMappedFlow*>(
|
||||
static_cast<ComplexTextRunUserData*>(aTextRun->GetUserData()) + 1);
|
||||
} else {
|
||||
|
@ -554,9 +554,9 @@ GetMappedFlows(const gfxTextRun* aTextRun)
|
|||
static nsTextFrame*
|
||||
GetFrameForSimpleFlow(const gfxTextRun* aTextRun)
|
||||
{
|
||||
MOZ_ASSERT(aTextRun->GetFlags() & nsTextFrameUtils::TEXT_IS_SIMPLE_FLOW,
|
||||
MOZ_ASSERT(aTextRun->GetFlags2() & nsTextFrameUtils::TEXT_IS_SIMPLE_FLOW,
|
||||
"Not so simple flow?");
|
||||
if (aTextRun->GetFlags() & nsTextFrameUtils::TEXT_MIGHT_HAVE_GLYPH_CHANGES) {
|
||||
if (aTextRun->GetFlags2() & nsTextFrameUtils::TEXT_MIGHT_HAVE_GLYPH_CHANGES) {
|
||||
return static_cast<SimpleTextRunUserData*>(aTextRun->GetUserData())->mFrame;
|
||||
}
|
||||
|
||||
|
@ -620,7 +620,7 @@ UnhookTextRunFromFrames(gfxTextRun* aTextRun, nsTextFrame* aStartContinuation)
|
|||
return;
|
||||
}
|
||||
|
||||
if (aTextRun->GetFlags() & nsTextFrameUtils::TEXT_IS_SIMPLE_FLOW) {
|
||||
if (aTextRun->GetFlags2() & nsTextFrameUtils::TEXT_IS_SIMPLE_FLOW) {
|
||||
nsTextFrame* userDataFrame = GetFrameForSimpleFlow(aTextRun);
|
||||
nsFrameState whichTextRunState =
|
||||
userDataFrame->GetTextRun(nsTextFrame::eInflated) == aTextRun
|
||||
|
@ -702,7 +702,7 @@ InvalidateFrameDueToGlyphsChanged(nsIFrame* aFrame)
|
|||
void
|
||||
GlyphObserver::NotifyGlyphsChanged()
|
||||
{
|
||||
if (mTextRun->GetFlags() & nsTextFrameUtils::TEXT_IS_SIMPLE_FLOW) {
|
||||
if (mTextRun->GetFlags2() & nsTextFrameUtils::TEXT_IS_SIMPLE_FLOW) {
|
||||
InvalidateFrameDueToGlyphsChanged(GetFrameForSimpleFlow(mTextRun));
|
||||
return;
|
||||
}
|
||||
|
@ -897,11 +897,11 @@ IsAllWhitespace(const nsTextFragment* aFrag, bool aAllowNewline)
|
|||
static void
|
||||
ClearObserversFromTextRun(gfxTextRun* aTextRun)
|
||||
{
|
||||
if (!(aTextRun->GetFlags() & nsTextFrameUtils::TEXT_MIGHT_HAVE_GLYPH_CHANGES)) {
|
||||
if (!(aTextRun->GetFlags2() & nsTextFrameUtils::TEXT_MIGHT_HAVE_GLYPH_CHANGES)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (aTextRun->GetFlags() & nsTextFrameUtils::TEXT_IS_SIMPLE_FLOW) {
|
||||
if (aTextRun->GetFlags2() & nsTextFrameUtils::TEXT_IS_SIMPLE_FLOW) {
|
||||
static_cast<SimpleTextRunUserData*>(aTextRun->GetUserData())
|
||||
->mGlyphObservers.Clear();
|
||||
} else {
|
||||
|
@ -940,10 +940,10 @@ CreateObserversForAnimatedGlyphs(gfxTextRun* aTextRun)
|
|||
|
||||
nsTArray<UniquePtr<GlyphObserver>>* observers;
|
||||
|
||||
if (aTextRun->GetFlags() & nsTextFrameUtils::TEXT_IS_SIMPLE_FLOW) {
|
||||
if (aTextRun->GetFlags2() & nsTextFrameUtils::TEXT_IS_SIMPLE_FLOW) {
|
||||
// Swap the frame pointer for a just-allocated SimpleTextRunUserData if
|
||||
// appropriate.
|
||||
if (!(aTextRun->GetFlags() & nsTextFrameUtils::TEXT_MIGHT_HAVE_GLYPH_CHANGES)) {
|
||||
if (!(aTextRun->GetFlags2() & nsTextFrameUtils::TEXT_MIGHT_HAVE_GLYPH_CHANGES)) {
|
||||
auto frame = static_cast<nsTextFrame*>(aTextRun->GetUserData());
|
||||
aTextRun->SetUserData(new SimpleTextRunUserData(frame));
|
||||
}
|
||||
|
@ -952,7 +952,7 @@ CreateObserversForAnimatedGlyphs(gfxTextRun* aTextRun)
|
|||
static_cast<SimpleTextRunUserData*>(aTextRun->GetUserData());
|
||||
observers = &data->mGlyphObservers;
|
||||
} else {
|
||||
if (!(aTextRun->GetFlags() & nsTextFrameUtils::TEXT_MIGHT_HAVE_GLYPH_CHANGES)) {
|
||||
if (!(aTextRun->GetFlags2() & nsTextFrameUtils::TEXT_MIGHT_HAVE_GLYPH_CHANGES)) {
|
||||
auto oldData = static_cast<TextRunUserData*>(aTextRun->GetUserData());
|
||||
TextRunMappedFlow* oldMappedFlows = GetMappedFlows(aTextRun);
|
||||
ComplexTextRunUserData* data =
|
||||
|
@ -1109,9 +1109,9 @@ public:
|
|||
|
||||
virtual void SetCapitalization(uint32_t aOffset, uint32_t aLength,
|
||||
bool* aCapitalize) override {
|
||||
MOZ_ASSERT(mTextRun->GetFlags() & nsTextFrameUtils::TEXT_IS_TRANSFORMED,
|
||||
MOZ_ASSERT(mTextRun->GetFlags2() & nsTextFrameUtils::TEXT_IS_TRANSFORMED,
|
||||
"Text run should be transformed!");
|
||||
if (mTextRun->GetFlags() & nsTextFrameUtils::TEXT_IS_TRANSFORMED) {
|
||||
if (mTextRun->GetFlags2() & nsTextFrameUtils::TEXT_IS_TRANSFORMED) {
|
||||
nsTransformedTextRun* transformedTextRun =
|
||||
static_cast<nsTransformedTextRun*>(mTextRun.get());
|
||||
transformedTextRun->SetCapitalization(aOffset + mOffsetIntoTextRun, aLength,
|
||||
|
@ -1120,9 +1120,9 @@ public:
|
|||
}
|
||||
|
||||
void Finish(gfxMissingFontRecorder* aMFR) {
|
||||
MOZ_ASSERT(!(mTextRun->GetFlags() & nsTextFrameUtils::TEXT_UNUSED_FLAG),
|
||||
MOZ_ASSERT(!(mTextRun->GetFlags2() & nsTextFrameUtils::TEXT_UNUSED_FLAG),
|
||||
"Flag set that should never be set! (memory safety error?)");
|
||||
if (mTextRun->GetFlags() & nsTextFrameUtils::TEXT_IS_TRANSFORMED) {
|
||||
if (mTextRun->GetFlags2() & nsTextFrameUtils::TEXT_IS_TRANSFORMED) {
|
||||
nsTransformedTextRun* transformedTextRun =
|
||||
static_cast<nsTransformedTextRun*>(mTextRun.get());
|
||||
transformedTextRun->FinishSettingProperties(mDrawTarget, aMFR);
|
||||
|
@ -1572,7 +1572,7 @@ ExpandBuffer(char16_t* aDest, uint8_t* aSrc, uint32_t aCount)
|
|||
bool
|
||||
BuildTextRunsScanner::IsTextRunValidForMappedFlows(const gfxTextRun* aTextRun)
|
||||
{
|
||||
if (aTextRun->GetFlags() & nsTextFrameUtils::TEXT_IS_SIMPLE_FLOW) {
|
||||
if (aTextRun->GetFlags2() & nsTextFrameUtils::TEXT_IS_SIMPLE_FLOW) {
|
||||
return mMappedFlows.Length() == 1 &&
|
||||
mMappedFlows[0].mStartFrame == GetFrameForSimpleFlow(aTextRun) &&
|
||||
mMappedFlows[0].mEndFrame == nullptr;
|
||||
|
@ -1600,7 +1600,7 @@ void BuildTextRunsScanner::FlushFrames(bool aFlushLineBreaks, bool aSuppressTrai
|
|||
RefPtr<gfxTextRun> textRun;
|
||||
if (!mMappedFlows.IsEmpty()) {
|
||||
if (!mSkipIncompleteTextRuns && mCurrentFramesAllSameTextRun &&
|
||||
((mCurrentFramesAllSameTextRun->GetFlags() & nsTextFrameUtils::TEXT_INCOMING_WHITESPACE) != 0) ==
|
||||
((mCurrentFramesAllSameTextRun->GetFlags2() & nsTextFrameUtils::TEXT_INCOMING_WHITESPACE) != 0) ==
|
||||
((mCurrentRunContextInfo & nsTextFrameUtils::INCOMING_WHITESPACE) != 0) &&
|
||||
((mCurrentFramesAllSameTextRun->GetFlags() & gfxTextRunFactory::TEXT_INCOMING_ARABICCHAR) != 0) ==
|
||||
((mCurrentRunContextInfo & nsTextFrameUtils::INCOMING_ARABICCHAR) != 0) &&
|
||||
|
@ -1615,7 +1615,7 @@ void BuildTextRunsScanner::FlushFrames(bool aFlushLineBreaks, bool aSuppressTrai
|
|||
|
||||
// Update mNextRunContextInfo appropriately
|
||||
mNextRunContextInfo = nsTextFrameUtils::INCOMING_NONE;
|
||||
if (textRun->GetFlags() & nsTextFrameUtils::TEXT_TRAILING_WHITESPACE) {
|
||||
if (textRun->GetFlags2() & nsTextFrameUtils::TEXT_TRAILING_WHITESPACE) {
|
||||
mNextRunContextInfo |= nsTextFrameUtils::INCOMING_WHITESPACE;
|
||||
}
|
||||
if (textRun->GetFlags() & gfxTextRunFactory::TEXT_TRAILING_ARABICCHAR) {
|
||||
|
@ -1759,7 +1759,7 @@ WordSpacing(nsIFrame* aFrame, const gfxTextRun* aTextRun,
|
|||
|
||||
// Returns gfxTextRunFactory::TEXT_ENABLE_SPACING if non-standard
|
||||
// letter-spacing or word-spacing is present.
|
||||
static uint32_t
|
||||
static uint16_t
|
||||
GetSpacingFlags(nsIFrame* aFrame, const nsStyleText* aStyleText = nullptr)
|
||||
{
|
||||
if (nsSVGUtils::IsInSVGTextSubtree(aFrame)) {
|
||||
|
@ -2023,13 +2023,14 @@ BuildTextRunsScanner::BuildTextRunForFrames(void* aTextBuffer)
|
|||
bool anyTextEmphasis = false;
|
||||
uint8_t sstyScriptLevel = 0;
|
||||
uint32_t mathFlags = 0;
|
||||
uint32_t textFlags = nsTextFrameUtils::TEXT_NO_BREAKS;
|
||||
uint16_t flags = 0;
|
||||
uint16_t flags2 = nsTextFrameUtils::TEXT_NO_BREAKS;
|
||||
|
||||
if (mCurrentRunContextInfo & nsTextFrameUtils::INCOMING_WHITESPACE) {
|
||||
textFlags |= nsTextFrameUtils::TEXT_INCOMING_WHITESPACE;
|
||||
flags2 |= nsTextFrameUtils::TEXT_INCOMING_WHITESPACE;
|
||||
}
|
||||
if (mCurrentRunContextInfo & nsTextFrameUtils::INCOMING_ARABICCHAR) {
|
||||
textFlags |= gfxTextRunFactory::TEXT_INCOMING_ARABICCHAR;
|
||||
flags |= gfxTextRunFactory::TEXT_INCOMING_ARABICCHAR;
|
||||
}
|
||||
|
||||
AutoTArray<int32_t,50> textBreakPoints;
|
||||
|
@ -2081,12 +2082,12 @@ BuildTextRunsScanner::BuildTextRunForFrames(void* aTextBuffer)
|
|||
if (textStyle->HasTextEmphasis()) {
|
||||
anyTextEmphasis = true;
|
||||
}
|
||||
textFlags |= GetSpacingFlags(f);
|
||||
flags |= GetSpacingFlags(f);
|
||||
nsTextFrameUtils::CompressionMode compression =
|
||||
GetCSSWhitespaceToCompressionMode(f, textStyle);
|
||||
if ((enabledJustification || f->ShouldSuppressLineBreak()) &&
|
||||
!textStyle->WhiteSpaceIsSignificant() && !isSVG) {
|
||||
textFlags |= gfxTextRunFactory::TEXT_ENABLE_SPACING;
|
||||
flags |= gfxTextRunFactory::TEXT_ENABLE_SPACING;
|
||||
}
|
||||
fontStyle = f->StyleFont();
|
||||
nsIFrame* parent = mLineContainer->GetParent();
|
||||
|
@ -2095,7 +2096,7 @@ BuildTextRunsScanner::BuildTextRunForFrames(void* aTextBuffer)
|
|||
anyMathMLStyling = true;
|
||||
}
|
||||
} else if (mLineContainer->GetStateBits() & NS_FRAME_IS_IN_SINGLE_CHAR_MI) {
|
||||
textFlags |= nsTextFrameUtils::TEXT_IS_SINGLE_CHAR_MI;
|
||||
flags2 |= nsTextFrameUtils::TEXT_IS_SINGLE_CHAR_MI;
|
||||
anyMathMLStyling = true;
|
||||
// Test for fontstyle attribute as StyleFont() may not be accurate
|
||||
// To be consistent in terms of ignoring CSS style changes, fontweight
|
||||
|
@ -2122,7 +2123,7 @@ BuildTextRunsScanner::BuildTextRunForFrames(void* aTextBuffer)
|
|||
// All MathML tokens except <mtext> use 'math' script.
|
||||
if (!(parent && parent->GetContent() &&
|
||||
parent->GetContent()->IsMathMLElement(nsGkAtoms::mtext_))) {
|
||||
textFlags |= gfxTextRunFactory::TEXT_USE_MATH_SCRIPT;
|
||||
flags |= gfxTextRunFactory::TEXT_USE_MATH_SCRIPT;
|
||||
}
|
||||
nsIMathMLFrame* mathFrame = do_QueryFrame(parent);
|
||||
if (mathFrame) {
|
||||
|
@ -2178,7 +2179,7 @@ BuildTextRunsScanner::BuildTextRunForFrames(void* aTextBuffer)
|
|||
nextBreakBeforeFrame = GetNextBreakBeforeFrame(&nextBreakIndex);
|
||||
}
|
||||
|
||||
uint32_t analysisFlags;
|
||||
uint16_t analysisFlags;
|
||||
if (frag->Is2b()) {
|
||||
NS_ASSERTION(mDoubleByteText, "Wrong buffer char size!");
|
||||
char16_t* bufStart = static_cast<char16_t*>(aTextBuffer);
|
||||
|
@ -2213,12 +2214,12 @@ BuildTextRunsScanner::BuildTextRunForFrames(void* aTextBuffer)
|
|||
currentTransformedTextOffset = end - static_cast<const uint8_t*>(textPtr);
|
||||
}
|
||||
}
|
||||
textFlags |= analysisFlags;
|
||||
flags2 |= analysisFlags;
|
||||
}
|
||||
|
||||
void* finalUserData;
|
||||
if (userData == &dummyData) {
|
||||
textFlags |= nsTextFrameUtils::TEXT_IS_SIMPLE_FLOW;
|
||||
flags2 |= nsTextFrameUtils::TEXT_IS_SIMPLE_FLOW;
|
||||
userData = nullptr;
|
||||
finalUserData = mMappedFlows[0].mStartFrame;
|
||||
} else {
|
||||
|
@ -2242,30 +2243,30 @@ BuildTextRunsScanner::BuildTextRunForFrames(void* aTextBuffer)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
if (textFlags & nsTextFrameUtils::TEXT_HAS_TAB) {
|
||||
textFlags |= gfxTextRunFactory::TEXT_ENABLE_SPACING;
|
||||
if (flags2 & nsTextFrameUtils::TEXT_HAS_TAB) {
|
||||
flags |= gfxTextRunFactory::TEXT_ENABLE_SPACING;
|
||||
}
|
||||
if (textFlags & nsTextFrameUtils::TEXT_HAS_SHY) {
|
||||
textFlags |= gfxTextRunFactory::TEXT_ENABLE_HYPHEN_BREAKS;
|
||||
if (flags2 & nsTextFrameUtils::TEXT_HAS_SHY) {
|
||||
flags |= gfxTextRunFactory::TEXT_ENABLE_HYPHEN_BREAKS;
|
||||
}
|
||||
if (mBidiEnabled && (IS_LEVEL_RTL(firstFrame->GetEmbeddingLevel()))) {
|
||||
textFlags |= gfxTextRunFactory::TEXT_IS_RTL;
|
||||
flags |= gfxTextRunFactory::TEXT_IS_RTL;
|
||||
}
|
||||
if (mNextRunContextInfo & nsTextFrameUtils::INCOMING_WHITESPACE) {
|
||||
textFlags |= nsTextFrameUtils::TEXT_TRAILING_WHITESPACE;
|
||||
flags2 |= nsTextFrameUtils::TEXT_TRAILING_WHITESPACE;
|
||||
}
|
||||
if (mNextRunContextInfo & nsTextFrameUtils::INCOMING_ARABICCHAR) {
|
||||
textFlags |= gfxTextRunFactory::TEXT_TRAILING_ARABICCHAR;
|
||||
flags |= gfxTextRunFactory::TEXT_TRAILING_ARABICCHAR;
|
||||
}
|
||||
// ContinueTextRunAcrossFrames guarantees that it doesn't matter which
|
||||
// frame's style is used, so we use a mixture of the first frame and
|
||||
// last frame's style
|
||||
textFlags |= nsLayoutUtils::GetTextRunFlagsForStyle(lastStyleContext,
|
||||
flags |= nsLayoutUtils::GetTextRunFlagsForStyle(lastStyleContext,
|
||||
fontStyle, textStyle, LetterSpacing(firstFrame, textStyle));
|
||||
// XXX this is a bit of a hack. For performance reasons, if we're favouring
|
||||
// performance over quality, don't try to get accurate glyph extents.
|
||||
if (!(textFlags & gfxTextRunFactory::TEXT_OPTIMIZE_SPEED)) {
|
||||
textFlags |= gfxTextRunFactory::TEXT_NEED_BOUNDING_BOX;
|
||||
if (!(flags & gfxTextRunFactory::TEXT_OPTIMIZE_SPEED)) {
|
||||
flags |= gfxTextRunFactory::TEXT_NEED_BOUNDING_BOX;
|
||||
}
|
||||
|
||||
// Convert linebreak coordinates to transformed string offsets
|
||||
|
@ -2321,7 +2322,7 @@ BuildTextRunsScanner::BuildTextRunForFrames(void* aTextBuffer)
|
|||
}
|
||||
}
|
||||
}
|
||||
textFlags |= nsTextFrameUtils::TEXT_IS_TRANSFORMED;
|
||||
flags2 |= nsTextFrameUtils::TEXT_IS_TRANSFORMED;
|
||||
NS_ASSERTION(iter.GetSkippedOffset() == transformedLength,
|
||||
"We didn't cover all the characters in the text run!");
|
||||
}
|
||||
|
@ -2337,7 +2338,7 @@ BuildTextRunsScanner::BuildTextRunForFrames(void* aTextBuffer)
|
|||
const char16_t* text = static_cast<const char16_t*>(textPtr);
|
||||
if (transformingFactory) {
|
||||
textRun = transformingFactory->MakeTextRun(text, transformedLength,
|
||||
¶ms, fontGroup, textFlags,
|
||||
¶ms, fontGroup, flags, flags2,
|
||||
Move(styles), true);
|
||||
if (textRun) {
|
||||
// ownership of the factory has passed to the textrun
|
||||
|
@ -2347,14 +2348,14 @@ BuildTextRunsScanner::BuildTextRunForFrames(void* aTextBuffer)
|
|||
}
|
||||
} else {
|
||||
textRun = fontGroup->MakeTextRun(text, transformedLength, ¶ms,
|
||||
textFlags, mMissingFonts);
|
||||
flags, flags2, mMissingFonts);
|
||||
}
|
||||
} else {
|
||||
const uint8_t* text = static_cast<const uint8_t*>(textPtr);
|
||||
textFlags |= gfxFontGroup::TEXT_IS_8BIT;
|
||||
flags |= gfxFontGroup::TEXT_IS_8BIT;
|
||||
if (transformingFactory) {
|
||||
textRun = transformingFactory->MakeTextRun(text, transformedLength,
|
||||
¶ms, fontGroup, textFlags,
|
||||
¶ms, fontGroup, flags, flags2,
|
||||
Move(styles), true);
|
||||
if (textRun) {
|
||||
// ownership of the factory has passed to the textrun
|
||||
|
@ -2364,7 +2365,7 @@ BuildTextRunsScanner::BuildTextRunForFrames(void* aTextBuffer)
|
|||
}
|
||||
} else {
|
||||
textRun = fontGroup->MakeTextRun(text, transformedLength, ¶ms,
|
||||
textFlags, mMissingFonts);
|
||||
flags, flags2, mMissingFonts);
|
||||
}
|
||||
}
|
||||
if (!textRun) {
|
||||
|
@ -2472,7 +2473,7 @@ BuildTextRunsScanner::SetupLineBreakerContext(gfxTextRun *aTextRun)
|
|||
nextBreakBeforeFrame = GetNextBreakBeforeFrame(&nextBreakIndex);
|
||||
}
|
||||
|
||||
uint32_t analysisFlags;
|
||||
uint16_t analysisFlags;
|
||||
if (frag->Is2b()) {
|
||||
NS_ASSERTION(mDoubleByteText, "Wrong buffer char size!");
|
||||
char16_t* bufStart = static_cast<char16_t*>(textPtr);
|
||||
|
@ -2591,7 +2592,7 @@ BuildTextRunsScanner::SetupBreakSinksForTextRun(gfxTextRun* aTextRun,
|
|||
if (!textStyle->WhiteSpaceCanWrap(startFrame)) {
|
||||
flags |= nsLineBreaker::BREAK_SUPPRESS_INSIDE;
|
||||
}
|
||||
if (aTextRun->GetFlags() & nsTextFrameUtils::TEXT_NO_BREAKS) {
|
||||
if (aTextRun->GetFlags2() & nsTextFrameUtils::TEXT_NO_BREAKS) {
|
||||
flags |= nsLineBreaker::BREAK_SKIP_SETTING_NO_BREAKS;
|
||||
}
|
||||
if (textStyle->mTextTransform == NS_STYLE_TEXT_TRANSFORM_CAPITALIZE) {
|
||||
|
@ -2740,7 +2741,7 @@ BuildTextRunsScanner::AssignTextRun(gfxTextRun* aTextRun, float aInflation)
|
|||
#ifdef DEBUG_roc
|
||||
if (f->GetTextRun(mWhichTextRun)) {
|
||||
gfxTextRun* textRun = f->GetTextRun(mWhichTextRun);
|
||||
if (textRun->GetFlags() & nsTextFrameUtils::TEXT_IS_SIMPLE_FLOW) {
|
||||
if (textRun->GetFlags2() & nsTextFrameUtils::TEXT_IS_SIMPLE_FLOW) {
|
||||
if (mMappedFlows[0].mStartFrame != GetFrameForSimpleFlow(textRun)) {
|
||||
NS_WARNING("REASSIGNING SIMPLE FLOW TEXT RUN!");
|
||||
}
|
||||
|
@ -2760,7 +2761,7 @@ BuildTextRunsScanner::AssignTextRun(gfxTextRun* aTextRun, float aInflation)
|
|||
if (oldTextRun) {
|
||||
nsTextFrame* firstFrame = nullptr;
|
||||
uint32_t startOffset = 0;
|
||||
if (oldTextRun->GetFlags() & nsTextFrameUtils::TEXT_IS_SIMPLE_FLOW) {
|
||||
if (oldTextRun->GetFlags2() & nsTextFrameUtils::TEXT_IS_SIMPLE_FLOW) {
|
||||
firstFrame = GetFrameForSimpleFlow(oldTextRun);
|
||||
} else {
|
||||
auto userData = static_cast<TextRunUserData*>(oldTextRun->GetUserData());
|
||||
|
@ -2844,7 +2845,7 @@ nsTextFrame::EnsureTextRun(TextRunType aWhichTextRun,
|
|||
}
|
||||
}
|
||||
|
||||
if (textRun->GetFlags() & nsTextFrameUtils::TEXT_IS_SIMPLE_FLOW) {
|
||||
if (textRun->GetFlags2() & nsTextFrameUtils::TEXT_IS_SIMPLE_FLOW) {
|
||||
if (aFlowEndInTextRun) {
|
||||
*aFlowEndInTextRun = textRun->GetLength();
|
||||
}
|
||||
|
@ -3354,7 +3355,7 @@ void
|
|||
PropertyProvider::GetSpacing(Range aRange, Spacing* aSpacing) const
|
||||
{
|
||||
GetSpacingInternal(aRange, aSpacing,
|
||||
(mTextRun->GetFlags() & nsTextFrameUtils::TEXT_HAS_TAB) == 0);
|
||||
(mTextRun->GetFlags2() & nsTextFrameUtils::TEXT_HAS_TAB) == 0);
|
||||
}
|
||||
|
||||
static bool
|
||||
|
@ -5487,14 +5488,14 @@ GenerateTextRunForEmphasisMarks(nsTextFrame* aFrame,
|
|||
const nsString& emphasisString = aStyleText->mTextEmphasisStyleString;
|
||||
RefPtr<DrawTarget> dt = CreateReferenceDrawTarget(aFrame);
|
||||
auto appUnitsPerDevUnit = aFrame->PresContext()->AppUnitsPerDevPixel();
|
||||
uint32_t flags = nsLayoutUtils::GetTextRunOrientFlagsForStyle(aStyleContext);
|
||||
uint16_t flags = nsLayoutUtils::GetTextRunOrientFlagsForStyle(aStyleContext);
|
||||
if (flags == gfxTextRunFactory::TEXT_ORIENT_VERTICAL_MIXED) {
|
||||
// The emphasis marks should always be rendered upright per spec.
|
||||
flags = gfxTextRunFactory::TEXT_ORIENT_VERTICAL_UPRIGHT;
|
||||
}
|
||||
return aFontMetrics->GetThebesFontGroup()->
|
||||
MakeTextRun<char16_t>(emphasisString.get(), emphasisString.Length(),
|
||||
dt, appUnitsPerDevUnit, flags, nullptr);
|
||||
dt, appUnitsPerDevUnit, flags, 0, nullptr);
|
||||
}
|
||||
|
||||
static nsRubyFrame*
|
||||
|
@ -8363,7 +8364,7 @@ nsTextFrame::AddInlineMinISizeForFlow(nsRenderingContext *aRenderingContext,
|
|||
bool hyphenating = frag->GetLength() > 0 &&
|
||||
(textStyle->mHyphens == StyleHyphens::Auto ||
|
||||
(textStyle->mHyphens == StyleHyphens::Manual &&
|
||||
(textRun->GetFlags() & gfxTextRunFactory::TEXT_ENABLE_HYPHEN_BREAKS) != 0));
|
||||
(textRun->GetFlags2() & gfxTextRunFactory::TEXT_ENABLE_HYPHEN_BREAKS) != 0));
|
||||
if (hyphenating) {
|
||||
gfxSkipCharsIterator tmp(iter);
|
||||
len = std::min<int32_t>(GetContentOffset() + GetInFlowContentLength(),
|
||||
|
@ -8456,7 +8457,7 @@ nsTextFrame::AddInlineMinISizeForFlow(nsRenderingContext *aRenderingContext,
|
|||
wordStart = i + 1;
|
||||
} else if (i < flowEndInTextRun ||
|
||||
(i == textRun->GetLength() &&
|
||||
(textRun->GetFlags() & nsTextFrameUtils::TEXT_HAS_TRAILING_BREAK))) {
|
||||
(textRun->GetFlags2() & nsTextFrameUtils::TEXT_HAS_TRAILING_BREAK))) {
|
||||
if (preformattedNewline) {
|
||||
aData->ForceBreak();
|
||||
} else if (i < flowEndInTextRun && hyphenating &&
|
||||
|
@ -8770,7 +8771,7 @@ HasSoftHyphenBefore(const nsTextFragment* aFrag, const gfxTextRun* aTextRun,
|
|||
aTextRun->CanHyphenateBefore(aIter.GetSkippedOffset())) {
|
||||
return true;
|
||||
}
|
||||
if (!(aTextRun->GetFlags() & nsTextFrameUtils::TEXT_HAS_SHY))
|
||||
if (!(aTextRun->GetFlags2() & nsTextFrameUtils::TEXT_HAS_SHY))
|
||||
return false;
|
||||
gfxSkipCharsIterator iter = aIter;
|
||||
while (iter.GetOriginalOffset() > aStartOffset) {
|
||||
|
@ -9248,7 +9249,7 @@ nsTextFrame::ReflowText(nsLineLayout& aLineLayout, nscoord aAvailableWidth,
|
|||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
iter.SetOriginalOffset(offset);
|
||||
nscoord xOffsetForTabs = (mTextRun->GetFlags() & nsTextFrameUtils::TEXT_HAS_TAB) ?
|
||||
nscoord xOffsetForTabs = (mTextRun->GetFlags2() & nsTextFrameUtils::TEXT_HAS_TAB) ?
|
||||
(aLineLayout.GetCurrentFrameInlineDistanceFromBlock() -
|
||||
lineContainer->GetUsedBorderAndPadding().left)
|
||||
: -1;
|
||||
|
@ -9543,7 +9544,7 @@ nsTextFrame::ReflowText(nsLineLayout& aLineLayout, nscoord aAvailableWidth,
|
|||
bool emptyTextAtStartOfLine = atStartOfLine && length == 0;
|
||||
if (!breakAfter && charsFit == length && !emptyTextAtStartOfLine &&
|
||||
transformedOffset + transformedLength == mTextRun->GetLength() &&
|
||||
(mTextRun->GetFlags() & nsTextFrameUtils::TEXT_HAS_TRAILING_BREAK)) {
|
||||
(mTextRun->GetFlags2() & nsTextFrameUtils::TEXT_HAS_TRAILING_BREAK)) {
|
||||
// We placed all the text in the textrun and we have a break opportunity
|
||||
// at the end of the textrun. We need to record it because the following
|
||||
// content may not care about nsLineBreaker.
|
||||
|
@ -9773,8 +9774,8 @@ static void TransformChars(nsTextFrame* aFrame, const nsStyleText* aStyle,
|
|||
}
|
||||
|
||||
if (aStyle->mTextTransform != NS_STYLE_TEXT_TRANSFORM_NONE) {
|
||||
MOZ_ASSERT(aTextRun->GetFlags() & nsTextFrameUtils::TEXT_IS_TRANSFORMED);
|
||||
if (aTextRun->GetFlags() & nsTextFrameUtils::TEXT_IS_TRANSFORMED) {
|
||||
MOZ_ASSERT(aTextRun->GetFlags2() & nsTextFrameUtils::TEXT_IS_TRANSFORMED);
|
||||
if (aTextRun->GetFlags2() & nsTextFrameUtils::TEXT_IS_TRANSFORMED) {
|
||||
// Apply text-transform according to style in the transformed run.
|
||||
auto transformedTextRun =
|
||||
static_cast<const nsTransformedTextRun*>(aTextRun);
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
using namespace mozilla;
|
||||
|
||||
static bool
|
||||
IsDiscardable(char16_t ch, uint32_t* aFlags)
|
||||
IsDiscardable(char16_t ch, uint16_t* aFlags)
|
||||
{
|
||||
// Unlike IS_DISCARDABLE, we don't discard \r. \r will be ignored by gfxTextRun
|
||||
// and discarding it would force us to copy text in many cases of preformatted
|
||||
|
@ -29,7 +29,7 @@ IsDiscardable(char16_t ch, uint32_t* aFlags)
|
|||
}
|
||||
|
||||
static bool
|
||||
IsDiscardable(uint8_t ch, uint32_t* aFlags)
|
||||
IsDiscardable(uint8_t ch, uint16_t* aFlags)
|
||||
{
|
||||
if (ch == CH_SHY) {
|
||||
*aFlags |= nsTextFrameUtils::TEXT_HAS_SHY;
|
||||
|
@ -93,7 +93,7 @@ TransformWhiteSpaces(const CharT* aText, uint32_t aLength,
|
|||
bool aHasSegmentBreak,
|
||||
bool& aInWhitespace,
|
||||
CharT* aOutput,
|
||||
uint32_t& aFlags,
|
||||
uint16_t& aFlags,
|
||||
nsTextFrameUtils::CompressionMode aCompression,
|
||||
gfxSkipChars* aSkipChars)
|
||||
{
|
||||
|
@ -209,9 +209,9 @@ nsTextFrameUtils::TransformText(const CharT* aText, uint32_t aLength,
|
|||
CompressionMode aCompression,
|
||||
uint8_t* aIncomingFlags,
|
||||
gfxSkipChars* aSkipChars,
|
||||
uint32_t* aAnalysisFlags)
|
||||
uint16_t* aAnalysisFlags)
|
||||
{
|
||||
uint32_t flags = 0;
|
||||
uint16_t flags = 0;
|
||||
CharT* outputStart = aOutput;
|
||||
#ifdef DEBUG
|
||||
int32_t skipCharsOffset = aSkipChars->GetOriginalCharCount();
|
||||
|
@ -358,14 +358,14 @@ nsTextFrameUtils::TransformText(const uint8_t* aText, uint32_t aLength,
|
|||
CompressionMode aCompression,
|
||||
uint8_t* aIncomingFlags,
|
||||
gfxSkipChars* aSkipChars,
|
||||
uint32_t* aAnalysisFlags);
|
||||
uint16_t* aAnalysisFlags);
|
||||
template char16_t*
|
||||
nsTextFrameUtils::TransformText(const char16_t* aText, uint32_t aLength,
|
||||
char16_t* aOutput,
|
||||
CompressionMode aCompression,
|
||||
uint8_t* aIncomingFlags,
|
||||
gfxSkipChars* aSkipChars,
|
||||
uint32_t* aAnalysisFlags);
|
||||
uint16_t* aAnalysisFlags);
|
||||
template bool
|
||||
nsTextFrameUtils::IsSkippableCharacterForTransformText(uint8_t aChar);
|
||||
template bool
|
||||
|
|
|
@ -26,41 +26,49 @@ public:
|
|||
// The following flags are set by TransformText
|
||||
|
||||
// the text has at least one untransformed tab character
|
||||
TEXT_HAS_TAB = 0x010000,
|
||||
TEXT_HAS_TAB = 0x01,
|
||||
// the original text has at least one soft hyphen character
|
||||
TEXT_HAS_SHY = 0x020000,
|
||||
TEXT_WAS_TRANSFORMED = 0x040000,
|
||||
TEXT_UNUSED_FLAG = 0x080000,
|
||||
TEXT_HAS_SHY = 0x02,
|
||||
TEXT_WAS_TRANSFORMED = 0x04,
|
||||
TEXT_UNUSED_FLAG = 0x08,
|
||||
|
||||
// The following flags are set by nsTextFrame
|
||||
|
||||
TEXT_IS_SIMPLE_FLOW = 0x100000,
|
||||
TEXT_INCOMING_WHITESPACE = 0x200000,
|
||||
TEXT_TRAILING_WHITESPACE = 0x400000,
|
||||
TEXT_COMPRESSED_LEADING_WHITESPACE = 0x800000,
|
||||
TEXT_NO_BREAKS = 0x1000000,
|
||||
TEXT_IS_TRANSFORMED = 0x2000000,
|
||||
TEXT_IS_SIMPLE_FLOW = 0x10,
|
||||
TEXT_INCOMING_WHITESPACE = 0x20,
|
||||
TEXT_TRAILING_WHITESPACE = 0x40,
|
||||
TEXT_COMPRESSED_LEADING_WHITESPACE = 0x80,
|
||||
TEXT_NO_BREAKS = 0x100,
|
||||
TEXT_IS_TRANSFORMED = 0x200,
|
||||
// This gets set if there's a break opportunity at the end of the textrun.
|
||||
// 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
|
||||
// layout to know about it in case the following content is not text
|
||||
TEXT_HAS_TRAILING_BREAK = 0x4000000,
|
||||
TEXT_HAS_TRAILING_BREAK = 0x400,
|
||||
|
||||
// This is set if the textrun was created for a textframe whose
|
||||
// NS_FRAME_IS_IN_SINGLE_CHAR_MI flag is set. This occurs if the textframe
|
||||
// belongs to a MathML <mi> element whose embedded text consists of a
|
||||
// single character.
|
||||
TEXT_IS_SINGLE_CHAR_MI = 0x8000000,
|
||||
TEXT_IS_SINGLE_CHAR_MI = 0x800,
|
||||
|
||||
// This is set if the text run might be observing for glyph changes.
|
||||
TEXT_MIGHT_HAVE_GLYPH_CHANGES = 0x10000000,
|
||||
TEXT_MIGHT_HAVE_GLYPH_CHANGES = 0x1000,
|
||||
|
||||
// The following are defined by gfxTextRunWordCache rather than here,
|
||||
// so that it also has access to the _INCOMING flag
|
||||
// For internal use by the memory reporter when accounting for
|
||||
// storage used by textruns.
|
||||
// Because the reporter may visit each textrun multiple times while
|
||||
// walking the frame trees and textrun cache, it needs to mark
|
||||
// textruns that have been seen so as to avoid multiple-accounting.
|
||||
TEXT_RUN_SIZE_ACCOUNTED = 0x2000,
|
||||
|
||||
// The following are defined by gfxTextRunFactory rather than here,
|
||||
// so that it also has access to the _INCOMING and MATH_SCRIPT flags
|
||||
// for shaping purposes.
|
||||
// They live in the gfxShapedText::mFlags field rather than the
|
||||
// gfxTextRun::mFlags2 field.
|
||||
// TEXT_TRAILING_ARABICCHAR
|
||||
// TEXT_INCOMING_ARABICCHAR
|
||||
|
||||
// This is defined in gfxTextRunFactory to allow access in gfxFont.
|
||||
// TEXT_USE_MATH_SCRIPT
|
||||
};
|
||||
|
||||
|
@ -119,7 +127,7 @@ public:
|
|||
CompressionMode aCompression,
|
||||
uint8_t* aIncomingFlags,
|
||||
gfxSkipChars* aSkipChars,
|
||||
uint32_t* aAnalysisFlags);
|
||||
uint16_t* aAnalysisFlags);
|
||||
|
||||
/**
|
||||
* Returns whether aChar is a character that nsTextFrameUtils::TransformText
|
||||
|
|
|
@ -38,7 +38,8 @@ nsTransformedTextRun::Create(const gfxTextRunFactory::Parameters* aParams,
|
|||
nsTransformingTextRunFactory* aFactory,
|
||||
gfxFontGroup* aFontGroup,
|
||||
const char16_t* aString, uint32_t aLength,
|
||||
const uint32_t aFlags,
|
||||
const uint16_t aFlags,
|
||||
const uint16_t aFlags2,
|
||||
nsTArray<RefPtr<nsTransformedCharStyle>>&& aStyles,
|
||||
bool aOwnsFactory)
|
||||
{
|
||||
|
@ -52,7 +53,7 @@ nsTransformedTextRun::Create(const gfxTextRunFactory::Parameters* aParams,
|
|||
|
||||
RefPtr<nsTransformedTextRun> result =
|
||||
new (storage) nsTransformedTextRun(aParams, aFactory, aFontGroup,
|
||||
aString, aLength, aFlags,
|
||||
aString, aLength, aFlags, aFlags2,
|
||||
Move(aStyles), aOwnsFactory);
|
||||
return result.forget();
|
||||
}
|
||||
|
@ -102,19 +103,21 @@ nsTransformedTextRun::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf)
|
|||
already_AddRefed<nsTransformedTextRun>
|
||||
nsTransformingTextRunFactory::MakeTextRun(const char16_t* aString, uint32_t aLength,
|
||||
const gfxTextRunFactory::Parameters* aParams,
|
||||
gfxFontGroup* aFontGroup, uint32_t aFlags,
|
||||
gfxFontGroup* aFontGroup,
|
||||
uint16_t aFlags, uint16_t aFlags2,
|
||||
nsTArray<RefPtr<nsTransformedCharStyle>>&& aStyles,
|
||||
bool aOwnsFactory)
|
||||
{
|
||||
return nsTransformedTextRun::Create(aParams, this, aFontGroup,
|
||||
aString, aLength, aFlags, Move(aStyles),
|
||||
aString, aLength, aFlags, aFlags2, Move(aStyles),
|
||||
aOwnsFactory);
|
||||
}
|
||||
|
||||
already_AddRefed<nsTransformedTextRun>
|
||||
nsTransformingTextRunFactory::MakeTextRun(const uint8_t* aString, uint32_t aLength,
|
||||
const gfxTextRunFactory::Parameters* aParams,
|
||||
gfxFontGroup* aFontGroup, uint32_t aFlags,
|
||||
gfxFontGroup* aFontGroup,
|
||||
uint16_t aFlags, uint16_t aFlags2,
|
||||
nsTArray<RefPtr<nsTransformedCharStyle>>&& aStyles,
|
||||
bool aOwnsFactory)
|
||||
{
|
||||
|
@ -123,6 +126,7 @@ nsTransformingTextRunFactory::MakeTextRun(const uint8_t* aString, uint32_t aLeng
|
|||
NS_ConvertASCIItoUTF16 unicodeString(reinterpret_cast<const char*>(aString), aLength);
|
||||
return MakeTextRun(unicodeString.get(), aLength, aParams, aFontGroup,
|
||||
aFlags & ~(gfxFontGroup::TEXT_IS_PERSISTENT | gfxFontGroup::TEXT_IS_8BIT),
|
||||
aFlags2,
|
||||
Move(aStyles), aOwnsFactory);
|
||||
}
|
||||
|
||||
|
@ -213,7 +217,8 @@ MergeCharactersInTextRun(gfxTextRun* aDest, gfxTextRun* aSrc,
|
|||
}
|
||||
|
||||
gfxTextRunFactory::Parameters
|
||||
GetParametersForInner(nsTransformedTextRun* aTextRun, uint32_t* aFlags,
|
||||
GetParametersForInner(nsTransformedTextRun* aTextRun,
|
||||
uint16_t* aFlags,
|
||||
DrawTarget* aRefDrawTarget)
|
||||
{
|
||||
gfxTextRunFactory::Parameters params =
|
||||
|
@ -660,7 +665,7 @@ nsCaseTransformTextRunFactory::RebuildTextRun(nsTransformedTextRun* aTextRun,
|
|||
&canBreakBeforeArray,
|
||||
&styleArray);
|
||||
|
||||
uint32_t flags;
|
||||
uint16_t flags;
|
||||
gfxTextRunFactory::Parameters innerParams =
|
||||
GetParametersForInner(aTextRun, &flags, aRefDrawTarget);
|
||||
gfxFontGroup* fontGroup = aTextRun->GetFontGroup();
|
||||
|
@ -672,12 +677,12 @@ nsCaseTransformTextRunFactory::RebuildTextRun(nsTransformedTextRun* aTextRun,
|
|||
if (mInnerTransformingTextRunFactory) {
|
||||
transformedChild = mInnerTransformingTextRunFactory->MakeTextRun(
|
||||
convertedString.BeginReading(), convertedString.Length(),
|
||||
&innerParams, fontGroup, flags, Move(styleArray), false);
|
||||
&innerParams, fontGroup, flags, 0, Move(styleArray), false);
|
||||
child = transformedChild.get();
|
||||
} else {
|
||||
cachedChild = fontGroup->MakeTextRun(
|
||||
convertedString.BeginReading(), convertedString.Length(),
|
||||
&innerParams, flags, aMFR);
|
||||
&innerParams, flags, 0, aMFR);
|
||||
child = cachedChild.get();
|
||||
}
|
||||
if (!child)
|
||||
|
|
|
@ -49,14 +49,14 @@ public:
|
|||
already_AddRefed<nsTransformedTextRun>
|
||||
MakeTextRun(const uint8_t* aString, uint32_t aLength,
|
||||
const gfxFontGroup::Parameters* aParams,
|
||||
gfxFontGroup* aFontGroup, uint32_t aFlags,
|
||||
gfxFontGroup* aFontGroup, uint16_t aFlags, uint16_t aFlags2,
|
||||
nsTArray<RefPtr<nsTransformedCharStyle>>&& aStyles,
|
||||
bool aOwnsFactory);
|
||||
|
||||
already_AddRefed<nsTransformedTextRun>
|
||||
MakeTextRun(const char16_t* aString, uint32_t aLength,
|
||||
const gfxFontGroup::Parameters* aParams,
|
||||
gfxFontGroup* aFontGroup, uint32_t aFlags,
|
||||
gfxFontGroup* aFontGroup, uint16_t aFlags, uint16_t aFlags2,
|
||||
nsTArray<RefPtr<nsTransformedCharStyle>>&& aStyles,
|
||||
bool aOwnsFactory);
|
||||
|
||||
|
@ -125,7 +125,7 @@ public:
|
|||
nsTransformingTextRunFactory* aFactory,
|
||||
gfxFontGroup* aFontGroup,
|
||||
const char16_t* aString, uint32_t aLength,
|
||||
const uint32_t aFlags,
|
||||
const uint16_t aFlags, const uint16_t aFlags2,
|
||||
nsTArray<RefPtr<nsTransformedCharStyle>>&& aStyles,
|
||||
bool aOwnsFactory);
|
||||
|
||||
|
@ -169,10 +169,10 @@ private:
|
|||
nsTransformingTextRunFactory* aFactory,
|
||||
gfxFontGroup* aFontGroup,
|
||||
const char16_t* aString, uint32_t aLength,
|
||||
const uint32_t aFlags,
|
||||
const uint16_t aFlags, const uint16_t aFlags2,
|
||||
nsTArray<RefPtr<nsTransformedCharStyle>>&& aStyles,
|
||||
bool aOwnsFactory)
|
||||
: gfxTextRun(aParams, aLength, aFontGroup, aFlags),
|
||||
: gfxTextRun(aParams, aLength, aFontGroup, aFlags, aFlags2),
|
||||
mFactory(aFactory), mStyles(aStyles), mString(aString, aLength),
|
||||
mOwnsFactory(aOwnsFactory), mNeedsRebuild(true)
|
||||
{
|
||||
|
@ -215,7 +215,8 @@ MergeCharactersInTextRun(gfxTextRun* aDest, gfxTextRun* aSrc,
|
|||
const bool* aCharsToMerge, const bool* aDeletedChars);
|
||||
|
||||
gfxTextRunFactory::Parameters
|
||||
GetParametersForInner(nsTransformedTextRun* aTextRun, uint32_t* aFlags,
|
||||
GetParametersForInner(nsTransformedTextRun* aTextRun,
|
||||
uint16_t* aFlags,
|
||||
mozilla::gfx::DrawTarget* aRefDrawTarget);
|
||||
|
||||
|
||||
|
|
|
@ -393,7 +393,7 @@ nsPropertiesTable::MakeTextRun(DrawTarget* aDrawTarget,
|
|||
"nsPropertiesTable can only access glyphs by code point");
|
||||
return aFontGroup->
|
||||
MakeTextRun(aGlyph.code, aGlyph.Length(), aDrawTarget,
|
||||
aAppUnitsPerDevPixel, 0, nullptr);
|
||||
aAppUnitsPerDevPixel, 0, 0, nullptr);
|
||||
}
|
||||
|
||||
// An instance of nsOpenTypeTable is associated with one gfxFontEntry that
|
||||
|
@ -474,7 +474,7 @@ nsOpenTypeTable::UpdateCache(DrawTarget* aDrawTarget,
|
|||
{
|
||||
if (mCharCache != aChar) {
|
||||
RefPtr<gfxTextRun> textRun = aFontGroup->
|
||||
MakeTextRun(&aChar, 1, aDrawTarget, aAppUnitsPerDevPixel, 0, nullptr);
|
||||
MakeTextRun(&aChar, 1, aDrawTarget, aAppUnitsPerDevPixel, 0, 0, nullptr);
|
||||
const gfxTextRun::CompressedGlyph& data = textRun->GetCharacterGlyphs()[0];
|
||||
if (data.IsSimpleGlyph()) {
|
||||
mGlyphID = data.GetSimpleGlyph();
|
||||
|
@ -568,7 +568,7 @@ nsOpenTypeTable::MakeTextRun(DrawTarget* aDrawTarget,
|
|||
aDrawTarget, nullptr, nullptr, nullptr, 0, aAppUnitsPerDevPixel
|
||||
};
|
||||
RefPtr<gfxTextRun> textRun =
|
||||
gfxTextRun::Create(¶ms, 1, aFontGroup, 0);
|
||||
gfxTextRun::Create(¶ms, 1, aFontGroup, 0, 0);
|
||||
textRun->AddGlyphRun(aFontGroup->GetFirstValidFont(),
|
||||
gfxTextRange::kFontGroup, 0,
|
||||
false, gfxTextRunFactory::TEXT_ORIENT_HORIZONTAL);
|
||||
|
@ -1535,7 +1535,7 @@ nsMathMLChar::StretchInternal(nsPresContext* aPresContext,
|
|||
uint32_t len = uint32_t(mData.Length());
|
||||
mGlyphs[0] = fm->GetThebesFontGroup()->
|
||||
MakeTextRun(static_cast<const char16_t*>(mData.get()), len, aDrawTarget,
|
||||
aPresContext->AppUnitsPerDevPixel(), 0,
|
||||
aPresContext->AppUnitsPerDevPixel(), 0, 0,
|
||||
aPresContext->MissingFontRecorder());
|
||||
aDesiredStretchSize = MeasureTextRun(aDrawTarget, mGlyphs[0].get());
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче