mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-19 07:33:20 +00:00
LibWeb: Support length resolution context for document lacking navigable
Some documents (e.g. those created by DOMParser.parseFromString()) will not be associated with a navigable. These documents effectively have a viewport of 0x0.
This commit is contained in:
parent
c23ed104e5
commit
29fb63c928
Notes:
github-actions[bot]
2025-10-16 09:28:56 +00:00
Author: https://github.com/Calme1709
Commit: 29fb63c928
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6482
Reviewed-by: https://github.com/tcl3 ✅
1 changed files with 6 additions and 1 deletions
|
@ -142,8 +142,13 @@ Length::ResolutionContext Length::ResolutionContext::for_document(DOM::Document
|
|||
auto const& initial_font = document.style_computer().initial_font();
|
||||
Gfx::FontPixelMetrics const& initial_font_metrics = initial_font.pixel_metrics();
|
||||
Length::FontMetrics font_metrics { CSSPixels { initial_font.pixel_size() }, initial_font_metrics, InitialValues::line_height() };
|
||||
CSSPixelRect viewport_rect;
|
||||
|
||||
if (document.navigable())
|
||||
viewport_rect = document.navigable()->viewport_rect();
|
||||
|
||||
return Length::ResolutionContext {
|
||||
.viewport_rect = document.navigable()->viewport_rect(),
|
||||
.viewport_rect = viewport_rect,
|
||||
.font_metrics = font_metrics,
|
||||
.root_font_metrics = font_metrics,
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue