mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-30 12:49:19 +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:
parent
afff44be86
commit
6fd24c2a68
Notes:
github-actions[bot]
2025-02-13 19:53:36 +00:00
Author: https://github.com/awesomekling
Commit: 6fd24c2a68
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3558
Reviewed-by: https://github.com/AtkinsSJ ✅
2 changed files with 21 additions and 13 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue