mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-03 07:32:00 +00:00
LibWeb: Invalidate style (and rule cache) on MediaList changes
This makes dynamic changes to a style sheet's media attribute actually take effect immediately.
This commit is contained in:
parent
80c0a16597
commit
6606eecce5
Notes:
github-actions[bot]
2025-03-04 18:08:34 +00:00
Author: https://github.com/awesomekling
Commit: 6606eecce5
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3798
12 changed files with 109 additions and 3 deletions
|
@ -14,6 +14,7 @@
|
|||
#include <LibWeb/Bindings/HTMLLinkElementPrototype.h>
|
||||
#include <LibWeb/Bindings/PrincipalHostDefined.h>
|
||||
#include <LibWeb/CSS/Parser/Parser.h>
|
||||
#include <LibWeb/CSS/StyleComputer.h>
|
||||
#include <LibWeb/DOM/DOMTokenList.h>
|
||||
#include <LibWeb/DOM/Document.h>
|
||||
#include <LibWeb/DOM/Event.h>
|
||||
|
@ -125,6 +126,18 @@ GC::Ref<DOM::DOMTokenList> HTMLLinkElement::sizes()
|
|||
return *m_sizes;
|
||||
}
|
||||
|
||||
void HTMLLinkElement::set_media(String media)
|
||||
{
|
||||
(void)set_attribute(HTML::AttributeNames::media, media);
|
||||
if (auto sheet = m_loaded_style_sheet)
|
||||
sheet->set_media(media);
|
||||
}
|
||||
|
||||
String HTMLLinkElement::media() const
|
||||
{
|
||||
return attribute(HTML::AttributeNames::media).value_or(String {});
|
||||
}
|
||||
|
||||
bool HTMLLinkElement::has_loaded_icon() const
|
||||
{
|
||||
return m_relationship & Relationship::Icon && resource() && resource()->is_loaded() && resource()->has_encoded_data();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue