Commit e7deb8fc authored by Koji Ishii's avatar Koji Ishii Committed by Commit Bot

Update layout/ng/inline/README.md

After the rename of NGLogicalLineItem in r769156
<crrev.com/c/2203036>.

NOTRY=true

Bug: 982194
Change-Id: Ib8b92f13f82b26081df864f2e5be88463b7c5805
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2203564Reviewed-by: default avatarKent Tamura <tkent@chromium.org>
Reviewed-by: default avatarYoshifumi Inoue <yosin@chromium.org>
Commit-Queue: Koji Ishii <kojii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#769620}
parent 4e08b0af
......@@ -62,11 +62,12 @@ as in the following.
Inline layout is performed in the following phases:
1. **Pre-layout** converts LayoutObject tree to a concatenated string
1. **[Pre-layout]** converts LayoutObject tree to a concatenated string
and a list of [NGInlineItem].
2. **Line breaking** breaks it into lines and
2. **[Line breaking]** breaks it into lines and
produces a list of [NGInlineItemResult] for each line.
3. **Line box construction** produces a fragment tree.
3. **[Line box construction]** orders and positions items on a line.
4. **[Generate fragments]** generates physical fragments.
This is similar to [CSS Text Processing Order of Operations],
but not exactly the same,
......@@ -74,8 +75,8 @@ because the spec prioritizes the simple description than being accurate.
[CSS Text Processing Order of Operations]: https://drafts.csswg.org/css-text-3/#order
### Pre-layout ###
[Pre-layout]: #pre-layout
### <a name="pre-layout">Pre-layout</a> ###
[pre-layout]: #pre-layout
For inline layout there is a pre-layout pass that prepares the internal data
structures needed to perform line layout.
......@@ -104,7 +105,8 @@ three separate steps or stages that are executed in order:
[text-transform]: https://drafts.csswg.org/css-text-3/#propdef-text-transform
### Line Breaking ###
### <a name="line-breaking">Line Breaking</a> ###
[line breaking]: #line-breaking
[NGLineBreaker] takes a list of [NGInlineItem],
measure them, break into lines, and
......@@ -134,53 +136,51 @@ This phase:
[CSS Calculating widths and margins]: https://drafts.csswg.org/css2/visudet.html#Computing_widths_and_margins
### Line Box Construction ###
### <a name="create-line">Line Box Construction</a> ###
[line Box Construction]: #create-line
`NGInlineLayoutAlgorithm::CreateLine()` takes a list of [NGInlineItemResult] and
produces [NGPhysicalLineBoxFragment] for each line.
Lines are then wrapped in an anonymous [NGPhysicalBoxFragment]
so that one [NGInlineNode] has one corresponding fragment.
produces a list of [NGLogicalLineItem].
This phase consists of following sub-phases:
1. Bidirectional reordering:
Reorder the list of [NGInlineItemResult]
1. Create a [NGLogicalLineItem] for each [NGInlineItemResult]
and determine the positions.
The inline size of each item was already determined by [NGLineBreaker],
but the inline position is recomputed
because [BiDi reordering](#bidi) may change them.
In block direction,
[NGLogicalLineItem] is placed as if the baseline is at 0.
This is adjusted later, possibly multiple times,
for [vertical-align] and the block offset of the parent inline box.
An open-tag item pushes a new stack entry of [NGInlineBoxState],
and a close-tag item pops a stack entry.
This stack is used to determine the size of the inline box,
for [vertical-align], and for a few other purposes.
Please see [Inline Box Tree] below.
2. Process all pending operations in [Inline Box Tree].
3. [Bidirectional reordering](#bidi):
Reorder the list of [NGLogicalLineItem]
according to [UAX#9 Reordering Resolved Levels].
See [Bidirectional text] below.
After this point forward, the list of [NGInlineItemResult] is
After this point forward, the list of [NGLogicalLineItem] is
in _visual order_; which is from [line-left] to [line-right].
The block direction is still logical,
but the inline direction is physical.
4. Applies [ellipsizing] if needed.
5. Applies the CSS [text-align] property.
6. Moves the baseline to the correct position
based on the height of the line box.
2. Create a [NGPhysicalFragment] for each [NGInlineItemResult]
in visual ([line-left] to [line-right]) order,
and place them into [NGPhysicalLineBoxFragment].
1. A text item produces a [NGPhysicalTextFragment].
2. An open-tag item pushes a new stack entry of [NGInlineBoxState],
and a close-tag item pops a stack entry.
Performs operations that require the size of the inline box,
or ancestor boxes.
See [Inline Box Tree] below.
The inline size of each item was already determined by [NGLineBreaker],
but the inline position is recomputed
because BiDi reordering may have changed it.
In block direction, [NGPhysicalFragment] is placed
as if the baseline is at 0.
This is adjusted later, possibly multiple times.
See [Inline Box Tree] and the post-process below.
3. Post-process the constructed line box.
This includes:
1. Process all pending operations in [Inline Box Tree].
2. Moves the baseline to the correct position
based on the height of the line box.
3. Applies the CSS [text-align] property.
Note: There is [a discussion](https://docs.google.com/document/d/1dxzIHl1dwBtgeKgWd2cKcog8AyydN5rduQvXthMOMD0/edit?usp=sharing)
to merge [NGInlineItemResult] and [NGLogicalLineItem], but this hasn't been done yet.
[ellipsizing]: https://drafts.csswg.org/css-ui-3/#overflow-ellipsis
[line-left]: https://drafts.csswg.org/css-writing-modes-3/#line-left
[line-right]: https://drafts.csswg.org/css-writing-modes-3/#line-right
[text-align]: https://drafts.csswg.org/css-text-3/#propdef-text-align
......@@ -240,6 +240,20 @@ Once all children and their positions and sizes are finalized,
`NGInlineLayoutStateStack::CreateBoxFragments()`
creates [NGPhysicalBoxFragment] and add children to it.
### <a name="generate-fragments">Generate Fragments</a> ###
[generate fragments]: #generate-fragments
When all [NGLogicalLineItem]s are ordered and positioned,
they are converted to fragments.
Without [NGFragmentItem] enabled,
each [NGLogicalLineItem] produces a [NGPhysicalFragment],
added to the [NGPhysicalLineBoxFragment].
With [NGFragmentItem] enabled,
each [NGLogicalLineItem] produces a [NGFragmentItem],
added to the [NGFragmentItems] in the containing block of the inline formatting context.
## Miscellaneous topics ##
### Baseline ###
......@@ -355,6 +369,8 @@ positions in the context. See [design doc](https://goo.gl/CJbxky) for details.
[NGBoxFragmentBuilder]: ../ng_box_fragment_builder.h
[NGConstraintSpace]: ../ng_constraint_space_builder.h
[NGConstraintSpaceBuilder]: ../ng_constraint_space_builder.h
[NGFragmentItem]: ng_fragment_item.h
[NGFragmentItems]: ng_fragment_items.h
[NGInlineBoxState]: ng_inline_box_state.h
[NGInlineItem]: ng_inline_item.h
[NGInlineItemResult]: ng_inline_item_result.h
......@@ -362,6 +378,8 @@ positions in the context. See [design doc](https://goo.gl/CJbxky) for details.
[NGInlineLayoutAlgorithm]: ng_inline_layout_algorithm.h
[NGLayoutInputNode]: ../ng_layout_input_node.h
[NGLineBreaker]: ng_line_breaker.h
[NGLogicalLineItem]: ng_logical_line_item.h
[NGLogicalLineItems]: ng_logical_line_items.h
[NGOffsetMapping]: ng_offset_mapping.h
[NGPhysicalBoxFragment]: ../ng_physical_box_fragment.h
[NGPhysicalFragment]: ../ng_physical_fragment.h
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment