mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-01 12:07:14 +02:00
LibWeb: Invalidate pseudo-elements on hover even when not yet created
The hover invalidation code only tried matching ::before/::after selectors when has_pseudo_element() returned true, which requires an existing layout node. A pseudo-element that doesn't exist yet (because its content is only set by a hover rule) has no layout node, so the match was skipped and hovering never triggered a style recompute. Always try ::before/::after selectors during hover invalidation.
This commit is contained in:
committed by
Tim Flynn
parent
77b9fcf7f9
commit
16dffe39a0
Notes:
github-actions[bot]
2026-03-24 14:28:09 +00:00
Author: https://github.com/gmta Commit: https://github.com/LadybirdBrowser/ladybird/commit/16dffe39a0c Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/8605 Reviewed-by: https://github.com/trflynn89 ✅
36
Tests/LibWeb/Text/input/css/pseudo-elements-on-hover.html
Normal file
36
Tests/LibWeb/Text/input/css/pseudo-elements-on-hover.html
Normal file
@@ -0,0 +1,36 @@
|
||||
<!DOCTYPE html>
|
||||
<style>
|
||||
.outer {
|
||||
height: 100px;
|
||||
}
|
||||
.update {
|
||||
display: inline-block;
|
||||
}
|
||||
.update::before {
|
||||
content: "Hi";
|
||||
}
|
||||
.outer:hover .update::before {
|
||||
content: "Long text";
|
||||
}
|
||||
.create {
|
||||
display: inline-block;
|
||||
}
|
||||
.outer:hover .create::before {
|
||||
content: "Flag";
|
||||
}
|
||||
</style>
|
||||
<script src="../include.js"></script>
|
||||
<div class="outer"><div class="update"></div><div class="create"></div></div>
|
||||
<script>
|
||||
test(() => {
|
||||
const update = document.querySelector('.update');
|
||||
const create = document.querySelector('.create');
|
||||
println(`update: ${update.clientWidth} create: ${create.clientWidth}`);
|
||||
|
||||
internals.mouseMove(50, 50);
|
||||
println(`update: ${update.clientWidth} create: ${create.clientWidth}`);
|
||||
|
||||
internals.mouseMove(200, 200);
|
||||
println(`update: ${update.clientWidth} create: ${create.clientWidth}`);
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user