Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LibWeb: Use first font with space in range for first_available_computed_font #3970

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions Libraries/LibWeb/CSS/ComputedProperties.h
Original file line number Diff line number Diff line change
Expand Up @@ -186,17 +186,24 @@ class ComputedProperties final : public JS::Cell {
FillRule fill_rule() const;
ClipRule clip_rule() const;

Gfx::Font const& first_available_computed_font() const { return m_font_list->first(); }

Gfx::FontCascadeList const& computed_font_list() const
{
VERIFY(m_font_list);
return *m_font_list;
}

Gfx::Font const& first_available_computed_font() const
{
VERIFY(m_first_available_computed_font);
return *m_first_available_computed_font;
}

void set_computed_font_list(NonnullRefPtr<Gfx::FontCascadeList> font_list) const
{
m_font_list = move(font_list);
// https://drafts.csswg.org/css-fonts/#first-available-font
// First font for which the character U+0020 (space) is not excluded by a unicode-range
m_first_available_computed_font = m_font_list->font_for_code_point(' ');
}

[[nodiscard]] CSSPixels compute_line_height(CSSPixelRect const& viewport_rect, Length::FontMetrics const& font_metrics, Length::FontMetrics const& root_font_metrics) const;
Expand Down Expand Up @@ -245,6 +252,7 @@ class ComputedProperties final : public JS::Cell {

int m_math_depth { InitialValues::math_depth() };
mutable RefPtr<Gfx::FontCascadeList> m_font_list;
mutable RefPtr<Gfx::Font> m_first_available_computed_font;

Optional<CSSPixels> m_line_height;

Expand Down
Loading