| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 private: | 59 private: |
| 60 template <typename Tree> | 60 template <typename Tree> |
| 61 std::string iterateWithIterator(typename Tree::TextIteratorType&); | 61 std::string iterateWithIterator(typename Tree::TextIteratorType&); |
| 62 }; | 62 }; |
| 63 | 63 |
| 64 template <typename Tree> | 64 template <typename Tree> |
| 65 std::string TextIteratorTest::iterate(TextIteratorBehavior iteratorBehavior) | 65 std::string TextIteratorTest::iterate(TextIteratorBehavior iteratorBehavior) |
| 66 { | 66 { |
| 67 RefPtrWillBeRawPtr<Element> body = document().body(); | 67 RefPtrWillBeRawPtr<Element> body = document().body(); |
| 68 using PositionType = typename Tree::PositionType; | 68 using PositionType = typename Tree::PositionType; |
| 69 auto start = PositionType(body, 0, PositionType::PositionIsOffsetInAnchor); | 69 auto start = PositionType(body, 0); |
| 70 auto end = PositionType(body, Tree::countChildren(*body), PositionType::Posi
tionIsOffsetInAnchor); | 70 auto end = PositionType(body, Tree::countChildren(*body)); |
| 71 typename Tree::TextIteratorType iterator(start, end, iteratorBehavior); | 71 typename Tree::TextIteratorType iterator(start, end, iteratorBehavior); |
| 72 return iterateWithIterator<Tree>(iterator); | 72 return iterateWithIterator<Tree>(iterator); |
| 73 } | 73 } |
| 74 | 74 |
| 75 template <typename Tree> | 75 template <typename Tree> |
| 76 std::string TextIteratorTest::iteratePartial(const typename Tree::PositionType&
start, const typename Tree::PositionType& end, TextIteratorBehavior iteratorBeha
vior) | 76 std::string TextIteratorTest::iteratePartial(const typename Tree::PositionType&
start, const typename Tree::PositionType& end, TextIteratorBehavior iteratorBeha
vior) |
| 77 { | 77 { |
| 78 typename Tree::TextIteratorType iterator(start, end, iteratorBehavior); | 78 typename Tree::TextIteratorType iterator(start, end, iteratorBehavior); |
| 79 return iterateWithIterator<Tree>(iterator); | 79 return iterateWithIterator<Tree>(iterator); |
| 80 } | 80 } |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 | 430 |
| 431 Node* divNode = document().getElementById("div"); | 431 Node* divNode = document().getElementById("div"); |
| 432 RefPtrWillBeRawPtr<Range> entireRange = Range::create(document(), divNode, 0
, divNode, 3); | 432 RefPtrWillBeRawPtr<Range> entireRange = Range::create(document(), divNode, 0
, divNode, 3); |
| 433 | 433 |
| 434 RefPtrWillBeRawPtr<Range> subrange = TextIterator::subrange(entireRange.get(
), 2, 3); | 434 RefPtrWillBeRawPtr<Range> subrange = TextIterator::subrange(entireRange.get(
), 2, 3); |
| 435 EXPECT_EQ(0, subrange->startOffset()); | 435 EXPECT_EQ(0, subrange->startOffset()); |
| 436 EXPECT_EQ(3, subrange->endOffset()); | 436 EXPECT_EQ(3, subrange->endOffset()); |
| 437 } | 437 } |
| 438 | 438 |
| 439 } // namespace blink | 439 } // namespace blink |
| OLD | NEW |