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

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

Issue 2931563002: [LayoutNG] Implement 'text-align-last' (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_inline_item_result.h
diff --git a/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_item_result.h b/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_item_result.h
index 2be86d0b161929295392d87a2d9782f7082a6690..6a312e3bf876b2b54b255a4edb8f92f8ffe3fed2 100644
--- a/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_item_result.h
+++ b/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_item_result.h
@@ -13,6 +13,8 @@
namespace blink {
+class NGInlineNode;
+
// The result of measuring NGInlineItem.
//
// This is a transient context object only while building line boxes.
@@ -61,6 +63,44 @@ struct CORE_EXPORT NGInlineItemResult {
// Represents a set of NGInlineItemResult that form a line box.
using NGInlineItemResults = Vector<NGInlineItemResult, 32>;
+// Represents a line to build.
+//
+// This is a transient context object only while building line boxes.
+//
+// NGLineBreaker produces, and NGInlineLayoutAlgorithm consumes.
+class CORE_EXPORT NGLineInfo {
+ DISALLOW_NEW_EXCEPT_PLACEMENT_NEW();
+
+ public:
+ NGLineInfo() {}
+ explicit NGLineInfo(size_t capacity) : results_(capacity) {}
+
+ // The style to use for the line.
+ const ComputedStyle& LineStyle() const {
+ DCHECK(line_style_);
+ return *line_style_;
+ }
+ void SetLineStyle(const NGInlineNode&, bool is_first_line);
+
+ // Use ::first-line style if true.
+ // https://drafts.csswg.org/css-pseudo/#selectordef-first-line
+ bool IsFirstLine() const { return is_first_line_; }
+
+ // The last line of a block, or the line ends with a forced line break.
+ // https://drafts.csswg.org/css-text-3/#propdef-text-align-last
+ bool IsLastLine() const { return is_last_line_; }
+ void SetIsLastLine(bool is_last_line) { is_last_line_ = is_last_line; }
+
+ // NGInlineItemResults for this line.
+ NGInlineItemResults& Results() { return results_; }
+
+ private:
+ const ComputedStyle* line_style_ = nullptr;
+ NGInlineItemResults results_;
+ bool is_first_line_ = false;
+ bool is_last_line_ = false;
+};
+
} // namespace blink
#endif // NGInlineItemResult_h

Powered by Google App Engine
This is Rietveld 408576698