mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 13:47:45 +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:
parent
ef33a40b99
commit
88aa356606
1 changed files with 6 additions and 2 deletions
|
@ -1081,13 +1081,17 @@ void Document::set_focused_element(Element* element)
|
||||||
if (m_focused_element == element)
|
if (m_focused_element == element)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (m_focused_element)
|
if (m_focused_element) {
|
||||||
m_focused_element->did_lose_focus();
|
m_focused_element->did_lose_focus();
|
||||||
|
m_focused_element->set_needs_style_update(true);
|
||||||
|
}
|
||||||
|
|
||||||
m_focused_element = element;
|
m_focused_element = element;
|
||||||
|
|
||||||
if (m_focused_element)
|
if (m_focused_element) {
|
||||||
m_focused_element->did_receive_focus();
|
m_focused_element->did_receive_focus();
|
||||||
|
m_focused_element->set_needs_style_update(true);
|
||||||
|
}
|
||||||
|
|
||||||
if (m_layout_root)
|
if (m_layout_root)
|
||||||
m_layout_root->set_needs_display();
|
m_layout_root->set_needs_display();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue