| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv
ed. | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv
ed. |
| 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 534 | 534 |
| 535 Document* d = boundary->document(); | 535 Document* d = boundary->document(); |
| 536 RefPtr<Range> searchRange(d->createRange()); | 536 RefPtr<Range> searchRange(d->createRange()); |
| 537 Position start(pos.parentAnchoredEquivalent()); | 537 Position start(pos.parentAnchoredEquivalent()); |
| 538 | 538 |
| 539 Vector<UChar, 1024> string; | 539 Vector<UChar, 1024> string; |
| 540 unsigned prefixLength = 0; | 540 unsigned prefixLength = 0; |
| 541 | 541 |
| 542 if (requiresContextForWordBoundary(c.characterAfter())) { | 542 if (requiresContextForWordBoundary(c.characterAfter())) { |
| 543 RefPtr<Range> backwardsScanRange(d->createRange()); | 543 RefPtr<Range> backwardsScanRange(d->createRange()); |
| 544 backwardsScanRange->setEnd(start.deprecatedNode(), start.deprecatedEditi
ngOffset(), IGNORE_EXCEPTION_STATE); | 544 backwardsScanRange->setEnd(start.deprecatedNode(), start.deprecatedEditi
ngOffset(), IGNORE_EXCEPTION); |
| 545 SimplifiedBackwardsTextIterator backwardsIterator(backwardsScanRange.get
()); | 545 SimplifiedBackwardsTextIterator backwardsIterator(backwardsScanRange.get
()); |
| 546 while (!backwardsIterator.atEnd()) { | 546 while (!backwardsIterator.atEnd()) { |
| 547 Vector<UChar, 1024> characters; | 547 Vector<UChar, 1024> characters; |
| 548 backwardsIterator.prependTextTo(characters); | 548 backwardsIterator.prependTextTo(characters); |
| 549 int length = characters.size(); | 549 int length = characters.size(); |
| 550 int i = startOfLastWordBoundaryContext(characters.data(), length); | 550 int i = startOfLastWordBoundaryContext(characters.data(), length); |
| 551 string.prepend(characters.data() + i, length - i); | 551 string.prepend(characters.data() + i, length - i); |
| 552 prefixLength += length - i; | 552 prefixLength += length - i; |
| 553 if (i > 0) | 553 if (i > 0) |
| 554 break; | 554 break; |
| 555 backwardsIterator.advance(); | 555 backwardsIterator.advance(); |
| 556 } | 556 } |
| 557 } | 557 } |
| 558 | 558 |
| 559 searchRange->selectNodeContents(boundary, IGNORE_EXCEPTION_STATE); | 559 searchRange->selectNodeContents(boundary, IGNORE_EXCEPTION); |
| 560 searchRange->setStart(start.deprecatedNode(), start.deprecatedEditingOffset(
), IGNORE_EXCEPTION_STATE); | 560 searchRange->setStart(start.deprecatedNode(), start.deprecatedEditingOffset(
), IGNORE_EXCEPTION); |
| 561 TextIterator it(searchRange.get(), TextIteratorEmitsCharactersBetweenAllVisi
blePositions); | 561 TextIterator it(searchRange.get(), TextIteratorEmitsCharactersBetweenAllVisi
blePositions); |
| 562 unsigned next = 0; | 562 unsigned next = 0; |
| 563 bool inTextSecurityMode = start.deprecatedNode() && start.deprecatedNode()->
renderer() && start.deprecatedNode()->renderer()->style()->textSecurity() != TSN
ONE; | 563 bool inTextSecurityMode = start.deprecatedNode() && start.deprecatedNode()->
renderer() && start.deprecatedNode()->renderer()->style()->textSecurity() != TSN
ONE; |
| 564 bool needMoreContext = false; | 564 bool needMoreContext = false; |
| 565 while (!it.atEnd()) { | 565 while (!it.atEnd()) { |
| 566 // Keep asking the iterator for chunks until the search function | 566 // Keep asking the iterator for chunks until the search function |
| 567 // returns an end value not equal to the length of the string passed to
it. | 567 // returns an end value not equal to the length of the string passed to
it. |
| 568 if (!inTextSecurityMode) | 568 if (!inTextSecurityMode) |
| 569 it.appendTextTo(string); | 569 it.appendTextTo(string); |
| 570 else { | 570 else { |
| (...skipping 843 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1414 { | 1414 { |
| 1415 return direction == LTR ? logicalStartOfLine(c) : logicalEndOfLine(c); | 1415 return direction == LTR ? logicalStartOfLine(c) : logicalEndOfLine(c); |
| 1416 } | 1416 } |
| 1417 | 1417 |
| 1418 VisiblePosition rightBoundaryOfLine(const VisiblePosition& c, TextDirection dire
ction) | 1418 VisiblePosition rightBoundaryOfLine(const VisiblePosition& c, TextDirection dire
ction) |
| 1419 { | 1419 { |
| 1420 return direction == LTR ? logicalEndOfLine(c) : logicalStartOfLine(c); | 1420 return direction == LTR ? logicalEndOfLine(c) : logicalStartOfLine(c); |
| 1421 } | 1421 } |
| 1422 | 1422 |
| 1423 } | 1423 } |
| OLD | NEW |