mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-07 21:59:54 +00:00
LibWeb: Separate font computation logic from StyleComputer
Font computation and loading is distinct enough from style computation that it makes more sense to have this in it's own class. This will be useful later when we move the font loading process to `ComputedProperties` in order to respect animated values.
This commit is contained in:
parent
dfa47d9ed6
commit
6c236d04d8
Notes:
github-actions[bot]
2025-12-05 10:04:34 +00:00
Author: https://github.com/Calme1709
Commit: 6c236d04d8
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6757
Reviewed-by: https://github.com/AtkinsSJ ✅
Reviewed-by: https://github.com/gmta
13 changed files with 722 additions and 646 deletions
|
|
@ -11,9 +11,9 @@
|
|||
#include <LibGfx/Font/Font.h>
|
||||
#include <LibGfx/Rect.h>
|
||||
#include <LibWeb/CSS/ComputedProperties.h>
|
||||
#include <LibWeb/CSS/FontComputer.h>
|
||||
#include <LibWeb/CSS/Length.h>
|
||||
#include <LibWeb/CSS/Percentage.h>
|
||||
#include <LibWeb/CSS/StyleComputer.h>
|
||||
#include <LibWeb/DOM/Document.h>
|
||||
#include <LibWeb/HTML/BrowsingContext.h>
|
||||
#include <LibWeb/HTML/Navigable.h>
|
||||
|
|
@ -139,7 +139,7 @@ Length::ResolutionContext Length::ResolutionContext::for_element(DOM::AbstractEl
|
|||
|
||||
Length::ResolutionContext Length::ResolutionContext::for_window(HTML::Window const& window)
|
||||
{
|
||||
auto const& initial_font = window.associated_document().style_computer().initial_font();
|
||||
auto const& initial_font = window.associated_document().font_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() };
|
||||
return Length::ResolutionContext {
|
||||
|
|
@ -151,7 +151,7 @@ Length::ResolutionContext Length::ResolutionContext::for_window(HTML::Window con
|
|||
|
||||
Length::ResolutionContext Length::ResolutionContext::for_document(DOM::Document const& document)
|
||||
{
|
||||
auto const& initial_font = document.style_computer().initial_font();
|
||||
auto const& initial_font = document.font_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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue