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

Side by Side Diff: third_party/WebKit/Source/core/layout/ng/inline/ng_inline_items_builder.h

Issue 2960673004: Templatize NGInlineItemsBuilder to take a OffsetMappingBuilder parameter (Closed)
Patch Set: Move EmptyOffsetMappingBuilder to ng/inline/ Created 3 years, 5 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 NGInlineItemsBuilder_h 5 #ifndef NGInlineItemsBuilder_h
6 #define NGInlineItemsBuilder_h 6 #define NGInlineItemsBuilder_h
7 7
8 #include "core/CoreExport.h" 8 #include "core/CoreExport.h"
9 #include "core/layout/ng/inline/empty_offset_mapping_builder.h"
9 #include "core/layout/ng/inline/ng_inline_node.h" 10 #include "core/layout/ng/inline/ng_inline_node.h"
10 #include "platform/wtf/Allocator.h" 11 #include "platform/wtf/Allocator.h"
11 #include "platform/wtf/Vector.h" 12 #include "platform/wtf/Vector.h"
12 #include "platform/wtf/text/StringBuilder.h" 13 #include "platform/wtf/text/StringBuilder.h"
13 #include "platform/wtf/text/WTFString.h" 14 #include "platform/wtf/text/WTFString.h"
14 15
15 namespace blink { 16 namespace blink {
16 17
17 class ComputedStyle; 18 class ComputedStyle;
18 class LayoutObject; 19 class LayoutObject;
19 class NGInlineItem; 20 class NGInlineItem;
20 21
21 // NGInlineItemsBuilder builds a string and a list of NGInlineItem from inlines. 22 // NGInlineItemsBuilder builds a string and a list of NGInlineItem from inlines.
22 // 23 //
23 // When appending, spaces are collapsed according to CSS Text, The white space 24 // When appending, spaces are collapsed according to CSS Text, The white space
24 // processing rules 25 // processing rules
25 // https://drafts.csswg.org/css-text-3/#white-space-rules 26 // https://drafts.csswg.org/css-text-3/#white-space-rules
26 // 27 //
27 // By calling EnterInline/ExitInline, it inserts bidirectional control 28 // By calling EnterInline/ExitInline, it inserts bidirectional control
28 // characters as defined in: 29 // characters as defined in:
29 // https://drafts.csswg.org/css-writing-modes-3/#bidi-control-codes-injection-ta ble 30 // https://drafts.csswg.org/css-writing-modes-3/#bidi-control-codes-injection-ta ble
30 class CORE_EXPORT NGInlineItemsBuilder { 31 // TODO(xiaochengh): Utilize the passed-in OffsetMappingBuilder to construct
32 // the whitespace-collapsed offset mapping.
33 template <typename OffsetMappingBuilder>
34 class CORE_TEMPLATE_CLASS_EXPORT NGInlineItemsBuilderTemplate {
31 STACK_ALLOCATED(); 35 STACK_ALLOCATED();
32 36
33 public: 37 public:
34 explicit NGInlineItemsBuilder(Vector<NGInlineItem>* items) : items_(items) {} 38 explicit NGInlineItemsBuilderTemplate(Vector<NGInlineItem>* items)
35 ~NGInlineItemsBuilder(); 39 : items_(items) {}
40 ~NGInlineItemsBuilderTemplate();
36 41
37 String ToString(); 42 String ToString();
38 43
39 void SetIsSVGText(bool value) { is_svgtext_ = value; } 44 void SetIsSVGText(bool value) { is_svgtext_ = value; }
40 45
41 // Returns whether the items contain any Bidi controls. 46 // Returns whether the items contain any Bidi controls.
42 bool HasBidiControls() const { return has_bidi_controls_; } 47 bool HasBidiControls() const { return has_bidi_controls_; }
43 48
44 // Append a string. 49 // Append a string.
45 // When appending, spaces are collapsed according to CSS Text, The white space 50 // When appending, spaces are collapsed according to CSS Text, The white space
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 void RemoveTrailingCollapsibleSpaceIfExists(); 120 void RemoveTrailingCollapsibleSpaceIfExists();
116 void RemoveTrailingCollapsibleSpace(unsigned); 121 void RemoveTrailingCollapsibleSpace(unsigned);
117 void RemoveTrailingCollapsibleNewlineIfNeeded(const String&, 122 void RemoveTrailingCollapsibleNewlineIfNeeded(const String&,
118 unsigned, 123 unsigned,
119 const ComputedStyle*); 124 const ComputedStyle*);
120 125
121 void Enter(LayoutObject*, UChar); 126 void Enter(LayoutObject*, UChar);
122 void Exit(LayoutObject*); 127 void Exit(LayoutObject*);
123 }; 128 };
124 129
130 extern template class CORE_EXTERN_TEMPLATE_EXPORT
131 NGInlineItemsBuilderTemplate<EmptyOffsetMappingBuilder>;
132
133 using NGInlineItemsBuilder =
134 NGInlineItemsBuilderTemplate<EmptyOffsetMappingBuilder>;
135
125 } // namespace blink 136 } // namespace blink
126 137
127 #endif // NGInlineItemsBuilder_h 138 #endif // NGInlineItemsBuilder_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698