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

Side by Side Diff: third_party/WebKit/Source/core/editing/iterators/TextIteratorTest.cpp

Issue 2336043006: Restore only the collapsed leading space when copy text (Closed)
Patch Set: [For landing] Fix crash on Android Created 4 years, 3 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 /* 1 /*
2 * Copyright (c) 2013, Google Inc. All rights reserved. 2 * Copyright (c) 2013, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 526
527 TEST_F(TextIteratorTest, PreserveLeadingSpace) 527 TEST_F(TextIteratorTest, PreserveLeadingSpace)
528 { 528 {
529 setBodyContent("<div style='width: 2em;'><b><i>foo</i></b> bar</div>"); 529 setBodyContent("<div style='width: 2em;'><b><i>foo</i></b> bar</div>");
530 Element* div = document().querySelector("div"); 530 Element* div = document().querySelector("div");
531 Position start(div->firstChild()->firstChild()->firstChild(), 0); 531 Position start(div->firstChild()->firstChild()->firstChild(), 0);
532 Position end(div->lastChild(), 4); 532 Position end(div->lastChild(), 4);
533 EXPECT_EQ("foo bar", plainText(EphemeralRange(start, end), TextIteratorEmits ImageAltText)); 533 EXPECT_EQ("foo bar", plainText(EphemeralRange(start, end), TextIteratorEmits ImageAltText));
534 } 534 }
535 535
536 TEST_F(TextIteratorTest, PreserveOnlyLeadingSpace)
537 {
538 setBodyContent("<div style='width: 2em;'><b><i id='foo'>foo </i></b> bar</di v>");
539 Element* div = document().querySelector("div");
540 Position start(document().getElementById("foo")->firstChild(), 0);
541 Position end(div->lastChild(), 4);
542 EXPECT_EQ("foo bar", plainText(EphemeralRange(start, end), TextIteratorEmits ImageAltText));
543 }
544
536 } // namespace blink 545 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698