summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2022-03-14 19:59:05 +0100
committerAndreas Kling <kling@serenityos.org>2022-03-15 19:48:19 +0100
commitcf69cc7f7d8dc4918eeea0eec3969e3657a8f9c1 (patch)
tree979ab0236545a735196aa4ee9a55d5b4851614c2 /Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp
parent2be4064ca8ad5b107384e2a0ca17ce08d84cadf0 (diff)
downloadserenity-cf69cc7f7d8dc4918eeea0eec3969e3657a8f9c1.zip
LibWeb: Invalidate style when a browsing context's viewport is resized
Anything with viewport-relative CSS lengths (vw/vh/vmin/vmax) needs to have its style recomputed if the viewport size changes.
Diffstat (limited to 'Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp')
-rw-r--r--Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp b/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp
index 7f6374f4be..66b18d9bc1 100644
--- a/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp
+++ b/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp
@@ -97,8 +97,10 @@ void BrowsingContext::set_viewport_rect(Gfx::IntRect const& rect)
if (m_size != rect.size()) {
m_size = rect.size();
- if (auto* document = active_document())
- document->set_needs_layout();
+ if (auto* document = active_document()) {
+ // NOTE: Resizing the viewport changes the reference value for viewport-relative CSS lengths.
+ document->invalidate_style();
+ }
did_change = true;
}