mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
LibWeb: Fix two problems where media queries didn't invalidate properly
There were two things going wrong here: - Transformed text (via CSS text-transform) was not invalidated after a `@media` rule changed state. - Removing the `style` attribute from an element didn't trigger a style update. This fixes the regression in subtest 46 of Acid3. Fixes #21777
This commit is contained in:
parent
3b84b03d62
commit
41667f969d
Notes:
sideshowbarker
2024-07-17 07:06:47 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/41667f969d Pull-request: https://github.com/SerenityOS/serenity/pull/23995 Issue: https://github.com/SerenityOS/serenity/issues/21777
4 changed files with 29 additions and 1 deletions
|
@ -0,0 +1,2 @@
|
|||
TRANSFORMED TEXT
|
||||
transformed text
|
|
@ -0,0 +1,25 @@
|
|||
<!doctype html>
|
||||
<style>
|
||||
iframe {
|
||||
width: 0;
|
||||
height: 0;
|
||||
border: 1px solid black;
|
||||
}
|
||||
</style>
|
||||
<script src="../include.js"></script>
|
||||
<body><iframe id="i1"></iframe>
|
||||
<script>
|
||||
asyncTest((done) => {
|
||||
i1.srcdoc = `
|
||||
<style>
|
||||
@media all and (min-height: 1px) { #y1 { text-transform: uppercase; } }
|
||||
</style><div id=y1>transformed text</div><script>document.body.offsetWidth</` + `script>`;
|
||||
i1.onload = function() {
|
||||
i1.setAttribute("style", "height: 100px; width: 100px");
|
||||
println(i1.contentDocument.body.innerText);
|
||||
i1.removeAttribute("style");
|
||||
println(i1.contentDocument.body.innerText);
|
||||
done();
|
||||
};
|
||||
});
|
||||
</script>
|
|
@ -2503,6 +2503,7 @@ void Document::evaluate_media_rules()
|
|||
if (any_media_queries_changed_match_state) {
|
||||
style_computer().invalidate_rule_cache();
|
||||
invalidate_style();
|
||||
invalidate_layout();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -475,7 +475,7 @@ void Element::attribute_changed(FlyString const& name, Optional<String> const& v
|
|||
m_class_list->associated_attribute_changed(value_or_empty);
|
||||
} else if (name == HTML::AttributeNames::style) {
|
||||
if (!value.has_value()) {
|
||||
if (!m_inline_style) {
|
||||
if (m_inline_style) {
|
||||
m_inline_style = nullptr;
|
||||
set_needs_style_update(true);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue