| 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 return VisiblePosition(); | 453 return VisiblePosition(); |
| 454 | 454 |
| 455 Document& d = boundary->document(); | 455 Document& d = boundary->document(); |
| 456 Position start = createLegacyEditingPosition(boundary, 0).parentAnchoredEqui
valent(); | 456 Position start = createLegacyEditingPosition(boundary, 0).parentAnchoredEqui
valent(); |
| 457 Position end = pos.parentAnchoredEquivalent(); | 457 Position end = pos.parentAnchoredEquivalent(); |
| 458 RefPtr<Range> searchRange = Range::create(d); | 458 RefPtr<Range> searchRange = Range::create(d); |
| 459 | 459 |
| 460 Vector<UChar, 1024> string; | 460 Vector<UChar, 1024> string; |
| 461 unsigned suffixLength = 0; | 461 unsigned suffixLength = 0; |
| 462 | 462 |
| 463 TrackExceptionState es; | 463 TrackExceptionState exceptionState; |
| 464 if (requiresContextForWordBoundary(c.characterBefore())) { | 464 if (requiresContextForWordBoundary(c.characterBefore())) { |
| 465 RefPtr<Range> forwardsScanRange(d.createRange()); | 465 RefPtr<Range> forwardsScanRange(d.createRange()); |
| 466 forwardsScanRange->setEndAfter(boundary, es); | 466 forwardsScanRange->setEndAfter(boundary, exceptionState); |
| 467 forwardsScanRange->setStart(end.deprecatedNode(), end.deprecatedEditingO
ffset(), es); | 467 forwardsScanRange->setStart(end.deprecatedNode(), end.deprecatedEditingO
ffset(), exceptionState); |
| 468 TextIterator forwardsIterator(forwardsScanRange.get()); | 468 TextIterator forwardsIterator(forwardsScanRange.get()); |
| 469 while (!forwardsIterator.atEnd()) { | 469 while (!forwardsIterator.atEnd()) { |
| 470 Vector<UChar, 1024> characters; | 470 Vector<UChar, 1024> characters; |
| 471 forwardsIterator.appendTextTo(characters); | 471 forwardsIterator.appendTextTo(characters); |
| 472 int i = endOfFirstWordBoundaryContext(characters.data(), characters.
size()); | 472 int i = endOfFirstWordBoundaryContext(characters.data(), characters.
size()); |
| 473 string.append(characters.data(), i); | 473 string.append(characters.data(), i); |
| 474 suffixLength += i; | 474 suffixLength += i; |
| 475 if (static_cast<unsigned>(i) < characters.size()) | 475 if (static_cast<unsigned>(i) < characters.size()) |
| 476 break; | 476 break; |
| 477 forwardsIterator.advance(); | 477 forwardsIterator.advance(); |
| 478 } | 478 } |
| 479 } | 479 } |
| 480 | 480 |
| 481 searchRange->setStart(start.deprecatedNode(), start.deprecatedEditingOffset(
), es); | 481 searchRange->setStart(start.deprecatedNode(), start.deprecatedEditingOffset(
), exceptionState); |
| 482 searchRange->setEnd(end.deprecatedNode(), end.deprecatedEditingOffset(), es)
; | 482 searchRange->setEnd(end.deprecatedNode(), end.deprecatedEditingOffset(), exc
eptionState); |
| 483 | 483 |
| 484 ASSERT(!es.hadException()); | 484 ASSERT(!exceptionState.hadException()); |
| 485 if (es.hadException()) | 485 if (exceptionState.hadException()) |
| 486 return VisiblePosition(); | 486 return VisiblePosition(); |
| 487 | 487 |
| 488 SimplifiedBackwardsTextIterator it(searchRange.get()); | 488 SimplifiedBackwardsTextIterator it(searchRange.get()); |
| 489 unsigned next = 0; | 489 unsigned next = 0; |
| 490 bool needMoreContext = false; | 490 bool needMoreContext = false; |
| 491 while (!it.atEnd()) { | 491 while (!it.atEnd()) { |
| 492 bool inTextSecurityMode = it.node() && it.node()->renderer() && it.node(
)->renderer()->style()->textSecurity() != TSNONE; | 492 bool inTextSecurityMode = it.node() && it.node()->renderer() && it.node(
)->renderer()->style()->textSecurity() != TSNONE; |
| 493 // iterate to get chunks until the searchFunction returns a non-zero val
ue. | 493 // iterate to get chunks until the searchFunction returns a non-zero val
ue. |
| 494 if (!inTextSecurityMode) | 494 if (!inTextSecurityMode) |
| 495 it.prependTextTo(string); | 495 it.prependTextTo(string); |
| (...skipping 914 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1410 { | 1410 { |
| 1411 return direction == LTR ? logicalStartOfLine(c) : logicalEndOfLine(c); | 1411 return direction == LTR ? logicalStartOfLine(c) : logicalEndOfLine(c); |
| 1412 } | 1412 } |
| 1413 | 1413 |
| 1414 VisiblePosition rightBoundaryOfLine(const VisiblePosition& c, TextDirection dire
ction) | 1414 VisiblePosition rightBoundaryOfLine(const VisiblePosition& c, TextDirection dire
ction) |
| 1415 { | 1415 { |
| 1416 return direction == LTR ? logicalEndOfLine(c) : logicalStartOfLine(c); | 1416 return direction == LTR ? logicalEndOfLine(c) : logicalStartOfLine(c); |
| 1417 } | 1417 } |
| 1418 | 1418 |
| 1419 } | 1419 } |
| OLD | NEW |