| OLD | NEW |
| 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 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 | 446 |
| 447 TEST_F(TextIteratorTest, RangeLengthWithReplacedElements) { | 447 TEST_F(TextIteratorTest, RangeLengthWithReplacedElements) { |
| 448 static const char* bodyContent = | 448 static const char* bodyContent = |
| 449 "<div id='div' contenteditable='true'>1<img src='foo.png'>3</div>"; | 449 "<div id='div' contenteditable='true'>1<img src='foo.png'>3</div>"; |
| 450 setBodyContent(bodyContent); | 450 setBodyContent(bodyContent); |
| 451 document().view()->updateAllLifecyclePhases(); | 451 document().view()->updateAllLifecyclePhases(); |
| 452 | 452 |
| 453 Node* divNode = document().getElementById("div"); | 453 Node* divNode = document().getElementById("div"); |
| 454 Range* range = Range::create(document(), divNode, 0, divNode, 3); | 454 Range* range = Range::create(document(), divNode, 0, divNode, 3); |
| 455 | 455 |
| 456 EXPECT_EQ(3, TextIterator::rangeLength(range->startPosition(), | 456 EXPECT_EQ( |
| 457 range->endPosition())); | 457 3, |
| 458 TextIterator::rangeLength(range->startPosition(), range->endPosition())); |
| 458 } | 459 } |
| 459 | 460 |
| 460 TEST_F(TextIteratorTest, WhitespaceCollapseForReplacedElements) { | 461 TEST_F(TextIteratorTest, WhitespaceCollapseForReplacedElements) { |
| 461 static const char* bodyContent = | 462 static const char* bodyContent = |
| 462 "<span>Some text </span> <input type='button' value='Button " | 463 "<span>Some text </span> <input type='button' value='Button " |
| 463 "text'/><span>Some more text</span>"; | 464 "text'/><span>Some more text</span>"; |
| 464 setBodyContent(bodyContent); | 465 setBodyContent(bodyContent); |
| 465 EXPECT_EQ("[Some text ][][Some more text]", | 466 EXPECT_EQ("[Some text ][][Some more text]", |
| 466 iterate<DOMTree>(collapseTrailingSpaceBehavior())); | 467 iterate<DOMTree>(collapseTrailingSpaceBehavior())); |
| 467 EXPECT_EQ("[Some text ][][Button text][Some more text]", | 468 EXPECT_EQ("[Some text ][][Button text][Some more text]", |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 753 EXPECT_EQ(Position(text, 1), iter.startPositionInCurrentContainer()); | 754 EXPECT_EQ(Position(text, 1), iter.startPositionInCurrentContainer()); |
| 754 EXPECT_EQ(Position(text, 4), iter.endPositionInCurrentContainer()); | 755 EXPECT_EQ(Position(text, 4), iter.endPositionInCurrentContainer()); |
| 755 | 756 |
| 756 iter.advance(); | 757 iter.advance(); |
| 757 EXPECT_TRUE(iter.atEnd()); | 758 EXPECT_TRUE(iter.atEnd()); |
| 758 | 759 |
| 759 EXPECT_EQ("xyz", String(buffer.data())); | 760 EXPECT_EQ("xyz", String(buffer.data())); |
| 760 } | 761 } |
| 761 | 762 |
| 762 } // namespace blink | 763 } // namespace blink |
| OLD | NEW |