Chromium Code Reviews| 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 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 258 , m_hasEmitted(false) | 258 , m_hasEmitted(false) |
| 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_emitsReplacementChar(behavior & TextIteratorEmitsReplacementChar) | |
| 268 { | 269 { |
| 269 if (range) | 270 if (range) |
| 270 initialize(range->startPosition(), range->endPosition()); | 271 initialize(range->startPosition(), range->endPosition()); |
| 271 } | 272 } |
| 272 | 273 |
| 273 TextIterator::TextIterator(const Position& start, const Position& end, TextItera torBehaviorFlags behavior) | 274 TextIterator::TextIterator(const Position& start, const Position& end, TextItera torBehaviorFlags behavior) |
| 274 : m_startContainer(0) | 275 : m_startContainer(0) |
| 275 , m_startOffset(0) | 276 , m_startOffset(0) |
| 276 , m_endContainer(0) | 277 , m_endContainer(0) |
| 277 , m_endOffset(0) | 278 , m_endOffset(0) |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 288 , m_hasEmitted(false) | 289 , m_hasEmitted(false) |
| 289 , m_emitsCharactersBetweenAllVisiblePositions(behavior & TextIteratorEmitsCh aractersBetweenAllVisiblePositions) | 290 , m_emitsCharactersBetweenAllVisiblePositions(behavior & TextIteratorEmitsCh aractersBetweenAllVisiblePositions) |
| 290 , m_entersTextControls(behavior & TextIteratorEntersTextControls) | 291 , m_entersTextControls(behavior & TextIteratorEntersTextControls) |
| 291 , m_emitsOriginalText(behavior & TextIteratorEmitsOriginalText) | 292 , m_emitsOriginalText(behavior & TextIteratorEmitsOriginalText) |
| 292 , m_handledFirstLetter(false) | 293 , m_handledFirstLetter(false) |
| 293 , m_ignoresStyleVisibility(behavior & TextIteratorIgnoresStyleVisibility) | 294 , m_ignoresStyleVisibility(behavior & TextIteratorIgnoresStyleVisibility) |
| 294 , m_stopsOnFormControls(behavior & TextIteratorStopsOnFormControls) | 295 , m_stopsOnFormControls(behavior & TextIteratorStopsOnFormControls) |
| 295 , m_shouldStop(false) | 296 , m_shouldStop(false) |
| 296 , m_emitsImageAltText(behavior & TextIteratorEmitsImageAltText) | 297 , m_emitsImageAltText(behavior & TextIteratorEmitsImageAltText) |
| 297 , m_entersAuthorShadowRoots(behavior & TextIteratorEntersAuthorShadowRoots) | 298 , m_entersAuthorShadowRoots(behavior & TextIteratorEntersAuthorShadowRoots) |
| 299 , m_emitsReplacementChar(behavior & TextIteratorEmitsReplacementChar) | |
| 298 { | 300 { |
| 299 initialize(start, end); | 301 initialize(start, end); |
| 300 } | 302 } |
| 301 | 303 |
| 302 void TextIterator::initialize(const Position& start, const Position& end) | 304 void TextIterator::initialize(const Position& start, const Position& end) |
| 303 { | 305 { |
| 304 ASSERT(comparePositions(start, end) <= 0); | 306 ASSERT(comparePositions(start, end) <= 0); |
| 305 | 307 |
| 306 // Get and validate |start| and |end|. | 308 // Get and validate |start| and |end|. |
| 307 Node* startContainer = start.containerNode(); | 309 Node* startContainer = start.containerNode(); |
| (...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 775 | 777 |
| 776 bool TextIterator::handleReplacedElement() | 778 bool TextIterator::handleReplacedElement() |
| 777 { | 779 { |
| 778 if (m_fullyClippedStack.top()) | 780 if (m_fullyClippedStack.top()) |
| 779 return false; | 781 return false; |
| 780 | 782 |
| 781 RenderObject* renderer = m_node->renderer(); | 783 RenderObject* renderer = m_node->renderer(); |
| 782 if (renderer->style()->visibility() != VISIBLE && !m_ignoresStyleVisibility) | 784 if (renderer->style()->visibility() != VISIBLE && !m_ignoresStyleVisibility) |
| 783 return false; | 785 return false; |
| 784 | 786 |
| 787 if (m_entersTextControls && renderer->isTextControl()) { | |
| 788 // The shadow tree should be already visited. | |
| 789 return true; | |
| 790 } | |
| 791 | |
| 792 if (m_emitsReplacementChar) { | |
| 793 emitCharacter(objectReplacementCharacter, m_node->parentNode(), m_node, 0, 1); | |
| 794 return true; | |
| 795 } | |
| 796 | |
| 785 if (m_lastTextNodeEndedWithCollapsedSpace) { | 797 if (m_lastTextNodeEndedWithCollapsedSpace) { |
| 786 emitCharacter(' ', m_lastTextNode->parentNode(), m_lastTextNode, 1, 1); | 798 emitCharacter(' ', m_lastTextNode->parentNode(), m_lastTextNode, 1, 1); |
| 787 return false; | 799 return false; |
| 788 } | 800 } |
| 789 | 801 |
| 790 if (m_entersTextControls && renderer->isTextControl()) { | |
|
leviw_travelin_and_unemployed
2014/05/27 23:33:45
Why are you pulling this up above the m_lastTextNo
guohui
2014/05/28 01:17:06
actually it was not clear to me why this was not u
Yuta Kitamura
2014/05/28 07:36:07
Text control case does seem like a bug, but I thin
guohui
2014/05/28 13:19:12
reverted, we'd better fix the text control case in
guohui
2014/05/28 13:32:39
Correction:
when m_lastTextNodeEndedWithCollapsed
| |
| 791 // The shadow tree should be already visited. | |
| 792 return true; | |
| 793 } | |
| 794 | |
| 795 m_hasEmitted = true; | 802 m_hasEmitted = true; |
| 796 | 803 |
| 797 if (m_emitsCharactersBetweenAllVisiblePositions) { | 804 if (m_emitsCharactersBetweenAllVisiblePositions) { |
| 798 // We want replaced elements to behave like punctuation for boundary | 805 // We want replaced elements to behave like punctuation for boundary |
| 799 // finding, and to simply take up space for the selection preservation | 806 // finding, and to simply take up space for the selection preservation |
| 800 // code in moveParagraphs, so we use a comma. | 807 // code in moveParagraphs, so we use a comma. |
| 801 emitCharacter(',', m_node->parentNode(), m_node, 0, 1); | 808 emitCharacter(',', m_node->parentNode(), m_node, 0, 1); |
| 802 return true; | 809 return true; |
| 803 } | 810 } |
| 804 | 811 |
| (...skipping 1390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2195 resultEnd = collapseTo; | 2202 resultEnd = collapseTo; |
| 2196 return; | 2203 return; |
| 2197 } | 2204 } |
| 2198 } | 2205 } |
| 2199 | 2206 |
| 2200 CharacterIterator computeRangeIterator(inputStart, inputEnd, iteratorFlagsFo rFindPlainText); | 2207 CharacterIterator computeRangeIterator(inputStart, inputEnd, iteratorFlagsFo rFindPlainText); |
| 2201 calculateCharacterSubrange(computeRangeIterator, matchStart, matchLength, re sultStart, resultEnd); | 2208 calculateCharacterSubrange(computeRangeIterator, matchStart, matchLength, re sultStart, resultEnd); |
| 2202 } | 2209 } |
| 2203 | 2210 |
| 2204 } | 2211 } |
| OLD | NEW |