OLD | NEW |
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 NGInlineNode_h | 5 #ifndef NGInlineNode_h |
6 #define NGInlineNode_h | 6 #define NGInlineNode_h |
7 | 7 |
8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
9 #include "core/layout/ng/ng_layout_input_node.h" | 9 #include "core/layout/ng/ng_layout_input_node.h" |
10 #include "platform/fonts/FontFallbackPriority.h" | 10 #include "platform/fonts/FontFallbackPriority.h" |
11 #include "platform/fonts/shaping/ShapeResult.h" | 11 #include "platform/fonts/shaping/ShapeResult.h" |
12 #include "platform/heap/Handle.h" | 12 #include "platform/heap/Handle.h" |
13 #include "platform/text/TextDirection.h" | 13 #include "platform/text/TextDirection.h" |
14 #include "wtf/text/WTFString.h" | 14 #include "wtf/text/WTFString.h" |
15 | 15 |
16 #include <unicode/ubidi.h> | 16 #include <unicode/ubidi.h> |
17 #include <unicode/uscript.h> | 17 #include <unicode/uscript.h> |
18 | 18 |
19 namespace blink { | 19 namespace blink { |
20 | 20 |
21 class ComputedStyle; | 21 class ComputedStyle; |
22 class LayoutBlockFlow; | 22 class LayoutBlockFlow; |
23 class LayoutObject; | 23 class LayoutObject; |
24 class LayoutUnit; | 24 class LayoutUnit; |
25 struct MinAndMaxContentSizes; | 25 struct MinMaxContentSize; |
26 class NGConstraintSpace; | 26 class NGConstraintSpace; |
27 class NGLayoutInlineItem; | 27 class NGLayoutInlineItem; |
28 class NGLayoutInlineItemRange; | 28 class NGLayoutInlineItemRange; |
29 class NGLayoutInlineItemsBuilder; | 29 class NGLayoutInlineItemsBuilder; |
30 class NGLayoutResult; | 30 class NGLayoutResult; |
31 class NGLineBuilder; | 31 class NGLineBuilder; |
32 | 32 |
33 // Represents an anonymous block box to be laid out, that contains consecutive | 33 // Represents an anonymous block box to be laid out, that contains consecutive |
34 // inline nodes and their descendants. | 34 // inline nodes and their descendants. |
35 class CORE_EXPORT NGInlineNode : public NGLayoutInputNode { | 35 class CORE_EXPORT NGInlineNode : public NGLayoutInputNode { |
36 public: | 36 public: |
37 NGInlineNode(LayoutObject* start_inline, const ComputedStyle* block_style); | 37 NGInlineNode(LayoutObject* start_inline, const ComputedStyle* block_style); |
38 ~NGInlineNode() override; | 38 ~NGInlineNode() override; |
39 | 39 |
40 const ComputedStyle* BlockStyle() const { return block_style_.get(); } | 40 const ComputedStyle* BlockStyle() const { return block_style_.get(); } |
41 | 41 |
42 RefPtr<NGLayoutResult> Layout(NGConstraintSpace*, NGBreakToken*) override; | 42 RefPtr<NGLayoutResult> Layout(NGConstraintSpace*, NGBreakToken*) override; |
43 void LayoutInline(NGConstraintSpace*, NGLineBuilder*); | 43 void LayoutInline(NGConstraintSpace*, NGLineBuilder*); |
44 NGInlineNode* NextSibling() override; | 44 NGInlineNode* NextSibling() override; |
45 LayoutObject* GetLayoutObject() override; | 45 LayoutObject* GetLayoutObject() override; |
46 | 46 |
47 // Computes the value of min-content and max-content for this anonymous block | 47 // Computes the value of min-content and max-content for this anonymous block |
48 // box. min-content is the inline size when lines wrap at every break | 48 // box. min-content is the inline size when lines wrap at every break |
49 // opportunity, and max-content is when lines do not wrap at all. | 49 // opportunity, and max-content is when lines do not wrap at all. |
50 MinAndMaxContentSizes ComputeMinAndMaxContentSizes(); | 50 MinMaxContentSize ComputeMinMaxContentSize(); |
51 | 51 |
52 // Instruct to re-compute |PrepareLayout| on the next layout. | 52 // Instruct to re-compute |PrepareLayout| on the next layout. |
53 void InvalidatePrepareLayout(); | 53 void InvalidatePrepareLayout(); |
54 | 54 |
55 const String& Text() const { return text_content_; } | 55 const String& Text() const { return text_content_; } |
56 String Text(unsigned start_offset, unsigned end_offset) const { | 56 String Text(unsigned start_offset, unsigned end_offset) const { |
57 return text_content_.substring(start_offset, end_offset); | 57 return text_content_.substring(start_offset, end_offset); |
58 } | 58 } |
59 | 59 |
60 Vector<NGLayoutInlineItem>& Items() { return items_; } | 60 Vector<NGLayoutInlineItem>& Items() { return items_; } |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 | 224 |
225 private: | 225 private: |
226 NGLayoutInlineItem* start_item_; | 226 NGLayoutInlineItem* start_item_; |
227 unsigned size_; | 227 unsigned size_; |
228 unsigned start_index_; | 228 unsigned start_index_; |
229 }; | 229 }; |
230 | 230 |
231 } // namespace blink | 231 } // namespace blink |
232 | 232 |
233 #endif // NGInlineNode_h | 233 #endif // NGInlineNode_h |
OLD | NEW |