mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-04 16:11:54 +00:00
LibWeb: Note what's causing a style invalidation to happen
You can now build with STYLE_INVALIDATION_DEBUG and get a debug stream of reasons why style invalidations are happening and where. I've rewritten this code many times, so instead of throwing it away once again, I figured we should at least have it behind a flag.
This commit is contained in:
parent
1f5c49f40d
commit
ddbfac38b0
Notes:
github-actions[bot]
2024-09-08 07:46:37 +00:00
Author: https://github.com/awesomekling
Commit: ddbfac38b0
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1276
20 changed files with 92 additions and 38 deletions
|
@ -156,7 +156,7 @@ void HTMLInputElement::set_checked(bool checked, ChangeSource change_source)
|
|||
// so we need to invalidate the style of all siblings.
|
||||
if (parent()) {
|
||||
parent()->for_each_child([&](auto& child) {
|
||||
child.invalidate_style();
|
||||
child.invalidate_style(DOM::StyleInvalidationReason::HTMLInputElementSetChecked);
|
||||
return IterationDecision::Continue;
|
||||
});
|
||||
}
|
||||
|
@ -1142,10 +1142,10 @@ void HTMLInputElement::did_receive_focus()
|
|||
{
|
||||
if (!m_text_node)
|
||||
return;
|
||||
m_text_node->invalidate_style();
|
||||
m_text_node->invalidate_style(DOM::StyleInvalidationReason::DidReceiveFocus);
|
||||
|
||||
if (m_placeholder_text_node)
|
||||
m_placeholder_text_node->invalidate_style();
|
||||
m_placeholder_text_node->invalidate_style(DOM::StyleInvalidationReason::DidReceiveFocus);
|
||||
|
||||
document().set_cursor_position(DOM::Position::create(realm(), *m_text_node, 0));
|
||||
}
|
||||
|
@ -1153,10 +1153,10 @@ void HTMLInputElement::did_receive_focus()
|
|||
void HTMLInputElement::did_lose_focus()
|
||||
{
|
||||
if (m_text_node)
|
||||
m_text_node->invalidate_style();
|
||||
m_text_node->invalidate_style(DOM::StyleInvalidationReason::DidLoseFocus);
|
||||
|
||||
if (m_placeholder_text_node)
|
||||
m_placeholder_text_node->invalidate_style();
|
||||
m_placeholder_text_node->invalidate_style(DOM::StyleInvalidationReason::DidLoseFocus);
|
||||
|
||||
commit_pending_changes();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue