| 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 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 454 setBodyInnerHTML(bodyContent); | 454 setBodyInnerHTML(bodyContent); |
| 455 EXPECT_EQ("[Before][\xEF\xBF\xBC][After]", iterate<DOMTree>(TextIteratorEmit
sObjectReplacementCharacter)); | 455 EXPECT_EQ("[Before][\xEF\xBF\xBC][After]", iterate<DOMTree>(TextIteratorEmit
sObjectReplacementCharacter)); |
| 456 EXPECT_EQ("[Before][\xEF\xBF\xBC][After]", iterate<ComposedTree>(TextIterato
rEmitsObjectReplacementCharacter)); | 456 EXPECT_EQ("[Before][\xEF\xBF\xBC][After]", iterate<ComposedTree>(TextIterato
rEmitsObjectReplacementCharacter)); |
| 457 } | 457 } |
| 458 | 458 |
| 459 TEST_F(TextIteratorTest, RangeLengthWithReplacedElements) | 459 TEST_F(TextIteratorTest, RangeLengthWithReplacedElements) |
| 460 { | 460 { |
| 461 static const char* bodyContent = | 461 static const char* bodyContent = |
| 462 "<div id='div' contenteditable='true'>1<img src='foo.png'>3</div>"; | 462 "<div id='div' contenteditable='true'>1<img src='foo.png'>3</div>"; |
| 463 setBodyInnerHTML(bodyContent); | 463 setBodyInnerHTML(bodyContent); |
| 464 document().view()->updateLayoutAndStyleIfNeededRecursive(); | 464 document().view()->updateLayoutAndStyleForPainting(); |
| 465 | 465 |
| 466 Node* divNode = document().getElementById("div"); | 466 Node* divNode = document().getElementById("div"); |
| 467 RefPtrWillBeRawPtr<Range> range = Range::create(document(), divNode, 0, divN
ode, 3); | 467 RefPtrWillBeRawPtr<Range> range = Range::create(document(), divNode, 0, divN
ode, 3); |
| 468 | 468 |
| 469 EXPECT_EQ(3, TextIterator::rangeLength(range->startPosition(), range->endPos
ition())); | 469 EXPECT_EQ(3, TextIterator::rangeLength(range->startPosition(), range->endPos
ition())); |
| 470 } | 470 } |
| 471 | 471 |
| 472 TEST_F(TextIteratorTest, SubrangeWithReplacedElements) | 472 TEST_F(TextIteratorTest, SubrangeWithReplacedElements) |
| 473 { | 473 { |
| 474 static const char* bodyContent = | 474 static const char* bodyContent = |
| 475 "<div id='div' contenteditable='true'>1<img src='foo.png'>345</div>"; | 475 "<div id='div' contenteditable='true'>1<img src='foo.png'>345</div>"; |
| 476 setBodyInnerHTML(bodyContent); | 476 setBodyInnerHTML(bodyContent); |
| 477 document().view()->updateLayoutAndStyleIfNeededRecursive(); | 477 document().view()->updateLayoutAndStyleForPainting(); |
| 478 | 478 |
| 479 Node* divNode = document().getElementById("div"); | 479 Node* divNode = document().getElementById("div"); |
| 480 RefPtrWillBeRawPtr<Range> entireRange = Range::create(document(), divNode, 0
, divNode, 3); | 480 RefPtrWillBeRawPtr<Range> entireRange = Range::create(document(), divNode, 0
, divNode, 3); |
| 481 | 481 |
| 482 RefPtrWillBeRawPtr<Range> subrange = TextIterator::subrange(entireRange.get(
), 2, 3); | 482 RefPtrWillBeRawPtr<Range> subrange = TextIterator::subrange(entireRange.get(
), 2, 3); |
| 483 EXPECT_EQ(0, subrange->startOffset()); | 483 EXPECT_EQ(0, subrange->startOffset()); |
| 484 EXPECT_EQ(3, subrange->endOffset()); | 484 EXPECT_EQ(3, subrange->endOffset()); |
| 485 } | 485 } |
| 486 | 486 |
| 487 } | 487 } |
| OLD | NEW |