mirror of
https://github.com/RGBCube/serenity
synced 2025-06-01 03:08:13 +00:00
LibWeb: Use the new Gfx::Painter::draw_text_run() API for drawing text
This avoids a bunch of unnecessary work in Painter which not only took time, but sometimes also led to alignment issues. draw_text_run() will draw the text where we tell it, and that's it.
This commit is contained in:
parent
dd940dfa85
commit
1c88536298
4 changed files with 16 additions and 9 deletions
|
@ -159,7 +159,7 @@ void LineBuilder::update_last_line()
|
|||
|
||||
auto line_box_baseline = [&] {
|
||||
float line_box_baseline = 0;
|
||||
for (auto const& fragment : line_box.fragments()) {
|
||||
for (auto& fragment : line_box.fragments()) {
|
||||
auto baseline = fragment_baseline(fragment);
|
||||
if (fragment.height() < m_context.containing_block().line_height())
|
||||
baseline += (m_context.containing_block().line_height() - fragment.height()) / 2;
|
||||
|
@ -168,6 +168,9 @@ void LineBuilder::update_last_line()
|
|||
if (auto length_percentage = fragment.layout_node().computed_values().vertical_align().template get_pointer<CSS::LengthPercentage>(); length_percentage && length_percentage->is_length())
|
||||
baseline += length_percentage->length().to_px(fragment.layout_node());
|
||||
|
||||
// Store the baseline on the fragment. This is used when painting.
|
||||
fragment.set_baseline(baseline);
|
||||
|
||||
line_box_baseline = max(line_box_baseline, baseline);
|
||||
}
|
||||
return line_box_baseline;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue