mirror of
https://github.com/zebrajr/ladybird.git
synced 2025-12-06 00:19:53 +01: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
|
|
@ -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…
Reference in New Issue
Block a user