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 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
259 , m_emitsCharactersBetweenAllVisiblePositions(behavior & TextIteratorEmitsCh aractersBetweenAllVisiblePositions) | 259 , m_emitsCharactersBetweenAllVisiblePositions(behavior & TextIteratorEmitsCh aractersBetweenAllVisiblePositions) |
260 , m_entersTextControls(behavior & TextIteratorEntersTextControls) | 260 , m_entersTextControls(behavior & TextIteratorEntersTextControls) |
261 , m_emitsOriginalText(behavior & TextIteratorEmitsOriginalText) | 261 , m_emitsOriginalText(behavior & TextIteratorEmitsOriginalText) |
262 , m_handledFirstLetter(false) | 262 , m_handledFirstLetter(false) |
263 , m_ignoresStyleVisibility(behavior & TextIteratorIgnoresStyleVisibility) | 263 , m_ignoresStyleVisibility(behavior & TextIteratorIgnoresStyleVisibility) |
264 , m_stopsOnFormControls(behavior & TextIteratorStopsOnFormControls) | 264 , m_stopsOnFormControls(behavior & TextIteratorStopsOnFormControls) |
265 , m_shouldStop(false) | 265 , m_shouldStop(false) |
266 , m_emitsImageAltText(behavior & TextIteratorEmitsImageAltText) | 266 , m_emitsImageAltText(behavior & TextIteratorEmitsImageAltText) |
267 , m_entersAuthorShadowRoots(behavior & TextIteratorEntersAuthorShadowRoots) | 267 , m_entersAuthorShadowRoots(behavior & TextIteratorEntersAuthorShadowRoots) |
268 , m_emitsObjectReplacementCharacter(behavior & TextIteratorEmitsObjectReplac ementCharacter) | 268 , m_emitsObjectReplacementCharacter(behavior & TextIteratorEmitsObjectReplac ementCharacter) |
269 , m_breakAtZeroLengthBoundary(behavior & TextIteratorBreakAtZeroLengthBounda ry) | |
269 { | 270 { |
270 if (range) | 271 if (range) |
271 initialize(range->startPosition(), range->endPosition()); | 272 initialize(range->startPosition(), range->endPosition()); |
272 } | 273 } |
273 | 274 |
274 TextIterator::TextIterator(const Position& start, const Position& end, TextItera torBehaviorFlags behavior) | 275 TextIterator::TextIterator(const Position& start, const Position& end, TextItera torBehaviorFlags behavior) |
275 : m_startContainer(nullptr) | 276 : m_startContainer(nullptr) |
276 , m_startOffset(0) | 277 , m_startOffset(0) |
277 , m_endContainer(nullptr) | 278 , m_endContainer(nullptr) |
278 , m_endOffset(0) | 279 , m_endOffset(0) |
(...skipping 11 matching lines...) Expand all Loading... | |
290 , m_emitsCharactersBetweenAllVisiblePositions(behavior & TextIteratorEmitsCh aractersBetweenAllVisiblePositions) | 291 , m_emitsCharactersBetweenAllVisiblePositions(behavior & TextIteratorEmitsCh aractersBetweenAllVisiblePositions) |
291 , m_entersTextControls(behavior & TextIteratorEntersTextControls) | 292 , m_entersTextControls(behavior & TextIteratorEntersTextControls) |
292 , m_emitsOriginalText(behavior & TextIteratorEmitsOriginalText) | 293 , m_emitsOriginalText(behavior & TextIteratorEmitsOriginalText) |
293 , m_handledFirstLetter(false) | 294 , m_handledFirstLetter(false) |
294 , m_ignoresStyleVisibility(behavior & TextIteratorIgnoresStyleVisibility) | 295 , m_ignoresStyleVisibility(behavior & TextIteratorIgnoresStyleVisibility) |
295 , m_stopsOnFormControls(behavior & TextIteratorStopsOnFormControls) | 296 , m_stopsOnFormControls(behavior & TextIteratorStopsOnFormControls) |
296 , m_shouldStop(false) | 297 , m_shouldStop(false) |
297 , m_emitsImageAltText(behavior & TextIteratorEmitsImageAltText) | 298 , m_emitsImageAltText(behavior & TextIteratorEmitsImageAltText) |
298 , m_entersAuthorShadowRoots(behavior & TextIteratorEntersAuthorShadowRoots) | 299 , m_entersAuthorShadowRoots(behavior & TextIteratorEntersAuthorShadowRoots) |
299 , m_emitsObjectReplacementCharacter(behavior & TextIteratorEmitsObjectReplac ementCharacter) | 300 , m_emitsObjectReplacementCharacter(behavior & TextIteratorEmitsObjectReplac ementCharacter) |
301 , m_breakAtZeroLengthBoundary(behavior & TextIteratorBreakAtZeroLengthBounda ry) | |
300 { | 302 { |
301 initialize(start, end); | 303 initialize(start, end); |
302 } | 304 } |
303 | 305 |
304 void TextIterator::initialize(const Position& start, const Position& end) | 306 void TextIterator::initialize(const Position& start, const Position& end) |
305 { | 307 { |
306 ASSERT(comparePositions(start, end) <= 0); | 308 ASSERT(comparePositions(start, end) <= 0); |
307 | 309 |
308 // Get and validate |start| and |end|. | 310 // Get and validate |start| and |end|. |
309 Node* startContainer = start.containerNode(); | 311 Node* startContainer = start.containerNode(); |
(...skipping 1429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1739 } | 1741 } |
1740 | 1742 |
1741 // exhaust the current m_textIterator run | 1743 // exhaust the current m_textIterator run |
1742 count -= remaining; | 1744 count -= remaining; |
1743 m_offset += remaining; | 1745 m_offset += remaining; |
1744 | 1746 |
1745 // move to a subsequent m_textIterator run | 1747 // move to a subsequent m_textIterator run |
1746 for (m_textIterator.advance(); !atEnd(); m_textIterator.advance()) { | 1748 for (m_textIterator.advance(); !atEnd(); m_textIterator.advance()) { |
1747 int runLength = m_textIterator.length(); | 1749 int runLength = m_textIterator.length(); |
1748 if (!runLength) { | 1750 if (!runLength) { |
1749 m_atBreak = true; | 1751 m_atBreak = m_textIterator.breakAtZeroLengthBoundary(); |
yosin_UTC9
2014/10/03 07:53:56
Please make default value of |m_breakAtZeroLengthB
| |
1750 } else { | 1752 } else { |
1751 // see whether this is m_textIterator to use | 1753 // see whether this is m_textIterator to use |
1752 if (count < runLength) { | 1754 if (count < runLength) { |
1753 m_runOffset = count; | 1755 m_runOffset = count; |
1754 m_offset += count; | 1756 m_offset += count; |
1755 return; | 1757 return; |
1756 } | 1758 } |
1757 | 1759 |
1758 // exhaust this m_textIterator run | 1760 // exhaust this m_textIterator run |
1759 count -= runLength; | 1761 count -= runLength; |
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2419 resultEnd = collapseTo; | 2421 resultEnd = collapseTo; |
2420 return; | 2422 return; |
2421 } | 2423 } |
2422 } | 2424 } |
2423 | 2425 |
2424 CharacterIterator computeRangeIterator(inputStart, inputEnd, iteratorFlagsFo rFindPlainText); | 2426 CharacterIterator computeRangeIterator(inputStart, inputEnd, iteratorFlagsFo rFindPlainText); |
2425 calculateCharacterSubrange(computeRangeIterator, matchStart, matchLength, re sultStart, resultEnd); | 2427 calculateCharacterSubrange(computeRangeIterator, matchStart, matchLength, re sultStart, resultEnd); |
2426 } | 2428 } |
2427 | 2429 |
2428 } | 2430 } |
OLD | NEW |