mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-12 12:32:21 +00:00
LibWeb: Add "allow declarative shadow roots" flag to Document
This commit is contained in:
parent
637ccbec35
commit
f3070118b1
Notes:
sideshowbarker
2024-07-16 22:24:48 +09:00
Author: https://github.com/awesomekling
Commit: f3070118b1
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/278
Reviewed-by: https://github.com/mattco98
Reviewed-by: https://github.com/nico
3 changed files with 23 additions and 1 deletions
|
@ -288,7 +288,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<Document>> Document::create_and_initialize(
|
||||||
// URL: creationURL
|
// URL: creationURL
|
||||||
// current document readiness: "loading"
|
// current document readiness: "loading"
|
||||||
// about base URL: navigationParams's about base URL
|
// about base URL: navigationParams's about base URL
|
||||||
// FIXME: allow declarative shadow roots: true
|
// allow declarative shadow roots: true
|
||||||
auto document = HTML::HTMLDocument::create(window->realm());
|
auto document = HTML::HTMLDocument::create(window->realm());
|
||||||
document->m_type = type;
|
document->m_type = type;
|
||||||
document->m_content_type = move(content_type);
|
document->m_content_type = move(content_type);
|
||||||
|
@ -300,6 +300,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<Document>> Document::create_and_initialize(
|
||||||
document->set_url(*creation_url);
|
document->set_url(*creation_url);
|
||||||
document->m_readiness = HTML::DocumentReadyState::Loading;
|
document->m_readiness = HTML::DocumentReadyState::Loading;
|
||||||
document->m_about_base_url = navigation_params.about_base_url;
|
document->m_about_base_url = navigation_params.about_base_url;
|
||||||
|
document->set_allow_declarative_shadow_roots(true);
|
||||||
|
|
||||||
document->m_window = window;
|
document->m_window = window;
|
||||||
|
|
||||||
|
@ -5209,4 +5210,16 @@ Vector<JS::Handle<DOM::Range>> Document::find_matching_text(String const& query,
|
||||||
return matches;
|
return matches;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://dom.spec.whatwg.org/#document-allow-declarative-shadow-roots
|
||||||
|
bool Document::allow_declarative_shadow_roots() const
|
||||||
|
{
|
||||||
|
return m_allow_declarative_shadow_roots;
|
||||||
|
}
|
||||||
|
|
||||||
|
// https://dom.spec.whatwg.org/#document-allow-declarative-shadow-roots
|
||||||
|
void Document::set_allow_declarative_shadow_roots(bool allow)
|
||||||
|
{
|
||||||
|
m_allow_declarative_shadow_roots = allow;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -400,6 +400,9 @@ public:
|
||||||
bool is_fully_active() const;
|
bool is_fully_active() const;
|
||||||
bool is_active() const;
|
bool is_active() const;
|
||||||
|
|
||||||
|
[[nodiscard]] bool allow_declarative_shadow_roots() const;
|
||||||
|
void set_allow_declarative_shadow_roots(bool);
|
||||||
|
|
||||||
JS::NonnullGCPtr<HTML::History> history();
|
JS::NonnullGCPtr<HTML::History> history();
|
||||||
JS::NonnullGCPtr<HTML::History> history() const;
|
JS::NonnullGCPtr<HTML::History> history() const;
|
||||||
|
|
||||||
|
@ -929,6 +932,9 @@ private:
|
||||||
// instead they generate boxes as if they were siblings of the root element.
|
// instead they generate boxes as if they were siblings of the root element.
|
||||||
OrderedHashTable<JS::NonnullGCPtr<Element>> m_top_layer_elements;
|
OrderedHashTable<JS::NonnullGCPtr<Element>> m_top_layer_elements;
|
||||||
OrderedHashTable<JS::NonnullGCPtr<Element>> m_top_layer_pending_removals;
|
OrderedHashTable<JS::NonnullGCPtr<Element>> m_top_layer_pending_removals;
|
||||||
|
|
||||||
|
// https://dom.spec.whatwg.org/#document-allow-declarative-shadow-roots
|
||||||
|
bool m_allow_declarative_shadow_roots { false };
|
||||||
};
|
};
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
|
|
|
@ -246,6 +246,9 @@ WebIDL::ExceptionOr<BrowsingContext::BrowsingContextAndDocument> BrowsingContext
|
||||||
// about base URL: creatorBaseURL
|
// about base URL: creatorBaseURL
|
||||||
document->set_about_base_url(creator_base_url);
|
document->set_about_base_url(creator_base_url);
|
||||||
|
|
||||||
|
// allow declarative shadow roots: true
|
||||||
|
document->set_allow_declarative_shadow_roots(true);
|
||||||
|
|
||||||
// 16. If creator is non-null, then:
|
// 16. If creator is non-null, then:
|
||||||
if (creator) {
|
if (creator) {
|
||||||
// 1. Set document's referrer to the serialization of creator's URL.
|
// 1. Set document's referrer to the serialization of creator's URL.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue