mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-10 13:12:56 +00:00
LibGC+Everywhere: Factor out a LibGC from LibJS
Resulting in a massive rename across almost everywhere! Alongside the namespace change, we now have the following names: * JS::NonnullGCPtr -> GC::Ref * JS::GCPtr -> GC::Ptr * JS::HeapFunction -> GC::Function * JS::CellImpl -> GC::Cell * JS::Handle -> GC::Root
This commit is contained in:
parent
ce23efc5f6
commit
f87041bf3a
Notes:
github-actions[bot]
2024-11-15 13:50:17 +00:00
Author: https://github.com/shannonbooth
Commit: f87041bf3a
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2345
1722 changed files with 9939 additions and 9906 deletions
Libraries/LibWeb/CSS
|
@ -21,15 +21,15 @@
|
|||
|
||||
namespace Web::CSS {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(CSSStyleSheet);
|
||||
GC_DEFINE_ALLOCATOR(CSSStyleSheet);
|
||||
|
||||
JS::NonnullGCPtr<CSSStyleSheet> CSSStyleSheet::create(JS::Realm& realm, CSSRuleList& rules, MediaList& media, Optional<URL::URL> location)
|
||||
GC::Ref<CSSStyleSheet> CSSStyleSheet::create(JS::Realm& realm, CSSRuleList& rules, MediaList& media, Optional<URL::URL> location)
|
||||
{
|
||||
return realm.create<CSSStyleSheet>(realm, rules, media, move(location));
|
||||
}
|
||||
|
||||
// https://drafts.csswg.org/cssom/#dom-cssstylesheet-cssstylesheet
|
||||
WebIDL::ExceptionOr<JS::NonnullGCPtr<CSSStyleSheet>> CSSStyleSheet::construct_impl(JS::Realm& realm, Optional<CSSStyleSheetInit> const& options)
|
||||
WebIDL::ExceptionOr<GC::Ref<CSSStyleSheet>> CSSStyleSheet::construct_impl(JS::Realm& realm, Optional<CSSStyleSheetInit> const& options)
|
||||
{
|
||||
// 1. Construct a new CSSStyleSheet object sheet.
|
||||
auto sheet = create(realm, CSSRuleList::create_empty(realm), CSS::MediaList::create(realm, {}), {});
|
||||
|
@ -82,7 +82,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<CSSStyleSheet>> CSSStyleSheet::construct_im
|
|||
if (options->media.has<String>()) {
|
||||
sheet->set_media(options->media.get<String>());
|
||||
} else {
|
||||
sheet->m_media = *options->media.get<JS::Handle<MediaList>>();
|
||||
sheet->m_media = *options->media.get<GC::Root<MediaList>>();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -187,7 +187,7 @@ WebIDL::ExceptionOr<void> CSSStyleSheet::delete_rule(unsigned index)
|
|||
}
|
||||
|
||||
// https://drafts.csswg.org/cssom/#dom-cssstylesheet-replace
|
||||
JS::NonnullGCPtr<WebIDL::Promise> CSSStyleSheet::replace(String text)
|
||||
GC::Ref<WebIDL::Promise> CSSStyleSheet::replace(String text)
|
||||
{
|
||||
auto& realm = this->realm();
|
||||
|
||||
|
@ -209,7 +209,7 @@ JS::NonnullGCPtr<WebIDL::Promise> CSSStyleSheet::replace(String text)
|
|||
set_disallow_modification(true);
|
||||
|
||||
// 4. In parallel, do these steps:
|
||||
Platform::EventLoopPlugin::the().deferred_invoke(JS::create_heap_function(realm.heap(), [&realm, this, text = move(text), promise = JS::Handle(promise)] {
|
||||
Platform::EventLoopPlugin::the().deferred_invoke(GC::create_function(realm.heap(), [&realm, this, text = move(text), promise = GC::Root(promise)] {
|
||||
HTML::TemporaryExecutionContext execution_context { realm, HTML::TemporaryExecutionContext::CallbacksEnabled::Yes };
|
||||
|
||||
// 1. Let rules be the result of running parse a stylesheet’s contents from text.
|
||||
|
@ -218,7 +218,7 @@ JS::NonnullGCPtr<WebIDL::Promise> CSSStyleSheet::replace(String text)
|
|||
auto& rules = parsed_stylesheet->rules();
|
||||
|
||||
// 2. If rules contains one or more @import rules, remove those rules from rules.
|
||||
JS::MarkedVector<JS::NonnullGCPtr<CSSRule>> rules_without_import(realm.heap());
|
||||
GC::MarkedVector<GC::Ref<CSSRule>> rules_without_import(realm.heap());
|
||||
for (auto rule : rules) {
|
||||
if (rule->type() != CSSRule::Type::Import)
|
||||
rules_without_import.append(rule);
|
||||
|
@ -252,7 +252,7 @@ WebIDL::ExceptionOr<void> CSSStyleSheet::replace_sync(StringView text)
|
|||
auto& rules = parsed_stylesheet->rules();
|
||||
|
||||
// 3. If rules contains one or more @import rules, remove those rules from rules.
|
||||
JS::MarkedVector<JS::NonnullGCPtr<CSSRule>> rules_without_import(realm().heap());
|
||||
GC::MarkedVector<GC::Ref<CSSRule>> rules_without_import(realm().heap());
|
||||
for (auto rule : rules) {
|
||||
if (rule->type() != CSSRule::Type::Import)
|
||||
rules_without_import.append(rule);
|
||||
|
@ -352,7 +352,7 @@ Optional<FlyString> CSSStyleSheet::default_namespace() const
|
|||
Optional<FlyString> CSSStyleSheet::namespace_uri(StringView namespace_prefix) const
|
||||
{
|
||||
return m_namespace_rules.get(namespace_prefix)
|
||||
.map([](JS::GCPtr<CSSNamespaceRule> namespace_) {
|
||||
.map([](GC::Ptr<CSSNamespaceRule> namespace_) {
|
||||
return namespace_->namespace_uri();
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue