mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 19:59:17 +00:00
LibWeb: Layout inline elements respective of writing-mode
Use the `writing-mode` property to determine what values should be used for computing each element's rect on the screen. If it is a vertical mode, swap the inline and block, lengths and offsets. This only lays out whole inline formatting contexts vertically, and does not currently support mixing the two orientations in a single context.
This commit is contained in:
parent
ede9012723
commit
80e7e6dd7d
Notes:
github-actions[bot]
2024-11-03 16:03:04 +00:00
Author: https://github.com/BenJilks
Commit: 80e7e6dd7d
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2135
Reviewed-by: https://github.com/kalenikaliaksandr ✅
9 changed files with 65 additions and 12 deletions
|
@ -13,7 +13,7 @@
|
|||
|
||||
namespace Web::Layout {
|
||||
|
||||
LineBoxFragment::LineBoxFragment(Node const& layout_node, int start, int length, CSSPixels inline_offset, CSSPixels block_offset, CSSPixels inline_length, CSSPixels block_length, CSSPixels border_box_top, CSS::Direction direction, RefPtr<Gfx::GlyphRun> glyph_run)
|
||||
LineBoxFragment::LineBoxFragment(Node const& layout_node, int start, int length, CSSPixels inline_offset, CSSPixels block_offset, CSSPixels inline_length, CSSPixels block_length, CSSPixels border_box_top, CSS::Direction direction, CSS::WritingMode writing_mode, RefPtr<Gfx::GlyphRun> glyph_run)
|
||||
: m_layout_node(layout_node)
|
||||
, m_start(start)
|
||||
, m_length(length)
|
||||
|
@ -23,6 +23,7 @@ LineBoxFragment::LineBoxFragment(Node const& layout_node, int start, int length,
|
|||
, m_block_length(block_length)
|
||||
, m_border_box_top(border_box_top)
|
||||
, m_direction(direction)
|
||||
, m_writing_mode(writing_mode)
|
||||
, m_glyph_run(move(glyph_run))
|
||||
{
|
||||
if (m_glyph_run) {
|
||||
|
@ -34,11 +35,15 @@ LineBoxFragment::LineBoxFragment(Node const& layout_node, int start, int length,
|
|||
|
||||
CSSPixelPoint LineBoxFragment::offset() const
|
||||
{
|
||||
if (m_writing_mode != CSS::WritingMode::HorizontalTb)
|
||||
return { m_block_offset, m_inline_offset };
|
||||
return { m_inline_offset, m_block_offset };
|
||||
}
|
||||
|
||||
CSSPixelSize LineBoxFragment::size() const
|
||||
{
|
||||
if (m_writing_mode != CSS::WritingMode::HorizontalTb)
|
||||
return { m_block_length, m_inline_length };
|
||||
return { m_inline_length, m_block_length };
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue