1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 21:08:12 +00:00

LibWeb: Update element style when focus state changes

To ensure that :focus rules get included (or excluded), we have to
update style whenever focus moves.
This commit is contained in:
Andreas Kling 2022-03-03 13:24:03 +01:00
parent ef33a40b99
commit 88aa356606

View file

@ -1081,13 +1081,17 @@ void Document::set_focused_element(Element* element)
if (m_focused_element == element)
return;
if (m_focused_element)
if (m_focused_element) {
m_focused_element->did_lose_focus();
m_focused_element->set_needs_style_update(true);
}
m_focused_element = element;
if (m_focused_element)
if (m_focused_element) {
m_focused_element->did_receive_focus();
m_focused_element->set_needs_style_update(true);
}
if (m_layout_root)
m_layout_root->set_needs_display();