OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/layout/ng/inline/ng_inline_item_result.h" | 5 #include "core/layout/ng/inline/ng_inline_item_result.h" |
6 | 6 |
7 #include "core/layout/ng/inline/ng_inline_node.h" | 7 #include "core/layout/ng/inline/ng_inline_node.h" |
| 8 #include "core/layout/ng/ng_constraint_space.h" |
8 | 9 |
9 namespace blink { | 10 namespace blink { |
10 | 11 |
11 NGInlineItemResult::NGInlineItemResult() {} | 12 NGInlineItemResult::NGInlineItemResult() {} |
12 | 13 |
13 NGInlineItemResult::NGInlineItemResult(unsigned index, | 14 NGInlineItemResult::NGInlineItemResult(unsigned index, |
14 unsigned start, | 15 unsigned start, |
15 unsigned end) | 16 unsigned end) |
16 : item_index(index), | 17 : item_index(index), |
17 start_offset(start), | 18 start_offset(start), |
18 end_offset(end), | 19 end_offset(end), |
19 no_break_opportunities_inside(false), | 20 no_break_opportunities_inside(false), |
20 prohibit_break_after(false) {} | 21 prohibit_break_after(false) {} |
21 | 22 |
22 void NGLineInfo::SetLineStyle(const NGInlineNode& node, bool is_first_line) { | 23 void NGLineInfo::SetLineStyle(const NGInlineNode& node, |
| 24 const NGConstraintSpace& constraint_space, |
| 25 bool is_first_line, |
| 26 bool is_after_forced_break) { |
23 LayoutObject* layout_object = node.GetLayoutObject(); | 27 LayoutObject* layout_object = node.GetLayoutObject(); |
24 if (is_first_line && | 28 use_first_line_style_ = |
25 layout_object->GetDocument().GetStyleEngine().UsesFirstLineRules()) { | 29 is_first_line && |
26 is_first_line_ = true; | 30 layout_object->GetDocument().GetStyleEngine().UsesFirstLineRules(); |
27 line_style_ = layout_object->FirstLineStyle(); | 31 line_style_ = layout_object->Style(use_first_line_style_); |
28 return; | 32 |
| 33 if (line_style_->ShouldUseTextIndent(is_first_line, is_after_forced_break)) { |
| 34 text_indent_ = |
| 35 MinimumValueForLength(line_style_->TextIndent(), |
| 36 constraint_space.AvailableSize().inline_size); |
| 37 } else { |
| 38 text_indent_ = LayoutUnit(); |
29 } | 39 } |
30 is_first_line_ = false; | |
31 line_style_ = layout_object->Style(); | |
32 } | 40 } |
33 | 41 |
34 void NGLineInfo::SetLineLocation(LayoutUnit line_left, | 42 void NGLineInfo::SetLineLocation(LayoutUnit line_left, |
35 LayoutUnit available_width, | 43 LayoutUnit available_width, |
36 LayoutUnit line_top) { | 44 LayoutUnit line_top) { |
37 line_left_ = line_left; | 45 line_left_ = line_left; |
38 available_width_ = available_width; | 46 available_width_ = available_width; |
39 line_top_ = line_top; | 47 line_top_ = line_top; |
40 } | 48 } |
41 | 49 |
42 } // namespace blink | 50 } // namespace blink |
OLD | NEW |