mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-28 04:08:08 +00:00
LibWeb: Update layout when checking media queries inside iframes
This ensures that the containing iframe has up-to-date viewport metrics, which is important since that may affect media query results.
This commit is contained in:
committed by
Andreas Kling
parent
afff44be86
commit
6fd24c2a68
@@ -54,6 +54,13 @@ bool MediaQueryList::matches() const
|
||||
if (m_media.is_empty())
|
||||
return true;
|
||||
|
||||
// NOTE: If our document is inside a frame, we need to update layout
|
||||
// since that may cause our frame (and thus viewport) to resize.
|
||||
if (auto container_document = m_document->container_document()) {
|
||||
container_document->update_layout();
|
||||
const_cast<MediaQueryList*>(this)->evaluate();
|
||||
}
|
||||
|
||||
for (auto& media : m_media) {
|
||||
if (media->matches())
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user