| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r
ights reserved. | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r
ights reserved. |
| 3 * Copyright (C) 2005 Alexey Proskuryakov. | 3 * Copyright (C) 2005 Alexey Proskuryakov. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 , m_stopsOnFormControls(behavior & TextIteratorStopsOnFormControls) | 79 , m_stopsOnFormControls(behavior & TextIteratorStopsOnFormControls) |
| 80 , m_shouldStop(false) | 80 , m_shouldStop(false) |
| 81 , m_emitsOriginalText(false) | 81 , m_emitsOriginalText(false) |
| 82 { | 82 { |
| 83 ASSERT(behavior == TextIteratorDefaultBehavior || behavior == TextIteratorSt
opsOnFormControls); | 83 ASSERT(behavior == TextIteratorDefaultBehavior || behavior == TextIteratorSt
opsOnFormControls); |
| 84 | 84 |
| 85 Node* startNode = start.anchorNode(); | 85 Node* startNode = start.anchorNode(); |
| 86 if (!startNode) | 86 if (!startNode) |
| 87 return; | 87 return; |
| 88 Node* endNode = end.anchorNode(); | 88 Node* endNode = end.anchorNode(); |
| 89 int startOffset = start.deprecatedEditingOffset(); | 89 int startOffset = start.computeEditingOffset(); |
| 90 int endOffset = end.deprecatedEditingOffset(); | 90 int endOffset = end.computeEditingOffset(); |
| 91 | 91 |
| 92 init(startNode, endNode, startOffset, endOffset); | 92 init(startNode, endNode, startOffset, endOffset); |
| 93 } | 93 } |
| 94 | 94 |
| 95 template <typename Strategy> | 95 template <typename Strategy> |
| 96 void SimplifiedBackwardsTextIteratorAlgorithm<Strategy>::init(Node* startNode, N
ode* endNode, int startOffset, int endOffset) | 96 void SimplifiedBackwardsTextIteratorAlgorithm<Strategy>::init(Node* startNode, N
ode* endNode, int startOffset, int endOffset) |
| 97 { | 97 { |
| 98 if (!startNode->offsetInCharacters() && startOffset >= 0) { | 98 if (!startNode->offsetInCharacters() && startOffset >= 0) { |
| 99 // NodeTraversal::childAt() will return 0 if the offset is out of range.
We rely on this behavior | 99 // NodeTraversal::childAt() will return 0 if the offset is out of range.
We rely on this behavior |
| 100 // instead of calling countChildren() to avoid traversing the children t
wice. | 100 // instead of calling countChildren() to avoid traversing the children t
wice. |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 if (m_positionNode) | 378 if (m_positionNode) |
| 379 return PositionAlgorithm<Strategy>::createLegacyEditingPosition(m_positi
onNode, m_positionEndOffset); | 379 return PositionAlgorithm<Strategy>::createLegacyEditingPosition(m_positi
onNode, m_positionEndOffset); |
| 380 return PositionAlgorithm<Strategy>::createLegacyEditingPosition(m_startNode,
m_startOffset); | 380 return PositionAlgorithm<Strategy>::createLegacyEditingPosition(m_startNode,
m_startOffset); |
| 381 } | 381 } |
| 382 | 382 |
| 383 template class CORE_TEMPLATE_EXPORT SimplifiedBackwardsTextIteratorAlgorithm<Edi
tingStrategy>; | 383 template class CORE_TEMPLATE_EXPORT SimplifiedBackwardsTextIteratorAlgorithm<Edi
tingStrategy>; |
| 384 template class CORE_TEMPLATE_EXPORT SimplifiedBackwardsTextIteratorAlgorithm<Edi
tingInComposedTreeStrategy>; | 384 template class CORE_TEMPLATE_EXPORT SimplifiedBackwardsTextIteratorAlgorithm<Edi
tingInComposedTreeStrategy>; |
| 385 | 385 |
| 386 | 386 |
| 387 } // namespace blink | 387 } // namespace blink |
| OLD | NEW |