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 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 | 447 |
448 typedef unsigned (*BoundarySearchFunction)(const UChar*, unsigned length, unsign
ed offset, BoundarySearchContextAvailability, bool& needMoreContext); | 448 typedef unsigned (*BoundarySearchFunction)(const UChar*, unsigned length, unsign
ed offset, BoundarySearchContextAvailability, bool& needMoreContext); |
449 | 449 |
450 static VisiblePosition previousBoundary(const VisiblePosition& c, BoundarySearch
Function searchFunction) | 450 static VisiblePosition previousBoundary(const VisiblePosition& c, BoundarySearch
Function searchFunction) |
451 { | 451 { |
452 Position pos = c.deepEquivalent(); | 452 Position pos = c.deepEquivalent(); |
453 Node* boundary = pos.parentEditingBoundary(); | 453 Node* boundary = pos.parentEditingBoundary(); |
454 if (!boundary) | 454 if (!boundary) |
455 return VisiblePosition(); | 455 return VisiblePosition(); |
456 | 456 |
| 457 TempRangeScope scope; |
| 458 |
457 Document& d = boundary->document(); | 459 Document& d = boundary->document(); |
458 Position start = createLegacyEditingPosition(boundary, 0).parentAnchoredEqui
valent(); | 460 Position start = createLegacyEditingPosition(boundary, 0).parentAnchoredEqui
valent(); |
459 Position end = pos.parentAnchoredEquivalent(); | 461 Position end = pos.parentAnchoredEquivalent(); |
460 RefPtrWillBeRawPtr<Range> searchRange = Range::create(d); | 462 RefPtrWillBeRawPtr<Range> searchRange = Range::create(d); |
461 | 463 |
462 Vector<UChar, 1024> string; | 464 Vector<UChar, 1024> string; |
463 unsigned suffixLength = 0; | 465 unsigned suffixLength = 0; |
464 | 466 |
465 TrackExceptionState exceptionState; | 467 TrackExceptionState exceptionState; |
466 if (requiresContextForWordBoundary(c.characterBefore())) { | 468 if (requiresContextForWordBoundary(c.characterBefore())) { |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 return VisiblePosition(charIt.range()->endPosition(), DOWNSTREAM); | 530 return VisiblePosition(charIt.range()->endPosition(), DOWNSTREAM); |
529 } | 531 } |
530 | 532 |
531 static VisiblePosition nextBoundary(const VisiblePosition& c, BoundarySearchFunc
tion searchFunction) | 533 static VisiblePosition nextBoundary(const VisiblePosition& c, BoundarySearchFunc
tion searchFunction) |
532 { | 534 { |
533 Position pos = c.deepEquivalent(); | 535 Position pos = c.deepEquivalent(); |
534 Node* boundary = pos.parentEditingBoundary(); | 536 Node* boundary = pos.parentEditingBoundary(); |
535 if (!boundary) | 537 if (!boundary) |
536 return VisiblePosition(); | 538 return VisiblePosition(); |
537 | 539 |
| 540 TempRangeScope scope; |
| 541 |
538 Document& d = boundary->document(); | 542 Document& d = boundary->document(); |
539 RefPtrWillBeRawPtr<Range> searchRange(d.createRange()); | 543 RefPtrWillBeRawPtr<Range> searchRange(d.createRange()); |
540 Position start(pos.parentAnchoredEquivalent()); | 544 Position start(pos.parentAnchoredEquivalent()); |
541 | 545 |
542 Vector<UChar, 1024> string; | 546 Vector<UChar, 1024> string; |
543 unsigned prefixLength = 0; | 547 unsigned prefixLength = 0; |
544 | 548 |
545 if (requiresContextForWordBoundary(c.characterAfter())) { | 549 if (requiresContextForWordBoundary(c.characterAfter())) { |
546 RefPtrWillBeRawPtr<Range> backwardsScanRange(d.createRange()); | 550 RefPtrWillBeRawPtr<Range> backwardsScanRange(d.createRange()); |
547 backwardsScanRange->setEnd(start.deprecatedNode(), start.deprecatedEditi
ngOffset(), IGNORE_EXCEPTION); | 551 backwardsScanRange->setEnd(start.deprecatedNode(), start.deprecatedEditi
ngOffset(), IGNORE_EXCEPTION); |
(...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1386 { | 1390 { |
1387 return direction == LTR ? logicalStartOfLine(c) : logicalEndOfLine(c); | 1391 return direction == LTR ? logicalStartOfLine(c) : logicalEndOfLine(c); |
1388 } | 1392 } |
1389 | 1393 |
1390 VisiblePosition rightBoundaryOfLine(const VisiblePosition& c, TextDirection dire
ction) | 1394 VisiblePosition rightBoundaryOfLine(const VisiblePosition& c, TextDirection dire
ction) |
1391 { | 1395 { |
1392 return direction == LTR ? logicalEndOfLine(c) : logicalStartOfLine(c); | 1396 return direction == LTR ? logicalEndOfLine(c) : logicalStartOfLine(c); |
1393 } | 1397 } |
1394 | 1398 |
1395 } | 1399 } |
OLD | NEW |