Chromium Code Reviews| 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 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" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 56 // Currently this function is for adding control characters such as | 56 // Currently this function is for adding control characters such as |
| 57 // objectReplacementCharacter, and does not support all space collapsing logic | 57 // objectReplacementCharacter, and does not support all space collapsing logic |
| 58 // as its String version does. | 58 // as its String version does. |
| 59 // See the String version for using nullptr for ComputedStyle and | 59 // See the String version for using nullptr for ComputedStyle and |
| 60 // LayoutObject. | 60 // LayoutObject. |
| 61 void Append(NGInlineItem::NGInlineItemType, | 61 void Append(NGInlineItem::NGInlineItemType, |
| 62 UChar, | 62 UChar, |
| 63 const ComputedStyle* = nullptr, | 63 const ComputedStyle* = nullptr, |
| 64 LayoutObject* = nullptr); | 64 LayoutObject* = nullptr); |
| 65 | 65 |
| 66 // Append a non-character item. | 66 // Append a character. |
| 67 void Append(NGInlineItem::NGInlineItemType, | 67 // The character is opaque to space collapsing; i.e., spaces before this |
| 68 const ComputedStyle* = nullptr, | 68 // character and after this character can collapse as if this character does |
| 69 LayoutObject* = nullptr); | 69 // not exist. |
| 70 void AppendAsOpaqueToSpaceCollapsing(NGInlineItem::NGInlineItemType, UChar); | |
|
eae
2017/06/23 18:49:09
These names are a little too verbose, how about sh
| |
| 71 | |
| 72 // Append a non-character item that is opaque to space collapsing. | |
| 73 void AppendAsOpaqueToSpaceCollapsing(NGInlineItem::NGInlineItemType, | |
| 74 const ComputedStyle* = nullptr, | |
| 75 LayoutObject* = nullptr); | |
| 70 | 76 |
| 71 // Append a Bidi control character, for LTR or RTL depends on the style. | 77 // Append a Bidi control character, for LTR or RTL depends on the style. |
| 72 void AppendBidiControl(const ComputedStyle*, UChar ltr, UChar rtl); | 78 void AppendBidiControl(const ComputedStyle*, UChar ltr, UChar rtl); |
| 73 | 79 |
| 74 void EnterBlock(const ComputedStyle*); | 80 void EnterBlock(const ComputedStyle*); |
| 75 void ExitBlock(); | 81 void ExitBlock(); |
| 76 void EnterInline(LayoutObject*); | 82 void EnterInline(LayoutObject*); |
| 77 void ExitInline(LayoutObject*); | 83 void ExitInline(LayoutObject*); |
| 78 | 84 |
| 79 private: | 85 private: |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 105 LayoutObject*); | 111 LayoutObject*); |
| 106 | 112 |
| 107 void AppendForcedBreak(const ComputedStyle*, LayoutObject*); | 113 void AppendForcedBreak(const ComputedStyle*, LayoutObject*); |
| 108 | 114 |
| 109 // Because newlines may be removed depends on following characters, newlines | 115 // Because newlines may be removed depends on following characters, newlines |
| 110 // at the end of input string is not added to |text_| but instead | 116 // at the end of input string is not added to |text_| but instead |
| 111 // |has_pending_newline_| flag is set. | 117 // |has_pending_newline_| flag is set. |
| 112 // This function determines whether to add the newline or ignore. | 118 // This function determines whether to add the newline or ignore. |
| 113 void ProcessPendingNewline(const String&, const ComputedStyle*); | 119 void ProcessPendingNewline(const String&, const ComputedStyle*); |
| 114 | 120 |
| 115 // Removes the collapsible space at the end of |text_| if exists. | 121 void RemoveTrailingCollapsibleSpaceIfExists(); |
| 116 void RemoveTrailingCollapsibleSpaceIfExists(unsigned*); | 122 void RemoveTrailingCollapsibleSpace(unsigned); |
| 117 void RemoveTrailingCollapsibleSpace(unsigned*); | 123 void RemoveTrailingCollapsibleNewlineIfNeeded(const String&, |
| 118 | |
| 119 void RemoveTrailingCollapsibleNewlineIfNeeded(unsigned*, | |
| 120 const String&, | |
| 121 unsigned, | 124 unsigned, |
| 122 const ComputedStyle*); | 125 const ComputedStyle*); |
| 123 | 126 |
| 124 void Enter(LayoutObject*, UChar); | 127 void Enter(LayoutObject*, UChar); |
| 125 void Exit(LayoutObject*); | 128 void Exit(LayoutObject*); |
| 126 }; | 129 }; |
| 127 | 130 |
| 128 } // namespace blink | 131 } // namespace blink |
| 129 | 132 |
| 130 #endif // NGInlineItemsBuilder_h | 133 #endif // NGInlineItemsBuilder_h |
| OLD | NEW |