layout: More conservatively replace Stylist's Device (#31857)

Instead of replacing Stylist's device on every reflow, only replace it
when the viewport changes. In addition, preserve the root font size from
the previous reflow fixing an issue where `rem` units were not properly
computed between reflows.

This fixes a bug where fonts that are sized using `rem` units change
size on reload.
This commit is contained in:
Martin Robinson 2024-03-26 16:00:50 +01:00 committed by GitHub
parent b71de92569
commit bf3798bbde
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 95 additions and 61 deletions

View file

@ -81,11 +81,13 @@ impl VirtualMethods for HTMLFontElement {
}
fn attribute_affects_presentational_hints(&self, attr: &Attr) -> bool {
if attr.local_name() == &local_name!("color") {
if attr.local_name() == &local_name!("color") ||
attr.local_name() == &local_name!("size") ||
attr.local_name() == &local_name!("face")
{
return true;
}
// FIXME: Should also return true for `size` and `face` changes!
self.super_type()
.unwrap()
.attribute_affects_presentational_hints(attr)