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 #ifndef NGInlineBoxState_h | 5 #ifndef NGInlineBoxState_h |
6 #define NGInlineBoxState_h | 6 #define NGInlineBoxState_h |
7 | 7 |
8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
9 #include "core/layout/ng/inline/ng_line_height_metrics.h" | 9 #include "core/layout/ng/inline/ng_line_height_metrics.h" |
10 #include "core/style/ComputedStyleConstants.h" | 10 #include "core/style/ComputedStyleConstants.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 struct NGInlineBoxState { | 33 struct NGInlineBoxState { |
34 unsigned fragment_start; | 34 unsigned fragment_start; |
35 const ComputedStyle* style; | 35 const ComputedStyle* style; |
36 NGLineHeightMetrics metrics; | 36 NGLineHeightMetrics metrics; |
37 NGLineHeightMetrics text_metrics; | 37 NGLineHeightMetrics text_metrics; |
38 LayoutUnit text_top; | 38 LayoutUnit text_top; |
39 Vector<NGPendingPositions> pending_descendants; | 39 Vector<NGPendingPositions> pending_descendants; |
40 bool include_used_fonts = false; | 40 bool include_used_fonts = false; |
41 | 41 |
42 // Compute text metrics for a box. All text in a box share the same metrics. | 42 // Compute text metrics for a box. All text in a box share the same metrics. |
43 void ComputeTextMetrics(const NGInlineItem&, FontBaseline); | 43 void ComputeTextMetrics(const ComputedStyle& style, FontBaseline); |
| 44 void AccumulateUsedFonts(const NGInlineItem&, |
| 45 unsigned start, |
| 46 unsigned end, |
| 47 FontBaseline); |
44 }; | 48 }; |
45 | 49 |
46 // Represents the inline tree structure. This class provides: | 50 // Represents the inline tree structure. This class provides: |
47 // 1) Allow access to fragments belonging to the current box. | 51 // 1) Allow access to fragments belonging to the current box. |
48 // 2) Performs layout when the positin/size of a box was computed. | 52 // 2) Performs layout when the positin/size of a box was computed. |
49 // 3) Cache common values for a box. | 53 // 3) Cache common values for a box. |
50 class NGInlineLayoutStateStack { | 54 class NGInlineLayoutStateStack { |
51 public: | 55 public: |
| 56 // The box state for the line box. |
| 57 NGInlineBoxState& LineBoxState() { return stack_.front(); } |
| 58 |
52 // Initialize the box state stack for a new line. | 59 // Initialize the box state stack for a new line. |
53 // @return The initial box state for the line. | 60 // @return The initial box state for the line. |
54 NGInlineBoxState* OnBeginPlaceItems(const ComputedStyle*); | 61 NGInlineBoxState* OnBeginPlaceItems(const ComputedStyle*, FontBaseline); |
55 | 62 |
56 // Push a box state stack. | 63 // Push a box state stack. |
57 NGInlineBoxState* OnOpenTag(const NGInlineItem&, | 64 NGInlineBoxState* OnOpenTag(const NGInlineItem&, |
58 NGLineBoxFragmentBuilder*, | 65 NGLineBoxFragmentBuilder*, |
59 NGTextFragmentBuilder*); | 66 NGTextFragmentBuilder*); |
60 | 67 |
61 // Pop a box state stack. | 68 // Pop a box state stack. |
62 NGInlineBoxState* OnCloseTag(const NGInlineItem&, | 69 NGInlineBoxState* OnCloseTag(const NGInlineItem&, |
63 NGLineBoxFragmentBuilder*, | 70 NGLineBoxFragmentBuilder*, |
64 NGInlineBoxState*); | 71 NGInlineBoxState*); |
(...skipping 13 matching lines...) Expand all Loading... |
78 // https://www.w3.org/TR/CSS22/visudet.html#propdef-vertical-align | 85 // https://www.w3.org/TR/CSS22/visudet.html#propdef-vertical-align |
79 // https://www.w3.org/TR/css-inline-3/#propdef-vertical-align | 86 // https://www.w3.org/TR/css-inline-3/#propdef-vertical-align |
80 void ApplyBaselineShift(NGInlineBoxState*, NGLineBoxFragmentBuilder*); | 87 void ApplyBaselineShift(NGInlineBoxState*, NGLineBoxFragmentBuilder*); |
81 | 88 |
82 Vector<NGInlineBoxState, 4> stack_; | 89 Vector<NGInlineBoxState, 4> stack_; |
83 }; | 90 }; |
84 | 91 |
85 } // namespace blink | 92 } // namespace blink |
86 | 93 |
87 #endif // NGInlineBoxState_h | 94 #endif // NGInlineBoxState_h |
OLD | NEW |