mirror of
https://github.com/RGBCube/serenity
synced 2025-06-01 10:08:10 +00:00
LibWeb: Simplify some WeakPtr assignments
We can assign a raw pointer directly to a WeakPtr without null-checking it first.
This commit is contained in:
parent
ebac8abc04
commit
7a7043f821
3 changed files with 4 additions and 16 deletions
|
@ -25,18 +25,12 @@ void CSSRule::set_css_text(StringView)
|
|||
|
||||
void CSSRule::set_parent_rule(CSSRule* parent_rule)
|
||||
{
|
||||
if (parent_rule)
|
||||
m_parent_rule = parent_rule->make_weak_ptr();
|
||||
else
|
||||
m_parent_rule = nullptr;
|
||||
m_parent_rule = parent_rule;
|
||||
}
|
||||
|
||||
void CSSRule::set_parent_style_sheet(CSSStyleSheet* parent_style_sheet)
|
||||
{
|
||||
if (parent_style_sheet)
|
||||
m_parent_style_sheet = parent_style_sheet->make_weak_ptr();
|
||||
else
|
||||
m_parent_style_sheet = nullptr;
|
||||
m_parent_style_sheet = parent_style_sheet;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -792,10 +792,7 @@ void Node::removed_last_ref()
|
|||
|
||||
void Node::set_layout_node(Badge<Layout::Node>, Layout::Node* layout_node) const
|
||||
{
|
||||
if (layout_node)
|
||||
m_layout_node = layout_node->make_weak_ptr();
|
||||
else
|
||||
m_layout_node = nullptr;
|
||||
m_layout_node = layout_node;
|
||||
}
|
||||
|
||||
EventTarget* Node::get_parent(Event const&)
|
||||
|
|
|
@ -752,10 +752,7 @@ bool EventHandler::handle_keyup(KeyCode key, unsigned modifiers, u32 code_point)
|
|||
|
||||
void EventHandler::set_mouse_event_tracking_layout_node(Layout::Node* layout_node)
|
||||
{
|
||||
if (layout_node)
|
||||
m_mouse_event_tracking_layout_node = layout_node->make_weak_ptr();
|
||||
else
|
||||
m_mouse_event_tracking_layout_node = nullptr;
|
||||
m_mouse_event_tracking_layout_node = layout_node;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue