Skip to content

Commit 9de4e3a

Browse files
Calme1709AtkinsSJ
authored andcommitted
LibWeb: Avoid resetting important flag when recomputing inherited style
We were missing the important flag here so would always reset it to false
1 parent 9d2ecc0 commit 9de4e3a

File tree

3 files changed

+38
-2
lines changed

3 files changed

+38
-2
lines changed

Libraries/LibWeb/DOM/Element.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -850,8 +850,7 @@ CSS::RequiredInvalidationAfterStyleChange Element::recompute_inherited_style()
850850
|| (property_id == CSS::PropertyID::FontWeight && first_is_one_of(preabsolutized_value->to_keyword(), CSS::Keyword::Bolder, CSS::Keyword::Lighter))
851851
|| (property_id == CSS::PropertyID::FontSize && first_is_one_of(preabsolutized_value->to_keyword(), CSS::Keyword::Larger, CSS::Keyword::Smaller));
852852
if (needs_updating) {
853-
auto is_inherited = computed_properties->is_property_inherited(property_id);
854-
computed_properties->set_property(property_id, *preabsolutized_value, is_inherited ? CSS::ComputedProperties::Inherited::Yes : CSS::ComputedProperties::Inherited::No);
853+
computed_properties->set_property_without_modifying_flags(property_id, *preabsolutized_value);
855854
property_values_affected_by_inherited_style.set(i, old_value);
856855
}
857856
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<!DOCTYPE html>
2+
<style>
3+
#bar {
4+
width: 1em !important;
5+
background-color: green;
6+
height: 1em;
7+
}
8+
</style>
9+
<div id="bar"></div>
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<!DOCTYPE html>
2+
<link rel="match" href="../../expected/css/recomputing-inherited-style-doesnt-remove-important-ref.html" />
3+
<style>
4+
@keyframes fontSize {
5+
from {
6+
width: 5em;
7+
}
8+
to {
9+
width: 5em;
10+
}
11+
}
12+
13+
#bar {
14+
width: 1em !important;
15+
animation: fontSize 1s infinite;
16+
background-color: green;
17+
height: 1em;
18+
}
19+
</style>
20+
<div id="foo"><div id="bar"></div></div>
21+
<script>
22+
requestAnimationFrame(() => {
23+
requestAnimationFrame(() => {
24+
getComputedStyle(foo).fontSize;
25+
foo.style.setProperty("color", "blue");
26+
});
27+
});
28+
</script>

0 commit comments

Comments
 (0)