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

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

Issue 2943983002: [LayoutNG] Implement CSS 'text-indent' property (Closed)
Patch Set: Cleanup 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.cc
diff --git a/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_item_result.cc b/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_item_result.cc
index d0200c35fc1c69c34bbafab38e8fb11ba653cb32..132384575680012c082478ab7d4d142b9b888176 100644
--- a/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_item_result.cc
+++ b/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_item_result.cc
@@ -5,6 +5,7 @@
#include "core/layout/ng/inline/ng_inline_item_result.h"
#include "core/layout/ng/inline/ng_inline_node.h"
+#include "core/layout/ng/ng_constraint_space.h"
namespace blink {
@@ -19,16 +20,23 @@ NGInlineItemResult::NGInlineItemResult(unsigned index,
no_break_opportunities_inside(false),
prohibit_break_after(false) {}
-void NGLineInfo::SetLineStyle(const NGInlineNode& node, bool is_first_line) {
+void NGLineInfo::SetLineStyle(const NGInlineNode& node,
+ const NGConstraintSpace& constraint_space,
+ bool is_first_line,
+ bool is_after_forced_break) {
LayoutObject* layout_object = node.GetLayoutObject();
- if (is_first_line &&
- layout_object->GetDocument().GetStyleEngine().UsesFirstLineRules()) {
- is_first_line_ = true;
- line_style_ = layout_object->FirstLineStyle();
- return;
+ use_first_line_style_ =
+ is_first_line &&
+ layout_object->GetDocument().GetStyleEngine().UsesFirstLineRules();
+ line_style_ = layout_object->Style(use_first_line_style_);
+
+ if (line_style_->ShouldUseTextIndent(is_first_line, is_after_forced_break)) {
+ text_indent_ =
+ MinimumValueForLength(line_style_->TextIndent(),
+ constraint_space.AvailableSize().inline_size);
+ } else {
+ text_indent_ = LayoutUnit();
}
- is_first_line_ = false;
- line_style_ = layout_object->Style();
}
void NGLineInfo::SetLineLocation(LayoutUnit line_left,

Powered by Google App Engine
This is Rietveld 408576698