| Index: third_party/WebKit/Source/core/layout/ng/inline/ng_inline_layout_algorithm.h
|
| diff --git a/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_layout_algorithm.h b/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_layout_algorithm.h
|
| index 2f9b4f2b75811fd8052498cb5f450776a0638583..2bfa6352f252758f4bb1f32d583de41f75af5c62 100644
|
| --- a/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_layout_algorithm.h
|
| +++ b/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_layout_algorithm.h
|
| @@ -9,6 +9,7 @@
|
| #include "core/layout/ng/geometry/ng_logical_offset.h"
|
| #include "core/layout/ng/inline/ng_inline_box_state.h"
|
| #include "core/layout/ng/inline/ng_inline_break_token.h"
|
| +#include "core/layout/ng/inline/ng_inline_item_result.h"
|
| #include "core/layout/ng/inline/ng_line_height_metrics.h"
|
| #include "core/layout/ng/ng_constraint_space_builder.h"
|
| #include "core/layout/ng/ng_fragment_builder.h"
|
| @@ -42,59 +43,24 @@ class CORE_EXPORT NGInlineLayoutAlgorithm final
|
| NGConstraintSpace*,
|
| NGInlineBreakToken* = nullptr);
|
|
|
| - LayoutUnit MaxInlineSize() const { return max_inline_size_; }
|
| -
|
| - // Returns if the current items fit on a line.
|
| - bool CanFitOnLine() const;
|
| -
|
| - // Returns if there were any items.
|
| - bool HasItems() const;
|
| -
|
| - // Set the end offset.
|
| - void SetEnd(unsigned end_offset);
|
| -
|
| - // Set the end offset if caller knows the inline size since the current end.
|
| - void SetEnd(unsigned index,
|
| - unsigned end_offset,
|
| - LayoutUnit inline_size_since_current_end);
|
| + // The available width for the current line.
|
| + LayoutUnit AvailableWidth() const;
|
|
|
| // Create a line up to the end offset.
|
| // Then set the start to the end offset, and thus empty the current line.
|
| // @return false if the line does not fit in the constraint space in block
|
| // direction.
|
| - bool CreateLine();
|
| -
|
| - // Returns if a break opportunity was set on the current line.
|
| - bool HasBreakOpportunity() const;
|
| -
|
| - // Returns if there were items after the last break opportunity.
|
| - bool HasItemsAfterLastBreakOpportunity() const;
|
| -
|
| - // Set the break opportunity at the current end offset.
|
| - void SetBreakOpportunity();
|
| -
|
| - // Create a line up to the last break opportunity.
|
| - // Items after that are sent to the next line.
|
| - // @return false if the line does not fit in the constraint space in block
|
| - // direction.
|
| - bool CreateLineUpToLastBreakOpportunity();
|
| -
|
| - // Set the start offset of hangables; e.g., spaces or hanging punctuations.
|
| - // Hangable characters can go beyond the right margin, and are ignored for
|
| - // center/right alignment.
|
| - void SetStartOfHangables(unsigned offset);
|
| + bool CreateLine(NGInlineItemResults*, RefPtr<NGInlineBreakToken> = nullptr);
|
|
|
| RefPtr<NGLayoutResult> Layout() override;
|
|
|
| - // Compute MinMaxContentSize by performing layout.
|
| - // Unlike NGLayoutAlgorithm::ComputeMinMaxContentSize(), this function runs
|
| - // part of layout operations and modifies the state of |this|.
|
| - MinMaxContentSize ComputeMinMaxContentSizeByLayout();
|
| -
|
| - // Compute inline size of an NGInlineItem.
|
| - // Same as NGInlineItem::InlineSize(), except that this function can compute
|
| - // atomic inlines by performing layout.
|
| - LayoutUnit InlineSize(const NGInlineItem&);
|
| + // Lays out the inline float.
|
| + // List of actions:
|
| + // - tries to position the float right away if we have enough space.
|
| + // - updates the current_opportunity if we actually place the float.
|
| + // - if it's too wide then we add the float to the unpositioned list so it can
|
| + // be positioned after we're done with the current line.
|
| + void LayoutAndPositionFloat(LayoutUnit end_position, LayoutObject*);
|
|
|
| private:
|
| bool IsHorizontalWritingMode() const { return is_horizontal_writing_mode_; }
|
| @@ -103,38 +69,11 @@ class CORE_EXPORT NGInlineLayoutAlgorithm final
|
| const ComputedStyle& FirstLineStyle() const;
|
| const ComputedStyle& LineStyle() const;
|
|
|
| - // Set the start and the end to the specified offset.
|
| - // This empties the current line.
|
| - void Initialize(unsigned index, unsigned offset);
|
| -
|
| - LayoutUnit InlineSize(const NGInlineItem&,
|
| - unsigned start_offset,
|
| - unsigned end_offset);
|
| - LayoutUnit InlineSizeFromLayout(const NGInlineItem&);
|
| - const NGLayoutResult* LayoutItem(const NGInlineItem&);
|
| -
|
| - struct LineItemChunk {
|
| - unsigned index;
|
| - unsigned start_offset;
|
| - unsigned end_offset;
|
| - LayoutUnit inline_size;
|
| - };
|
| -
|
| - void BidiReorder(Vector<LineItemChunk, 32>*);
|
| -
|
| - // Lays out the inline float.
|
| - // List of actions:
|
| - // - tries to position the float right away if we have enough space.
|
| - // - updates the current_opportunity if we actually place the float.
|
| - // - if it's too wide then we add the float to the unpositioned list so it can
|
| - // be positioned after we're done with the current line.
|
| - void LayoutAndPositionFloat(LayoutUnit end_position, LayoutObject*);
|
| + void BidiReorder(NGInlineItemResults*);
|
|
|
| - bool PlaceItems(const Vector<LineItemChunk, 32>&);
|
| - void AccumulateUsedFonts(const NGInlineItem&,
|
| - const LineItemChunk&,
|
| - NGLineBoxFragmentBuilder*);
|
| + bool PlaceItems(NGInlineItemResults*, RefPtr<NGInlineBreakToken>);
|
| LayoutUnit PlaceAtomicInline(const NGInlineItem&,
|
| + NGInlineItemResult*,
|
| NGLineBoxFragmentBuilder*,
|
| NGInlineBoxState*,
|
| NGTextFragmentBuilder*);
|
| @@ -142,16 +81,7 @@ class CORE_EXPORT NGInlineLayoutAlgorithm final
|
| // Finds the next layout opportunity for the next text fragment.
|
| void FindNextLayoutOpportunity();
|
|
|
| - Vector<RefPtr<NGLayoutResult>, 32> layout_results_;
|
| NGInlineLayoutStateStack box_states_;
|
| - unsigned start_index_ = 0;
|
| - unsigned start_offset_ = 0;
|
| - unsigned last_index_ = 0;
|
| - unsigned end_offset_ = 0;
|
| - unsigned last_break_opportunity_index_ = 0;
|
| - unsigned last_break_opportunity_offset_ = 0;
|
| - LayoutUnit end_position_;
|
| - LayoutUnit last_break_opportunity_position_;
|
| LayoutUnit content_size_;
|
| LayoutUnit max_inline_size_;
|
| FontBaseline baseline_type_ = FontBaseline::kAlphabeticBaseline;
|
| @@ -163,9 +93,6 @@ class CORE_EXPORT NGInlineLayoutAlgorithm final
|
| unsigned disallow_first_line_rules_ : 1;
|
|
|
| NGConstraintSpaceBuilder space_builder_;
|
| -#if DCHECK_IS_ON()
|
| - unsigned is_bidi_reordered_ : 1;
|
| -#endif
|
| };
|
|
|
| } // namespace blink
|
|
|