mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-08 06:09:58 +00:00
LibWeb: Use document's viewport when resolving lengths in media queries
Previously we would always use the window's viewport which was incorrect if we were within an iframe. This is likely applicable to all uses of `Length::ResolutionContext::for_window`.
This commit is contained in:
parent
c33be71df9
commit
05c336ea4e
Notes:
github-actions[bot]
2025-10-07 09:34:36 +00:00
Author: https://github.com/Calme1709
Commit: 05c336ea4e
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6412
Reviewed-by: https://github.com/AtkinsSJ ✅
23 changed files with 198 additions and 83 deletions
|
|
@ -55,7 +55,10 @@ public:
|
|||
FlyString unit_name() const { return CSS::to_string(m_unit); }
|
||||
|
||||
struct ResolutionContext {
|
||||
[[nodiscard]] static ResolutionContext for_document(DOM::Document const&);
|
||||
[[nodiscard]] static ResolutionContext for_element(DOM::AbstractElement const&);
|
||||
// FIXME: Anywhere we use this we probably want to use `for_document` instead since this uses the window's
|
||||
// viewport rather than the documents which can differ e.g. with iframes.
|
||||
[[nodiscard]] static ResolutionContext for_window(HTML::Window const&);
|
||||
[[nodiscard]] static ResolutionContext for_layout_node(Layout::Node const&);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue