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

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

Issue 2943573002: Make NGInlineItemsBuilder construct whitespace-collapsed offset mapping (Closed)
Patch Set: Wed Jun 21 16:40:35 PDT 2017 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 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/ng_inline_node.h" 9 #include "core/layout/ng/inline/ng_inline_node.h"
10 #include "platform/wtf/Allocator.h" 10 #include "platform/wtf/Allocator.h"
11 #include "platform/wtf/Vector.h" 11 #include "platform/wtf/Vector.h"
12 #include "platform/wtf/text/StringBuilder.h" 12 #include "platform/wtf/text/StringBuilder.h"
13 #include "platform/wtf/text/WTFString.h" 13 #include "platform/wtf/text/WTFString.h"
14 14
15 namespace blink { 15 namespace blink {
16 16
17 class ComputedStyle; 17 class ComputedStyle;
18 class LayoutObject; 18 class LayoutObject;
19 class NGInlineItem; 19 class NGInlineItem;
20 class NGOffsetMappingBuilder;
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 class CORE_EXPORT NGInlineItemsBuilder {
31 STACK_ALLOCATED(); 32 STACK_ALLOCATED();
32 33
33 public: 34 public:
34 explicit NGInlineItemsBuilder(Vector<NGInlineItem>* items) : items_(items) {} 35 explicit NGInlineItemsBuilder(Vector<NGInlineItem>* items)
36 : items_(items), mapping_builder_(nullptr) {}
37 explicit NGInlineItemsBuilder(Vector<NGInlineItem>* items,
38 NGOffsetMappingBuilder* mapping_builder)
39 : items_(items), mapping_builder_(mapping_builder) {}
35 ~NGInlineItemsBuilder(); 40 ~NGInlineItemsBuilder();
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.
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 UChar character; 90 UChar character;
86 } OnExitNode; 91 } OnExitNode;
87 Vector<OnExitNode> exits_; 92 Vector<OnExitNode> exits_;
88 93
89 enum class CollapsibleSpace { kNone, kSpace, kNewline }; 94 enum class CollapsibleSpace { kNone, kSpace, kNewline };
90 95
91 CollapsibleSpace last_collapsible_space_ = CollapsibleSpace::kSpace; 96 CollapsibleSpace last_collapsible_space_ = CollapsibleSpace::kSpace;
92 bool is_svgtext_ = false; 97 bool is_svgtext_ = false;
93 bool has_bidi_controls_ = false; 98 bool has_bidi_controls_ = false;
94 99
100 NGOffsetMappingBuilder* mapping_builder_;
yosin_UTC9 2017/06/22 03:31:04 nit: s/NGOffsetMappingBuilder*/NGOffsetMappingBuil
Xiaocheng 2017/06/22 03:36:10 Will do.
101
95 void AppendWithWhiteSpaceCollapsing(const String&, 102 void AppendWithWhiteSpaceCollapsing(const String&,
96 unsigned start, 103 unsigned start,
97 unsigned end, 104 unsigned end,
98 const ComputedStyle*, 105 const ComputedStyle*,
99 LayoutObject*); 106 LayoutObject*);
100 void AppendWithoutWhiteSpaceCollapsing(const String&, 107 void AppendWithoutWhiteSpaceCollapsing(const String&,
101 const ComputedStyle*, 108 const ComputedStyle*,
102 LayoutObject*); 109 LayoutObject*);
103 void AppendWithPreservingNewlines(const String&, 110 void AppendWithPreservingNewlines(const String&,
104 const ComputedStyle*, 111 const ComputedStyle*,
(...skipping 16 matching lines...) Expand all
121 unsigned, 128 unsigned,
122 const ComputedStyle*); 129 const ComputedStyle*);
123 130
124 void Enter(LayoutObject*, UChar); 131 void Enter(LayoutObject*, UChar);
125 void Exit(LayoutObject*); 132 void Exit(LayoutObject*);
126 }; 133 };
127 134
128 } // namespace blink 135 } // namespace blink
129 136
130 #endif // NGInlineItemsBuilder_h 137 #endif // NGInlineItemsBuilder_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698