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 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 } | 453 } |
454 | 454 |
455 | 455 |
456 enum BoundarySearchContextAvailability { DontHaveMoreContext, MayHaveMoreContext
}; | 456 enum BoundarySearchContextAvailability { DontHaveMoreContext, MayHaveMoreContext
}; |
457 | 457 |
458 typedef unsigned (*BoundarySearchFunction)(const UChar*, unsigned length, unsign
ed offset, BoundarySearchContextAvailability, bool& needMoreContext); | 458 typedef unsigned (*BoundarySearchFunction)(const UChar*, unsigned length, unsign
ed offset, BoundarySearchContextAvailability, bool& needMoreContext); |
459 | 459 |
460 static VisiblePosition previousBoundary(const VisiblePosition& c, BoundarySearch
Function searchFunction) | 460 static VisiblePosition previousBoundary(const VisiblePosition& c, BoundarySearch
Function searchFunction) |
461 { | 461 { |
462 Position pos = c.deepEquivalent(); | 462 Position pos = c.deepEquivalent(); |
463 Node* boundary = pos.parentEditingBoundary(); | 463 Node* boundary = parentEditingBoundary(pos); |
464 if (!boundary) | 464 if (!boundary) |
465 return VisiblePosition(); | 465 return VisiblePosition(); |
466 | 466 |
467 Document& d = boundary->document(); | 467 Document& d = boundary->document(); |
468 Position start = Position::editingPositionOf(boundary, 0).parentAnchoredEqui
valent(); | 468 Position start = Position::editingPositionOf(boundary, 0).parentAnchoredEqui
valent(); |
469 Position end = pos.parentAnchoredEquivalent(); | 469 Position end = pos.parentAnchoredEquivalent(); |
470 | 470 |
471 Vector<UChar, 1024> string; | 471 Vector<UChar, 1024> string; |
472 unsigned suffixLength = 0; | 472 unsigned suffixLength = 0; |
473 | 473 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 // Use the character iterator to translate the next value into a DOM positio
n. | 531 // Use the character iterator to translate the next value into a DOM positio
n. |
532 BackwardsCharacterIterator charIt(start, end); | 532 BackwardsCharacterIterator charIt(start, end); |
533 charIt.advance(string.size() - suffixLength - next); | 533 charIt.advance(string.size() - suffixLength - next); |
534 // FIXME: charIt can get out of shadow host. | 534 // FIXME: charIt can get out of shadow host. |
535 return VisiblePosition(charIt.endPosition()); | 535 return VisiblePosition(charIt.endPosition()); |
536 } | 536 } |
537 | 537 |
538 static VisiblePosition nextBoundary(const VisiblePosition& c, BoundarySearchFunc
tion searchFunction) | 538 static VisiblePosition nextBoundary(const VisiblePosition& c, BoundarySearchFunc
tion searchFunction) |
539 { | 539 { |
540 Position pos = c.deepEquivalent(); | 540 Position pos = c.deepEquivalent(); |
541 Node* boundary = pos.parentEditingBoundary(); | 541 Node* boundary = parentEditingBoundary(pos); |
542 if (!boundary) | 542 if (!boundary) |
543 return VisiblePosition(); | 543 return VisiblePosition(); |
544 | 544 |
545 Document& d = boundary->document(); | 545 Document& d = boundary->document(); |
546 Position start(pos.parentAnchoredEquivalent()); | 546 Position start(pos.parentAnchoredEquivalent()); |
547 | 547 |
548 Vector<UChar, 1024> string; | 548 Vector<UChar, 1024> string; |
549 unsigned prefixLength = 0; | 549 unsigned prefixLength = 0; |
550 | 550 |
551 if (requiresContextForWordBoundary(c.characterAfter())) { | 551 if (requiresContextForWordBoundary(c.characterAfter())) { |
(...skipping 1044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1596 | 1596 |
1597 if (previousRenderedEditable(position1.anchorNode()) == position2.anchorNode
() | 1597 if (previousRenderedEditable(position1.anchorNode()) == position2.anchorNode
() |
1598 && !renderedOffset1 && renderedOffset2 == caretMaxOffset(position2.ancho
rNode())) { | 1598 && !renderedOffset1 && renderedOffset2 == caretMaxOffset(position2.ancho
rNode())) { |
1599 return false; | 1599 return false; |
1600 } | 1600 } |
1601 | 1601 |
1602 return true; | 1602 return true; |
1603 } | 1603 } |
1604 | 1604 |
1605 } | 1605 } |
OLD | NEW |