LibWeb: Do includes_properties_from_invalidation_set() for :link & co

Fixes #3511.
This commit is contained in:
Andreas Kling 2025-02-09 12:16:15 +01:00 committed by Alexander Kalenik
parent c4bc0842c1
commit 5f10f8c54c
Notes: github-actions[bot] 2025-02-09 14:21:51 +00:00
2 changed files with 25 additions and 0 deletions

View file

@ -41,6 +41,8 @@
#include <LibWeb/HTML/CustomElements/CustomElementReactionNames.h>
#include <LibWeb/HTML/CustomElements/CustomElementRegistry.h>
#include <LibWeb/HTML/EventLoop/EventLoop.h>
#include <LibWeb/HTML/HTMLAnchorElement.h>
#include <LibWeb/HTML/HTMLAreaElement.h>
#include <LibWeb/HTML/HTMLBodyElement.h>
#include <LibWeb/HTML/HTMLButtonElement.h>
#include <LibWeb/HTML/HTMLFieldSetElement.h>
@ -72,6 +74,7 @@
#include <LibWeb/Page/Page.h>
#include <LibWeb/Painting/PaintableBox.h>
#include <LibWeb/Painting/ViewportPaintable.h>
#include <LibWeb/SVG/SVGAElement.h>
#include <LibWeb/Selection/Selection.h>
#include <LibWeb/WebIDL/AbstractOperations.h>
#include <LibWeb/WebIDL/DOMException.h>
@ -1198,6 +1201,15 @@ bool Element::includes_properties_from_invalidation_set(CSS::InvalidationSet con
// - FIXME: textarea elements that have a placeholder attribute whose value is currently being presented to the user.
return false;
}
case CSS::PseudoClass::AnyLink:
case CSS::PseudoClass::Link:
case CSS::PseudoClass::LocalLink: {
if (!is<HTML::HTMLAnchorElement>(*this) && !is<HTML::HTMLAreaElement>(*this) && !is<SVG::SVGAElement>(*this))
return false;
if (!has_attribute(HTML::AttributeNames::href))
return false;
return true;
}
default:
VERIFY_NOT_REACHED();
}

View file

@ -0,0 +1,13 @@
<!doctype html>
<style>
ul#mylist a:link { }
ul#mylist a:any-link { }
ul#mylist a:local-link { }
</style>
<script>
let o = document.createElement("div");
o.offsetWidth;
</script>
<body>
<ul id="mylist"></ul>
</body>