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 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 261 , m_entersTextControls(behavior & TextIteratorEntersTextControls) | 261 , m_entersTextControls(behavior & TextIteratorEntersTextControls) |
| 262 , m_emitsOriginalText(behavior & TextIteratorEmitsOriginalText) | 262 , m_emitsOriginalText(behavior & TextIteratorEmitsOriginalText) |
| 263 , m_handledFirstLetter(false) | 263 , m_handledFirstLetter(false) |
| 264 , m_ignoresStyleVisibility(behavior & TextIteratorIgnoresStyleVisibility) | 264 , m_ignoresStyleVisibility(behavior & TextIteratorIgnoresStyleVisibility) |
| 265 , m_stopsOnFormControls(behavior & TextIteratorStopsOnFormControls) | 265 , m_stopsOnFormControls(behavior & TextIteratorStopsOnFormControls) |
| 266 , m_shouldStop(false) | 266 , m_shouldStop(false) |
| 267 , m_emitsImageAltText(behavior & TextIteratorEmitsImageAltText) | 267 , m_emitsImageAltText(behavior & TextIteratorEmitsImageAltText) |
| 268 , m_entersAuthorShadowRoots(behavior & TextIteratorEntersAuthorShadowRoots) | 268 , m_entersAuthorShadowRoots(behavior & TextIteratorEntersAuthorShadowRoots) |
| 269 , m_emitsObjectReplacementCharacter(behavior & TextIteratorEmitsObjectReplac ementCharacter) | 269 , m_emitsObjectReplacementCharacter(behavior & TextIteratorEmitsObjectReplac ementCharacter) |
| 270 , m_breaksAtReplacedElement(!(behavior & TextIteratorDoesNotBreakAtReplacedE lement)) | 270 , m_breaksAtReplacedElement(!(behavior & TextIteratorDoesNotBreakAtReplacedE lement)) |
| 271 , m_hasNodesFollowing(behavior & TextIteratorBehavesAsIfNodesFollowing) | |
|
yosin_UTC9
2015/01/14 01:46:20
Do we need to have new behavior? It seems the issu
c.shu
2015/01/14 21:13:41
The bug is not a general issue. It only shows up w
| |
| 271 { | 272 { |
| 272 if (range) | 273 if (range) |
| 273 initialize(range->startPosition(), range->endPosition()); | 274 initialize(range->startPosition(), range->endPosition()); |
| 274 } | 275 } |
| 275 | 276 |
| 276 TextIterator::TextIterator(const Position& start, const Position& end, TextItera torBehaviorFlags behavior) | 277 TextIterator::TextIterator(const Position& start, const Position& end, TextItera torBehaviorFlags behavior) |
| 277 : m_startContainer(nullptr) | 278 : m_startContainer(nullptr) |
| 278 , m_startOffset(0) | 279 , m_startOffset(0) |
| 279 , m_endContainer(nullptr) | 280 , m_endContainer(nullptr) |
| 280 , m_endOffset(0) | 281 , m_endOffset(0) |
| (...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 737 // If we are doing a subrun that doesn't go to the end of the te xt box, | 738 // If we are doing a subrun that doesn't go to the end of the te xt box, |
| 738 // come back again to finish handling this text box; don't advan ce to the next one. | 739 // come back again to finish handling this text box; don't advan ce to the next one. |
| 739 if (static_cast<unsigned>(m_positionEndOffset) < textBoxEnd) | 740 if (static_cast<unsigned>(m_positionEndOffset) < textBoxEnd) |
| 740 return; | 741 return; |
| 741 | 742 |
| 742 // Advance and return | 743 // Advance and return |
| 743 unsigned nextRunStart = nextTextBox ? nextTextBox->start() : str .length(); | 744 unsigned nextRunStart = nextTextBox ? nextTextBox->start() : str .length(); |
| 744 if (nextRunStart > runEnd) | 745 if (nextRunStart > runEnd) |
| 745 m_lastTextNodeEndedWithCollapsedSpace = true; // collapsed s pace between runs or at the end | 746 m_lastTextNodeEndedWithCollapsedSpace = true; // collapsed s pace between runs or at the end |
| 746 | 747 |
| 748 // Don't advance if last spaces, excluding '\n', are collapsed b y next non-text box. | |
| 749 if (m_lastTextNodeEndedWithCollapsedSpace && !nextTextBox && m_h asNodesFollowing) { | |
|
yosin_UTC9
2015/01/14 01:46:20
Sorry, I'm not sure why newline character is a spe
c.shu
2015/01/14 21:13:41
We don't want to restore the space for newline as
| |
| 750 // None of the collapsed spaces should be '\n' but check the last one is enough. | |
| 751 if (str[str.length() -1] != '\n') | |
| 752 return; | |
| 753 } | |
| 754 | |
| 747 m_textBox = nextTextBox; | 755 m_textBox = nextTextBox; |
| 748 if (renderer->containsReversedText()) | 756 if (renderer->containsReversedText()) |
| 749 ++m_sortedTextBoxesPosition; | 757 ++m_sortedTextBoxesPosition; |
| 750 return; | 758 return; |
| 751 } | 759 } |
| 752 // Advance and continue | 760 // Advance and continue |
| 753 m_textBox = nextTextBox; | 761 m_textBox = nextTextBox; |
| 754 if (renderer->containsReversedText()) | 762 if (renderer->containsReversedText()) |
| 755 ++m_sortedTextBoxesPosition; | 763 ++m_sortedTextBoxesPosition; |
| 756 } | 764 } |
| (...skipping 1673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2430 resultEnd = collapseTo; | 2438 resultEnd = collapseTo; |
| 2431 return; | 2439 return; |
| 2432 } | 2440 } |
| 2433 } | 2441 } |
| 2434 | 2442 |
| 2435 CharacterIterator computeRangeIterator(inputStart, inputEnd, iteratorFlagsFo rFindPlainText); | 2443 CharacterIterator computeRangeIterator(inputStart, inputEnd, iteratorFlagsFo rFindPlainText); |
| 2436 calculateCharacterSubrange(computeRangeIterator, matchStart, matchLength, re sultStart, resultEnd); | 2444 calculateCharacterSubrange(computeRangeIterator, matchStart, matchLength, re sultStart, resultEnd); |
| 2437 } | 2445 } |
| 2438 | 2446 |
| 2439 } | 2447 } |
| OLD | NEW |