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

Side by Side Diff: third_party/WebKit/Source/core/layout/ng/inline/ng_inline_items_builder_test.cc

Issue 2951213005: [LayoutNG] Support objects that are opaque to whitespace collapsing (Closed)
Patch Set: Renamed to AppendOpaque 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 #include "core/layout/ng/inline/ng_inline_items_builder.h" 5 #include "core/layout/ng/inline/ng_inline_items_builder.h"
6 6
7 #include "core/layout/LayoutInline.h" 7 #include "core/layout/LayoutInline.h"
8 #include "core/layout/ng/inline/ng_inline_node.h" 8 #include "core/layout/ng/inline/ng_inline_node.h"
9 #include "core/style/ComputedStyle.h" 9 #include "core/style/ComputedStyle.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 EXPECT_EQ(String(u"A \u4E00"), TestAppend(u"A\n\u4E00")) 213 EXPECT_EQ(String(u"A \u4E00"), TestAppend(u"A\n\u4E00"))
214 << "Newline is not removed when before is Narrow."; 214 << "Newline is not removed when before is Narrow.";
215 215
216 EXPECT_EQ(String(u"\u4E00\u4E00"), TestAppend(u"\u4E00\n", u"\u4E00")) 216 EXPECT_EQ(String(u"\u4E00\u4E00"), TestAppend(u"\u4E00\n", u"\u4E00"))
217 << "Newline at the end of elements is removed when both sides are Wide."; 217 << "Newline at the end of elements is removed when both sides are Wide.";
218 EXPECT_EQ(String(u"\u4E00\u4E00"), TestAppend(u"\u4E00", u"\n\u4E00")) 218 EXPECT_EQ(String(u"\u4E00\u4E00"), TestAppend(u"\u4E00", u"\n\u4E00"))
219 << "Newline at the beginning of elements is removed " 219 << "Newline at the beginning of elements is removed "
220 "when both sides are Wide."; 220 "when both sides are Wide.";
221 } 221 }
222 222
223 TEST_F(NGInlineItemsBuilderTest, OpaqueToSpaceCollapsing) {
224 NGInlineItemsBuilder builder(&items_);
225 builder.Append("Hello ", style_.Get());
226 builder.AppendOpaque(NGInlineItem::kBidiControl,
227 kFirstStrongIsolateCharacter);
228 builder.Append(" ", style_.Get());
229 builder.AppendOpaque(NGInlineItem::kBidiControl,
230 kFirstStrongIsolateCharacter);
231 builder.Append(" World", style_.Get());
232 EXPECT_EQ(String(u"Hello \u2068\u2068World"), builder.ToString());
233 }
234
223 TEST_F(NGInlineItemsBuilderTest, CollapseAroundReplacedElement) { 235 TEST_F(NGInlineItemsBuilderTest, CollapseAroundReplacedElement) {
224 NGInlineItemsBuilder builder(&items_); 236 NGInlineItemsBuilder builder(&items_);
225 builder.Append("Hello ", style_.Get()); 237 builder.Append("Hello ", style_.Get());
226 builder.Append(NGInlineItem::kAtomicInline, kObjectReplacementCharacter); 238 builder.Append(NGInlineItem::kAtomicInline, kObjectReplacementCharacter);
227 builder.Append(" World", style_.Get()); 239 builder.Append(" World", style_.Get());
228 EXPECT_EQ(String(u"Hello \uFFFC World"), builder.ToString()); 240 EXPECT_EQ(String(u"Hello \uFFFC World"), builder.ToString());
229 } 241 }
230 242
231 TEST_F(NGInlineItemsBuilderTest, CollapseNewlineAfterObject) { 243 TEST_F(NGInlineItemsBuilderTest, CollapseNewlineAfterObject) {
232 NGInlineItemsBuilder builder(&items_); 244 NGInlineItemsBuilder builder(&items_);
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 u"\u2068\u202E" 350 u"\u2068\u202E"
339 u"\u05E2\u05D1\u05E8\u05D9\u05EA" 351 u"\u05E2\u05D1\u05E8\u05D9\u05EA"
340 u"\u202C\u2069" 352 u"\u202C\u2069"
341 u" World"), 353 u" World"),
342 builder.ToString()); 354 builder.ToString());
343 } 355 }
344 356
345 } // namespace 357 } // namespace
346 358
347 } // namespace blink 359 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698