Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(569)

Unified Diff: third_party/WebKit/Source/core/layout/ng/inline/ng_line_breaker.h

Issue 2930963002: [LayoutNG] Refactor of NGLineBreaker. (Closed)
Patch Set: rebase Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/layout/ng/inline/ng_line_breaker.h
diff --git a/third_party/WebKit/Source/core/layout/ng/inline/ng_line_breaker.h b/third_party/WebKit/Source/core/layout/ng/inline/ng_line_breaker.h
index 2c6b2da41bd301e4ff35120e7c491be6e60cdb7b..3db522182a4c42066fb3f27f6d1c4006d6458f08 100644
--- a/third_party/WebKit/Source/core/layout/ng/inline/ng_line_breaker.h
+++ b/third_party/WebKit/Source/core/layout/ng/inline/ng_line_breaker.h
@@ -19,7 +19,7 @@ namespace blink {
class NGInlineBreakToken;
class NGInlineItem;
class NGInlineNode;
-class NGInlineLayoutAlgorithm;
+class NGFragmentBuilder;
// Represents a line breaker.
//
@@ -28,23 +28,24 @@ class NGInlineLayoutAlgorithm;
class CORE_EXPORT NGLineBreaker {
public:
NGLineBreaker(NGInlineNode,
- const NGConstraintSpace*,
- NGInlineBreakToken* = nullptr);
+ NGConstraintSpace*,
+ NGFragmentBuilder*,
+ const NGInlineBreakToken* = nullptr);
~NGLineBreaker() {}
STACK_ALLOCATED();
// Compute the next line break point and produces NGInlineItemResults for
// the line.
- // TODO(kojii): NGInlineLayoutAlgorithm is needed because floats require
- // not only constraint space but also container builder. Consider refactor
- // not to require algorithm.
- bool NextLine(NGLineInfo*, NGInlineLayoutAlgorithm*);
+ bool NextLine(NGLineInfo*, const NGLogicalOffset&);
// Create an NGInlineBreakToken for the last line returned by NextLine().
RefPtr<NGInlineBreakToken> CreateBreakToken() const;
private:
- void BreakLine(NGLineInfo*, NGInlineLayoutAlgorithm*);
+ void BreakLine(NGLineInfo*, const NGLogicalOffset&);
+
+ void ResolveBFCOffset();
+ LayoutUnit ComputeAvailableWidth(const NGLogicalOffset&) const;
enum class LineBreakState {
// The current position is not breakable.
@@ -57,7 +58,9 @@ class CORE_EXPORT NGLineBreaker {
kForcedBreak
};
- LineBreakState HandleText(const NGInlineItem&, NGInlineItemResult*);
+ LineBreakState HandleText(const NGInlineItem&,
+ LayoutUnit available_width,
+ NGInlineItemResult*);
void BreakText(NGInlineItemResult*,
const NGInlineItem&,
LayoutUnit available_width);
@@ -65,13 +68,14 @@ class CORE_EXPORT NGLineBreaker {
LineBreakState HandleControlItem(const NGInlineItem&, NGInlineItemResult*);
LineBreakState HandleAtomicInline(const NGInlineItem&, NGInlineItemResult*);
void HandleFloat(const NGInlineItem&,
- NGInlineItemResults*,
- NGInlineLayoutAlgorithm*);
+ const NGLogicalOffset&,
+ WTF::Optional<LayoutUnit>* available_width,
+ NGInlineItemResults*);
void HandleOpenTag(const NGInlineItem&, NGInlineItemResult*);
void HandleCloseTag(const NGInlineItem&, NGInlineItemResult*);
- void HandleOverflow(NGLineInfo*);
+ void HandleOverflow(LayoutUnit available_width, NGLineInfo*);
void Rewind(NGLineInfo*, unsigned new_end);
void UpdateBreakIterator(const ComputedStyle&);
@@ -81,11 +85,11 @@ class CORE_EXPORT NGLineBreaker {
void SkipCollapsibleWhitespaces();
NGInlineNode node_;
- const NGConstraintSpace* constraint_space_;
+ NGConstraintSpace* constraint_space_;
+ NGFragmentBuilder* container_builder_;
const AtomicString locale_;
unsigned item_index_;
unsigned offset_;
- LayoutUnit available_width_;
LayoutUnit position_;
LazyLineBreakIterator break_iterator_;
HarfBuzzShaper shaper_;

Powered by Google App Engine
This is Rietveld 408576698