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 #include "core/layout/ng/ng_layout_inline_items_builder.h" | 5 #include "core/layout/ng/ng_layout_inline_items_builder.h" |
6 | 6 |
7 #include "core/layout/LayoutObject.h" | 7 #include "core/layout/LayoutObject.h" |
8 #include "core/layout/ng/ng_inline_node.h" | 8 #include "core/layout/ng/ng_inline_node.h" |
9 #include "core/style/ComputedStyle.h" | 9 #include "core/style/ComputedStyle.h" |
10 | 10 |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 AppendAsOpaqueToSpaceCollapsing( | 200 AppendAsOpaqueToSpaceCollapsing( |
201 style->direction() == TextDirection::kRtl ? rtl : ltr); | 201 style->direction() == TextDirection::kRtl ? rtl : ltr); |
202 } | 202 } |
203 | 203 |
204 void NGLayoutInlineItemsBuilder::EnterBlock(const ComputedStyle* style) { | 204 void NGLayoutInlineItemsBuilder::EnterBlock(const ComputedStyle* style) { |
205 // Handle bidi-override on the block itself. | 205 // Handle bidi-override on the block itself. |
206 // Isolate and embed values are enforced by default and redundant on the block | 206 // Isolate and embed values are enforced by default and redundant on the block |
207 // elements. | 207 // elements. |
208 // Plaintext and direction are handled as the paragraph level by | 208 // Plaintext and direction are handled as the paragraph level by |
209 // NGBidiParagraph::SetParagraph(). | 209 // NGBidiParagraph::SetParagraph(). |
210 if (style->unicodeBidi() == Override || | 210 if (style->unicodeBidi() == EUnicodeBidi::kBidiOverride || |
211 style->unicodeBidi() == IsolateOverride) { | 211 style->unicodeBidi() == EUnicodeBidi::kIsolateOverride) { |
212 AppendBidiControl(style, leftToRightOverrideCharacter, | 212 AppendBidiControl(style, leftToRightOverrideCharacter, |
213 rightToLeftOverrideCharacter); | 213 rightToLeftOverrideCharacter); |
214 Enter(nullptr, popDirectionalFormattingCharacter); | 214 Enter(nullptr, popDirectionalFormattingCharacter); |
215 } | 215 } |
216 } | 216 } |
217 | 217 |
218 void NGLayoutInlineItemsBuilder::EnterInline(LayoutObject* node) { | 218 void NGLayoutInlineItemsBuilder::EnterInline(LayoutObject* node) { |
219 // https://drafts.csswg.org/css-writing-modes-3/#bidi-control-codes-injection-
table | 219 // https://drafts.csswg.org/css-writing-modes-3/#bidi-control-codes-injection-
table |
220 const ComputedStyle* style = node->style(); | 220 const ComputedStyle* style = node->style(); |
221 switch (style->unicodeBidi()) { | 221 switch (style->unicodeBidi()) { |
222 case UBNormal: | 222 case EUnicodeBidi::kNormal: |
223 break; | 223 break; |
224 case Embed: | 224 case EUnicodeBidi::kEmbed: |
225 AppendBidiControl(style, leftToRightEmbedCharacter, | 225 AppendBidiControl(style, leftToRightEmbedCharacter, |
226 rightToLeftEmbedCharacter); | 226 rightToLeftEmbedCharacter); |
227 Enter(node, popDirectionalFormattingCharacter); | 227 Enter(node, popDirectionalFormattingCharacter); |
228 break; | 228 break; |
229 case Override: | 229 case EUnicodeBidi::kBidiOverride: |
230 AppendBidiControl(style, leftToRightOverrideCharacter, | 230 AppendBidiControl(style, leftToRightOverrideCharacter, |
231 rightToLeftOverrideCharacter); | 231 rightToLeftOverrideCharacter); |
232 Enter(node, popDirectionalFormattingCharacter); | 232 Enter(node, popDirectionalFormattingCharacter); |
233 break; | 233 break; |
234 case Isolate: | 234 case EUnicodeBidi::kIsolate: |
235 AppendBidiControl(style, leftToRightIsolateCharacter, | 235 AppendBidiControl(style, leftToRightIsolateCharacter, |
236 rightToLeftIsolateCharacter); | 236 rightToLeftIsolateCharacter); |
237 Enter(node, popDirectionalIsolateCharacter); | 237 Enter(node, popDirectionalIsolateCharacter); |
238 break; | 238 break; |
239 case Plaintext: | 239 case EUnicodeBidi::kPlaintext: |
240 AppendAsOpaqueToSpaceCollapsing(firstStrongIsolateCharacter); | 240 AppendAsOpaqueToSpaceCollapsing(firstStrongIsolateCharacter); |
241 Enter(node, popDirectionalIsolateCharacter); | 241 Enter(node, popDirectionalIsolateCharacter); |
242 break; | 242 break; |
243 case IsolateOverride: | 243 case EUnicodeBidi::kIsolateOverride: |
244 AppendAsOpaqueToSpaceCollapsing(firstStrongIsolateCharacter); | 244 AppendAsOpaqueToSpaceCollapsing(firstStrongIsolateCharacter); |
245 AppendBidiControl(style, leftToRightOverrideCharacter, | 245 AppendBidiControl(style, leftToRightOverrideCharacter, |
246 rightToLeftOverrideCharacter); | 246 rightToLeftOverrideCharacter); |
247 Enter(node, popDirectionalIsolateCharacter); | 247 Enter(node, popDirectionalIsolateCharacter); |
248 Enter(node, popDirectionalFormattingCharacter); | 248 Enter(node, popDirectionalFormattingCharacter); |
249 break; | 249 break; |
250 } | 250 } |
251 } | 251 } |
252 | 252 |
253 void NGLayoutInlineItemsBuilder::Enter(LayoutObject* node, | 253 void NGLayoutInlineItemsBuilder::Enter(LayoutObject* node, |
(...skipping 12 matching lines...) Expand all Loading... |
266 } | 266 } |
267 | 267 |
268 void NGLayoutInlineItemsBuilder::Exit(LayoutObject* node) { | 268 void NGLayoutInlineItemsBuilder::Exit(LayoutObject* node) { |
269 while (!exits_.isEmpty() && exits_.back().node == node) { | 269 while (!exits_.isEmpty() && exits_.back().node == node) { |
270 AppendAsOpaqueToSpaceCollapsing(exits_.back().character); | 270 AppendAsOpaqueToSpaceCollapsing(exits_.back().character); |
271 exits_.pop_back(); | 271 exits_.pop_back(); |
272 } | 272 } |
273 } | 273 } |
274 | 274 |
275 } // namespace blink | 275 } // namespace blink |
OLD | NEW |