mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-30 04:39:06 +00:00
LibWeb: Add start
and end
values to text-align
The `start` and `end` value set the text alignment based on the computed value of `direction`. The default value of `text-align` is now `start` instead of `left`.
This commit is contained in:
parent
82989554ab
commit
1537d589ca
Notes:
github-actions[bot]
2024-08-13 14:20:44 +00:00
Author: https://github.com/BenJilks
Commit: 1537d589ca
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1060
Reviewed-by: https://github.com/AtkinsSJ ✅
8 changed files with 51 additions and 12 deletions
|
@ -163,6 +163,7 @@ void LineBuilder::update_last_line()
|
|||
auto& line_box = line_boxes.last();
|
||||
|
||||
auto text_align = m_context.containing_block().computed_values().text_align();
|
||||
auto direction = m_context.containing_block().computed_values().direction();
|
||||
|
||||
auto current_line_height = max(m_max_height_on_current_line, m_context.containing_block().computed_values().line_height());
|
||||
CSSPixels x_offset_top = m_context.leftmost_x_offset_at(m_current_y);
|
||||
|
@ -179,6 +180,14 @@ void LineBuilder::update_last_line()
|
|||
case CSS::TextAlign::LibwebCenter:
|
||||
x_offset += excess_horizontal_space / 2;
|
||||
break;
|
||||
case CSS::TextAlign::Start:
|
||||
if (direction == CSS::Direction::Rtl)
|
||||
x_offset += excess_horizontal_space;
|
||||
break;
|
||||
case CSS::TextAlign::End:
|
||||
if (direction == CSS::Direction::Ltr)
|
||||
x_offset += excess_horizontal_space;
|
||||
break;
|
||||
case CSS::TextAlign::Right:
|
||||
case CSS::TextAlign::LibwebRight:
|
||||
x_offset += excess_horizontal_space;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue