mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 12:19:54 +00:00
LibWeb: Make new_container in insertParagraph command a GC::Ref
This value will never be null.
This commit is contained in:
parent
5e2cb00f75
commit
2d130ffad4
Notes:
github-actions[bot]
2024-12-21 18:17:55 +00:00
Author: https://github.com/gmta
Commit: 2d130ffad4
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2991
1 changed files with 2 additions and 2 deletions
|
@ -697,7 +697,7 @@ bool command_insert_paragraph_action(DOM::Document& document, String const&)
|
|||
}();
|
||||
|
||||
// 22. Let new container be the result of calling createElement(new container name) on the context object.
|
||||
GC::Ptr<DOM::Element> new_container = MUST(DOM::create_element(document, new_container_name, Namespace::HTML));
|
||||
auto new_container = MUST(DOM::create_element(document, new_container_name, Namespace::HTML));
|
||||
|
||||
// 23. Copy all attributes of container to new container.
|
||||
container_element.for_each_attribute([&new_container](FlyString const& name, String const& value) {
|
||||
|
@ -742,7 +742,7 @@ bool command_insert_paragraph_action(DOM::Document& document, String const&)
|
|||
// 31. While new container's lastChild is a prohibited paragraph child, set new container to its lastChild.
|
||||
while (new_container->last_child() && is_prohibited_paragraph_child(*new_container->last_child())) {
|
||||
// NOTE: is_prohibited_paragraph_child() ensures that last_child() is an HTML::HTMLElement
|
||||
new_container = static_cast<HTML::HTMLElement*>(new_container->last_child());
|
||||
new_container = static_cast<HTML::HTMLElement&>(*new_container->last_child());
|
||||
}
|
||||
|
||||
// 32. If container has no visible children, call createElement("br") on the context object, and append the result
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue