Skip to content

Commit

Permalink
Backed out 3 changesets (bug 1719554) for causing bustages complainin…
Browse files Browse the repository at this point in the history
…g about gfxTextRun.cpp.

Backed out changeset 6181e40d4da1 (bug 1719554)
Backed out changeset c261ede6ae81 (bug 1719554)
Backed out changeset 221ec418475c (bug 1719554)
  • Loading branch information
Butkovits Atila committed Dec 3, 2021
1 parent 28e0dbf commit d2197de
Show file tree
Hide file tree
Showing 41 changed files with 479 additions and 587 deletions.
2 changes: 1 addition & 1 deletion .clang-format-ignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ layout/style/nsStyleStructList.h
gfx/gl/GLConsts.h
gfx/webrender_bindings/webrender_ffi_generated.h
dom/webgpu/ffi/wgpu_ffi_generated.h
intl/components/src/UnicodeScriptCodes.h
intl/unicharutil/util/nsSpecialCasingData.cpp
intl/unicharutil/util/nsUnicodePropertyData.cpp
intl/unicharutil/util/nsUnicodeScriptCodes.h
media/mp4parse-rust/mp4parse.h
security/manager/ssl/StaticHPKPins.h
widget/gtk/wayland/gtk-primary-selection-client-protocol.h
Expand Down
9 changes: 4 additions & 5 deletions dom/base/DirectionalityUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,6 @@
#include "mozilla/dom/Element.h"
#include "mozilla/dom/HTMLSlotElement.h"
#include "mozilla/dom/ShadowRoot.h"
#include "mozilla/intl/UnicodeProperties.h"
#include "nsUnicodeProperties.h"
#include "nsTextFragment.h"
#include "nsAttrValue.h"
Expand Down Expand Up @@ -304,12 +303,12 @@ static bool DoesNotAffectDirectionOfAncestors(const Element* aElement) {
* Returns the directionality of a Unicode character
*/
static Directionality GetDirectionFromChar(uint32_t ch) {
switch (intl::UnicodeProperties::GetBidiClass(ch)) {
case intl::BidiClass::RightToLeft:
case intl::BidiClass::RightToLeftArabic:
switch (mozilla::unicode::GetBidiCat(ch)) {
case eCharType_RightToLeft:
case eCharType_RightToLeftArabic:
return eDir_RTL;

case intl::BidiClass::LeftToRight:
case eCharType_LeftToRight:
return eDir_LTR;

default:
Expand Down
5 changes: 2 additions & 3 deletions dom/serializers/nsPlainTextSerializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "nsContentUtils.h"
#include "nsReadableUtils.h"
#include "nsUnicharUtils.h"
#include "nsUnicodeProperties.h"
#include "nsCRT.h"
#include "mozilla/Casting.h"
#include "mozilla/EditorUtils.h"
Expand All @@ -30,8 +31,6 @@
#include "mozilla/dom/HTMLBRElement.h"
#include "mozilla/dom/Text.h"
#include "mozilla/intl/Segmenter.h"
#include "mozilla/intl/UnicodeProperties.h"
#include "nsUnicodeProperties.h"
#include "mozilla/Span.h"
#include "mozilla/Preferences.h"
#include "mozilla/StaticPrefs_converter.h"
Expand Down Expand Up @@ -1804,7 +1803,7 @@ int32_t GetUnicharWidth(char32_t aCh) {
return 1;
}

return intl::UnicodeProperties::IsEastAsianWidthFW(aCh) ? 2 : 1;
return unicode::IsEastAsianWidthFW(aCh) ? 2 : 1;
}

int32_t GetUnicharStringWidth(Span<const char16_t> aString) {
Expand Down
7 changes: 4 additions & 3 deletions gfx/thebes/gfxCoreTextShaper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,10 @@ gfxCoreTextShaper::~gfxCoreTextShaper() {
}
}

static bool IsBuggyIndicScript(intl::Script aScript) {
return aScript == intl::Script::BENGALI || aScript == intl::Script::KANNADA ||
aScript == intl::Script::ORIYA || aScript == intl::Script::KHMER;
static bool IsBuggyIndicScript(unicode::Script aScript) {
return aScript == unicode::Script::BENGALI ||
aScript == unicode::Script::KANNADA ||
aScript == unicode::Script::ORIYA || aScript == unicode::Script::KHMER;
}

bool gfxCoreTextShaper::ShapeText(DrawTarget* aDrawTarget,
Expand Down
10 changes: 5 additions & 5 deletions gfx/thebes/gfxFont.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1105,10 +1105,10 @@ static void HasLookupRuleWithGlyph(hb_face_t* aFace, hb_tag_t aTableTag,
hb_set_destroy(otherLookups);
}

nsTHashMap<nsUint32HashKey, intl::Script>* gfxFont::sScriptTagToCode = nullptr;
nsTHashMap<nsUint32HashKey, Script>* gfxFont::sScriptTagToCode = nullptr;
nsTHashSet<uint32_t>* gfxFont::sDefaultFeatures = nullptr;

static inline bool HasSubstitution(uint32_t* aBitVector, intl::Script aScript) {
static inline bool HasSubstitution(uint32_t* aBitVector, Script aScript) {
return (aBitVector[static_cast<uint32_t>(aScript) >> 5] &
(1 << (static_cast<uint32_t>(aScript) & 0x1f))) != 0;
}
Expand Down Expand Up @@ -1165,9 +1165,9 @@ void gfxFont::CheckForFeaturesInvolvingSpace() {
// Ensure that we don't try to look at script codes beyond what the
// current version of ICU (at runtime -- in case of system ICU)
// knows about.
Script scriptCount = Script(
std::min<int>(intl::UnicodeProperties::GetMaxNumberOfScripts() + 1,
int(Script::NUM_SCRIPT_CODES)));
Script scriptCount =
Script(std::min<int>(u_getIntPropertyMaxValue(UCHAR_SCRIPT) + 1,
int(Script::NUM_SCRIPT_CODES)));
for (Script s = Script::ARABIC; s < scriptCount;
s = Script(static_cast<int>(s) + 1)) {
hb_script_t script = hb_script_t(GetScriptTagForCode(s));
Expand Down
10 changes: 5 additions & 5 deletions gfx/thebes/gfxFont.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include "mozilla/UniquePtr.h"
#include "mozilla/gfx/MatrixFwd.h"
#include "mozilla/gfx/Point.h"
#include "mozilla/intl/UnicodeScriptCodes.h"
#include "nsCOMPtr.h"
#include "nsColor.h"
#include "nsTHashMap.h"
Expand All @@ -38,6 +37,7 @@
#include "nsString.h"
#include "nsTArray.h"
#include "nsTHashtable.h"
#include "nsUnicodeScriptCodes.h"
#include "nscore.h"

// Only required for function bodys
Expand Down Expand Up @@ -672,7 +672,7 @@ class gfxTextRunFactory {
class gfxFontShaper {
public:
typedef mozilla::gfx::DrawTarget DrawTarget;
typedef mozilla::intl::Script Script;
typedef mozilla::unicode::Script Script;

enum class RoundingFlags : uint8_t { kRoundX = 0x01, kRoundY = 0x02 };

Expand Down Expand Up @@ -731,7 +731,7 @@ MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(gfxFontShaper::RoundingFlags)
*/
class gfxShapedText {
public:
typedef mozilla::intl::Script Script;
typedef mozilla::unicode::Script Script;

gfxShapedText(uint32_t aLength, mozilla::gfx::ShapedTextFlags aFlags,
uint16_t aAppUnitsPerDevUnit)
Expand Down Expand Up @@ -1261,7 +1261,7 @@ class gfxShapedText {
*/
class gfxShapedWord final : public gfxShapedText {
public:
typedef mozilla::intl::Script Script;
typedef mozilla::unicode::Script Script;
// Create a ShapedWord that can hold glyphs for aLength characters,
// with mCharacterGlyphs sized appropriately.
Expand Down Expand Up @@ -1426,7 +1426,7 @@ class gfxFont {
protected:
using DrawTarget = mozilla::gfx::DrawTarget;
using Script = mozilla::intl::Script;
using Script = mozilla::unicode::Script;
using SVGContextPaint = mozilla::SVGContextPaint;
using RoundingFlags = gfxFontShaper::RoundingFlags;
Expand Down
5 changes: 2 additions & 3 deletions gfx/thebes/gfxFontEntry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -814,7 +814,7 @@ tainted_boolean_hint gfxFontEntry::HasGraphiteSpaceContextuals() {

#define FEATURE_SCRIPT_MASK 0x000000ff // script index replaces low byte of tag

static_assert(int(intl::Script::NUM_SCRIPT_CODES) <= FEATURE_SCRIPT_MASK,
static_assert(int(Script::NUM_SCRIPT_CODES) <= FEATURE_SCRIPT_MASK,
"Too many script codes");

// high-order three bytes of tag with script in low-order byte
Expand Down Expand Up @@ -1780,8 +1780,7 @@ void gfxFontFamily::FindFontForChar(GlobalFontMatch* aMatchData) {
LogModule* log = gfxPlatform::GetLog(eGfxLog_textrun);

if (MOZ_UNLIKELY(MOZ_LOG_TEST(log, LogLevel::Debug))) {
intl::Script script =
intl::UnicodeProperties::GetScriptCode(aMatchData->mCh);
Script script = GetScriptCode(aMatchData->mCh);
MOZ_LOG(log, LogLevel::Debug,
("(textrun-systemfallback-fonts) char: u+%6.6x "
"script: %d match: [%s]\n",
Expand Down
4 changes: 2 additions & 2 deletions gfx/thebes/gfxFontEntry.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@
#include "mozilla/RefPtr.h"
#include "mozilla/TypedEnumBits.h"
#include "mozilla/UniquePtr.h"
#include "mozilla/intl/UnicodeScriptCodes.h"
#include "nsTHashMap.h"
#include "nsDebug.h"
#include "nsHashKeys.h"
#include "nsISupports.h"
#include "nsStringFwd.h"
#include "nsTArray.h"
#include "nsUnicodeScriptCodes.h"
#include "nscore.h"

class FontInfoData;
Expand Down Expand Up @@ -131,7 +131,7 @@ struct gfxFontFeatureInfo {
class gfxFontEntry {
public:
typedef mozilla::gfx::DrawTarget DrawTarget;
typedef mozilla::intl::Script Script;
typedef mozilla::unicode::Script Script;
typedef mozilla::FontWeight FontWeight;
typedef mozilla::FontSlantStyle FontSlantStyle;
typedef mozilla::FontStretch FontStretch;
Expand Down
15 changes: 6 additions & 9 deletions gfx/thebes/gfxHarfBuzzShaper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@
#include "gfxTextRun.h"
#include "mozilla/Sprintf.h"
#include "mozilla/intl/String.h"
#include "mozilla/intl/UnicodeProperties.h"
#include "mozilla/intl/UnicodeScriptCodes.h"
#include "nsUnicodeProperties.h"
#include "nsUnicodeScriptCodes.h"

#include "harfbuzz/hb.h"
#include "harfbuzz/hb-ot.h"
Expand Down Expand Up @@ -982,7 +981,7 @@ static hb_position_t HBGetHKerning(hb_font_t* font, void* font_data,

static hb_codepoint_t HBGetMirroring(hb_unicode_funcs_t* ufuncs,
hb_codepoint_t aCh, void* user_data) {
return intl::UnicodeProperties::CharMirror(aCh);
return GetMirroredChar(aCh);
}

static hb_unicode_general_category_t HBGetGeneralCategory(
Expand All @@ -992,20 +991,18 @@ static hb_unicode_general_category_t HBGetGeneralCategory(

static hb_script_t HBGetScript(hb_unicode_funcs_t* ufuncs, hb_codepoint_t aCh,
void* user_data) {
return hb_script_t(
GetScriptTagForCode(intl::UnicodeProperties::GetScriptCode(aCh)));
return hb_script_t(GetScriptTagForCode(GetScriptCode(aCh)));
}

static hb_unicode_combining_class_t HBGetCombiningClass(
hb_unicode_funcs_t* ufuncs, hb_codepoint_t aCh, void* user_data) {
return hb_unicode_combining_class_t(
intl::UnicodeProperties::GetCombiningClass(aCh));
return hb_unicode_combining_class_t(GetCombiningClass(aCh));
}

static hb_bool_t HBUnicodeCompose(hb_unicode_funcs_t* ufuncs, hb_codepoint_t a,
hb_codepoint_t b, hb_codepoint_t* ab,
void* user_data) {
char32_t ch = intl::String::ComposePairNFC(a, b);
char32_t ch = mozilla::intl::String::ComposePairNFC(a, b);
if (ch > 0) {
*ab = ch;
return true;
Expand All @@ -1028,7 +1025,7 @@ static hb_bool_t HBUnicodeDecompose(hb_unicode_funcs_t* ufuncs,
#endif

char32_t decomp[2] = {0};
if (intl::String::DecomposeRawNFD(ab, decomp)) {
if (mozilla::intl::String::DecomposeRawNFD(ab, decomp)) {
if (decomp[1] || decomp[0] != ab) {
*a = decomp[0];
*b = decomp[1];
Expand Down
4 changes: 2 additions & 2 deletions gfx/thebes/gfxPlatform.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@

#include "mozilla/FontPropertyTypes.h"
#include "mozilla/gfx/Types.h"
#include "mozilla/intl/UnicodeScriptCodes.h"
#include "nsTArray.h"
#include "nsString.h"
#include "nsCOMPtr.h"
#include "nsUnicodeScriptCodes.h"

#include "gfxTelemetry.h"
#include "gfxTypes.h"
Expand Down Expand Up @@ -186,7 +186,7 @@ class gfxPlatform : public mozilla::layers::MemoryPressureListener {
typedef mozilla::gfx::DrawTarget DrawTarget;
typedef mozilla::gfx::IntSize IntSize;
typedef mozilla::gfx::SourceSurface SourceSurface;
typedef mozilla::intl::Script Script;
typedef mozilla::unicode::Script Script;

/**
* Return a pointer to the current active platform.
Expand Down
2 changes: 1 addition & 1 deletion gfx/thebes/gfxPlatformFontList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -975,7 +975,7 @@ gfxFont* gfxPlatformFontList::SystemFindFontForChar(
LogModule* log = gfxPlatform::GetLog(eGfxLog_textrun);

if (MOZ_UNLIKELY(MOZ_LOG_TEST(log, LogLevel::Warning))) {
Script script = intl::UnicodeProperties::GetScriptCode(aCh);
Script script = mozilla::unicode::GetScriptCode(aCh);
MOZ_LOG(log, LogLevel::Warning,
("(textrun-systemfallback-%s) char: u+%6.6x "
"script: %d match: [%s]"
Expand Down
2 changes: 1 addition & 1 deletion gfx/thebes/gfxPlatformFontList.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ class gfxPlatformFontList : public gfxFontInfoLoader {
typedef mozilla::StretchRange StretchRange;
typedef mozilla::SlantStyleRange SlantStyleRange;
typedef mozilla::WeightRange WeightRange;
typedef mozilla::intl::Script Script;
typedef mozilla::unicode::Script Script;

// For font family lists loaded from user preferences (prefs such as
// font.name-list.<generic>.<langGroup>) that map CSS generics to
Expand Down
20 changes: 9 additions & 11 deletions gfx/thebes/gfxScriptItemizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,11 @@
*/

#include "gfxScriptItemizer.h"
#include "mozilla/intl/UnicodeProperties.h"
#include "nsCharTraits.h"
#include "mozilla/intl/Script.h"
#include "nsUnicodeProperties.h"
#include "nsCharTraits.h"
#include "harfbuzz/hb.h"

using namespace mozilla::intl;
using namespace mozilla::unicode;

#define MOD(sp) ((sp) % PAREN_STACK_DEPTH)
Expand Down Expand Up @@ -117,8 +116,7 @@ static inline bool SameScript(Script runScript, Script currCharScript,
uint32_t aCurrCh) {
return CanMergeWithContext(runScript) ||
CanMergeWithContext(currCharScript) || currCharScript == runScript ||
IsClusterExtender(aCurrCh) ||
UnicodeProperties::HasScript(aCurrCh, runScript);
IsClusterExtender(aCurrCh) || HasScript(aCurrCh, runScript);
}

gfxScriptItemizer::gfxScriptItemizer(const char16_t* src, uint32_t length)
Expand Down Expand Up @@ -164,7 +162,7 @@ bool gfxScriptItemizer::Next(uint32_t& aRunStart, uint32_t& aRunLimit,
// if the character has script=COMMON, otherwise we don't care.
uint8_t gc = HB_UNICODE_GENERAL_CATEGORY_UNASSIGNED;

sc = UnicodeProperties::GetScriptCode(ch);
sc = GetScriptCode(ch);
if (sc == Script::COMMON) {
/*
* Paired character handling:
Expand All @@ -179,12 +177,12 @@ bool gfxScriptItemizer::Next(uint32_t& aRunStart, uint32_t& aRunLimit,
*/
gc = GetGeneralCategory(ch);
if (gc == HB_UNICODE_GENERAL_CATEGORY_OPEN_PUNCTUATION) {
uint32_t endPairChar = UnicodeProperties::CharMirror(ch);
uint32_t endPairChar = mozilla::unicode::GetMirroredChar(ch);
if (endPairChar != ch) {
push(endPairChar, scriptCode);
}
} else if (gc == HB_UNICODE_GENERAL_CATEGORY_CLOSE_PUNCTUATION &&
UnicodeProperties::IsMirrored(ch)) {
HasMirroredChar(ch)) {
while (STACK_IS_NOT_EMPTY() && TOP().endPairChar != ch) {
pop();
}
Expand All @@ -206,8 +204,8 @@ bool gfxScriptItemizer::Next(uint32_t& aRunStart, uint32_t& aRunLimit,
} else if (fallbackScript == Script::UNKNOWN) {
// See if the character has a ScriptExtensions property we can
// store for use in the event the run remains unresolved.
UnicodeProperties::ScriptExtensionVector extensions;
auto extResult = UnicodeProperties::GetExtensions(ch, extensions);
mozilla::intl::ScriptExtensionVector extensions;
auto extResult = mozilla::intl::Script::GetExtensions(ch, extensions);
if (extResult.isOk()) {
Script ext = Script(extensions[0]);
if (!CanMergeWithContext(ext)) {
Expand All @@ -222,7 +220,7 @@ bool gfxScriptItemizer::Next(uint32_t& aRunStart, uint32_t& aRunLimit,
* pop the matching open character from the stack
*/
if (gc == HB_UNICODE_GENERAL_CATEGORY_CLOSE_PUNCTUATION &&
UnicodeProperties::IsMirrored(ch)) {
HasMirroredChar(ch)) {
pop();
}
} else {
Expand Down
4 changes: 2 additions & 2 deletions gfx/thebes/gfxScriptItemizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@
#define GFX_SCRIPTITEMIZER_H

#include <stdint.h>
#include "mozilla/intl/UnicodeScriptCodes.h"
#include "nsUnicodeScriptCodes.h"

#define PAREN_STACK_DEPTH 32

class gfxScriptItemizer {
public:
typedef mozilla::intl::Script Script;
typedef mozilla::unicode::Script Script;

gfxScriptItemizer(const char16_t* src, uint32_t length);

Expand Down
Loading

0 comments on commit d2197de

Please sign in to comment.