diff options
author | Luke <luke.wilde@live.co.uk> | 2021-07-05 05:45:20 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-07-05 12:39:46 +0200 |
commit | a826df773eff63ee0584d7a8a9bf100e23cc6344 (patch) | |
tree | f3e08484e1aaf675fcac99f3b82d5edcd4a88857 /Userland/Libraries/LibWeb/DOM | |
parent | 62c015dc96d7e28fa9646b5ca928a1ec82b71b57 (diff) | |
download | serenity-a826df773eff63ee0584d7a8a9bf100e23cc6344.zip |
LibWeb: Make WrapperGenerator generate nullable wrapper types
Previously it was not doing so, and some code relied on this not being
the case.
In particular, set_caption, set_t_head and set_t_foot in
HTMLTableElement relied on this. This commit is not here to fix this,
so I added an assertion to make it equivalent to a reference for now.
Diffstat (limited to 'Userland/Libraries/LibWeb/DOM')
-rw-r--r-- | Userland/Libraries/LibWeb/DOM/Document.cpp | 6 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/DOM/Document.h | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/Userland/Libraries/LibWeb/DOM/Document.cpp b/Userland/Libraries/LibWeb/DOM/Document.cpp index 2d6ade6c5d..62871e8630 100644 --- a/Userland/Libraries/LibWeb/DOM/Document.cpp +++ b/Userland/Libraries/LibWeb/DOM/Document.cpp @@ -215,14 +215,14 @@ HTML::HTMLElement* Document::body() } // https://html.spec.whatwg.org/multipage/dom.html#dom-document-body -ExceptionOr<void> Document::set_body(HTML::HTMLElement& new_body) +ExceptionOr<void> Document::set_body(HTML::HTMLElement* new_body) { if (!is<HTML::HTMLBodyElement>(new_body) && !is<HTML::HTMLFrameSetElement>(new_body)) return DOM::HierarchyRequestError::create("Invalid document body element, must be 'body' or 'frameset'"); auto* existing_body = body(); if (existing_body) { - auto replace_result = existing_body->parent()->replace_child(new_body, *existing_body); + auto replace_result = existing_body->parent()->replace_child(*new_body, *existing_body); if (replace_result.is_exception()) return replace_result.exception(); return {}; @@ -232,7 +232,7 @@ ExceptionOr<void> Document::set_body(HTML::HTMLElement& new_body) if (!document_element) return DOM::HierarchyRequestError::create("Missing document element"); - auto append_result = document_element->append_child(new_body); + auto append_result = document_element->append_child(*new_body); if (append_result.is_exception()) return append_result.exception(); return {}; diff --git a/Userland/Libraries/LibWeb/DOM/Document.h b/Userland/Libraries/LibWeb/DOM/Document.h index 0d9a999d1c..4225636f73 100644 --- a/Userland/Libraries/LibWeb/DOM/Document.h +++ b/Userland/Libraries/LibWeb/DOM/Document.h @@ -110,7 +110,7 @@ public: return const_cast<Document*>(this)->body(); } - ExceptionOr<void> set_body(HTML::HTMLElement& new_body); + ExceptionOr<void> set_body(HTML::HTMLElement* new_body); String title() const; void set_title(const String&); |