| 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 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 setBodyContent(bodyContent); | 409 setBodyContent(bodyContent); |
| 410 EXPECT_EQ("[Before][\xEF\xBF\xBC][After]", iterate<DOMTree>(TextIteratorEmit
sObjectReplacementCharacter)); | 410 EXPECT_EQ("[Before][\xEF\xBF\xBC][After]", iterate<DOMTree>(TextIteratorEmit
sObjectReplacementCharacter)); |
| 411 EXPECT_EQ("[Before][\xEF\xBF\xBC][After]", iterate<ComposedTree>(TextIterato
rEmitsObjectReplacementCharacter)); | 411 EXPECT_EQ("[Before][\xEF\xBF\xBC][After]", iterate<ComposedTree>(TextIterato
rEmitsObjectReplacementCharacter)); |
| 412 } | 412 } |
| 413 | 413 |
| 414 TEST_F(TextIteratorTest, RangeLengthWithReplacedElements) | 414 TEST_F(TextIteratorTest, RangeLengthWithReplacedElements) |
| 415 { | 415 { |
| 416 static const char* bodyContent = | 416 static const char* bodyContent = |
| 417 "<div id='div' contenteditable='true'>1<img src='foo.png'>3</div>"; | 417 "<div id='div' contenteditable='true'>1<img src='foo.png'>3</div>"; |
| 418 setBodyContent(bodyContent); | 418 setBodyContent(bodyContent); |
| 419 document().view()->updateAllLifecyclePhases(); | 419 document().view()->updateLayoutAndStyleForPainting(); |
| 420 | 420 |
| 421 Node* divNode = document().getElementById("div"); | 421 Node* divNode = document().getElementById("div"); |
| 422 RefPtrWillBeRawPtr<Range> range = Range::create(document(), divNode, 0, divN
ode, 3); | 422 RefPtrWillBeRawPtr<Range> range = Range::create(document(), divNode, 0, divN
ode, 3); |
| 423 | 423 |
| 424 EXPECT_EQ(3, TextIterator::rangeLength(range->startPosition(), range->endPos
ition())); | 424 EXPECT_EQ(3, TextIterator::rangeLength(range->startPosition(), range->endPos
ition())); |
| 425 } | 425 } |
| 426 | 426 |
| 427 TEST_F(TextIteratorTest, SubrangeWithReplacedElements) | 427 TEST_F(TextIteratorTest, SubrangeWithReplacedElements) |
| 428 { | 428 { |
| 429 static const char* bodyContent = | 429 static const char* bodyContent = |
| 430 "<div id='div' contenteditable='true'>1<img src='foo.png'>345</div>"; | 430 "<div id='div' contenteditable='true'>1<img src='foo.png'>345</div>"; |
| 431 setBodyContent(bodyContent); | 431 setBodyContent(bodyContent); |
| 432 document().view()->updateAllLifecyclePhases(); | 432 document().view()->updateLayoutAndStyleForPainting(); |
| 433 | 433 |
| 434 Node* divNode = document().getElementById("div"); | 434 Node* divNode = document().getElementById("div"); |
| 435 RefPtrWillBeRawPtr<Range> entireRange = Range::create(document(), divNode, 0
, divNode, 3); | 435 RefPtrWillBeRawPtr<Range> entireRange = Range::create(document(), divNode, 0
, divNode, 3); |
| 436 | 436 |
| 437 RefPtrWillBeRawPtr<Range> subrange = TextIterator::subrange(entireRange.get(
), 2, 3); | 437 RefPtrWillBeRawPtr<Range> subrange = TextIterator::subrange(entireRange.get(
), 2, 3); |
| 438 EXPECT_EQ(0, subrange->startOffset()); | 438 EXPECT_EQ(0, subrange->startOffset()); |
| 439 EXPECT_EQ(3, subrange->endOffset()); | 439 EXPECT_EQ(3, subrange->endOffset()); |
| 440 } | 440 } |
| 441 | 441 |
| 442 } // namespace blink | 442 } // namespace blink |
| OLD | NEW |