| 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 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 }; | 383 }; |
| 384 // A trailing surrogate followed by a lead surrogate (U+DC03 U+D901). | 384 // A trailing surrogate followed by a lead surrogate (U+DC03 U+D901). |
| 385 static const UChar invalid3[] = { | 385 static const UChar invalid3[] = { |
| 386 0xd800u, 0xdc00u, 0x0061u, 0xdc03u, 0xd901u, 0xccadu, 0 | 386 0xd800u, 0xdc00u, 0x0061u, 0xdc03u, 0xd901u, 0xccadu, 0 |
| 387 }; | 387 }; |
| 388 | 388 |
| 389 static const UChar* invalidUStrings[] = { invalid1, invalid2, invalid3 }; | 389 static const UChar* invalidUStrings[] = { invalid1, invalid2, invalid3 }; |
| 390 | 390 |
| 391 for (size_t i = 0; i < WTF_ARRAY_LENGTH(invalidUStrings); ++i) { | 391 for (size_t i = 0; i < WTF_ARRAY_LENGTH(invalidUStrings); ++i) { |
| 392 String invalidTarget(invalidUStrings[i]); | 392 String invalidTarget(invalidUStrings[i]); |
| 393 RefPtrWillBeRawPtr<Range> actualRange = findPlainText(range.get(), inval
idTarget, 0); | 393 Position foundStart; |
| 394 Position foundEnd; |
| 395 findPlainText(range->startPosition(), range->endPosition(), invalidTarge
t, 0, foundStart, foundEnd); |
| 396 RefPtrWillBeRawPtr<Range> actualRange = Range::create(document(), foundS
tart, foundEnd); |
| 394 EXPECT_TRUE(areRangesEqual(expectedRange.get(), actualRange.get())); | 397 EXPECT_TRUE(areRangesEqual(expectedRange.get(), actualRange.get())); |
| 395 } | 398 } |
| 396 } | 399 } |
| 397 | 400 |
| 398 TEST_F(TextIteratorTest, EmitsReplacementCharForInput) | 401 TEST_F(TextIteratorTest, EmitsReplacementCharForInput) |
| 399 { | 402 { |
| 400 static const char* bodyContent = | 403 static const char* bodyContent = |
| 401 "<div contenteditable='true'>" | 404 "<div contenteditable='true'>" |
| 402 "Before" | 405 "Before" |
| 403 "<img src='foo.png'>" | 406 "<img src='foo.png'>" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 430 | 433 |
| 431 Node* divNode = document().getElementById("div"); | 434 Node* divNode = document().getElementById("div"); |
| 432 RefPtrWillBeRawPtr<Range> entireRange = Range::create(document(), divNode, 0
, divNode, 3); | 435 RefPtrWillBeRawPtr<Range> entireRange = Range::create(document(), divNode, 0
, divNode, 3); |
| 433 | 436 |
| 434 RefPtrWillBeRawPtr<Range> subrange = TextIterator::subrange(entireRange.get(
), 2, 3); | 437 RefPtrWillBeRawPtr<Range> subrange = TextIterator::subrange(entireRange.get(
), 2, 3); |
| 435 EXPECT_EQ(0, subrange->startOffset()); | 438 EXPECT_EQ(0, subrange->startOffset()); |
| 436 EXPECT_EQ(3, subrange->endOffset()); | 439 EXPECT_EQ(3, subrange->endOffset()); |
| 437 } | 440 } |
| 438 | 441 |
| 439 } // namespace blink | 442 } // namespace blink |
| OLD | NEW |