| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. |
| 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 1079 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1090 Document& document = *p.document(); | 1090 Document& document = *p.document(); |
| 1091 ShadowRoot* shadowRoot = p.anchorNode()->containingShadowRoot(); | 1091 ShadowRoot* shadowRoot = p.anchorNode()->containingShadowRoot(); |
| 1092 | 1092 |
| 1093 if (shadowRoot) | 1093 if (shadowRoot) |
| 1094 scope = shadowRoot; | 1094 scope = shadowRoot; |
| 1095 else | 1095 else |
| 1096 scope = document.documentElement(); | 1096 scope = document.documentElement(); |
| 1097 | 1097 |
| 1098 RefPtrWillBeRawPtr<Range> range = Range::create(document, firstPositionInNod
e(scope.get()), p.parentAnchoredEquivalent()); | 1098 RefPtrWillBeRawPtr<Range> range = Range::create(document, firstPositionInNod
e(scope.get()), p.parentAnchoredEquivalent()); |
| 1099 | 1099 |
| 1100 return TextIterator::rangeLength(range.get(), true); | 1100 return TextIterator::rangeLength(range->startPosition(), range->endPosition(
), true); |
| 1101 } | 1101 } |
| 1102 | 1102 |
| 1103 VisiblePosition visiblePositionForIndex(int index, ContainerNode* scope) | 1103 VisiblePosition visiblePositionForIndex(int index, ContainerNode* scope) |
| 1104 { | 1104 { |
| 1105 if (!scope) | 1105 if (!scope) |
| 1106 return VisiblePosition(); | 1106 return VisiblePosition(); |
| 1107 RefPtrWillBeRawPtr<Range> range = PlainTextRange(index).createRangeForSelect
ion(*scope); | 1107 RefPtrWillBeRawPtr<Range> range = PlainTextRange(index).createRangeForSelect
ion(*scope); |
| 1108 // Check for an invalid index. Certain editing operations invalidate indices
because | 1108 // Check for an invalid index. Certain editing operations invalidate indices
because |
| 1109 // of problems with TextIteratorEmitsCharactersBetweenAllVisiblePositions. | 1109 // of problems with TextIteratorEmitsCharactersBetweenAllVisiblePositions. |
| 1110 if (!range) | 1110 if (!range) |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1196 // if the selection starts just before a paragraph break, skip over it | 1196 // if the selection starts just before a paragraph break, skip over it |
| 1197 if (isEndOfParagraph(visiblePosition)) | 1197 if (isEndOfParagraph(visiblePosition)) |
| 1198 return visiblePosition.next().deepEquivalent().downstream(); | 1198 return visiblePosition.next().deepEquivalent().downstream(); |
| 1199 | 1199 |
| 1200 // otherwise, make sure to be at the start of the first selected node, | 1200 // otherwise, make sure to be at the start of the first selected node, |
| 1201 // instead of possibly at the end of the last node before the selection | 1201 // instead of possibly at the end of the last node before the selection |
| 1202 return visiblePosition.deepEquivalent().downstream(); | 1202 return visiblePosition.deepEquivalent().downstream(); |
| 1203 } | 1203 } |
| 1204 | 1204 |
| 1205 } // namespace blink | 1205 } // namespace blink |
| OLD | NEW |