LibWeb: Use correct viewport units for font properties in iframe root el

This commit is contained in:
Callum Law 2026-03-31 11:23:48 +13:00 committed by Jelle Raaijmakers
parent baecba0d08
commit 90e0e5a0f2
3 changed files with 22 additions and 1 deletions

View file

@ -1450,7 +1450,7 @@ ComputationContext const& StyleComputer::get_computation_context_for_property(Pr
m_cached_font_computation_context = {
.length_resolution_context = inheritance_parent.has_value()
? Length::ResolutionContext::for_element(inheritance_parent.value())
: Length::ResolutionContext::for_window(*m_document->window()),
: Length::ResolutionContext::for_document(m_document),
.abstract_element = abstract_element
};
}

View file

@ -0,0 +1 @@
40px

View file

@ -0,0 +1,20 @@
<!doctype html>
<script src="include.js"></script>
<iframe id="frame" style="width: 400px"></iframe>
<script>
asyncTest(done => {
frame.onload = () => {
println(getComputedStyle(frame.contentDocument.documentElement).fontSize);
done();
};
frame.srcdoc = `
<!DOCTYPE html>
<style>
:root {
font-size: 10vw;
}
</style>
`;
});
</script>