mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-28 23:39:02 +00:00
LibWeb: Move event handling & cursor from BrowsingContext to Navigable
This was a long standing FIXME since the introduction of navigables.
This commit is contained in:
parent
9cd4a65071
commit
0ebfc0a4c4
Notes:
sideshowbarker
2024-07-17 01:46:43 +09:00
Author: https://github.com/awesomekling
Commit: 0ebfc0a4c4
Pull-request: https://github.com/SerenityOS/serenity/pull/24123
26 changed files with 364 additions and 360 deletions
|
@ -379,7 +379,7 @@ WebIDL::ExceptionOr<void> HTMLInputElement::run_input_activation_behavior(DOM::E
|
|||
return {};
|
||||
}
|
||||
|
||||
void HTMLInputElement::did_edit_text_node(Badge<BrowsingContext>)
|
||||
void HTMLInputElement::did_edit_text_node(Badge<Navigable>)
|
||||
{
|
||||
// An input element's dirty value flag must be set to true whenever the user interacts with the control in a way that changes the value.
|
||||
m_value = value_sanitization_algorithm(m_text_node->data());
|
||||
|
@ -543,8 +543,8 @@ WebIDL::ExceptionOr<void> HTMLInputElement::set_value(String const& value)
|
|||
m_text_node->set_data(m_value);
|
||||
update_placeholder_visibility();
|
||||
|
||||
if (auto* browsing_context = document().browsing_context())
|
||||
browsing_context->set_cursor_position(DOM::Position::create(realm, *m_text_node, m_text_node->data().bytes().size()));
|
||||
if (auto navigable = document().navigable())
|
||||
navigable->set_cursor_position(DOM::Position::create(realm, *m_text_node, m_text_node->data().bytes().size()));
|
||||
}
|
||||
|
||||
update_shadow_tree();
|
||||
|
@ -1053,12 +1053,12 @@ void HTMLInputElement::update_slider_thumb_element()
|
|||
|
||||
void HTMLInputElement::did_receive_focus()
|
||||
{
|
||||
auto* browsing_context = document().browsing_context();
|
||||
if (!browsing_context)
|
||||
auto navigable = document().navigable();
|
||||
if (!navigable)
|
||||
return;
|
||||
if (!m_text_node)
|
||||
return;
|
||||
browsing_context->set_cursor_position(DOM::Position::create(realm(), *m_text_node, 0));
|
||||
navigable->set_cursor_position(DOM::Position::create(realm(), *m_text_node, 0));
|
||||
}
|
||||
|
||||
void HTMLInputElement::did_lose_focus()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue