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

Side by Side Diff: third_party/WebKit/Source/core/layout/ng/inline/ng_inline_layout_algorithm.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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 NGInlineLayoutAlgorithm_h 5 #ifndef NGInlineLayoutAlgorithm_h
6 #define NGInlineLayoutAlgorithm_h 6 #define NGInlineLayoutAlgorithm_h
7 7
8 #include "core/CoreExport.h" 8 #include "core/CoreExport.h"
9 #include "core/layout/ng/geometry/ng_logical_offset.h" 9 #include "core/layout/ng/geometry/ng_logical_offset.h"
10 #include "core/layout/ng/inline/ng_inline_box_state.h" 10 #include "core/layout/ng/inline/ng_inline_box_state.h"
(...skipping 27 matching lines...) Expand all
38 NGInlineLayoutAlgorithm(NGInlineNode, 38 NGInlineLayoutAlgorithm(NGInlineNode,
39 NGConstraintSpace*, 39 NGConstraintSpace*,
40 NGInlineBreakToken* = nullptr); 40 NGInlineBreakToken* = nullptr);
41 41
42 // The available width for the current line. 42 // The available width for the current line.
43 LayoutUnit AvailableWidth() const; 43 LayoutUnit AvailableWidth() const;
44 44
45 // Create a line. 45 // Create a line.
46 // @return false if the line does not fit in the constraint space in block 46 // @return false if the line does not fit in the constraint space in block
47 // direction. 47 // direction.
48 bool CreateLine(NGInlineItemResults*, RefPtr<NGInlineBreakToken> = nullptr); 48 bool CreateLine(NGLineInfo*, RefPtr<NGInlineBreakToken> = nullptr);
49 49
50 RefPtr<NGLayoutResult> Layout() override; 50 RefPtr<NGLayoutResult> Layout() override;
51 51
52 // Lays out the inline float. 52 // Lays out the inline float.
53 // List of actions: 53 // List of actions:
54 // - tries to position the float right away if we have enough space. 54 // - tries to position the float right away if we have enough space.
55 // - updates the current_opportunity if we actually place the float. 55 // - updates the current_opportunity if we actually place the float.
56 // - if it's too wide then we add the float to the unpositioned list so it can 56 // - if it's too wide then we add the float to the unpositioned list so it can
57 // be positioned after we're done with the current line. 57 // be positioned after we're done with the current line.
58 void LayoutAndPositionFloat(LayoutUnit end_position, LayoutObject*); 58 void LayoutAndPositionFloat(LayoutUnit end_position, LayoutObject*);
59 59
60 private: 60 private:
61 bool IsHorizontalWritingMode() const { return is_horizontal_writing_mode_; } 61 bool IsHorizontalWritingMode() const { return is_horizontal_writing_mode_; }
62 62
63 bool IsFirstLine() const;
64 const ComputedStyle& FirstLineStyle() const;
65 const ComputedStyle& LineStyle() const;
66
67 LayoutUnit LogicalLeftOffset() const; 63 LayoutUnit LogicalLeftOffset() const;
68 64
69 void BidiReorder(NGInlineItemResults*); 65 void BidiReorder(NGInlineItemResults*);
70 66
71 bool PlaceItems(NGInlineItemResults*, RefPtr<NGInlineBreakToken>); 67 bool PlaceItems(NGLineInfo*, RefPtr<NGInlineBreakToken>);
72 NGInlineBoxState* PlaceAtomicInline(const NGInlineItem&, 68 NGInlineBoxState* PlaceAtomicInline(const NGInlineItem&,
73 NGInlineItemResult*, 69 NGInlineItemResult*,
70 bool is_first_line,
74 LayoutUnit position, 71 LayoutUnit position,
75 NGLineBoxFragmentBuilder*, 72 NGLineBoxFragmentBuilder*,
76 NGTextFragmentBuilder*); 73 NGTextFragmentBuilder*);
77 74
78 void ApplyTextAlign(LayoutUnit* line_left, 75 void ApplyTextAlign(const ComputedStyle&,
76 ETextAlign,
77 LayoutUnit* line_left,
79 LayoutUnit inline_size, 78 LayoutUnit inline_size,
80 LayoutUnit available_width); 79 LayoutUnit available_width);
81 80
82 // Finds the next layout opportunity for the next text fragment. 81 // Finds the next layout opportunity for the next text fragment.
83 void FindNextLayoutOpportunity(); 82 void FindNextLayoutOpportunity();
84 83
85 NGInlineLayoutStateStack box_states_; 84 NGInlineLayoutStateStack box_states_;
86 LayoutUnit content_size_; 85 LayoutUnit content_size_;
87 LayoutUnit max_inline_size_; 86 LayoutUnit max_inline_size_;
88 FontBaseline baseline_type_ = FontBaseline::kAlphabeticBaseline; 87 FontBaseline baseline_type_ = FontBaseline::kAlphabeticBaseline;
89 88
90 NGLogicalOffset bfc_offset_; 89 NGLogicalOffset bfc_offset_;
91 NGLogicalRect current_opportunity_; 90 NGLogicalRect current_opportunity_;
92 91
93 unsigned is_horizontal_writing_mode_ : 1; 92 unsigned is_horizontal_writing_mode_ : 1;
94 unsigned disallow_first_line_rules_ : 1;
95 93
96 NGConstraintSpaceBuilder space_builder_; 94 NGConstraintSpaceBuilder space_builder_;
97 NGBoxStrut border_and_padding_; 95 NGBoxStrut border_and_padding_;
98 }; 96 };
99 97
100 } // namespace blink 98 } // namespace blink
101 99
102 #endif // NGInlineLayoutAlgorithm_h 100 #endif // NGInlineLayoutAlgorithm_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698