Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:42:Factory-Candidates-Check
nodejs-electron
bad-font-gc0000.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File bad-font-gc0000.patch of Package nodejs-electron
Revert the following commit: commit cc6c0b2a9e1dbc96f3ebed713dc71960a29dc4f1 Author: Ian Kilpatrick <ikilpatrick@chromium.org> Date: Tue Mar 5 20:27:13 2024 +0000 Reland "[gc] Make FontFamily immutable." This reverts commit 748ed11510ec5bb09cc8b92f67f1f62964f023fa. Reason for revert: Previous patch which caused MSAN issue was reapplied. Original change's description: > Revert "[gc] Make FontFamily immutable." > > This reverts commit ca3d3085d8b01fc74623d639c615fc57842cd26d. > > Reason for revert: crrev.com/c/5328767 is the reason for failure on some tests on MSAN. Please see crbug.com/327969288 for more details. > > Original change's description: > > [gc] Make FontFamily immutable. > > > > Previously we'd build up font-family lists front to back, but would > > need to mutate them to do so. Instead just build them backwards. > > > > This removes a bunch of problematic APIs (like AppendFamily - which > > doesn't append), and simplifies the code. > > > > This will help avoid atomic write barriers once converted to oilpan. > > > > Bug: 41490008 > > Change-Id: Icfcec2d0a1716585cf42985616c02b42b6647943 > > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5322929 > > Commit-Queue: Ian Kilpatrick <ikilpatrick@chromium.org> > > Reviewed-by: Dominik Röttsches <drott@chromium.org> > > Cr-Commit-Position: refs/heads/main@{#1267168} > > Bug: 41490008, 327969288 > Change-Id: Ic69a5707d00cc98b97dcae3f4b8207b452ce5cbd > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5333950 > Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> > Commit-Queue: Taiyo Mizuhashi <taiyo@chromium.org> > Owners-Override: Taiyo Mizuhashi <taiyo@chromium.org> > Cr-Commit-Position: refs/heads/main@{#1267674} Bug: 41490008, 327969288 Change-Id: If1d395e324b0be15488ef5410e9bcdb219bb19c6 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5344844 Commit-Queue: Ian Kilpatrick <ikilpatrick@chromium.org> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Cr-Commit-Position: refs/heads/main@{#1268654} --- a/third_party/blink/renderer/core/css/css_font_face.cc +++ b/third_party/blink/renderer/core/css/css_font_face.cc @@ -216,8 +216,9 @@ bool CSSFontFace::MaybeLoadFont(const Fo void CSSFontFace::Load() { FontDescription font_description; - font_description.SetFamily( - FontFamily(font_face_->family(), FontFamily::Type::kFamilyName)); + FontFamily font_family; + font_family.SetFamily(font_face_->family(), FontFamily::Type::kFamilyName); + font_description.SetFamily(font_family); Load(font_description); } --- a/third_party/blink/renderer/core/css/font_face_set_document.cc +++ b/third_party/blink/renderer/core/css/font_face_set_document.cc @@ -195,10 +195,13 @@ bool FontFaceSetDocument::ResolveFontSty ComputedStyleBuilder builder = GetDocument()->GetStyleResolver().CreateComputedStyleBuilder(); - FontDescription default_font_description; - default_font_description.SetFamily(FontFamily( + FontFamily font_family; + font_family.SetFamily( FontFaceSet::DefaultFontFamily(), - FontFamily::InferredTypeFor(FontFaceSet::DefaultFontFamily()))); + FontFamily::InferredTypeFor(FontFaceSet::DefaultFontFamily())); + + FontDescription default_font_description; + default_font_description.SetFamily(font_family); default_font_description.SetSpecifiedSize(FontFaceSet::kDefaultFontSize); default_font_description.SetComputedSize(FontFaceSet::kDefaultFontSize); --- a/third_party/blink/renderer/core/css/font_face_set_worker.cc +++ b/third_party/blink/renderer/core/css/font_face_set_worker.cc @@ -84,10 +84,13 @@ bool FontFaceSetWorker::ResolveFontStyle return false; } - FontDescription default_font_description; - default_font_description.SetFamily(FontFamily( + FontFamily font_family; + font_family.SetFamily( FontFaceSet::DefaultFontFamily(), - FontFamily::InferredTypeFor(FontFaceSet::DefaultFontFamily()))); + FontFamily::InferredTypeFor(FontFaceSet::DefaultFontFamily())); + + FontDescription default_font_description; + default_font_description.SetFamily(font_family); default_font_description.SetSpecifiedSize(FontFaceSet::kDefaultFontSize); default_font_description.SetComputedSize(FontFaceSet::kDefaultFontSize); --- a/third_party/blink/renderer/core/css/resolver/font_builder.cc +++ b/third_party/blink/renderer/core/css/resolver/font_builder.cc @@ -54,9 +54,11 @@ void FontBuilder::DidChangeWritingMode() } FontFamily FontBuilder::StandardFontFamily() const { + FontFamily family; const AtomicString& standard_font_family = StandardFontFamilyName(); - return FontFamily(standard_font_family, - FontFamily::InferredTypeFor(standard_font_family)); + family.SetFamily(standard_font_family, + FontFamily::InferredTypeFor(standard_font_family)); + return family; } AtomicString FontBuilder::StandardFontFamilyName() const { --- a/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc +++ b/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc @@ -379,8 +379,8 @@ FontDescription::FamilyDescription Style if (const auto* system_font = DynamicTo<cssvalue::CSSPendingSystemFontValue>(value)) { - desc.family = FontFamily(system_font->ResolveFontFamily(), - FontFamily::Type::kFamilyName); + desc.family.SetFamily(system_font->ResolveFontFamily(), + FontFamily::Type::kFamilyName); return desc; } @@ -410,8 +410,10 @@ FontDescription::FamilyDescription Style // Take the previous value and wrap it in a `SharedFontFamily` adding to // the linked list. if (has_value) { - next = - SharedFontFamily::Create(family_name, family_type, std::move(next)); + scoped_refptr<SharedFontFamily> shared = SharedFontFamily::Create(); + shared->SetFamily(family_name, family_type); + shared->AppendFamily(next); + next = shared; } family_name = next_family_name; family_type = is_generic ? FontFamily::Type::kGenericFamily @@ -442,7 +444,8 @@ FontDescription::FamilyDescription Style } #endif - desc.family = FontFamily(family_name, family_type, std::move(next)); + desc.family.SetFamily(family_name, family_type); + desc.family.AppendFamily(next); return desc; } --- a/third_party/blink/renderer/core/html/canvas/canvas_font_cache.cc +++ b/third_party/blink/renderer/core/html/canvas/canvas_font_cache.cc @@ -29,9 +29,11 @@ const int defaultFontSize = 10; const ComputedStyle* CreateDefaultFontStyle(const Document& document) { const AtomicString& default_font_family = font_family_names::kSansSerif; + FontFamily font_family; + font_family.SetFamily(default_font_family, + FontFamily::InferredTypeFor(default_font_family)); FontDescription default_font_description; - default_font_description.SetFamily(FontFamily( - default_font_family, FontFamily::InferredTypeFor(default_font_family))); + default_font_description.SetFamily(font_family); default_font_description.SetSpecifiedSize(defaultFontSize); default_font_description.SetComputedSize(defaultFontSize); ComputedStyleBuilder builder = --- a/third_party/blink/renderer/core/page/drag_image.cc +++ b/third_party/blink/renderer/core/page/drag_image.cc @@ -127,9 +127,11 @@ static Font DeriveDragLabelFont(int size const AtomicString& family = LayoutThemeFontProvider::SystemFontFamily(CSSValueID::kNone); + FontFamily font_family; + font_family.SetFamily(family, FontFamily::InferredTypeFor(family)); + FontDescription description; - description.SetFamily( - FontFamily(family, FontFamily::InferredTypeFor(family))); + description.SetFamily(font_family); description.SetWeight(font_weight); description.SetSpecifiedSize(size); description.SetComputedSize(size); --- a/third_party/blink/renderer/core/paint/embedded_object_painter.cc +++ b/third_party/blink/renderer/core/paint/embedded_object_painter.cc @@ -32,9 +32,11 @@ static Font ReplacementTextFont(const Do const float size = LayoutThemeFontProvider::SystemFontSize( CSSValueID::kWebkitSmallControl, document); + FontFamily font_family; + font_family.SetFamily(family, FontFamily::InferredTypeFor(family)); + FontDescription font_description; - font_description.SetFamily( - FontFamily(family, FontFamily::InferredTypeFor(family))); + font_description.SetFamily(font_family); font_description.SetWeight(kBoldWeightValue); font_description.SetSpecifiedSize(size); font_description.SetComputedSize(size); --- a/third_party/blink/renderer/platform/exported/web_font_description.cc +++ b/third_party/blink/renderer/platform/exported/web_font_description.cc @@ -49,10 +49,13 @@ WebFontDescription::WebFontDescription(c } WebFontDescription::operator FontDescription() const { + FontFamily font_family; + font_family.SetFamily(family, family_is_generic + ? FontFamily::Type::kGenericFamily + : FontFamily::Type::kFamilyName); + FontDescription desc; - desc.SetFamily(FontFamily(family, family_is_generic - ? FontFamily::Type::kGenericFamily - : FontFamily::Type::kFamilyName)); + desc.SetFamily(font_family); desc.SetGenericFamily( static_cast<FontDescription::GenericFamilyType>(generic_family)); desc.SetSpecifiedSize(size); --- a/third_party/blink/renderer/platform/fonts/font_description.h +++ b/third_party/blink/renderer/platform/fonts/font_description.h @@ -195,6 +195,7 @@ class PLATFORM_EXPORT FontDescription { FamilyDescription GetFamilyDescription() const { return FamilyDescription(GenericFamily(), Family()); } + FontFamily& FirstFamily() { return family_list_; } const FontFamily& FirstFamily() const { return family_list_; } Size GetSize() const { return Size(KeywordSize(), SpecifiedSize(), IsAbsoluteSize()); @@ -450,6 +451,10 @@ class PLATFORM_EXPORT FontDescription { return fields_.subpixel_ascent_descent_; } + void SetHashCategory(HashCategory category) { + fields_.hash_category_ = category; + } + HashCategory GetHashCategory() const { return static_cast<HashCategory>(fields_.hash_category_); } --- a/third_party/blink/renderer/platform/fonts/font_fallback_list.cc +++ b/third_party/blink/renderer/platform/fonts/font_fallback_list.cc @@ -178,8 +178,9 @@ const FontData* FontFallbackList::GetFon if (font_selector_) { // Try the user's preferred standard font. - FontFamily font_family(font_family_names::kWebkitStandard, - FontFamily::Type::kGenericFamily); + FontFamily font_family; + font_family.SetFamily(font_family_names::kWebkitStandard, + FontFamily::Type::kGenericFamily); if (const FontData* data = font_selector_->GetFontData(font_description, font_family)) { return data; --- a/third_party/blink/renderer/platform/fonts/font_family.cc +++ b/third_party/blink/renderer/platform/fonts/font_family.cc @@ -49,6 +49,20 @@ bool operator==(const FontFamily& a, con return true; } +wtf_size_t FontFamily::CountNames() const { + wtf_size_t count = 0; + for (const FontFamily* font_family = this; font_family; + font_family = font_family->Next()) + ++count; + return count; +} + +void FontFamily::AppendFamily(AtomicString family_name, Type family_type) { + scoped_refptr<SharedFontFamily> appended_family = SharedFontFamily::Create(); + appended_family->SetFamily(family_name, family_type); + AppendFamily(appended_family); +} + String FontFamily::ToString() const { StringBuilder builder; builder.Append(family_name_); --- a/third_party/blink/renderer/platform/fonts/font_family.h +++ b/third_party/blink/renderer/platform/fonts/font_family.h @@ -39,18 +39,16 @@ class PLATFORM_EXPORT FontFamily { DISALLOW_NEW(); public: - // https://drafts.csswg.org/css-fonts/#font-family-prop - enum class Type : uint8_t { kFamilyName, kGenericFamily }; - - FontFamily(const AtomicString& family_name, - Type family_type, - scoped_refptr<SharedFontFamily> next = nullptr) - : family_name_(family_name), - next_(std::move(next)), - family_type_(family_type) {} FontFamily() = default; ~FontFamily(); + // https://drafts.csswg.org/css-fonts/#font-family-prop + enum class Type : uint8_t { kFamilyName, kGenericFamily }; + + void SetFamily(const AtomicString& family_name, Type family_type) { + family_name_ = family_name; + family_type_ = family_type; + } // Return this font family's name. Note that it is never quoted nor escaped. // For web-exposed serialization, please rely instead on the functions // ComputedStyleUtils::ValueForFontFamily(const FontFamily&) and @@ -59,8 +57,13 @@ class PLATFORM_EXPORT FontFamily { const AtomicString& FamilyName() const { return family_name_; } bool FamilyIsGeneric() const { return family_type_ == Type::kGenericFamily; } + // Returns number of linked `FontFamily` including `this`, so return value is + // greater than or equal to 1. When `Next()` is `nullptr`, return value is 1. + wtf_size_t CountNames() const; const FontFamily* Next() const; + void AppendFamily(scoped_refptr<SharedFontFamily>); + void AppendFamily(AtomicString family_name, Type family_type); scoped_refptr<SharedFontFamily> ReleaseNext(); bool IsPrewarmed() const { return is_prewarmed_; } @@ -93,19 +96,12 @@ class PLATFORM_EXPORT SharedFontFamily : SharedFontFamily(const SharedFontFamily&) = delete; SharedFontFamily& operator=(const SharedFontFamily&) = delete; - static scoped_refptr<SharedFontFamily> Create( - const AtomicString& family_name, - Type family_type, - scoped_refptr<SharedFontFamily> next = nullptr) { - return base::AdoptRef( - new SharedFontFamily(family_name, family_type, std::move(next))); + static scoped_refptr<SharedFontFamily> Create() { + return base::AdoptRef(new SharedFontFamily); } private: - SharedFontFamily(const AtomicString& family_name, - Type family_type, - scoped_refptr<SharedFontFamily> next) - : FontFamily(family_name, family_type, std::move(next)) {} + SharedFontFamily() = default; }; PLATFORM_EXPORT bool operator==(const FontFamily&, const FontFamily&); @@ -125,6 +121,10 @@ inline const FontFamily* FontFamily::Nex return next_.get(); } +inline void FontFamily::AppendFamily(scoped_refptr<SharedFontFamily> family) { + next_ = std::move(family); +} + inline scoped_refptr<SharedFontFamily> FontFamily::ReleaseNext() { return std::move(next_); } --- a/third_party/blink/renderer/platform/graphics/placeholder_image.cc +++ b/third_party/blink/renderer/platform/graphics/placeholder_image.cc @@ -85,18 +85,23 @@ void DrawCenteredIcon(cc::PaintCanvas* c } FontDescription CreatePlaceholderFontDescription(float scale_factor) { - scoped_refptr<SharedFontFamily> arial = SharedFontFamily::Create( - font_family_names::kArial, FontFamily::Type::kFamilyName); - scoped_refptr<SharedFontFamily> helvetica = SharedFontFamily::Create( - font_family_names::kHelvetica, FontFamily::Type::kFamilyName, arial); - scoped_refptr<SharedFontFamily> helvetica_neue = - SharedFontFamily::Create(font_family_names::kHelveticaNeue, - FontFamily::Type::kFamilyName, helvetica); - FontFamily roboto(font_family_names::kRoboto, FontFamily::Type::kFamilyName, - helvetica_neue); - FontDescription description; - description.SetFamily(roboto); + description.FirstFamily().SetFamily(font_family_names::kRoboto, + FontFamily::Type::kFamilyName); + + scoped_refptr<SharedFontFamily> helvetica_neue = SharedFontFamily::Create(); + helvetica_neue->SetFamily(font_family_names::kHelveticaNeue, + FontFamily::Type::kFamilyName); + scoped_refptr<SharedFontFamily> helvetica = SharedFontFamily::Create(); + helvetica->SetFamily(font_family_names::kHelvetica, + FontFamily::Type::kFamilyName); + scoped_refptr<SharedFontFamily> arial = SharedFontFamily::Create(); + arial->SetFamily(font_family_names::kArial, FontFamily::Type::kFamilyName); + + helvetica->AppendFamily(std::move(arial)); + helvetica_neue->AppendFamily(std::move(helvetica)); + description.FirstFamily().AppendFamily(std::move(helvetica_neue)); + description.SetGenericFamily(FontDescription::kSansSerifFamily); description.SetComputedSize(scale_factor * kFontSize); description.SetWeight(FontSelectionValue(500)); --- a/third_party/blink/renderer/platform/testing/font_test_helpers.cc +++ b/third_party/blink/renderer/platform/testing/font_test_helpers.cc @@ -127,9 +127,11 @@ Font CreateTestFont(const AtomicString& size_t data_size, float size, const FontDescription::VariantLigatures* ligatures) { + FontFamily family; + family.SetFamily(family_name, FontFamily::Type::kFamilyName); + FontDescription font_description; - font_description.SetFamily( - FontFamily(family_name, FontFamily::Type::kFamilyName)); + font_description.SetFamily(family); font_description.SetSpecifiedSize(size); font_description.SetComputedSize(size); if (ligatures) @@ -143,9 +145,11 @@ Font CreateTestFont(const AtomicString& float size, const FontDescription::VariantLigatures* ligatures, void (*init_font_description)(FontDescription*)) { + FontFamily family; + family.SetFamily(family_name, FontFamily::Type::kFamilyName); + FontDescription font_description; - font_description.SetFamily( - FontFamily(family_name, FontFamily::Type::kFamilyName)); + font_description.SetFamily(family); font_description.SetSpecifiedSize(size); font_description.SetComputedSize(size); if (ligatures)
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor