Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(329)

Side by Side Diff: Source/core/editing/TextIterator.cpp

Issue 184023003: Make InlineBox::renderer() and related subclass methods return reference. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 634 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 unsigned runEnd = min(textBoxEnd, end); 645 unsigned runEnd = min(textBoxEnd, end);
646 646
647 // Determine what the next text box will be, but don't advance yet 647 // Determine what the next text box will be, but don't advance yet
648 InlineTextBox* nextTextBox = 0; 648 InlineTextBox* nextTextBox = 0;
649 if (renderer->containsReversedText()) { 649 if (renderer->containsReversedText()) {
650 if (m_sortedTextBoxesPosition + 1 < m_sortedTextBoxes.size()) 650 if (m_sortedTextBoxesPosition + 1 < m_sortedTextBoxes.size())
651 nextTextBox = m_sortedTextBoxes[m_sortedTextBoxesPosition + 1]; 651 nextTextBox = m_sortedTextBoxes[m_sortedTextBoxesPosition + 1];
652 } else { 652 } else {
653 nextTextBox = m_textBox->nextTextBox(); 653 nextTextBox = m_textBox->nextTextBox();
654 } 654 }
655 ASSERT(!nextTextBox || nextTextBox->renderer() == renderer); 655 ASSERT(!nextTextBox || &nextTextBox->renderer() == renderer);
656 656
657 if (runStart < runEnd) { 657 if (runStart < runEnd) {
658 // Handle either a single newline character (which becomes a space), 658 // Handle either a single newline character (which becomes a space),
659 // or a run of characters that does not include a newline. 659 // or a run of characters that does not include a newline.
660 // This effectively translates newlines to spaces without copying th e text. 660 // This effectively translates newlines to spaces without copying th e text.
661 if (str[runStart] == '\n') { 661 if (str[runStart] == '\n') {
662 emitCharacter(' ', m_node, 0, runStart, runStart + 1); 662 emitCharacter(' ', m_node, 0, runStart, runStart + 1);
663 m_offset = runStart + 1; 663 m_offset = runStart + 1;
664 } else { 664 } else {
665 size_t subrunEnd = str.find('\n', runStart); 665 size_t subrunEnd = str.find('\n', runStart);
(...skipping 1415 matching lines...) Expand 10 before | Expand all | Expand 10 after
2081 if (!matchLength) 2081 if (!matchLength)
2082 return collapsedToBoundary(range, !(options & Backwards)); 2082 return collapsedToBoundary(range, !(options & Backwards));
2083 } 2083 }
2084 2084
2085 // Then, find the document position of the start and the end of the text. 2085 // Then, find the document position of the start and the end of the text.
2086 CharacterIterator computeRangeIterator(range, TextIteratorEntersTextControls | TextIteratorEntersAuthorShadowRoots); 2086 CharacterIterator computeRangeIterator(range, TextIteratorEntersTextControls | TextIteratorEntersAuthorShadowRoots);
2087 return characterSubrange(computeRangeIterator, matchStart, matchLength); 2087 return characterSubrange(computeRangeIterator, matchStart, matchLength);
2088 } 2088 }
2089 2089
2090 } 2090 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698