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

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

Issue 2871733003: [LayoutNG] Refactor NGLineBreaker for ShapingLineBreaker (Closed)
Patch Set: Cleanup Created 3 years, 7 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 79f9d07250c41fea5d3c694f5f4c15efd54c0783..80293583afa7acd04e8381edbbff66f71f22010b 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
@@ -6,24 +6,56 @@
#define NGLineBreaker_h
#include "core/CoreExport.h"
+#include "core/layout/ng/inline/ng_inline_item_result.h"
#include "platform/heap/Handle.h"
#include "platform/wtf/text/AtomicString.h"
namespace blink {
+class LazyLineBreakIterator;
+class NGInlineBreakToken;
+class NGInlineItem;
+class NGInlineNode;
class NGInlineLayoutAlgorithm;
// Represents a line breaker.
+//
+// This class measures each NGInlineItem and determines items to form a line,
+// so that NGInlineLayoutAlgorithm can build a line box from the output.
class CORE_EXPORT NGLineBreaker {
public:
- NGLineBreaker(const AtomicString locale) : locale_(locale) {}
+ NGLineBreaker(NGInlineNode*,
+ const NGConstraintSpace*,
+ NGInlineBreakToken* = nullptr);
~NGLineBreaker() {}
STACK_ALLOCATED();
- void BreakLines(NGInlineLayoutAlgorithm*, const String&, unsigned);
+ // 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.
+ void NextLine(NGInlineItemResults*, NGInlineLayoutAlgorithm*);
+
+ // Create an NGInlineBreakToken for the last line returned by NextLine().
+ RefPtr<NGInlineBreakToken> CreateBreakToken() const;
private:
+ void BreakLine(NGInlineItemResults*, NGInlineLayoutAlgorithm*);
+
+ void LayoutAtomicInline(const NGInlineItem&, NGInlineItemResult*);
+
+ void HandleOverflow(NGInlineItemResults*, const LazyLineBreakIterator&);
+
+ void SkipCollapsibleWhitespaces();
+
+ void AppendCloseTags(NGInlineItemResults*);
+
+ Persistent<NGInlineNode> node_;
+ const NGConstraintSpace* constraint_space_;
const AtomicString locale_;
+ unsigned item_index_;
+ unsigned offset_;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698