mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-20 17:58:18 +03:00
LibWeb: Add non-const variants of Document::{html_element,body,head}()
This commit is contained in:
parent
46f2c278b0
commit
b6004a4ce1
Notes:
sideshowbarker
2024-07-18 18:37:33 +09:00
Author: https://github.com/Lubrsi Commit: https://github.com/SerenityOS/serenity/commit/b6004a4ce1a Pull-request: https://github.com/SerenityOS/serenity/pull/6905
@ -184,7 +184,7 @@ const Element* Document::document_element() const
|
||||
return first_child_of_type<Element>();
|
||||
}
|
||||
|
||||
const HTML::HTMLHtmlElement* Document::html_element() const
|
||||
HTML::HTMLHtmlElement* Document::html_element()
|
||||
{
|
||||
auto* html = document_element();
|
||||
if (is<HTML::HTMLHtmlElement>(html))
|
||||
@ -192,7 +192,7 @@ const HTML::HTMLHtmlElement* Document::html_element() const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const HTML::HTMLHeadElement* Document::head() const
|
||||
HTML::HTMLHeadElement* Document::head()
|
||||
{
|
||||
auto* html = html_element();
|
||||
if (!html)
|
||||
@ -200,7 +200,7 @@ const HTML::HTMLHeadElement* Document::head() const
|
||||
return html->first_child_of_type<HTML::HTMLHeadElement>();
|
||||
}
|
||||
|
||||
const HTML::HTMLElement* Document::body() const
|
||||
HTML::HTMLElement* Document::body()
|
||||
{
|
||||
auto* html = html_element();
|
||||
if (!html)
|
||||
|
@ -91,9 +91,25 @@ public:
|
||||
Element* document_element();
|
||||
const Element* document_element() const;
|
||||
|
||||
const HTML::HTMLHtmlElement* html_element() const;
|
||||
const HTML::HTMLHeadElement* head() const;
|
||||
const HTML::HTMLElement* body() const;
|
||||
HTML::HTMLHtmlElement* html_element();
|
||||
HTML::HTMLHeadElement* head();
|
||||
HTML::HTMLElement* body();
|
||||
|
||||
const HTML::HTMLHtmlElement* html_element() const
|
||||
{
|
||||
return const_cast<Document*>(this)->html_element();
|
||||
}
|
||||
|
||||
const HTML::HTMLHeadElement* head() const
|
||||
{
|
||||
return const_cast<Document*>(this)->head();
|
||||
}
|
||||
|
||||
const HTML::HTMLElement* body() const
|
||||
{
|
||||
return const_cast<Document*>(this)->body();
|
||||
}
|
||||
|
||||
ExceptionOr<void> set_body(HTML::HTMLElement& new_body);
|
||||
|
||||
String title() const;
|
||||
|
Loading…
Reference in New Issue
Block a user